[AArch64] Fix SDNode type mismatches between *.td files and ISel (#116523)
[llvm-project.git] / lldb / examples / python / gdb_disassemble.py
blob8f4b2cafac73be9afd3f356f26f036988c7f3b94
1 import lldb
4 def disassemble(debugger, command, result, dict):
5 if lldb.frame.function:
6 instructions = lldb.frame.function.instructions
7 start_addr = lldb.frame.function.addr.load_addr
8 name = lldb.frame.function.name
9 elif lldb.frame.symbol:
10 instructions = lldb.frame.symbol.instructions
11 start_addr = lldb.frame.symbol.addr.load_addr
12 name = lldb.frame.symbol.name
14 for inst in instructions:
15 inst_addr = inst.addr.load_addr
16 inst_offset = inst_addr - start_addr
17 comment = inst.comment
18 if comment:
19 print(
20 "<%s + %-4u> 0x%x %8s %s ; %s"
21 % (name, inst_offset, inst_addr, inst.mnemonic, inst.operands, comment)
23 else:
24 print(
25 "<%s + %-4u> 0x%x %8s %s"
26 % (name, inst_offset, inst_addr, inst.mnemonic, inst.operands)
30 # Install the command when the module gets imported
31 def __lldb_init_module(debugger, internal_dict):
32 debugger.HandleCommand(
33 "command script add -o -f gdb_disassemble.disassemble gdb-disassemble"
35 print('Installed "gdb-disassemble" command for disassembly')