This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH] Locate executables on remote stubs without multiprocess extensions


Gary Benson wrote:
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index d2e20d9..516a311 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -1144,17 +1144,32 @@ handle_qxfer_exec_file (const char *const_annex,
>  			gdb_byte *readbuf, const gdb_byte *writebuf,
>  			ULONGEST offset, LONGEST len)
>  {
> -  char *annex, *file;
> +  char *file;
>    ULONGEST pid;
>    int total_len;
>  
>    if (the_target->pid_to_exec_file == NULL || writebuf != NULL)
>      return -2;
>  
> -  annex = alloca (strlen (const_annex) + 1);
> -  strcpy (annex, const_annex);
> -  annex = unpack_varlen_hex (annex, &pid);
> -  if (annex[0] != '\0' || pid == 0)
> +  if (const_annex[0] == '\0')
> +    {
> +      if (current_thread == NULL)
> +	return -1;
> +
> +      pid = pid_of (current_thread);
> +    }
> +  else
> +    {
> +      char *annex = alloca (strlen (const_annex) + 1);
> +
> +      strcpy (annex, const_annex);
> +      annex = unpack_varlen_hex (annex, &pid);
> +
> +      if (annex[0] != '\0')
> +	return -1;
> +    }
> +
> +  if (pid < 0)
>      return -1;

Oops, this should be "<=".

Cheers,
Gary

--
http://gbenson.net/


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