How to get LD_DEBUG of forked process
David Daney
ddaney.cavm@gmail.com
Thu Oct 11 17:04:00 GMT 2012
On 10/10/2012 11:30 PM, Ajeet Yadav wrote:
> 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);
Here you completely replace the Environment of the process execing p2.
> }
> }
[...]
>
>
> Can anyone help me why I am not getting the relocation information of
> process P2,
You are not getting the LD_DEBUG=reloc information because that
environment variable is not set in P2 due to your elimination of the
entire environment.
> and how to get it ?
Pass LD_DEBUG=reloc in the environment of any process for which you wish
to see the dumps.
More information about the Gcc-help
mailing list