diff options
author | Daniel Malea <daniel.malea@intel.com> | 2013-08-07 21:54:09 +0000 |
---|---|---|
committer | Daniel Malea <daniel.malea@intel.com> | 2013-08-07 21:54:09 +0000 |
commit | d79ae05080702ae6bbf351efb82163a82ea43af6 (patch) | |
tree | 3c8602e393148659b2068733d066de2d707940dc /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp | |
parent | 16606887c48ca6df3a03417daf77021ec4340ad0 (diff) | |
download | bcm5719-llvm-d79ae05080702ae6bbf351efb82163a82ea43af6.tar.gz bcm5719-llvm-d79ae05080702ae6bbf351efb82163a82ea43af6.zip |
New settings: target.use-hex-immediates and target.hex-immediates-style
- Immediates can be shown as hex (either Intel or MASM style)
- See TestSettings.py for usage examples
- Verified to cause no regressions on Linux x86_64 (Ubuntu 12.10)
Patch by Richard Mitton!
llvm-svn: 187921
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp')
-rw-r--r-- | lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index 233515a23f2..e920d70cd59 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -256,12 +256,18 @@ public: m_using_file_addr = true; const bool data_from_file = GetDisassemblerLLVMC().m_data_from_file; - if (!data_from_file) + bool use_hex_immediates = true; + Disassembler::HexImmediateStyle hex_style = Disassembler::eHexStyleC; + + if (exe_ctx) { - if (exe_ctx) + Target *target = exe_ctx->GetTargetPtr(); + if (target) { - Target *target = exe_ctx->GetTargetPtr(); - if (target) + use_hex_immediates = target->GetUseHexImmediates(); + hex_style = target->GetHexImmediateStyle(); + + if (!data_from_file) { const lldb::addr_t load_addr = m_address.GetLoadAddress(target); if (load_addr != LLDB_INVALID_ADDRESS) @@ -282,10 +288,13 @@ public: opcode_data_len, pc, inst); - + if (inst_size > 0) + { + mc_disasm_ptr->SetStyle(use_hex_immediates, hex_style); mc_disasm_ptr->PrintMCInst(inst, out_string, sizeof(out_string)); - + } + llvm_disasm.Unlock(); if (inst_size == 0) @@ -546,6 +555,17 @@ DisassemblerLLVMC::LLVMCDisassembler::PrintMCInst (llvm::MCInst &mc_inst, return output_size; } +void +DisassemblerLLVMC::LLVMCDisassembler::SetStyle (bool use_hex_immed, HexImmediateStyle hex_style) +{ + m_instr_printer_ap->setPrintImmHex(use_hex_immed); + switch(hex_style) + { + case eHexStyleC: m_instr_printer_ap->setPrintImmHex(llvm::HexStyle::C); break; + case eHexStyleAsm: m_instr_printer_ap->setPrintImmHex(llvm::HexStyle::Asm); break; + } +} + bool DisassemblerLLVMC::LLVMCDisassembler::CanBranch (llvm::MCInst &mc_inst) { |