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


Pedro Alves wrote:
> On 05/06/2015 06:16 PM, Gary Benson wrote:
> > Gary Benson wrote:
> > @@ -11718,7 +11719,15 @@ remote_pid_to_exec_file
> >    if (filename != NULL)
> >      xfree (filename);
> >
> > -  xsnprintf (annex, sizeof (annex), "%x", pid);
> > +  inf = find_inferior_pid (pid);
> > +  if (inf != NULL && !inf->fake_pid_p)
> 
> This will silently do the wrong thing (retrieve the exec file of
> the server's current thread/process) if this method is ever used
> to try to fetch the exec out of a process that we're _not_ currently
> attached to.  Maybe this should be:
> 
>   if (inf == NULL)
>     internal_error (__FILE__, __LINE__,
>                     "attempt to retrieve exec-file of not-debugged process");
>   if (!inf->fake_pid_p)

Good catch, thanks!

> > > @@ -1144,17 +1144,32 @@ handle_qxfer_exec_file
[snip]
> > > +
> > > +  if (pid < 0)
> > >      return -1;
> > 
> > Oops, this should be "<=".
> 
> This is OK with that change and the point above addressed.

Ok, I've pushed this, thanks Pedro and Eli for the reviews.

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]