Re: View memory content with gdb

"Mahmood Naderan via gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>No it doesn't. Stack grows downward when you extend it — by reserving
>bytes or by `push`ing onto it. But after you've reserved the space in
>it, further addressing of that space is via positive offsets to $rsp.


Agreed... I can now see that 61H is inserted into those locations

(gdb) info registers rsp
rsp            0x7fffffffde50    0x7fffffffde50
(gdb) x/8x 0x7fffffffde50
0x7fffffffde50:    0xffffdf58    0x00007fff    0x55554580    0x00000002
0x7fffffffde60:    0xffffdf50    0x00007fff    0x00000000    0x00000000
(gdb) next
7      return 0;
(gdb) x/10x 0x7fffffffde50
0x7fffffffde50:    0xffffdf58    0x00007fff    0x55554580    0x00000002
0x7fffffffde60:    0xffffdf50    0x61617fff    0x61616161    0x61616161
0x7fffffffde70:    0x55554600    0x00005555


I wonder why it didn't insert 61H starting from 0x7fffffffde50?





>You've set two breakpoints: first at `#include <stdio.h>`, and second>at `int main( int argc, char **argv )`, which are the lines 1 and 3 of
>your current source file, respectively.


But what I did seems to be correct! 
Please see that although I set "break 1" and then "run", the program stops at strcpy line (line 6). That means it didn't set the breakpoint at the include line.

(gdb) break 1
Breakpoint 1 at 0x6bf: file mico.c, line 1.
(gdb) run aaaaaaaaa
Starting program: /home/mahmood/mico aaaaaaaaa

Breakpoint 1, main (argc=2, argv=0x7fffffffdf58) at mico.c:6
6      strcpy( buffer, argv[ 1 ] );
(gdb) p argv[1]
$1 = 0x7fffffffe302 "aaaaaaaaa"



Regards,
Mahmood
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.