[PATCH v2 3/6] Use get_remote_packet_size in download_tracepoint

Ulrich Weigand uweigand@de.ibm.com
Thu Aug 2 16:47:00 GMT 2018


Pedro Franco de Carvalho wrote:

> 	* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
> 	Replace array buf with gdb::char_vector buf, of size
> 	get_remote_packet_size ().  Replace references to buf and BUF_SIZE
> 	to buf.data () and buf.size ().  Replace strcpy, strcat and
> 	pack_hex_byte with snprintf.  Raise errors if the buffer is too
> 	small.

>  	  if (target_static_tracepoint_marker_at (tpaddr, &marker))
> -	    strcat (buf, ":S");
> +	    {
> +	      size_left = buf.size () - strlen (buf.data ());
> +	      ret = snprintf (buf.data () + strlen (buf.data ()),
> +			      size_left, ":F%x",
> +			      gdb_insn_length (loc->gdbarch, tpaddr));

This changes the message -- I guess that should remain :S?

Otherwise this looks good to me.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list