* printcmd.c: Include "arch-utils.h".
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:55:08 +0000 (14:55 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:55:08 +0000 (14:55 +0000)
(do_one_display): Re-parse expression if current architecture changed.

gdb/ChangeLog
gdb/printcmd.c

index 208967f9614353c04b8f97f34113c377040e6170..a8f1278cda55150806a17acf21e027b1a51e97d7 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * printcmd.c: Include "arch-utils.h".
+       (do_one_display): Re-parse expression if current architecture changed.
+
 2010-01-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
            Joel Brobecker  <brobecker@adacore.com>
 
index 2960e44d8b5ca2da1100ebd79aab89552b31f34e..88db08b01cef02e80944bd79e5f0aa7db0b0a2b3 100644 (file)
@@ -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;
This page took 0.025887 seconds and 4 git commands to generate.