You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I started to read your book - it is nice! Thanks for it.
I stuck with gdb, where your examples on page 45 (GDB Variables) do not work for me. maybe I have too new version? (I downgraded gcc, but gdb my distro does not have packaged gdb lower then 7)
In short I cannot use "*x@3" for an array, here is a self explanatory log
[nix-shell:~/Downloads/test]$ gcc --version
gcc (GCC) 5.4.0
[nix-shell:~/Downloads/test]$ gdb --version
GNU gdb (GDB) 7.12.1
[nix-shell:~/Downloads/test]$ cat test.c
int main() {
int x[20] = {};
x[0] = 3;
}
[nix-shell:~/Downloads/test]$ gcc -O0 -g -Wall -std=gnu11 test.c
warning about not using x
[nix-shell:~/Downloads/test]$ gdb a.out
(gdb) b 4
Breakpoint 1 at 0x400530: file test.c, line 4.
(gdb) r
Starting program: /home/kosh/Downloads/test/a.out
Breakpoint 1, main () at test.c:4
4 }
(gdb) set $ptr=&x[3]
Attempt to take address of value not located in memory.
(gdb) p x
$1 = {3, <optimized out> <repeats 19 times>}
(gdb) p *x
Attempt to take address of value not located in memory.
(gdb) p *x@1
Attempt to take address of value not located in memory.
(gdb) p x[1]
$2 = <optimized out>
(gdb) p x[0]
$3 = 3
Is the problem with new gdb?
The text was updated successfully, but these errors were encountered:
Hello,
I started to read your book - it is nice! Thanks for it.
I stuck with gdb, where your examples on page 45 (GDB Variables) do not work for me. maybe I have too new version? (I downgraded gcc, but gdb my distro does not have packaged gdb lower then 7)
In short I cannot use "*x@3" for an array, here is a self explanatory log
Is the problem with new gdb?
The text was updated successfully, but these errors were encountered: