This is the mail archive of the gdb@sources.redhat.com 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]

core files and shared libraries


I'm hoping that someone can help me with this problem.

I'm running version 2.4.2 of the Linux kernel on an embedded PPC. I've
applied a patch enables core file generation for multithreaded
applications. This seems to work.  However because of the number
of threads, the amount of memory allocated by the application, and
the limited filesystem space, I want to limit what goes into the core files.
Setting the environment's core file size limit (e.g in bash with "ulimit -c")
doesn't necessarily do what I want because it may generate a core
file which does not include the stack.

I've hacked at the kernel code which generates the ELF core file so that the
only memory section it writes is the one which contains the stack. The
note and reg sections are still generated. The problem I have now is
that when I examine the stack using gdb, I get something with no symbols:

(gdb) bt
#0  0xff836c4 in ?? ()
#1  0x0 in ?? ()

When I use a kernel without my hacks, it looks like this:

(gdb) bt
#0  0xff13224 in __syscall_rt_sigsuspend () from /lib/libc.so.6
#1  0xff11f18 in sigsuspend () from /lib/libc.so.6
#2  0x1064fae4 in __pthread_wait_for_restart_signal (self=0x7a3ffe40)
    at pthread.c:785
#3  0x1064c56c in pthread_cond_wait (cond=0x111f93c4, mutex=0x111f93ac)
    at restart.h:26
. . . .

I've tried both gdb 4.18 and a very recent snapshot of gdb 5.0 with the same
results.

I turned on target debugging in gdb, and found that with the core files that
my hacked kernel generates, gdb does not load symbols from any shared
libraries. I have even tried doing "set auto-solib-add 0; share /lib/libc.so.6" 
but that does nothing.

So there's something missing from my hacked ELF core files, but I don't know
what. Could someone tell me how gdb decides that it needs to load symbols
from shared libraries when it reads in a core file? 

Thanks very much,
-John Van Horne



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