[PATCH 4/6] Remove some dead code from handle_search_memory

Simon Marchi simark@simark.ca
Thu Jul 30 13:04:26 GMT 2020


On 2020-07-23 4:12 p.m., Tom Tromey wrote:
> handle_search_memory had some code after a call to error.  This code
> is dead, and this patch removes it.
> 
> 2020-07-23  Tom Tromey  <tromey@adacore.com>
> 
> 	* server.cc (handle_search_memory): Remove dead code.
> ---
>  gdbserver/ChangeLog | 4 ++++
>  gdbserver/server.cc | 8 +-------
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/gdbserver/server.cc b/gdbserver/server.cc
> index b050a1d8653..9af747cc0b7 100644
> --- a/gdbserver/server.cc
> +++ b/gdbserver/server.cc
> @@ -1053,11 +1053,7 @@ handle_search_memory (char *own_buf, int packet_len)
>  
>    pattern = (gdb_byte *) malloc (packet_len);
>    if (pattern == NULL)
> -    {
> -      error ("Unable to allocate memory to perform the search");
> -      strcpy (own_buf, "E00");
> -      return;
> -    }
> +    error ("Unable to allocate memory to perform the search");

Would you mind adding an empty line after this to visually separate it from the next block?

Or, can we use xmalloc/gdb::byte_vector and just not have this check?

Simon


More information about the Gdb-patches mailing list