gdbinit/Gdbinit — pull request #9 by vuquangtrong (2013-05-03 16:50:33+00:00)
Title: small bug: Function HEXDUMP doest work properly with 2 args

I have found that hexdump function doesnt work properly when you wanna dump a range of stack,
i.e:

hexdump $esp 20; print 20 lines x 16 bytes = 320 bytes of stack beginning at address stored in $esp

you will get error message:

gdb$ hexdump $esp 20
Argument to arithmetic operation not a number or boolean.

so, to solve this problem, you can edit file ~/.gdbinit at line 1412

old new change code
1411 - hexdump_aux $data_addr+$_i
1411 + # this line causes an error when run hexdump with 2 arguments
1412 + # hexdump_aux $data_addr+$_i
1413 + hexdump_aux $arg0+$_i
1412 1414 set $_count++

now, this function worked. I used this to see stack value instead of 8 lines displayed by setting $SHOWSTACK=1 option.

gdb$ hexdump $rsp 20
0x00007FFFFFFFE690 : 00 00 00 00 00 00 00 00 - 35 17 02 7F 32 00 00 00 ........5...2...
0x00007FFFFFFFE6A0 : 00 00 00 00 00 00 00 00 - 78 E7 FF FF FF 7F 00 00 ........x.......
0x00007FFFFFFFE6B0 : 00 00 00 00 01 00 00 00 - 24 0D 40 00 00 00 00 00 ........$.@.....
0x00007FFFFFFFE6C0 : 00 00 00 00 00 00 00 00 - E2 63 37 35 21 07 3A 53 .........c75!.:S
0x00007FFFFFFFE6D0 : 40 0C 40 00 00 00 00 00 - 70 E7 FF FF FF 7F 00 00 @.@.....p.......
0x00007FFFFFFFE6E0 : 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................