diff options
author | Pedro Alves <palves@redhat.com> | 2012-11-09 12:20:24 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-11-09 12:20:24 +0000 |
commit | 9107fc8d18ce84b88be37a2689c47ff600baf8fe (patch) | |
tree | bb3e4d4cafa994e19131e730ee89fe2b7c5762c0 /gdb/infrun.c | |
parent | 30f8135b5ca8edc8020e79061528cab41709be41 (diff) | |
download | gdb-9107fc8d18ce84b88be37a2689c47ff600baf8fe.zip gdb-9107fc8d18ce84b88be37a2689c47ff600baf8fe.tar.gz gdb-9107fc8d18ce84b88be37a2689c47ff600baf8fe.tar.bz2 |
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.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index 3d6eccd..4efc2af 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 |