Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 无法使用gdb查看堆栈中的内存_Macos_Gdb_Reverse - Fatal编程技术网

Macos 无法使用gdb查看堆栈中的内存

Macos 无法使用gdb查看堆栈中的内存,macos,gdb,reverse,Macos,Gdb,Reverse,我正在用gdb逆转Mac OS上的恶意软件。 然后我尝试查看堆栈中的一个局部变量,Gdb告诉我:“无法访问地址0xbffffd58处的内存”。为什么 嗯,我认为这是GDB中的一个bug: (gdb) x/12i $pc-0x2a 0x2473: push ebx 0x2474: call 0x2479 0x2479: pop ebx 0x247a: sub esp,0x34 0x247d: lea

我正在用gdb逆转Mac OS上的恶意软件。 然后我尝试查看堆栈中的一个局部变量,Gdb告诉我:“无法访问地址0xbffffd58处的内存”。为什么


嗯,我认为这是GDB中的一个bug:

(gdb) x/12i $pc-0x2a
       0x2473:  push   ebx
       0x2474:  call   0x2479
       0x2479:  pop    ebx
       0x247a:  sub    esp,0x34
       0x247d:  lea    edx,[ebp-0x19]
       0x2480:  mov    DWORD PTR [esp],edx
       0x2483:  mov    DWORD PTR [esp+0x8],0x6
       0x248b:  lea    eax,[ebx+0x15a3e]
       0x2491:  mov    DWORD PTR [esp+0x4],eax
       0x2495:  call   0xd900
       0x249a:  mov    DWORD PTR [esp],eax
    => 0x249d:  call   0x300b3
(gdb) x/10xb $eax
0xbffffcdf: Cannot access memory at address 0xbffffcdf
(gdb) x/1xw $esp
0xbffffcc0: 0xbffffcdf
(gdb) x/10xb 0xbffffcdf
0xbffffcdf: 0x2f    0x74    0x6d    0x70    0x00    0x05    0x7e    0x01
0xbffffce7: 0x00    0x27
(gdb) ni
0x000300b3 in ?? ()
=> 0x000300b3:  e8 48 42 de 8f  call   0x8fe14300
(gdb)
看到了吗?检查同一地址两次,我得到两个不同的结果

然后,我输入'ni'命令,GDB不会跳过


Gdb在Mac OS X上工作不好?

我认为OSX使用了clang和lldb。。。你可以试试lldb
(gdb) x/12i $pc-0x2a
       0x2473:  push   ebx
       0x2474:  call   0x2479
       0x2479:  pop    ebx
       0x247a:  sub    esp,0x34
       0x247d:  lea    edx,[ebp-0x19]
       0x2480:  mov    DWORD PTR [esp],edx
       0x2483:  mov    DWORD PTR [esp+0x8],0x6
       0x248b:  lea    eax,[ebx+0x15a3e]
       0x2491:  mov    DWORD PTR [esp+0x4],eax
       0x2495:  call   0xd900
       0x249a:  mov    DWORD PTR [esp],eax
    => 0x249d:  call   0x300b3
(gdb) x/10xb $eax
0xbffffcdf: Cannot access memory at address 0xbffffcdf
(gdb) x/1xw $esp
0xbffffcc0: 0xbffffcdf
(gdb) x/10xb 0xbffffcdf
0xbffffcdf: 0x2f    0x74    0x6d    0x70    0x00    0x05    0x7e    0x01
0xbffffce7: 0x00    0x27
(gdb) ni
0x000300b3 in ?? ()
=> 0x000300b3:  e8 48 42 de 8f  call   0x8fe14300
(gdb)