summaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-11-09 12:20:21 +0000
committerPedro Alves <palves@redhat.com>2012-11-09 12:20:21 +0000
commit9e2ad93ac5211111d8fbcb75179df590d27be185 (patch)
tree89b6f5830141cd98ec63e87547eb7f99c5435156 /gdb/infrun.c
parent86bfff1fc7f5a674955e37c1ea74f468075c28e6 (diff)
downloadgdb-9e2ad93ac5211111d8fbcb75179df590d27be185.tar.gz
2012-11-09 Pedro Alves <palves@redhat.com>
PR gdb/14306 * infrun.c: Include target-descriptions.h. (follow_exec): Fetch new target description. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> PR gdb/14306 * gdb.multi/multi-arch-exec.c: New file. * gdb.multi/multi-arch-exec.exp: New file.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 3d6eccd830f..4efc2af9e88 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -58,6 +58,7 @@
#include "probe.h"
#include "objfiles.h"
#include "completer.h"
+#include "target-descriptions.h"
/* Prototypes for local functions */
@@ -913,6 +914,16 @@ follow_exec (ptid_t pid, char *execd_pathname)
set_current_inferior (inf);
set_current_program_space (pspace);
}
+ else
+ {
+ /* The old description may no longer be fit for the new image.
+ E.g, a 64-bit process exec'ed a 32-bit process. Clear the
+ old description; we'll read a new one below. No need to do
+ this on "follow-exec-mode new", as the old inferior stays
+ around (its description is later cleared/refetched on
+ restart). */
+ target_clear_description ();
+ }
gdb_assert (current_program_space == inf->pspace);
@@ -932,6 +943,14 @@ follow_exec (ptid_t pid, char *execd_pathname)
if ((inf->symfile_flags & SYMFILE_NO_READ) == 0)
set_initial_language ();
+ /* If the target can specify a description, read it. Must do this
+ after flipping to the new executable (because the target supplied
+ description must be compatible with the executable's
+ architecture, and the old executable may e.g., be 32-bit, while
+ the new one 64-bit), and before anything involving memory or
+ registers. */
+ target_find_description ();
+
#ifdef SOLIB_CREATE_INFERIOR_HOOK
SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
#else