aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-06-05 13:50:50 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-06-05 13:50:50 +0000
commit19630284f570790ebf6d50bfb43caa1f125ee88a (patch)
tree1ae3d6f4c3a0fb1e045313bcead7b3f6c562a3fb /gdb/gdbarch.c
parent67ff19f7de8c61147c5401c7f56ad30fda0f5491 (diff)
downloadgdb-19630284f570790ebf6d50bfb43caa1f125ee88a.zip
gdb-19630284f570790ebf6d50bfb43caa1f125ee88a.tar.gz
gdb-19630284f570790ebf6d50bfb43caa1f125ee88a.tar.bz2
New "iterate_over_objfiles_in_search_order" gdbarch method.
This patch introduces the "iterate_over_objfiles_in_search_order" gdbarch method, as well as its default implementation, and converts the areas where it will matter to using this gdbarch method. The default method implementation is the only one installed, and the changes should have no functional impact in terms of behavior. This only paves the way for the architectures that will need their own version. gdb/ChangeLog: * gdbarch.sh: Add generation of "iterate_over_objfiles_in_search_order_cb_ftype" typedef in gdbarch.h. Add include of "objfiles.h" in gdbarch.c. (iterate_over_objfiles_in_search_order): New gdbarch method. * gdbarch.h, gdbarch.c: Regenerate. * objfiles.h (default_iterate_over_objfiles_in_search_order): Add declaration. * objfiles.c (default_iterate_over_objfiles_in_search_order): New function. * symtab.c (lookup_symbol_aux_objfile): New function, extracted out of lookup_symbol_aux_symtabs. (lookup_symbol_aux_symtabs): Replace extracted-out code by call to lookup_symbol_aux_objfile. (struct global_sym_lookup_data): New type. (lookup_symbol_global_iterator_cb): New function. (lookup_symbol_global): Search for symbol using gdbarch_iterate_over_objfiles_in_search_order and lookup_symbol_global_iterator_cb. * findvar.c (struct minsym_lookup_data): New type. (minsym_lookup_iterator_cb): New function. (default_read_var_value) [case LOC_UNRESOLVED]: Resolve the symbol's address via gdbarch_iterate_over_objfiles_in_search_order and minsym_lookup_iterator_cb.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 9d7b67a..4d46a5d 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -49,6 +49,7 @@
#include "gdb_obstack.h"
#include "observer.h"
#include "regcache.h"
+#include "objfiles.h"
/* Static function declarations */
@@ -284,6 +285,7 @@ struct gdbarch
int has_dos_based_file_system;
gdbarch_gen_return_address_ftype *gen_return_address;
gdbarch_info_proc_ftype *info_proc;
+ gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order;
};
@@ -451,6 +453,7 @@ struct gdbarch startup_gdbarch =
0, /* has_dos_based_file_system */
default_gen_return_address, /* gen_return_address */
0, /* info_proc */
+ default_iterate_over_objfiles_in_search_order, /* iterate_over_objfiles_in_search_order */
/* startup_gdbarch() */
};
@@ -541,6 +544,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->auto_charset = default_auto_charset;
gdbarch->auto_wide_charset = default_auto_wide_charset;
gdbarch->gen_return_address = default_gen_return_address;
+ gdbarch->iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order;
/* gdbarch_alloc() */
return gdbarch;
@@ -749,6 +753,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of has_dos_based_file_system, invalid_p == 0 */
/* Skip verify of gen_return_address, invalid_p == 0 */
/* Skip verify of info_proc, has predicate. */
+ /* Skip verify of iterate_over_objfiles_in_search_order, invalid_p == 0 */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -1067,6 +1072,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: integer_to_address = <%s>\n",
host_address_to_string (gdbarch->integer_to_address));
fprintf_unfiltered (file,
+ "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
+ host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
+ fprintf_unfiltered (file,
"gdbarch_dump: long_bit = %s\n",
plongest (gdbarch->long_bit));
fprintf_unfiltered (file,
@@ -4245,6 +4253,23 @@ set_gdbarch_info_proc (struct gdbarch *gdbarch,
gdbarch->info_proc = info_proc;
}
+void
+gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_iterate_over_objfiles_in_search_order called\n");
+ gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb, cb_data, current_objfile);
+}
+
+void
+set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch,
+ gdbarch_iterate_over_objfiles_in_search_order_ftype iterate_over_objfiles_in_search_order)
+{
+ gdbarch->iterate_over_objfiles_in_search_order = iterate_over_objfiles_in_search_order;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */