This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to get LD_DEBUG of forked process


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.



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