--- /home/pgilliam/linux-thread-db.c 2006-08-17 02:27:05.000000000 -0700 +++ hacked.linux-thread-db.c 2006-08-17 02:29:16.000000000 -0700 @@ -497,6 +497,7 @@ static td_err_e enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp) { + static CORE_ADDR thread_lib_reloc = 0; td_notify_t notify; td_err_e err; @@ -514,7 +515,24 @@ ? (CORE_ADDR) (intptr_t) notify.u.bptaddr : (CORE_ADDR) (uintptr_t) notify.u.bptaddr), ¤t_target)); - create_thread_event_breakpoint ((*bp)); + if (! thread_lib_reloc) { + char tbuf[1024]; + FILE *pmf; + + sprintf (tbuf, "/proc/%d/maps", proc_handle.pid); + pmf = fopen (tbuf, "r"); + if (pmf) { + while (fgets( tbuf, sizeof(tbuf), pmf)) { + char *cp = rindex (tbuf, '/'); + if (cp && strncmp (cp+1, "libpthread", 10) == 0) { + thread_lib_reloc = (CORE_ADDR) strtol (tbuf, 0, 16); + break; + } + } + fclose (pmf); + } + } + create_thread_event_breakpoint ((*bp) + thread_lib_reloc); return TD_OK; }