Code drop from //branches/cupcake/...@124589
diff --git a/debuggerd/utility.c b/debuggerd/utility.c
index 0cb790f..8f3931c 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 @@
}
/* 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;