GrandNecro
GrandNecro

Reputation: 19

What is the addresses shown during backtrace in GDB pointing to?

I'm new to GDB. I'm wondering what exactly does the address 0xXXXX means at the beginning of each frame?

enter image description here

(gdb) bt
#0  g2 (a=4, b=34) at 2.7.c:10
#1  0x0000000008000703 in main (argc=1, argv=0x7ffffffedd48) at 2.7.c:18

Is that the address of the Return Location or is that the address of where that the function begins? Here's the applicable part of the code. enter image description here

int g2(int a, int b){
    int c = g1(a+3, b-11);
    printf("g2: a = %d, b = %d, c = %d\n", a, b, c);
    return c;
}

int main(int argc, char **argv){
    int a = 5;
    int b = 17;
    int c = g2(a-1, b*2);
    printf("g3: a = %d, b = %d, c = %d\n", a, b, c);
    return 0;
}

Upvotes: 0

Views: 866

Answers (1)

Chris Dodd
Chris Dodd

Reputation: 126536

It is the return address within the function that will be returned to when the called code returns to this frame. If you disassemble the code to main (disas main), you'll see the code of main with addresses, one of which will be the address in question (0x8000703), which will probably be the instruction immediately after a call instruction.

Upvotes: 4

Related Questions