LLDB alias for multiple teams as one

I am trying to debug a library whose source I don’t have, so I use LLDB parsing many times. I was wondering if there is a way to automatically start disassembling after each "step input" call. Currently, when I do "stream input", LLDB executes the instruction and then returns with an empty prompt. To see where EIP has moved, I need to enter disassembly after each step-by-step input, which is extremely distracting and annoying (also LLDB doesn't seem to end the expression with;; so putting multiple commands on the same line doesn't work.)

In general, I was wondering if there is a way to create an alias for several LLDB commands in a row: for example, one alias that can print the contents of% rdi and then parse 10 lines around EIP. (Yes, I could write a python script for it, but I don't have much time on hand :-(

+6
source share
1 answer

Yes, the right way to do this is through the Python scripting interface. There was a deliberate decision to avoid the gdb approach, which requires sufficient control of the flow and execution logic in the debugger command language to make this possible (or rather, to make it possible ... bad). Instead, there is a low barrier where you need to use Python to complete the task, but the full power of the debugger is available through some fairly easy-to-use interfaces in Python. lldb derives a scripting language in Python and concentrates on providing a clean and powerful API that is easy to use from Python.

But to solve your goal here, why does stop-disassembly-count setup not do what you need? In fact, it should already do what you need if you did not turn off the disassembly display in your ~/.lldbinit file by changing the default stop-disassembly-display .

 (lldb) settings show stop-disassembly-count stop-disassembly-count (int) = 4 (lldb) settings show stop-disassembly-display stop-disassembly-display (enum) = no-source (lldb) 

lldb's default behavior is to show some context when you go through the program. If source code is available, it will show the source you are going through. If there is no source, it will show the assembly instructions that must be followed. There is a small error when you have debugging information (therefore, the debugger knows the file and line numbers), but the source code is not available (or in another way) - right now lldb will show you the disassembly, but this is the wrong behavior for This is the case. Users still work at the source level (using s and n for the step instead of si and ni for stepping at the instruction level), and lldb should not show context in this instance, just displaying the source file name and line number.

+1
source

All Articles