[lldb-dev] Question for debugging a forked program and reload symbol

Yin Ma yin at affinic.com
Tue Nov 19 14:49:06 PST 2013


Hi 

 

I have a very simple program 

 

#include <stdio.h>

int num = 0;

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

    int pid;

        int num;

    pid = fork();

    printf("%d", pid);

    if(pid == 0){       /*child*/

        num = 1;

    }else if(pid > 0){  /*parent*/

        num = 2;

    }

    printf("%d", num);

        while(num) {

                num ++;

        }

 

        return num;

}

 

I break at num = 1;

B g.c:9

 

And I run

The program never hits the breakpoint.

And the output from the program is

4862

2

0

 

However, if I run in terminal

The output is

4813

2

0

1

 

It looks like the forked portion is not available in lldb. 

What’s going on here?

 

Another question:

If I am debugging an executable, after I modified the source

And re-compile the executable, the next time when I run

Under debugger, gdb will show reload symbol. I didn’t see

The same thing for lldb or any output about updating. Do

I have to reload the executable every time I modify it?

 

I am using Moutain Lion, lldb-179.5

 

Thanks,

 

Yin 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131119/82206eca/attachment.html>


More information about the lldb-dev mailing list