aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2010-04-04 23:31:29 +0000
committerStan Shebs <shebs@codesourcery.com>2010-04-04 23:31:29 +0000
commitaf54718eaed854c5e7ef4dbd6845969aa6558ef4 (patch)
treef6a7b5c21b652efedc60182dcdfda6ac9572fe5f /gdb/tracepoint.c
parent74d1f91eb19fd48d51664b33769c8c0d4f8e4c38 (diff)
downloadfsf-binutils-gdb-af54718eaed854c5e7ef4dbd6845969aa6558ef4.zip
fsf-binutils-gdb-af54718eaed854c5e7ef4dbd6845969aa6558ef4.tar.gz
fsf-binutils-gdb-af54718eaed854c5e7ef4dbd6845969aa6558ef4.tar.bz2
2010-04-04 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (tfile_fetch_registers): Add fallback case. * gdb.texinfo (Tracepoint Restrictions): Document PC inference. (tdump): Explain how tdump works. * gdb.trace/tfile.exp: Sharpen tfind test.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 1b41806..0fb0e93 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3671,7 +3671,7 @@ tfile_fetch_registers (struct target_ops *ops,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
char block_type;
- int i, pos, offset, regn, regsize, gotten;
+ int i, pos, offset, regn, regsize, gotten, pc_regno;
unsigned short mlen;
char *regs;
@@ -3746,6 +3746,44 @@ tfile_fetch_registers (struct target_ops *ops,
break;
}
}
+
+ /* We get here if no register data has been found. Although we
+ don't like making up numbers, GDB has all manner of troubles when
+ the target says some register is not available. Filling in with
+ zeroes is a reasonable fallback. */
+ for (regn = 0; regn < gdbarch_num_regs (gdbarch); regn++)
+ regcache_raw_supply (regcache, regn, NULL);
+
+ /* 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))
+ {
+ struct breakpoint *tp = get_tracepoint (tracepoint_number);
+
+ if (tp && tp->loc)
+ {
+ /* But don't try to guess if tracepoint is multi-location... */
+ if (tp->loc->next)
+ {
+ warning ("Tracepoint %d has multiple locations, cannot infer $pc",
+ tp->number);
+ return;
+ }
+ /* ... or does while-stepping. */
+ if (tp->step_count > 0)
+ {
+ warning ("Tracepoint %d does while-stepping, cannot infer $pc",
+ tp->number);
+ return;
+ }
+
+ store_unsigned_integer (regs, register_size (gdbarch, pc_regno),
+ gdbarch_byte_order (gdbarch),
+ tp->loc->address);
+ regcache_raw_supply (regcache, pc_regno, regs);
+ }
+ }
}
static LONGEST