gdb cannot display argc/argv?
If I compile a simple "int main(int argc, char *argv)" program with -g, and debug with gdb, I'm getting an error when I break at the start and try to print argc or argv.
Cannot access memory at address 0x0
This is with SUSE 10.1, which is gcc 4.1.0. I happen to have some binaries of the *same* source that were compiled with gcc from 10.0 (which is gcc 4.0.2 I think) and these debug correctly.
The programs themselves work fine. It's just the debugger that has a problem.
Is this a known problem?
To reproduce, write the classic "hello world" main, compile with "gcc -o main -g main.c" or "g++ -o main -g main.cpp" (C and C++ give the same problem). Then "gdb main", "break main" and run to the breakpoint. "p argc" or "p argv" gives the error. If you (can) repeat this under SUSE 10.0 it may not show the problem.