diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2024-11-11 16:27:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-11 16:27:15 -0800 |
| commit | f109517d153609d4a8a3a3d3d3cc06da1b629364 (patch) | |
| tree | ad5ec7493427749fcbd5dc3a3f79da6941db6e5e /lldb/source/Target/Target.cpp | |
| parent | c280522f7e359117adde10de4158f9f6fec20a7b (diff) | |
[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.
Diffstat (limited to 'lldb/source/Target/Target.cpp')
| -rw-r--r-- | lldb/source/Target/Target.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<llvm::StringRef>( + 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<llvm::StringRef>( + 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<InlineStrategy>( |
