1 From d41401ace01c234f42697e190a2ac95991780626 Mon Sep 17 00:00:00 2001
2 From: Doug Evans <dje@google.com>
3 Date: Mon, 26 Oct 2015 13:20:12 -0700
4 Subject: [PATCH] Add some casts for building on musl.
8 * linux-thread-db.c (find_new_threads_callback): Cast ti.ti_tid to
9 unsigned long for debug_printf.
10 (thread_db_pid_to_str): Ditto.
12 gdb/gdbserver/ChangeLog:
14 * thread-db.c (find_one_thread): Cast ti.ti_tid to unsigned long
16 (attach_thread, find_new_threads_callback): Ditto.
18 [Arnout: removed the parts that don't apply, including ChangeLog]
19 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
21 gdb/ChangeLog | 5 +++++
22 gdb/gdbserver/ChangeLog | 6 ++++++
23 gdb/gdbserver/thread-db.c | 9 +++++----
24 gdb/linux-thread-db.c | 5 +++--
25 4 files changed, 19 insertions(+), 6 deletions(-)
27 diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
28 index ffe722d..3df10ff 100644
29 --- a/gdb/gdbserver/thread-db.c
30 +++ b/gdb/gdbserver/thread-db.c
31 @@ -278,7 +278,7 @@ find_one_thread (ptid_t ptid)
34 debug_printf ("Found thread %ld (LWP %d)\n",
35 - ti.ti_tid, ti.ti_lid);
36 + (unsigned long) ti.ti_tid, ti.ti_lid);
38 if (lwpid != ti.ti_lid)
40 @@ -319,12 +319,12 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
43 debug_printf ("Attaching to thread %ld (LWP %d)\n",
44 - ti_p->ti_tid, ti_p->ti_lid);
45 + (unsigned long) ti_p->ti_tid, ti_p->ti_lid);
46 err = linux_attach_lwp (ptid);
49 warning ("Could not attach to thread %ld (LWP %d): %s\n",
50 - ti_p->ti_tid, ti_p->ti_lid,
51 + (unsigned long) ti_p->ti_tid, ti_p->ti_lid,
52 linux_ptrace_attach_fail_reason_string (ptid, err));
55 diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
56 index 66e9595..41db29a 100644
57 --- a/gdb/linux-thread-db.c
58 +++ b/gdb/linux-thread-db.c
59 @@ -1816,7 +1817,7 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
61 tid = thread_info->priv->tid;
62 snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
63 - tid, ptid_get_lwp (ptid));
64 + (unsigned long) tid, ptid_get_lwp (ptid));