aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-06-11 15:51:38 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2016-06-24 10:34:29 -0700
commit2faa34476d9e6120eaf389b7f91b7227183fa2ce (patch)
treed0bdcf321eebfbd385ee4f89df0785063c6078a6 /gdb/gdbarch.c
parent3350c5f5de3d2e62dd9de2a76cf2d5d8728d2600 (diff)
downloadgdb-2faa34476d9e6120eaf389b7f91b7227183fa2ce.zip
gdb-2faa34476d9e6120eaf389b7f91b7227183fa2ce.tar.gz
gdb-2faa34476d9e6120eaf389b7f91b7227183fa2ce.tar.bz2
Add a new gdbarch method to print a single AUXV entry.
Different platforms have different meanings for auxiliary vector entries. The 'print_auxv_entry' gdbarch method allows an architecture to output a suitable description for platform-specific entries. A fprint_auxv_entry function is split out of fprint_target_auxv. This function outputs the description of a single auxiliary vector entry to the specified file using caller-supplied formatting and strings to describe the vector type. The existing switch on auxiliary vector types is moved out of fprint_target_auxv into a new default_print_auxv_entry function. default_print_auxv_entry chooses an appropriate format and description and calls fprint_single_auxv to describe a single vector entry. This function is used as the default 'print_auxv_entry' gdbarch method. fprint_target_auxv now invokes the gdbarch 'print_auxv_entry' method on each vector entry. gdb/ChangeLog: * auxv.c (fprint_auxv_entry): New function. (default_print_auxv_entry): New function. (fprint_target_auxv): Use gdbarch_print_auxv_entry. * auxv.h (enum auxv_format): New enum. (fprint_auxv_entry): Declare. (default_print_auxv_entry): Declare. * gdbarch.sh (print_auxv_entry): New. * gdbarch.c, gdbarch.h: Re-generated.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 313502b..af7359e 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -47,6 +47,7 @@
#include "observer.h"
#include "regcache.h"
#include "objfiles.h"
+#include "auxv.h"
/* Static function declarations */
@@ -328,6 +329,7 @@ struct gdbarch
gdbarch_insn_is_ret_ftype *insn_is_ret;
gdbarch_insn_is_jump_ftype *insn_is_jump;
gdbarch_auxv_parse_ftype *auxv_parse;
+ gdbarch_print_auxv_entry_ftype *print_auxv_entry;
gdbarch_vsyscall_range_ftype *vsyscall_range;
gdbarch_infcall_mmap_ftype *infcall_mmap;
gdbarch_infcall_munmap_ftype *infcall_munmap;
@@ -432,6 +434,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->insn_is_call = default_insn_is_call;
gdbarch->insn_is_ret = default_insn_is_ret;
gdbarch->insn_is_jump = default_insn_is_jump;
+ gdbarch->print_auxv_entry = default_print_auxv_entry;
gdbarch->vsyscall_range = default_vsyscall_range;
gdbarch->infcall_mmap = default_infcall_mmap;
gdbarch->infcall_munmap = default_infcall_munmap;
@@ -678,6 +681,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* 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. */
+ /* Skip verify of print_auxv_entry, invalid_p == 0 */
/* Skip verify of vsyscall_range, invalid_p == 0 */
/* Skip verify of infcall_mmap, invalid_p == 0 */
/* Skip verify of infcall_munmap, invalid_p == 0 */
@@ -1167,6 +1171,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: pointer_to_address = <%s>\n",
host_address_to_string (gdbarch->pointer_to_address));
fprintf_unfiltered (file,
+ "gdbarch_dump: print_auxv_entry = <%s>\n",
+ host_address_to_string (gdbarch->print_auxv_entry));
+ fprintf_unfiltered (file,
"gdbarch_dump: print_float_info = <%s>\n",
host_address_to_string (gdbarch->print_float_info));
fprintf_unfiltered (file,
@@ -4769,6 +4776,23 @@ set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
gdbarch->auxv_parse = auxv_parse;
}
+void
+gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->print_auxv_entry != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_print_auxv_entry called\n");
+ gdbarch->print_auxv_entry (gdbarch, file, type, val);
+}
+
+void
+set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch,
+ gdbarch_print_auxv_entry_ftype print_auxv_entry)
+{
+ gdbarch->print_auxv_entry = print_auxv_entry;
+}
+
int
gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
{