Re: Why enforcing sw_breakpoint_from_kind() implementation in GDBserver targets

Luis Machado
2020-06-11T10:35:38Z

On 6/11/20 6:40 AM, Shahab Vahedi via Gdb wrote:
> Hi Simon,
>
> The ARC GDB client inserts the breakpoint by writing to memory (the
> legacy way). With your explanations, I plan to add the Z0 packet
> support to it. Nevertheless, should it be still necessary to have
> "sw_breakpoint_from_kind" in GDBserver as a mandatory method?
>
> The rest follows:
>
> On Wed, Jun 10, 2020 at 11:05:38PM -0400, Simon Marchi wrote:
>> I don't understand your "This makes sense because we have a setup that looks
>> like below", because that looks like a standard GDB/GDBserver setup used for
>> other architectures.
>
> I said it makes sense because the first question that pops into mind is
> "If sw_breakpoint_from_kind should have been mandatory all the time,
> then how come a debugging session with ARC GDBserver was able to insert
> breakpoints?". The answer would be because ARC GDB client takes care of
> it. In ARC case, as you concluded as well, the client asks the GDBserver
> to write the opcodes to memory.
>> When a breakpoint is inserted, what's the remote protocol packet used? Is it
>> Z0, or is it a memory write operation that writes the breakpoint's opcode? Z0
>> is the "modern" way that provides more features (like target-side condition
>> evaluation) and a memory write is the legacy fallback.
>> sw_breakpoint_from_kind would be used if the Z0 packet was used, to translate
>> the "kind" into an opcode. Since you claim that sw_breakpoint_from_kind is
>> not used, I guess that the breakpoint is inserted with a memory write operation.
>> I'd look into why that is the case. GDB tries Z0 first and falls back to the
>> memory write if Z0 is not supported, so your GDBserver must not support it for
>> some reason.
>
> I am not sure why this could be the case. I will investigate that.

Probably because the ARC port doesn't implement low_insert_point and
low_remove_point? There is only a dummy Linux implementation, and Linux
implementations for insert_point/remove_point.