aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2014-02-27 13:40:15 +0100
committerMark Kettenis <kettenis@gnu.org>2014-02-27 13:40:15 +0100
commit27a48a9223d0c7558f0bfde2d704d4a660f5d4ea (patch)
tree8fbaa11502a79bb31e17ddd0aab09e980863397d /gdb/gdbarch.c
parent2e877f5ecb5916d147f91dfad461a8fa5017d8b0 (diff)
downloadgdb-27a48a9223d0c7558f0bfde2d704d4a660f5d4ea.zip
gdb-27a48a9223d0c7558f0bfde2d704d4a660f5d4ea.tar.gz
gdb-27a48a9223d0c7558f0bfde2d704d4a660f5d4ea.tar.bz2
Add auxv parsing to the architecture vector.
Necessary to fix parsing auxv entries from core files on systems that use the layout specified by ELF instead of the incompatible variant used by Linux. gdb/Changelog: * gdbarch.sh (auxv_parse): New. * gdbarch.h: Regenerated. * gdbarch.c: Regenerated. * auxv.c (target_auxv_parse): Call gdbarch_parse_auxv if provided.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index ef67680..9ec5865 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -318,6 +318,7 @@ struct gdbarch
gdbarch_insn_is_call_ftype *insn_is_call;
gdbarch_insn_is_ret_ftype *insn_is_ret;
gdbarch_insn_is_jump_ftype *insn_is_jump;
+ gdbarch_auxv_parse_ftype *auxv_parse;
};
/* Create a new ``struct gdbarch'' based on information provided by
@@ -628,6 +629,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of insn_is_call, invalid_p == 0 */
/* Skip verify of insn_is_ret, invalid_p == 0 */
/* Skip verify of insn_is_jump, invalid_p == 0 */
+ /* Skip verify of auxv_parse, has predicate. */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -691,6 +693,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: auto_wide_charset = <%s>\n",
host_address_to_string (gdbarch->auto_wide_charset));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_auxv_parse_p() = %d\n",
+ gdbarch_auxv_parse_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: auxv_parse = <%s>\n",
+ host_address_to_string (gdbarch->auxv_parse));
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
gdbarch_ax_pseudo_register_collect_p (gdbarch));
fprintf_unfiltered (file,
@@ -4374,6 +4382,30 @@ set_gdbarch_insn_is_jump (struct gdbarch *gdbarch,
gdbarch->insn_is_jump = insn_is_jump;
}
+int
+gdbarch_auxv_parse_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->auxv_parse != NULL;
+}
+
+int
+gdbarch_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->auxv_parse != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_auxv_parse called\n");
+ return gdbarch->auxv_parse (gdbarch, readptr, endptr, typep, valp);
+}
+
+void
+set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
+ gdbarch_auxv_parse_ftype auxv_parse)
+{
+ gdbarch->auxv_parse = auxv_parse;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */