nakst / gf

A GDB frontend for Linux.
MIT License
1.82k stars 61 forks source link

Debugging a stack overflow does not show the full stack trace and stops at 49 #175

Closed LainLayer closed 2 months ago

LainLayer commented 2 months ago

Apologies if this is a known problem, I did not see an existing issue for it.

In gf2 the call stack ends at 49: image

In gdb using bt:

...
#1058 0x0000555555555127 in b () at test.c:10
#1059 0x000055555555513a in a () at test.c:6
#1060 0x0000555555555127 in b () at test.c:10
#1061 0x000055555555513a in a () at test.c:6
--Type <RET> for more, q to quit, c to continue without paging--

... and it continues until main()

It is within reasonable expectations that a recursive program could have more than 49 calls on the stack so it is unclear in this case in gf2 that an overflow occurred.

example code:

void b();

void a() {
    b();
}

void b() {
    a();
}

int main(void) {
    a();
    return 0;
}

I realize displaying the whole hundreds of thousands of calls would be very non-practical, but it would be nice to see where they started from at least. perhaps something like

... last 2 function calls repeat 100,000 times...
test.c b
test.c a
test.c main

Or maybe list the stack trace upside down?

greg7mdp commented 2 months ago

Hi @LainLayer

See this in the README:

image

Just create a file ~/.config/gf2_config.ini and set the size you want in there.