From 0da0db4da0dbc4ca4b121aafb07192b6efbb9024 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 8 Mar 2014 23:00:51 -0500 Subject: [PATCH] Debugger: Partly rework hrev46696. - Various other places in Debugger expect the highpc attribute to be an address rather than an offset. As such, resolve it to one when setting the attribute in the corresponding DIE so the resolved value is available everywhere. Fixes variable scopes not being computed properly, and consequently the missing variables mentioned in the previous commit. This gets things working properly again under gcc4.8. --- src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp | 4 +--- src/apps/debugger/dwarf/DebugInfoEntries.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index 90c4d01188..8493317b4f 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -351,10 +351,8 @@ DwarfImageDebugInfo::GetFunctions(const BObjectList& symbols, if (rangeList == NULL) { target_addr_t lowPC = subprogramEntry->LowPC(); target_addr_t highPC = subprogramEntry->HighPC(); - if (lowPC == highPC) + if (highPC <= lowPC) continue; - else if (highPC < lowPC) - highPC += lowPC; rangeList = new(std::nothrow) TargetAddressRangeList( TargetAddressRange(lowPC, highPC - lowPC)); diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index 17154bb9b0..34ac9d47cf 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -115,6 +115,9 @@ DIECompileUnitBase::AddAttribute_high_pc(uint16 attributeName, const AttributeValue& value) { fHighPC = value.address; + if (fLowPC != 0 && fHighPC < fLowPC) + fHighPC += fLowPC; + return B_OK; } @@ -999,6 +1002,9 @@ DIELexicalBlock::AddAttribute_high_pc(uint16 attributeName, const AttributeValue& value) { fHighPC = value.address; + if (fLowPC != 0 && fHighPC < fLowPC) + fHighPC += fLowPC; + return B_OK; } @@ -1948,6 +1954,9 @@ DIESubprogram::AddAttribute_high_pc(uint16 attributeName, const AttributeValue& value) { fHighPC = value.address; + if (fLowPC != 0 && fHighPC < fLowPC) + fHighPC += fLowPC; + return B_OK; }