summaryrefslogtreecommitdiffstats
path: root/libs/utils/CallStack.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:35 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:35 -0800
commit9adf84a4b6735354893ff1e57c129f66d97d75ee (patch)
tree6fad0d5c1e6ba13f6ec539e4dec71e2c5f57ed39 /libs/utils/CallStack.cpp
parentedbf3b6af777b721cd2a1ef461947e51e88241e1 (diff)
downloadframeworks_native-9adf84a4b6735354893ff1e57c129f66d97d75ee.zip
frameworks_native-9adf84a4b6735354893ff1e57c129f66d97d75ee.tar.gz
frameworks_native-9adf84a4b6735354893ff1e57c129f66d97d75ee.tar.bz2
auto import from //depot/cupcake/@136594
Diffstat (limited to 'libs/utils/CallStack.cpp')
-rw-r--r--libs/utils/CallStack.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp
index 26fb22a..2fdaa71 100644
--- a/libs/utils/CallStack.cpp
+++ b/libs/utils/CallStack.cpp
@@ -120,13 +120,18 @@ class MapInfo {
char name[];
};
- const char *map_to_name(uint64_t pc, const char* def) {
+ const char *map_to_name(uint64_t pc, const char* def, uint64_t* start) {
mapinfo* mi = getMapInfoList();
while(mi) {
- if ((pc >= mi->start) && (pc < mi->end))
+ if ((pc >= mi->start) && (pc < mi->end)) {
+ if (start)
+ *start = mi->start;
return mi->name;
+ }
mi = mi->next;
}
+ if (start)
+ *start = 0;
return def;
}
@@ -183,8 +188,15 @@ public:
}
}
- static const char *mapAddressToName(const void* pc, const char* def) {
- return sMapInfo.map_to_name((uint64_t)pc, def);
+ static const char *mapAddressToName(const void* pc, const char* def,
+ void const** start)
+ {
+ uint64_t s;
+ char const* name = sMapInfo.map_to_name(uint64_t(uintptr_t(pc)), def, &s);
+ if (start) {
+ *start = (void*)s;
+ }
+ return name;
}
};
@@ -297,8 +309,9 @@ String8 CallStack::toStringSingleLevel(const char* prefix, int32_t level) const
res.append(name);
res.append(tmp2);
} else {
- name = MapInfo::mapAddressToName(ip, "<unknown>");
- snprintf(tmp, 256, "pc %p %s", ip, name);
+ void const* start = 0;
+ name = MapInfo::mapAddressToName(ip, "<unknown>", &start);
+ snprintf(tmp, 256, "pc %08lx %s", uintptr_t(ip)-uintptr_t(start), name);
res.append(tmp);
}
res.append("\n");