From 44d07fcc7c610730950e7e914e9e3bfb6736e65e Mon Sep 17 00:00:00 2001 From: Jaydeep Patil Date: Tue, 22 Sep 2015 06:36:56 +0000 Subject: [LLDB][MIPS] microMIPS breakpoints, disassembly and compressed addresses SUMMARY: This patch detects microMIPS symbols, sets breakpoints using un-compressed address and display disassembly in mixed mode for microMIPS applications (running on bare-iron targets). Reviewers: clayborg Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits Differential Revision: http://reviews.llvm.org/D12079 llvm-svn: 248248 --- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp') diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index cdb1798f4e2..43c3d7676ec 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1110,6 +1110,7 @@ struct ParseDWARFLineTableCallbackInfo { LineTable* line_table; std::unique_ptr sequence_ap; + lldb::addr_t addr_mask; }; //---------------------------------------------------------------------- @@ -1139,7 +1140,7 @@ ParseDWARFLineTableCallback(dw_offset_t offset, const DWARFDebugLine::State& sta assert(info->sequence_ap.get()); } line_table->AppendLineEntryToSequence (info->sequence_ap.get(), - state.address, + state.address & info->addr_mask, state.line, state.column, state.file, @@ -1179,6 +1180,28 @@ SymbolFileDWARF::ParseCompileUnitLineTable (const SymbolContext &sc) { ParseDWARFLineTableCallbackInfo info; info.line_table = line_table_ap.get(); + + /* + * MIPS: + * The SymbolContext may not have a valid target, thus we may not be able + * to call Address::GetOpcodeLoadAddress() which would clear the bit #0 + * for MIPS. Use ArchSpec to clear the bit #0. + */ + ArchSpec arch; + GetObjectFile()->GetArchitecture(arch); + switch (arch.GetMachine()) + { + case llvm::Triple::mips: + case llvm::Triple::mipsel: + case llvm::Triple::mips64: + case llvm::Triple::mips64el: + info.addr_mask = ~((lldb::addr_t)1); + break; + default: + info.addr_mask = ~((lldb::addr_t)0); + break; + } + lldb::offset_t offset = cu_line_offset; DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset, ParseDWARFLineTableCallback, &info); if (m_debug_map_symfile) -- cgit v1.2.3