0

When I arrive at a breakpoint in lldb, I want to be able to see the source code around the stopped point of execution. The l command does not appear to have any option to do that:

help l
     List relevant source code using one of several shorthand formats.  Expects 'raw' input (see 'help raw-input'.)

Syntax:
_regexp-list <file>:<line>   // List around specific file/line
_regexp-list <line>          // List current file around specified line
_regexp-list <function-name> // List specified function
_regexp-list 0x<address>     // List around specified address
_regexp-list -[<count>]      // List previous <count> lines
_regexp-list                 // List subsequent lines

Doing l just prints downward, not printing around where execution stopped. What's the easiest way to get the view that I'm looking for?

Thomas
  • 6,032
  • 6
  • 41
  • 79
  • If you are using command-line lldb you should see the lines around the stop pc when you hit the breakpoint. Are you not seeing that? Or is that not doing what you want? – Jim Ingham Jul 07 '20 at 17:01
  • 2
    Note also that using the `f` alias by itself as a command will redo the stop source listing. That's not much help if the stop source listing doesn't do what you want, but is useful if you've been listing subsequent lines and then want to go back to listing the stop point. – Jim Ingham Jul 07 '20 at 17:43

1 Answers1

0

You can use the quouted:

_regexp-list 0x<address>     // List around specified address

like this:

p/x $pc
(unsigned long) $5 = 0x00000001000008c7
l 0x00000001000008c7

Where pc stands for program counter.

Kamil.S
  • 5,205
  • 2
  • 22
  • 51