From f109517d153609d4a8a3a3d3d3cc06da1b629364 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 11 Nov 2024 16:27:15 -0800 Subject: [lldb] Support overriding the disassembly CPU & features (#115382) Add the ability to override the disassembly CPU and CPU features through a target setting (`target.disassembly-cpu` and `target.disassembly-features`) and a `disassemble` command option (`--cpu` and `--features`). This is especially relevant for architectures like RISC-V which relies heavily on CPU extensions. The majority of this patch is plumbing the options through. I recommend looking at DisassemblerLLVMC and the test for the observable change in behavior. --- lldb/source/Target/Target.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lldb/source/Target/Target.cpp') diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 242d2eaec2a1..a788bad88b29 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4490,6 +4490,20 @@ const char *TargetProperties::GetDisassemblyFlavor() const { return return_value; } +const char *TargetProperties::GetDisassemblyCPU() const { + const uint32_t idx = ePropertyDisassemblyCPU; + llvm::StringRef str = GetPropertyAtIndexAs( + idx, g_target_properties[idx].default_cstr_value); + return str.empty() ? nullptr : str.data(); +} + +const char *TargetProperties::GetDisassemblyFeatures() const { + const uint32_t idx = ePropertyDisassemblyFeatures; + llvm::StringRef str = GetPropertyAtIndexAs( + idx, g_target_properties[idx].default_cstr_value); + return str.empty() ? nullptr : str.data(); +} + InlineStrategy TargetProperties::GetInlineStrategy() const { const uint32_t idx = ePropertyInlineStrategy; return GetPropertyAtIndexAs( -- cgit v1.2.3