My goal is to figure out the address space of str_main
, but gdb skips over my breakpoint.
How do I find its address location?
I have a simple c program, stack.c
:
....
19 int main(int argc, char **argv[])
20 {
21 char str_main[517];
22 FILE *badfile;
23
24 badfile = fopen("badfile","r");
....
When I enter gdb I set a breakpoint at line 21. However, when I run the debugger, I get the following message:
Breakpoint 1, main(argc=1, argv=0xbffff3d4) at stack.c:24
24 badfile = fopen("badfile","r");
GDB wont stop on declarations without default value.
Even after reaching 24, you can still print the address.
p /s str_main