summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-03 13:14:04 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-03 16:42:41 +0000
commitc0f5f8567501da621b34142655775c336298f3f2 (patch)
treeff81c65f95b59cc8b6a8c1a5bb6bce73472bf7fe
parenta26faffa841d87c204b6b058af9dbece3148ddb6 (diff)
Report symbol addresses as absolute values
Previously symbols were relative to the ELF file, which may be loaded in different locations. Change-Id: If44982c6934fddc19721bf5eac6246f2d1bee86f Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--app/perfunwind.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp
index 2a2076c..d8a6f10 100644
--- a/app/perfunwind.cpp
+++ b/app/perfunwind.cpp
@@ -310,9 +310,9 @@ static PerfUnwind::Frame lookupSymbol(PerfUnwind::UnwindInfo *ui, Dwfl *dwfl, Dw
elfFile = elfInfo->file.fileName().toLocal8Bit();
}
- bool do_adjust = (ui->unwind->architecture() == PerfRegisterInfo::ARCH_ARM);
+ Dwarf_Addr adjusted = (ui->unwind->architecture() != PerfRegisterInfo::ARCH_ARM || (ip & 1)) ?
+ ip : ip + 1;
if (mod) {
- Dwarf_Addr adjusted = (!do_adjust || (ip & 1)) ? ip : ip + 1;
// For addrinfo we need the raw pointer into symtab, so we need to adjust ourselves.
symname = dwfl_module_addrinfo(mod, adjusted, &off, &sym, 0,
0, 0);
@@ -334,10 +334,8 @@ static PerfUnwind::Frame lookupSymbol(PerfUnwind::UnwindInfo *ui, Dwfl *dwfl, Dw
ui->isInterworking = true;
// Adjust it back. The symtab entries are 1 off for all practical purposes.
- PerfUnwind::Frame frame((do_adjust && (sym.st_value & 1)) ? sym.st_value - 1 :
- sym.st_value,
- isKernel, status == 0 ? demangled : symname, elfFile, srcFile,
- line, column);
+ PerfUnwind::Frame frame(adjusted - off, isKernel, status == 0 ? demangled : symname,
+ elfFile, srcFile, line, column);
free(demangled);
return frame;
} else {