Quoting Jonathan Adams <[EMAIL PROTECTED]>:
On Thu, Dec 29, 2005 at 03:13:18AM -0500, Matty wrote:
dladdr() and dladdr1() only look at the dynamic symbol table, which only
contains GLOB symbols. When asked for a static symbol, it will usually
give the nearest global symbol. Try printing out the symbol names to
see how this works.
Thanks, I should have realized that. It turns out that dladdr()/dladdr1()
sometimes can't find any symbols at all, causing printstack() to segfault.
Secondly, in display_stack_info(), which is called from printstack() in
libc, no attempt is made to verify that sym is not a NULL pointer
prior to deferencing it:
482 if (dladdr1((void *) pc, &info, (void**) &sym,
RTLD_DL_SYMENT) == 0) {
483 /* no info at all */
484 if (signo == 0)
485 async_filenoprintf(filenum, "0x%x\n", pc);
486 else
487 async_filenoprintf(filenum,
488 "0x%x [ Signal %d (%s)]\n", pc,
489 (ulong_t)signo, sigbuf);
490
491 } else if ((pc - (unsigned long)info.dli_saddr) <
492 sym->st_size) {
This caused my segfault handler to SEGFAULT (cute isn't it), and
I would like to recommend adding a check similar to the following:
491 } else if (sym && ((pc - (unsigned long)info.dli_saddr) <
492 sym->st_size)) {
Please file a bug.
Will do, thanks.
--
Clay McClure
http://daemons.net/~clay
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code