diff options
Diffstat (limited to 'source/Expression/DWARFExpression.cpp')
-rw-r--r-- | source/Expression/DWARFExpression.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp index 55eb65f32b5a..a6249b3a2864 100644 --- a/source/Expression/DWARFExpression.cpp +++ b/source/Expression/DWARFExpression.cpp @@ -9,19 +9,17 @@ #include "lldb/Expression/DWARFExpression.h" -// C Includes #include <inttypes.h> -// C++ Includes #include <vector> #include "lldb/Core/Module.h" -#include "lldb/Core/RegisterValue.h" -#include "lldb/Core/Scalar.h" #include "lldb/Core/Value.h" #include "lldb/Core/dwarf.h" #include "lldb/Utility/DataEncoder.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/RegisterValue.h" +#include "lldb/Utility/Scalar.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/VMRange.h" @@ -1841,7 +1839,7 @@ bool DWARFExpression::Evaluate( error_ptr->SetErrorString( "Expression stack needs at least 1 item for DW_OP_abs."); return false; - } else if (stack.back().ResolveValue(exe_ctx).AbsoluteValue() == false) { + } else if (!stack.back().ResolveValue(exe_ctx).AbsoluteValue()) { if (error_ptr) error_ptr->SetErrorString( "Failed to take the absolute value of the first stack item."); @@ -1974,7 +1972,7 @@ bool DWARFExpression::Evaluate( "Expression stack needs at least 1 item for DW_OP_neg."); return false; } else { - if (stack.back().ResolveValue(exe_ctx).UnaryNegate() == false) { + if (!stack.back().ResolveValue(exe_ctx).UnaryNegate()) { if (error_ptr) error_ptr->SetErrorString("Unary negate failed."); return false; @@ -1995,7 +1993,7 @@ bool DWARFExpression::Evaluate( "Expression stack needs at least 1 item for DW_OP_not."); return false; } else { - if (stack.back().ResolveValue(exe_ctx).OnesComplement() == false) { + if (!stack.back().ResolveValue(exe_ctx).OnesComplement()) { if (error_ptr) error_ptr->SetErrorString("Logical NOT failed."); return false; @@ -2102,8 +2100,8 @@ bool DWARFExpression::Evaluate( } else { tmp = stack.back(); stack.pop_back(); - if (stack.back().ResolveValue(exe_ctx).ShiftRightLogical( - tmp.ResolveValue(exe_ctx)) == false) { + if (!stack.back().ResolveValue(exe_ctx).ShiftRightLogical( + tmp.ResolveValue(exe_ctx))) { if (error_ptr) error_ptr->SetErrorString("DW_OP_shr failed."); return false; @@ -2382,7 +2380,7 @@ bool DWARFExpression::Evaluate( case DW_OP_lit29: case DW_OP_lit30: case DW_OP_lit31: - stack.push_back(Scalar(op - DW_OP_lit0)); + stack.push_back(Scalar((uint64_t)(op - DW_OP_lit0))); break; //---------------------------------------------------------------------- @@ -3029,7 +3027,9 @@ bool DWARFExpression::AddressRangeForLocationListEntry( if (!debug_loc_data.ValidOffset(*offset_ptr)) return false; - switch (dwarf_cu->GetSymbolFileDWARF()->GetLocationListFormat()) { + DWARFExpression::LocationListFormat format = + dwarf_cu->GetSymbolFileDWARF()->GetLocationListFormat(); + switch (format) { case NonLocationList: return false; case RegularLocationList: @@ -3037,6 +3037,7 @@ bool DWARFExpression::AddressRangeForLocationListEntry( high_pc = debug_loc_data.GetAddress(offset_ptr); return true; case SplitDwarfLocationList: + case LocLists: switch (debug_loc_data.GetU8(offset_ptr)) { case DW_LLE_end_of_list: return false; @@ -3050,12 +3051,25 @@ bool DWARFExpression::AddressRangeForLocationListEntry( case DW_LLE_startx_length: { uint64_t index = debug_loc_data.GetULEB128(offset_ptr); low_pc = ReadAddressFromDebugAddrSection(dwarf_cu, index); - uint32_t length = debug_loc_data.GetU32(offset_ptr); + uint64_t length = (format == LocLists) + ? debug_loc_data.GetULEB128(offset_ptr) + : debug_loc_data.GetU32(offset_ptr); high_pc = low_pc + length; return true; } + case DW_LLE_start_length: { + low_pc = debug_loc_data.GetAddress(offset_ptr); + high_pc = low_pc + debug_loc_data.GetULEB128(offset_ptr); + return true; + } + case DW_LLE_start_end: { + low_pc = debug_loc_data.GetAddress(offset_ptr); + high_pc = debug_loc_data.GetAddress(offset_ptr); + return true; + } default: // Not supported entry type + lldbassert(false && "Not supported location list type"); return false; } } |