[5/5] gdb: add inferior parameter to target_clear_description
Commit Message
From: Simon Marchi <simon.marchi@polymtl.ca>
Make target_clear_description not dependent on the current inferior on
entry. Add an inferior parameter, and make it switch the current
inferior temporarily where needed.
Mkae the callers pass the current inferior, no change in behavior is
expected.
Change-Id: I85e4c500fceee9fc037f209d188e608536ed3f13
---
gdb/infrun.c | 2 +-
gdb/remote.c | 2 +-
gdb/target-descriptions.c | 13 ++++++-------
gdb/target-descriptions.h | 2 +-
gdb/target.c | 2 +-
5 files changed, 10 insertions(+), 11 deletions(-)
@@ -1252,7 +1252,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
this on "follow-exec-mode new", as the old inferior stays
around (its description is later cleared/refetched on
restart). */
- target_clear_description ();
+ target_clear_description (inf);
target_follow_exec (inf, ptid, exec_file_target);
}
@@ -4962,7 +4962,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
if (remote_read_description_p (this)
&& gdbarch_target_desc (target_gdbarch ()) == NULL)
{
- target_clear_description ();
+ target_clear_description (current_inferior ());
target_find_description (current_inferior ());
}
@@ -588,13 +588,12 @@ target_find_description (inferior *inf)
tdesc_info->fetched = true;
}
-/* Discard any description fetched from the current target, and switch
- the current architecture to one with no target description. */
+/* See target-descriptions.h. */
void
-target_clear_description (void)
+target_clear_description (inferior *inf)
{
- target_desc_info *tdesc_info = get_tdesc_info (current_inferior ());
+ target_desc_info *tdesc_info = get_tdesc_info (inf);
if (!tdesc_info->fetched)
return;
@@ -603,7 +602,7 @@ target_clear_description (void)
tdesc_info->tdesc = nullptr;
gdbarch_info info;
- if (!gdbarch_update_p (current_inferior (), info))
+ if (!gdbarch_update_p (inf, info))
internal_error (_("Could not remove target-supplied description"));
}
@@ -1293,7 +1292,7 @@ set_tdesc_filename_cmd (const char *args, int from_tty,
tdesc_info->filename = tdesc_filename_cmd_string;
- target_clear_description ();
+ target_clear_description (current_inferior ());
target_find_description (current_inferior ());
}
@@ -1320,7 +1319,7 @@ unset_tdesc_filename_cmd (const char *args, int from_tty)
target_desc_info *tdesc_info = get_tdesc_info (current_inferior ());
tdesc_info->filename.clear ();
- target_clear_description ();
+ target_clear_description (current_inferior ());
target_find_description (current_inferior ());
}
@@ -40,7 +40,7 @@ void target_find_description (inferior *inf);
inferior, and switch the current architecture to one with no target
description. */
-void target_clear_description (void);
+void target_clear_description (inferior *inf);
/* Return the current inferior's target description. This should only
be used by gdbarch initialization code; most access should be
@@ -2484,7 +2484,7 @@ target_pre_inferior (int from_tty)
invalidate_target_mem_regions ();
- target_clear_description ();
+ target_clear_description (current_inferior ());
}
/* attach_flag may be set if the previous process associated with