Step into shared-library code of attached process

Yasuhiro Endoh quiver2k@ybb.ne.jp
Mon Jul 18 16:54:00 GMT 2005


Hello,

I'm trying to step into shared-library code of attached process. I can't
step into library-function at the first call. But I can step in the
function at the second call.
Can I step into library-function at the first the?

My Environments are:
CPU: Intel(R) Celeron(R) CPU 2.40GHz
OS: Fedora core 3
Kernel: 2.6.12 (kernel-2.6.12-1.1372_FC3)
gdb: 6.3

The followings are sample code:
void foo() {
    printf("foo\n");
}

int main(int argc, char *argv[])
{
    char buf[128];

    printf("attach me(pid=%d)> ", getpid());
    fgets(buf, sizeof(buf), stdin);

    foo();

    bar(); /* can't step-in */
    bar();
    bar();

    return 0;
}

Here, function bar() is defined in the shared library libbar.so.

To step into bar, I took the followings:
1. This program prompts "attach me(pid=18130)>".
2. I attached the process with id 18130
3. I set a break point at "foo();" in main
4. I typed "info sharedlibrary"

(gdb) info sharedlibrary
>From        To          Syms Read   Shared Object Library
0xb7f6644c  0xb7f66564  Yes         /home/yendoh/link/libbar.so
0x0088cc00  0x0097ccd0  Yes         /lib/tls/libc.so.6
0x008197a0  0x0082b58f  Yes         /lib/ld-linux.so.2

5. continued
6. The process was breakd at "foo():", I could step-in foo().
7. I tried to step into "bar();" , but I couldn't step-in.
8. I could step-in the second and third call of bar().


I attached my-program. To run the program:
1. make
2. make run

Thanks,
Endoh



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile
URL: <http://sourceware.org/pipermail/gdb/attachments/20050718/448355fd/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.c
Type: text/x-csrc
Size: 57 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20050718/448355fd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.h
Type: text/x-chdr
Size: 13 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20050718/448355fd/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 313 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20050718/448355fd/attachment-0002.bin>


More information about the Gdb mailing list