How to get LD_DEBUG of forked process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,
I wish to check the the LD_DEBUG=reloc for both parent and child process.

Code of parent process p1, that is forking the child process p2
[ajeet_y@localhost ajeet]$ cat main1.c
#include <stdio.h>
#include <unistd.h>
int main()
{
        pid_t pid;
        printf("In P1\n");
        pid = fork();
        if (pid){
                sleep(1);
        } else {
                execve("./p2",NULL,NULL);
        }
}

Code of the child process p2
[ajeet_y@localhost ajeet]$ cat main2.c
#include <stdio.h>
int main()
{
        printf("In P2\n");
}

[ajeet_y@localhost ajeet]$ gcc main1.c -o p1
[ajeet_y@localhost ajeet]$ gcc main2.c -o p2

When I run it normally
[ajeet_y@localhost ajeet]$ ./p1
In P1
In P2


Now when I run it with LD_DEBUG=reloc, I get relocation information of p1 only
[ajeet_y@localhost ajeet]$ export LD_DEBUG=reloc
[ajeet_y@localhost ajeet]$ ./p1
     12259:
     12259:     relocation processing: /lib/libc.so.6
     12259:
     12259:     relocation processing: ./p1 (lazy)
     12259:
     12259:     relocation processing: /lib/ld-linux.so.2
     12259:
     12259:     calling init: /lib/libc.so.6
     12259:
     12259:
     12259:     initialize program: ./p1
     12259:
     12259:
     12259:     transferring control: ./p1
     12259:
In P1
In P2
     12259:
     12259:     calling fini: ./p1 [0]
     12259:
     12259:
     12259:     calling fini: /lib/libc.so.6 [0]
     12259:
[ajeet_y@localhost ajeet]$ unset LD_DEBUG


Can anyone help me why I am not getting the relocation information of
process P2, and how to get it ?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux