This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa] insert_hw_breakpoint


On Aug 12,  4:04pm, Grace Sainsbury wrote:

> -  len = strlen (shadow);
> -  len = len ? len : 1;
> +  BREAKPOINT_FROM_PC (&addr, &len);
> +  
>    if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
>      error ("Can't set hardware breakpoint without the '%s' (%s) packet\n",
>  	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
> @@ -5027,7 +5027,8 @@
>    char *buf = alloca (rs->remote_packet_size);
>    char *p = buf;
>    
> -  len = sizeof (shadow);
> +  BREAKPOINT_FROM_PC (&addr, &len);
> + 
>    if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
>      error ("Can't clear hardware breakpoint without the '%s' (%s) packet\n",
>  	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,

Do stubs actually care about this length field for the packets under
consideration?

I agree that the use of strlen() and sizeof() seem dubious if not
outright wrong, but, unfortunately, not all architectures can define
a sensible BREAKPOINT_FROM_PC. (*)  I would like to see gdb relying less
on BREAKPOINT_FROM_PC, not more.

(*) E.g, IA-64.  For IA-64, I did define a BREAKPOINT_FROM_PC, but I
would have preferred not to.  The values returned by
ia64_breakpoint_from_pc() are fairly arbitrary and are of absolutely
no use for saving/restoring actual breakpoints.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]