This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA] attach_command: clear solib state before attaching toprocess


On Mon, 17 Jan 2005 15:54:25 +0100
Corinna Vinschen <vinschen@redhat.com> wrote:

> Hi,
> 
> I've observed a FAIL of the following test in gdb.base/attach.exp:
> 
>   (gdb) attach 4711
>   Cannot access memory at address 0xwhatever
>   FAIL: gdb.base/attach.exp: attach when process' a.out not in cwd
> 
> This happened on a machine running GNU/Linux with glibc 2.3.2.
> Further debugging showed that the function first_link_map_member()
> in solib-svr4.c happened to access memory which is not in the memory
> map of the process which GDB tried to attach to.
> 
> What happens is that shared libs are not necessarily mapped to the same
> virtual address in different processes.  But GDB does not invalidate
> the solib state or in other words, does not reset the static variable
> debug_base back to 0 to force to reload the address information when
> attaching to another process.  Therefore there's a pretty good chance
> for the debug_base pointer to point into nirvana when attaching to
> another process, leading to the above problem.
> 
> The below patch avoids that problem by calling CLEAR_SOLIB in attach_command,
> before the target process gets attached to.
> 
> Ok to apply?
> 
> 
> Corinna
> 
> 	* infcmd.c (attach_command): Call CLEAR_SOLIB if available.

Okay.

Kevin


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