From 6ecd47299a08f30181d8c3386c0271393b92a8d0 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 9 Nov 2012 01:47:20 +0000 Subject: gdb/ 2012-11-09 Pedro Alves * gdbarch.sh (target_gdbarch) : Reimplement as macro. (get_target_gdbarch) : New function. (startup_gdbarch) : Declare. (target_gdbarch): Delete. (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. (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) : 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 * gdb.multi/multi-arch.exp: New. --- gdb/gdbarch.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 6bc57afa69e..25e47506809 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -457,7 +457,6 @@ struct gdbarch startup_gdbarch = /* startup_gdbarch() */ }; -struct gdbarch *target_gdbarch = &startup_gdbarch; /* Create a new ``struct gdbarch'' based on information provided by ``struct gdbarch_info''. */ @@ -4671,11 +4670,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 -- cgit v1.2.1