Re: [PATCH 3/4] Use get_remote_packet_size in download_tracepoint

Pedro Franco de Carvalho
2018-06-26T18:49:06Z

Pedro Alves <palves@redhat.com> writes:

> I'm not sure I understand the details or the suggestions below (the
> patches don't seem to be meant to apply on top of current master, but
> they're using buf.data()), but I'd just like to point out that ideally
> GDB should not gdb_assert or abort on user input or remote stub
> limitations (small remote packet size), since neither are a GDB bug.

Sorry, I messed up the formatting.

I used the assert because other places in remote.c also use xsnprintf
with the remote packet size and so fail with an assert if this size is
too small.

But I agree that it makes more sense not to abort, so I can change all
uses of xsnprintf in remote_target::download_tracepoint to snprintf and
raise an error if the return value indicates the packet size is too
small.

>> I am also assuming throughout this function that size_t and
>> gdb::char_vector::size_type are compatible (since buf.size () returns
>> the latter and xsnprintf takes a size_t). Is this ok?
>
> It is.

Thanks!

--
Pedro Franco de Carvalho