aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-01-13 14:56:29 +0000
committerPedro Alves <palves@redhat.com>2014-01-13 14:56:29 +0000
commitf8de51293246a17166da9a2744c1eb5ab956d67b (patch)
tree81ce1b2648d836c4369f3f43f34dab4b15841ef4
parentfc270c357a3301fec8cc161199242bb934203cf6 (diff)
downloadgdb-f8de51293246a17166da9a2744c1eb5ab956d67b.zip
gdb-f8de51293246a17166da9a2744c1eb5ab956d67b.tar.gz
gdb-f8de51293246a17166da9a2744c1eb5ab956d67b.tar.bz2
tfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.
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.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/tracepoint.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2247c79..88ff989 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 582c284..4b47282 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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);