summaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-05-15 12:26:13 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-05-15 12:26:13 +0000
commitb74c156c02cac7fb90ea19bc7a5de78457987a85 (patch)
tree6f15e14ae0fc2dc4342c5ce16079cb84478c5eaa /gdb/gdbarch.c
parent78762a4af473e619e3d2b4c545f544ab887d5b6b (diff)
downloadgdb-b74c156c02cac7fb90ea19bc7a5de78457987a85.tar.gz
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging core files via the rs6000_xfer_partial method of the rs6000-nat target_ops vector. However, this target_ops vector does not get pushed on the target stack at all when debugging core files, thus bypassing completely that part of the code. This patch fixes the problem by extending corelow's core_xfer_partial into handling the TARGET_OBJECT_LIBRARIES_AIX object. gdb/ChangeLog: * gdbarch.sh (core_xfer_shared_libraries_aix): New method. * gdbarch.h, gdbarch.c: Regenerate. * corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX handling. * rs6000-aix-tdep.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h. * rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and "xml-utils.h". (struct field_info, struct ld_info_desc): New types. (ld_info32_desc, ld_info64_desc): New static constants. (struct ld_info): New type. (rs6000_aix_extract_ld_info): New function. (rs6000_aix_shared_library_to_xml): Likewise. (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. (rs6000_aix_init_osabi): Add call to set_gdbarch_core_xfer_shared_libraries_aix. * rs6000-nat.c: Add "rs6000-aix-tdep.h" include. Remove "xml-utils.h" include. (LdInfo): Delete typedef. (ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME): Delete macros. (rs6000_ptrace_ldinfo): Change return type to gdb_byte *. Adjust code accordingly. (rs6000_core_ldinfo): Delete, folded into rs6000_aix_core_xfer_shared_libraries_aix. (rs6000_xfer_shared_library): Delete. (rs6000_xfer_shared_libraries): Reimplement.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 129268fe588..db35b40fae8 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -241,6 +241,7 @@ struct gdbarch
gdbarch_elfcore_write_linux_prpsinfo_ftype *elfcore_write_linux_prpsinfo;
gdbarch_find_memory_regions_ftype *find_memory_regions;
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
+ gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix;
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
const char * gcore_bfd_target;
int vtable_function_descriptors;
@@ -412,6 +413,7 @@ struct gdbarch startup_gdbarch =
0, /* elfcore_write_linux_prpsinfo */
0, /* find_memory_regions */
0, /* core_xfer_shared_libraries */
+ 0, /* core_xfer_shared_libraries_aix */
0, /* core_pid_to_str */
0, /* gcore_bfd_target */
0, /* vtable_function_descriptors */
@@ -714,6 +716,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of elfcore_write_linux_prpsinfo, has predicate. */
/* Skip verify of find_memory_regions, has predicate. */
/* Skip verify of core_xfer_shared_libraries, has predicate. */
+ /* Skip verify of core_xfer_shared_libraries_aix, has predicate. */
/* Skip verify of core_pid_to_str, has predicate. */
/* Skip verify of gcore_bfd_target, has predicate. */
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
@@ -904,6 +907,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
host_address_to_string (gdbarch->core_xfer_shared_libraries));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_core_xfer_shared_libraries_aix_p() = %d\n",
+ gdbarch_core_xfer_shared_libraries_aix_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n",
+ host_address_to_string (gdbarch->core_xfer_shared_libraries_aix));
+ fprintf_unfiltered (file,
"gdbarch_dump: decr_pc_after_break = %s\n",
core_addr_to_string_nz (gdbarch->decr_pc_after_break));
fprintf_unfiltered (file,
@@ -3449,6 +3458,30 @@ set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
}
int
+gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->core_xfer_shared_libraries_aix != NULL;
+}
+
+LONGEST
+gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->core_xfer_shared_libraries_aix != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_shared_libraries_aix called\n");
+ return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset, len);
+}
+
+void
+set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
+ gdbarch_core_xfer_shared_libraries_aix_ftype core_xfer_shared_libraries_aix)
+{
+ gdbarch->core_xfer_shared_libraries_aix = core_xfer_shared_libraries_aix;
+}
+
+int
gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);