Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLDB - Evaluate Address In Register

To view my stack in LLDB, I currently use the following:

(lldb) register read rbp --format hex
rbp = 0x00007fff5fbff820

Then to view the first 64-bytes growing down:

(lldb) memory read --size 4 --format x --count 16 `0x00007fff5fbff820-64`
0x7fff5fbff7e0: 0x5fbff900 0x00007fff 0x00000000 0x00000000
0x7fff5fbff7f0: 0x00000000 0x00000000 0x00000000 0x00000000
0x7fff5fbff800: 0x00000000 0x00000000 0x00000000 0x00000000
0x7fff5fbff810: 0x5fbff838 0x00000006 0x00000008 0x00000000

I haven't been able to find how to do it, but is there any way to replace the expression:

`0x00007fff5fbff820-64`

With something more like:

`%rbp-64`

Thanks!

like image 471
Scruffers Avatar asked Aug 15 '12 11:08

Scruffers


People also ask

What does LLDB stand for?

LLDB (low-level debugger) is part of LLVM The LLVM compiler (low level virtual machine) creates programming languages. LLDB is Apple's “from the ground up” replacement for GDB. The LLDB debugger is analogous to GDB: (The GNU Project Debugger).

How do you set a breakpoint in LLDB?

In lldb you can set breakpoints by typing either break or b followed by information on where you want the program to pause. After the b command, you can put either: a function name (e.g., b my_subroutine ) a line number (e.g., b 12 )

Is LLDB compatible with GDB?

The standard LLDB installation provides you with an extensive set of commands designed to be compatible with familiar GDB commands. In addition to using the standard configuration, you can easily customize LLDB to suit your needs. Both GDB and LLDB are of course excellent debuggers without doubt.


1 Answers

`$rbp-64`

There are also shortcut formatters for memory read and print that act like gdb. e.g.

x/16x `$rbp`

see "help gdb-format" for details on accepted formatter chars for x/ and p/. These are really just command aliases to memory read -G and expr -G.

like image 155
Jason Molenda Avatar answered Oct 18 '22 17:10

Jason Molenda