+void
+tracefile_fetch_registers (struct regcache *regcache, int regno)
+{
+ struct gdbarch *gdbarch = regcache->arch ();
+ struct tracepoint *tp = get_tracepoint (get_tracepoint_number ());
+ int regn;
+
+ /* We get here if no register data has been found. Mark registers
+ as unavailable. */
+ for (regn = 0; regn < gdbarch_num_regs (gdbarch); regn++)
+ regcache->raw_supply (regn, NULL);
+
+ /* We can often usefully guess that the PC is going to be the same
+ as the address of the tracepoint. */
+ if (tp == NULL || tp->loc == NULL)
+ return;
+
+ /* 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. */
+ else if (tp->step_count > 0)
+ {
+ warning (_("Tracepoint %d does while-stepping, "
+ "cannot infer $pc"),
+ tp->number);
+ return;
+ }
+
+ /* Guess what we can from the tracepoint location. */
+ gdbarch_guess_tracepoint_registers (gdbarch, regcache,
+ tp->loc->address);