================ @@ -0,0 +1,87 @@ +""" +Defines a command, fdis, that does filtered disassembly. The command does the +lldb disassemble command with -b and any other arguments passed in, and +pipes that through a provided filter program. + +The intention is to support disassembly of RISC-V proprietary instructions. +This is handled with llvm-objdump by piping the output of llvm-objdump through +a filter program. This script is intended to mimic that workflow. +""" + +import lldb +import subprocess + +filter_program = "crustfilt" + +def __lldb_init_module(debugger, dict): + debugger.HandleCommand( + 'command script add -f filter_disasm.fdis fdis') + print("Disassembly filter command (fdis) loaded") + print("Filter program set to %s" % filter_program) + + +def fdis(debugger, args, result, dict): ---------------- DavidSpickett wrote:
I presume you already read https://lldb.llvm.org/use/python-reference.html#create-a-new-lldb-command-using-a-python-function or at least some of it (it's a lot). https://github.com/llvm/llvm-project/blob/main/lldb/examples/python/cmdtemplate.py shows the style I was thinking of, which should get you the same help formatting as a built in command. https://github.com/llvm/llvm-project/pull/145793 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits