diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-06-05 13:50:49 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-06-05 13:50:49 +0000 |
commit | c8c5621e862a8a7bdc312066bdc71fd67e91a9e2 (patch) | |
tree | f467dd87e66e6cda7c274dfec8e162f875482160 /gdb/gdbarch.sh | |
parent | 6624a4698fbcd343e56a6505c1e384d8a3f6a39c (diff) | |
download | gdb-c8c5621e862a8a7bdc312066bdc71fd67e91a9e2.tar.gz |
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.sh')
-rwxr-xr-x | gdb/gdbarch.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0f58defb383..23241384860 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -936,6 +936,21 @@ m:void:gen_return_address:struct agent_expr *ax, struct axs_value *value, CORE_A # Implement the "info proc" command. M:void:info_proc:char *args, enum info_proc_what what:args, what +# Iterate over all objfiles in the order that makes the most sense +# for the architecture to make global symbol searches. +# +# CB is a callback function where OBJFILE is the objfile to be searched, +# and CB_DATA a pointer to user-defined data (the same data that is passed +# when calling this gdbarch method). The iteration stops if this function +# returns nonzero. +# +# CB_DATA is a pointer to some user-defined data to be passed to +# the callback. +# +# If not NULL, CURRENT_OBJFILE corresponds to the objfile being +# inspected when the symbol search was requested. +m:void:iterate_over_objfiles_in_search_order:iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0 + EOF } @@ -1064,6 +1079,12 @@ struct stap_parse_info; Eventually, when support for multiple targets is implemented in GDB, this global should be made target-specific. */ extern struct gdbarch *target_gdbarch; + +/* Callback type for the 'iterate_over_objfiles_in_search_order' + gdbarch method. */ + +typedef int (iterate_over_objfiles_in_search_order_cb_ftype) + (struct objfile *objfile, void *cb_data); EOF # function typedef's @@ -1382,6 +1403,7 @@ cat <<EOF #include "gdb_obstack.h" #include "observer.h" #include "regcache.h" +#include "objfiles.h" /* Static function declarations */ |