]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
tfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.
authorPedro Alves <palves@redhat.com>
Mon, 13 Jan 2014 14:56:29 +0000 (14:56 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 13 Jan 2014 14:56:29 +0000 (14:56 +0000)
This PC guessing can't work when the PC is a pseudo-register.
Pseudo-register values don't end up stored in the regcache, they're
always recomputed.  And, it's actually wrong to try to write a
pseudo-register with regcache_raw_supply.  Skip it and add a comment.

gdb/
2014-01-13  Pedro Alves  <palves@redhat.com>

* tracepoint.c (tfile_fetch_registers): Don't infer the PC from
the tracepoint if the PC is a pseudo-register.

gdb/ChangeLog
gdb/tracepoint.c

index 2247c790c7d08795e4d77e6618eae9a3c9886dfc..88ff989ba63a8fbea05640e54453c03292dcb9b4 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-13  Pedro Alves  <palves@redhat.com>
+
+       * tracepoint.c (tfile_fetch_registers): Don't infer the PC from
+       the tracepoint if the PC is a pseudo-register.
+
 2014-01-13  Tom Tromey  <tromey@redhat.com>
 
        * defs.h (XCALLOC): Remove.
index 582c284db26b3f1ca524be59410a89b587da15b0..4b472820e51edf79cbef8472d8445cb26594c64b 100644 (file)
@@ -5060,7 +5060,17 @@ tfile_fetch_registers (struct target_ops *ops,
   /* We can often usefully guess that the PC is going to be the same
      as the address of the tracepoint.  */
   pc_regno = gdbarch_pc_regnum (gdbarch);
-  if (pc_regno >= 0 && (regno == -1 || regno == pc_regno))
+
+  /* XXX This guessing code below only works if the PC register isn't
+     a pseudo-register.  The value of a pseudo-register isn't stored
+     in the (non-readonly) regcache -- instead it's recomputed
+     (probably from some other cached raw register) whenever the
+     register is read.  This guesswork should probably move to some
+     higher layer.  */
+  if (pc_regno < 0 || pc_regno >= gdbarch_num_regs (gdbarch))
+    return;
+
+  if (regno == -1 || regno == pc_regno)
     {
       struct tracepoint *tp = get_tracepoint (tracepoint_number);