summaryrefslogtreecommitdiffstats
path: root/debuggerd/utility.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:08:08 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:08:08 -0800
commit35237d135807af84bf9b0e5b8d7f8633e58db6f5 (patch)
treed8bcf3ada2182d248604728285dd80abb466f22a /debuggerd/utility.c
parent4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 (diff)
downloadcore-35237d135807af84bf9b0e5b8d7f8633e58db6f5.tar.gz
core-35237d135807af84bf9b0e5b8d7f8633e58db6f5.tar.bz2
core-35237d135807af84bf9b0e5b8d7f8633e58db6f5.zip
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'debuggerd/utility.c')
-rw-r--r--debuggerd/utility.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/debuggerd/utility.c b/debuggerd/utility.c
index 0cb790fd6..8f3931c1f 100644
--- a/debuggerd/utility.c
+++ b/debuggerd/utility.c
@@ -18,6 +18,7 @@
#include <sys/ptrace.h>
#include <sys/exec_elf.h>
#include <assert.h>
+#include <string.h>
#include <errno.h>
#include "utility.h"
@@ -66,10 +67,14 @@ const char *map_to_name(mapinfo *mi, unsigned pc, const char* def)
}
/* Find the containing map info for the pc */
-const mapinfo *pc_to_mapinfo(mapinfo *mi, unsigned pc)
+const mapinfo *pc_to_mapinfo(mapinfo *mi, unsigned pc, unsigned *rel_pc)
{
while(mi) {
if((pc >= mi->start) && (pc < mi->end)){
+ // Only calculate the relative offset for shared libraries
+ if (strstr(mi->name, ".so")) {
+ *rel_pc = pc - mi->start;
+ }
return mi;
}
mi = mi->next;