Memory dump formatted like xxd from gdb

后端 未结 5 957
轻奢々
轻奢々 2020-12-23 02:10

I\'m trying to inspect a buffer which contains a binary formatted message, but also contains string data. As an example, I\'m using this C code:

int main (vo         


        
5条回答
  •  我在风中等你
    2020-12-23 02:47

    (gdb) define xxd
    >dump binary memory dump.bin $arg0 $arg0+$arg1
    >shell xxd dump.bin
    >end
    (gdb) xxd &j 10 
    0000000: 0000 0000 0000 0000 0000 0000 4d8c a7f7  ............M...
    0000010: ff7f 0000 0000 0000 0000 0000 c8d7 ffff  ................
    0000020: ff7f 0000 0000 0000
    

    Seems easy enough ;-)

    You could likely write a Python script (modern GDB versions have embedded Python interpreter) to do the same, and get rid of the need to "shell out".

提交回复
热议问题