This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: wrong assumptions about pthread_t being numeric


On Friday 16 September 2011 23:40:47, John Spencer wrote:

> i basically wanted to fix my compile error and send a patch, but i think 
> this should be discussed first.

> $ grep ti_tid `find gdb-7.3.1 -name '*.c'`
> gdb-7.3.1/gdb/sol-thread.c:  return BUILD_THREAD (ti.ti_tid, PIDGET (lwp));
> gdb-7.3.1/gdb/sol-thread.c:  ptid = BUILD_THREAD (ti.ti_tid, PIDGET 
> (inferior_ptid));
> gdb-7.3.1/gdb/sol-thread.c:                    ti.ti_tid, ti.ti_lid);
> gdb-7.3.1/gdb/aix-thread.c:      return thrinf.ti_tid;

These are only built natively on solaris and aix respectively, so
let's just leave them alone.

> thread-db.c: In function 'find_one_thread':
> thread-db.c:295:7: error: format '%ld' expects type 'long int', but 
> argument 3 has type 'thread_t'
> thread-db.c: In function 'attach_thread':
> thread-db.c:335:7: error: format '%ld' expects type 'long int', but 
> argument 3 has type 'thread_t'
> thread-db.c:341:9: error: format '%ld' expects type 'long int', but 
> argument 2 has type 'thread_t'

So just cast it to long, and you're done.

> gdb-7.3.1/gdb/linux-thread-db.c:  gdb_assert (ti_p->ti_tid != 0);
> gdb-7.3.1/gdb/linux-thread-db.c:  private->tid = ti_p->ti_tid;
> gdb-7.3.1/gdb/linux-thread-db.c:  if (ti.ti_tid == 0 && 
> target_has_execution)
> gdb-7.3.1/gdb/gdbserver/thread-db.c:         ti.ti_tid, ti.ti_lid);
> gdb-7.3.1/gdb/gdbserver/thread-db.c:  if (ti.ti_tid == 0)
> gdb-7.3.1/gdb/gdbserver/thread-db.c:         ti_p->ti_tid, ti_p->ti_lid);
> gdb-7.3.1/gdb/gdbserver/thread-db.c:           ti_p->ti_tid, ti_p->ti_lid);

Does your libc actually have a libthread_db.so?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]