aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2010-01-04 14:55:08 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2010-01-04 14:55:08 +0000
commit704e9165595fdc491ff1a9f467dc4d7a64c949fd (patch)
treeabb43b252e51eb43b3c9473411c6a8d4e62b7ab3 /gdb/printcmd.c
parentc975cc98812d1518ea614cb4c39ca7e771ccac16 (diff)
downloadgdb-704e9165595fdc491ff1a9f467dc4d7a64c949fd.zip
gdb-704e9165595fdc491ff1a9f467dc4d7a64c949fd.tar.gz
gdb-704e9165595fdc491ff1a9f467dc4d7a64c949fd.tar.bz2
* printcmd.c: Include "arch-utils.h".
(do_one_display): Re-parse expression if current architecture changed.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 2960e44..88db08b 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -49,6 +49,7 @@
#include "solib.h"
#include "parser-defs.h"
#include "charset.h"
+#include "arch-utils.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */
@@ -1606,6 +1607,20 @@ do_one_display (struct display *d)
if (d->enabled_p == 0)
return;
+ /* The expression carries the architecture that was used at parse time.
+ This is a problem if the expression depends on architecture features
+ (e.g. register numbers), and the current architecture is now different.
+ For example, a display statement like "display/i $pc" is expected to
+ display the PC register of the current architecture, not the arch at
+ the time the display command was given. Therefore, we re-parse the
+ expression if the current architecture has changed. */
+ if (d->exp != NULL && d->exp->gdbarch != get_current_arch ())
+ {
+ xfree (d->exp);
+ d->exp = NULL;
+ d->block = NULL;
+ }
+
if (d->exp == NULL)
{
volatile struct gdb_exception ex;