diff options
author | Pedro Alves <palves@redhat.com> | 2012-11-09 01:47:13 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-11-09 01:47:13 +0000 |
commit | 094722a6bfbe1170cf846446dcd4d628b068acf5 (patch) | |
tree | 85d7578b3f2271cb36d6b6ed42cf5109f697e03c /gdb/gdbarch.sh | |
parent | 80ad27952a54cffe851e6b44255ebfa0eeea734c (diff) | |
download | gdb-094722a6bfbe1170cf846446dcd4d628b068acf5.tar.gz |
gdb/
2012-11-09 Pedro Alves <palves@redhat.com>
* gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro.
(get_target_gdbarch) <gdbarch.h>: New function.
(startup_gdbarch) <gdbarch.h>: Declare.
<gdbarch.c> (target_gdbarch): Delete.
<gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the
current inferior's gdbarch.
<gdbarch.c> (get_target_gdbarch): New function.
* inferior.c: Include target-descriptions.h.
(free_inferior): Free target description info.
(add_inferior_with_spaces): Set the inferior's initial
architecture.
(clone_inferior_command): Copy the original inferior's target
description if it was user specified.
(initialize_inferiors): Add comment.
* inferior.h (struct target_desc_info): Forward declare.
(struct inferior) <gdbarch>: New field.
* linux-nat.c: Include target-descriptions.h.
(linux_child_follow_fork): Copy the parent's architecture and
target description to the child.
* target-descriptions.c: Include inferior.h.
(struct target_desc_info): New structure, holding the equivalents
of ...
(target_desc_fetched, current_target_desc)
(target_description_filename): ... these removed globals.
(get_tdesc_info, target_desc_info_from_user_p)
(copy_inferior_target_desc_info, target_desc_info_free): New.
(target_desc_fetched, current_target_desc)
(target_description_filename): Reimplemented as convenience
macros.
(tdesc_filename_cmd_string): New global.
(set_tdesc_filename_cmd): Copy the string manipulated by the "set
tdescs filename ..." commands to the per-inferior equivalent.
(show_tdesc_filename_cmd): Get the value to show from the
per-inferior description filename.
(_initilize_target_descriptions): Change the "set/show tdesc
filename" commands' variable.
* target-descriptions.h (struct target_desc, struct target_desc_info)
(struct inferior): Forward declare.
(target_find_description, target_clear_description)
(target_current_description): Adjust comments.
(copy_inferior_target_desc_info, target_desc_info_free)
(target_desc_info_from_user_p). Declare.
gdb/testsuite/
2012-11-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-arch.exp: New.
Diffstat (limited to 'gdb/gdbarch.sh')
-rwxr-xr-x | gdb/gdbarch.sh | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index e3e6329151c..13d5cc6539c 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1076,17 +1076,26 @@ struct agent_expr; struct axs_value; struct stap_parse_info; -/* The architecture associated with the connection to the target. - - The architecture vector provides some information that is really - a property of the target: The layout of certain packets, for instance; - or the solib_ops vector. Etc. To differentiate architecture accesses - to per-target properties from per-thread/per-frame/per-objfile properties, - accesses to per-target properties should be made through target_gdbarch. - - Eventually, when support for multiple targets is implemented in - GDB, this global should be made target-specific. */ -extern struct gdbarch *target_gdbarch; +/* The architecture associated with the inferior through the + connection to the target. + + The architecture vector provides some information that is really a + property of the inferior, accessed through a particular target: + ptrace operations; the layout of certain RSP packets; the solib_ops + vector; etc. To differentiate architecture accesses to + per-inferior/target properties from + per-thread/per-frame/per-objfile properties, accesses to + per-inferior/target properties should be made through this + gdbarch. */ + +/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */ +#define target_gdbarch get_target_gdbarch () +extern struct gdbarch *get_target_gdbarch (void); + +/* The initial, default architecture. It uses host values (for want of a better + choice). */ +extern struct gdbarch startup_gdbarch; + /* Callback type for the 'iterate_over_objfiles_in_search_order' gdbarch method. */ @@ -1559,7 +1568,6 @@ cat <<EOF /* startup_gdbarch() */ }; -struct gdbarch *target_gdbarch = &startup_gdbarch; EOF # Create a new gdbarch struct @@ -2278,11 +2286,19 @@ deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch) { gdb_assert (new_gdbarch != NULL); gdb_assert (new_gdbarch->initialized_p); - target_gdbarch = new_gdbarch; + current_inferior ()->gdbarch = new_gdbarch; observer_notify_architecture_changed (new_gdbarch); registers_changed (); } +/* Helper for 'target_gdbarch'. */ + +struct gdbarch * +get_target_gdbarch (void) +{ + return current_inferior ()->gdbarch; +} + extern void _initialize_gdbarch (void); void |