RE: [patch v8 24/24] record-btrace: add (reverse-)stepping support

Metzger, Markus T
2013-12-17T15:48:44Z

> -----Original Message-----
> From: Metzger, Markus T
> Sent: Tuesday, December 17, 2013 4:06 PM
> To: Pedro Alves

> I'm beginning to wonder if we should actually adjust the PC for
> btrace replay. The way I interpret the function, we got a SIGTRAP
> for executing the breakpoint instruction. The PC is after the breakpoint
> instruction, so it is one byte after the actual breakpoint location. We're
> now trying to undo the execution of the breakpoint instruction.
> Is this correct?
>
> In that case, we shouldn't adjust the PC since we did not execute
> the breakpoint instruction in the trace. We just asked whether there
> is a breakpoint at the current location.
>
> This seems to be different for s/w record. This is the first time, I need
> to distinguish between the different record targets.

The s/w record target also does not execute the breakpoint instruction.
It increments the PC by gdbarch_decr_pc_after_break () when it finds a
s/w breakpoint at the current location.

I wonder why they are doing that. Is this a workaround that was considered
less intrusive than what I am proposing below? Or are there more places
in GDB that expect the PC to be past the breakpoint instruction?

I could do the same, of course. Not sure which version is more desirable.

> I would add a new target method to_omit_pc_after_break_adjustment
> that would default to false if not present. The btrace record target will
> provide it and return true if we're replaying.
>
> OK with that?

Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052