English 中文(简体)
如何在gdb中印刷-0x4(%rbp)?
原标题:How to print -0x4(%rbp) in gdb?

在拆解中,有这样的法典:

movl   $0x6,-0x4(%rbp)

我试图以这种方式印刷价值,但未能做到:

(gdb) p  0x4(%esp)
A syntax error in expression, near `%esp) .
(gdb) p 0x4+$esp
Argument to arithmetic operation not a number or boolean.

如何正确印刷?

最佳回答

It looks like you re working with 64 bit code, in which case you just need, e.g.:

(gdb) p $rbp-0x4
$1 = (void *) 0x7fff5fbff71c

如果你想看到这一地址实际上是什么at,那么,你需要加入,避免* 地址,例如:

(gdb) p /x *(int *)($rbp-0x4)
$2 = 0x7fff

or, more succinctly, use x instead of p, e.g.

(gdb) x /w $rbp-0x4
0x7fff5fbff71c: 0x00007fff
问题回答

暂无回答




相关问题
tell gdb to disassemble "unknown" code

is it possible to configure gdb in order to debug assembly code when there are no debug symbols or no sources available ? I mean showing assembly instruction by assembly instruction when performing a ...

C++ Netbeans debugging issues

I installed netbeans6.7.1 ide for c/c++ also i have mingw/msys cygwin installed and i have given C:Msysin as environment variable path.It has gdb7 version.However wheni run dbugging thru netbeans ...

setting strings in gdb

c++: int main() { string a = "a"; ... ... } when i debug in gdb: (gdb) set var a = "ok" Invalid cast I run the program and pause at a break point after string a has been ...

How to debug programms written in fasm under linux using gdb?

I wrote simple "hello, world" in fasm, and its works, but how i can generate debug info for gdb and edb (Evan s Debugger)? Fasm compiler could only produce debugging symbols in its specific format - "...

How can I display Unicode strings while debugging on linux?

I have been working for some years now as C++ Developer using MS Visual Studio as working platform. Since I privately prefer to use linux, I recently took the chance to move my working environment to ...

Continue to debug after failed assertion on Linux?

When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you)...

热门标签