diff options
| author | Pavel Labath <pavel@labath.sk> | 2025-01-15 10:37:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-15 10:37:06 +0100 |
| commit | eb96c8c105226956c8ed5ab30699206f53de74f7 (patch) | |
| tree | 91902a7cefb9d5356fcff1d75a5cf1fae1e3c049 /lldb/test/Shell/ScriptInterpreter/Python | |
| parent | b3924cb9ecc95aa428d48e58ef5f2629f5166e02 (diff) | |
| download | llvm-eb96c8c105226956c8ed5ab30699206f53de74f7.zip llvm-eb96c8c105226956c8ed5ab30699206f53de74f7.tar.gz llvm-eb96c8c105226956c8ed5ab30699206f53de74f7.tar.bz2 | |
[lldb] Implement (SB)Function::GetInstructions for discontinuous functions (#122933)
The main change is to permit the disassembler class to process/store
multiple (discontinuous) ranges of addresses. The result is not
ambiguous because each instruction knows its size (in addition to its
address), so we can check for discontinuity by looking at whether the
next instruction begins where the previous ends.
This patch doesn't handle the "disassemble" CLI command, which uses a
more elaborate mechanism for disassembling and printing instructions.
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Python')
| -rw-r--r-- | lldb/test/Shell/ScriptInterpreter/Python/sb_function_ranges.s | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/sb_function_ranges.s b/lldb/test/Shell/ScriptInterpreter/Python/sb_function_ranges.s index a9e4104..2e2bc52 100644 --- a/lldb/test/Shell/ScriptInterpreter/Python/sb_function_ranges.s +++ b/lldb/test/Shell/ScriptInterpreter/Python/sb_function_ranges.s @@ -6,6 +6,16 @@ # CHECK: Found 1 function(s). # CHECK: foo: [input.o[0x0-0xe), input.o[0x14-0x1c)] +# CHECK-NEXT: input.o[0x0]: cmpl $0x0, %edi +# CHECK-NEXT: input.o[0x3]: je 0x14 +# CHECK-NEXT: input.o[0x5]: jmp 0x7 +# CHECK-NEXT: input.o[0x7]: callq 0xe +# CHECK-NEXT: input.o[0xc]: jmp 0x1b +# CHECK-EMPTY: +# CHECK-NEXT: input.o[0x14]: callq 0x19 +# CHECK-NEXT: input.o[0x19]: jmp 0x1b +# CHECK-NEXT: input.o[0x1b]: retq + #--- script.py import lldb @@ -17,6 +27,7 @@ def __lldb_init_module(debugger, internal_dict): for ctx in sym_ctxs: fn = ctx.function print(f"{fn.name}: {fn.GetRanges()}") + print(fn.GetInstructions(target)) #--- input.s # An example of a function which has been split into two parts. Roughly |
