From 3414d0b64d6a36ba8bcb014aed12d391085ef016 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 8 Mar 2014 22:36:22 -0500 Subject: [PATCH] Debugger: Fix program counter handling issue. - For DWARF4, lowpc/highpc can be specified as constants in addition to addresses. Furthermore, they can also be specified such that highpc is a relative offset from lowpc rather than an absolute address. We weren't handling this case, which gcc4.8 is now using when emitting version 4 debug information. Fixes another part of #10659. There still remains a problem with regards to class/structure variables not showing up in the local variables view. --- src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp | 6 ++++-- src/apps/debugger/dwarf/AttributeClasses.cpp | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index ba463b4824..90c4d01188 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012-2013, Rene Gollent, rene@gollent.com. + * Copyright 2012-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -351,8 +351,10 @@ DwarfImageDebugInfo::GetFunctions(const BObjectList& symbols, if (rangeList == NULL) { target_addr_t lowPC = subprogramEntry->LowPC(); target_addr_t highPC = subprogramEntry->HighPC(); - if (lowPC >= highPC) + if (lowPC == highPC) continue; + else if (highPC < lowPC) + highPC += lowPC; rangeList = new(std::nothrow) TargetAddressRangeList( TargetAddressRange(lowPC, highPC - lowPC)); diff --git a/src/apps/debugger/dwarf/AttributeClasses.cpp b/src/apps/debugger/dwarf/AttributeClasses.cpp index 801e7836f4..e326ed1425 100644 --- a/src/apps/debugger/dwarf/AttributeClasses.cpp +++ b/src/apps/debugger/dwarf/AttributeClasses.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2013, Rene Gollent, rene@gollent.com. + * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -49,8 +49,8 @@ static const attribute_name_info_entry kAttributeNameInfos[] = { { ENTRY(bit_offset), AC_BLOCK | AC_CONSTANT | AC_REFERENCE }, { ENTRY(bit_size), AC_BLOCK | AC_CONSTANT | AC_REFERENCE }, { ENTRY(stmt_list), AC_LINEPTR }, - { ENTRY(low_pc), AC_ADDRESS }, - { ENTRY(high_pc), AC_ADDRESS }, + { ENTRY(low_pc), AC_ADDRESS | AC_CONSTANT | AC_REFERENCE }, + { ENTRY(high_pc), AC_ADDRESS | AC_CONSTANT | AC_REFERENCE }, { ENTRY(language), AC_CONSTANT }, { ENTRY(discr), AC_REFERENCE }, { ENTRY(discr_value), AC_CONSTANT },