[PATCH 3/4] Use get_remote_packet_size in download_tracepoint
Ulrich Weigand
uweigand@de.ibm.com
Tue Jun 26 10:52:00 GMT 2018
Pedro Franco de Carvalho wrote:
> Ulrich Weigand <uweigand@de.ibm.com> writes:
>
> > You know from the beginning that the agent expression will take
> > (2 * aexpr->len) bytes, so it should be OK to only check this
> > once, ahead of time. In fact, sending a partial agent expression
> > seems to be worse than sending none, so if the agent expression
> > is too long, I think it should be just omitted (and the user
> > warned).
>
> I don't think a partial agent expression would be sent in this case,
> since this is before the first putpkt is called in the function. But I
> can still issue the warning and ignore the condition expression instead
> of failing on the assertion. Otherwise I can check the size once and
> call a gdb_assert if its too small, like the rest of the function. Which
> is better?
Ah, you right -- I missed that xsnprintf acually aborts. In this case,
I agree that just checking once and assserting would be fine.
> 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?
I'm not sure I fully understand the C++ standard on this question,
but it seems a reasonable assumption to me. Maybe some of the C++
experts can chime in here?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list