deal thread id as unsigned

Yoriko Komatsuzaki
2007-04-16T02:40:05Z

Hello.

I would like to ask you to consider this tiny patch about thread id type.
Thread id is unsigned type in Linux.

Without this patch (especially about linux-thread-db.c), thread id
display can be minus...

# Apologies in advance if this is already-known issue.

Thank you.

--- gdb-6.6/gdb/defs.org.h 2007-04-10 16:04:51.000000000 +0900
+++ gdb-6.6/gdb/defs.h 2007-04-10 16:05:06.000000000 +0900
@@ -795,7 +795,7 @@ struct ptid
long lwp;

/* Thread id */
- long tid;
+ unsigned long tid;
};

typedef struct ptid ptid_t;
--- gdb-6.6/gdb/linux-thread-db.org.c 2007-04-10 16:55:55.000000000 +0900
+++ gdb-6.6/gdb/linux-thread-db.c 2007-04-10 16:53:30.000000000 +0900
@@ -1031,10 +1031,10 @@ thread_db_pid_to_str (ptid_t ptid)

thread_info = find_thread_pid (ptid);
if (thread_info == NULL)
- snprintf (buf, sizeof (buf), "Thread %ld (LWP %ld) (Missing)",
+ snprintf (buf, sizeof (buf), "Thread %lu (LWP %ld) (Missing)",
GET_THREAD (ptid), GET_LWP (ptid));
else
- snprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
+ snprintf (buf, sizeof (buf), "Thread %lu (LWP %ld)",
GET_THREAD (ptid), GET_LWP (ptid));

return buf;

---
Yoriko Komatsuzaki (yoriko@sm.sony.co.jp)