Unix Technical Forum

Debugging ld.so

This is a discussion on Debugging ld.so within the mailing.openbsd.tech forums, part of the OpenBSD category; --> I could use some pointers on how to debug a segfault in ld.so on i386 -current (as of last ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 06:28 AM
Kurt Miller
 
Posts: n/a
Default Debugging ld.so

I could use some pointers on how to debug a segfault in ld.so on
i386 -current (as of last night). I'm trying (so far in vain) to figure out
a
problem with devel/jdk/1.2 in -current. javac segfaults before it reaches
the main function. niklas@ gave me some pointers on how to track down
problems in ld.so, but I've kind of hit the wall and can't make any more
progress...

Using DL_DEB statements in the _dl_boot function in libexec/ld.so :
loader.c, I know that the segfault is happening while executing line
365/366:

(*(void (*)(Elf_Addr))(sym->st_value + ooff))
((Elf_Addr)_dl_dtors);

The comments and code indicate this code calls the atexit function. I placed
printf statements in the atexit function of libc/stdlib/atexit.c (don't do
this at home), however I never reach them while attempting to execute
javac_g. (I did see my printf all over while executing other stuff and I
would not recommend doing it at least not without a backup of libc).

OK, at this point I'm a bit perplexed because I expected to see the printf's
I added to libc/stdlib/atexit.c, but I didn't. However, I know something is
being executed by lines 365/366 in loader.c because DL_DEB statements are
being output from dlopen:

calling atexit - (before line 365 of loader.c)
dlopen: loading: libc.so
linking dep /usr/lib/libc.so.30.0 as child of
/usr/ports/devel/jdk/1.2/w-jdk-1.2.2/build/bsd/bin/i386/green_threads/javac_
g
dlopen returning: already loaded (at line 72 of dlfcn.c)

Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb)

So I'm stuck. Something is being executed but I don't know what. I haven't
been able to put a breakpoint in using gdb because all of this happens
before the main function of javac_g. Is there a way I can halt execution and
step through this code? or Would someone enlighten me as to what is being
executed by line 365/366 so I can continue using DL_DEB or printf's to
figure this out? Any assistance, RTFM or flames welcome ;-)

Thanks,
-Kurt

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:46 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com