Index: gdb/solib-svr4.c |
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c |
index 69d3cb518e14eee51fad17885292f81a1ef5e692..93201197d232ce601843809c4bc46cc4d2db79b5 100644 |
--- a/gdb/solib-svr4.c |
+++ b/gdb/solib-svr4.c |
@@ -50,6 +50,8 @@ |
static struct link_map_offsets *svr4_fetch_link_map_offsets (void); |
static int svr4_have_link_map_offsets (void); |
static void svr4_relocate_main_executable (void); |
+static const char *svr4_map_so_name(char *name); |
+static int svr4_have_map_so_name (void); |
/* Link map info to include in an allocated so_list entry. */ |
@@ -1227,7 +1229,15 @@ svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr, |
continue; |
} |
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); |
+ if (svr4_have_map_so_name ()) |
+ { |
+ strncpy (new->so_name, svr4_map_so_name (buffer), |
+ SO_NAME_MAX_PATH_SIZE - 1); |
+ } |
+ else |
+ { |
+ strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); |
+ } |
new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; |
strcpy (new->so_original_name, new->so_name); |
xfree (buffer); |
@@ -2318,6 +2328,8 @@ struct solib_svr4_ops |
{ |
/* Return a description of the layout of `struct link_map'. */ |
struct link_map_offsets *(*fetch_link_map_offsets)(void); |
+ /* Return real path for the solib name given by ld.so. */ |
+ const char *(*map_so_name)(char*); |
}; |
/* Return a default for the architecture-specific operations. */ |
@@ -2329,6 +2341,7 @@ solib_svr4_init (struct obstack *obstack) |
ops = OBSTACK_ZALLOC (obstack, struct solib_svr4_ops); |
ops->fetch_link_map_offsets = NULL; |
+ ops->map_so_name = NULL; |
return ops; |
} |
@@ -2346,6 +2359,17 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch, |
set_solib_ops (gdbarch, &svr4_so_ops); |
} |
+/* Set function to map ld.so solib names to real paths. */ |
+ |
+void |
+set_solib_svr4_map_so_name(struct gdbarch *gdbarch, |
+ const char* (*map_so_name) (char*)) |
+{ |
+ struct solib_svr4_ops *ops = gdbarch_data (gdbarch, solib_svr4_data); |
+ |
+ ops->map_so_name = map_so_name; |
+} |
+ |
/* Fetch a link_map_offsets structure using the architecture-specific |
`struct link_map_offsets' fetcher. */ |
@@ -2367,6 +2391,25 @@ svr4_have_link_map_offsets (void) |
return (ops->fetch_link_map_offsets != NULL); |
} |
+ |
+/* Return real path for the solib name given by ld.so. */ |
+ |
+static const char * |
+svr4_map_so_name(char *name) |
+{ |
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data); |
+ gdb_assert (ops->map_so_name); |
+ return ops->map_so_name (name); |
+} |
+ |
+/* Return 1 if a solib name map function has been defined, 0 otherwise. */ |
+ |
+static int |
+svr4_have_map_so_name(void) |
+{ |
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data); |
+ return (ops->map_so_name != NULL); |
+} |
/* Most OS'es that have SVR4-style ELF dynamic libraries define a |