Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdbserver ps_lgetregs implementation for nptl
@ 2003-12-11  9:43 Amit S. Kale
  2003-12-11 14:14 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Amit S. Kale @ 2003-12-11  9:43 UTC (permalink / raw)
  To: gdb

Hi,

I am trying to debug nptl programs using gdbserver on x86 platform. First 
problem I found was missing ps_get_thread_area, which was easy to copy from 
the implementation in gdb. Then error return from ps_lgetregs caused a 
problem. ps_lgetregs has come code, though it's commented out. Any ideas on 
completing that code?

Thanks.
-- 
Amit Kale
EmSysSoft (http://www.emsyssoft.com)
KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver ps_lgetregs implementation for nptl
  2003-12-11  9:43 gdbserver ps_lgetregs implementation for nptl Amit S. Kale
@ 2003-12-11 14:14 ` Daniel Jacobowitz
  2003-12-12 15:07   ` Amit S. Kale
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-12-11 14:14 UTC (permalink / raw)
  To: Amit S. Kale; +Cc: gdb

On Thu, Dec 11, 2003 at 03:13:23PM +0530, Amit S. Kale wrote:
> Hi,
> 
> I am trying to debug nptl programs using gdbserver on x86 platform. First 
> problem I found was missing ps_get_thread_area, which was easy to copy from 
> the implementation in gdb. Then error return from ps_lgetregs caused a 
> problem. ps_lgetregs has come code, though it's commented out. Any ideas on 
> completing that code?

I've been meaning to make it work with NPTL and not found the time...
However, it will take more than making it load to make it work.  I
expect that it will also require an extension to the remote protocol to
query the thread base address.

ps_get_thread_area in LinuxThreads was only called by functions that
gdbserver did not use.  If it's necessary for LinuxThreads - it appears
to be - then you'll have to supply a working version.  This will
require describing register sets in gdbserver, which it already can do
on some platforms (see the code that uses PTRACE_GETREGS).

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver ps_lgetregs implementation for nptl
  2003-12-11 14:14 ` Daniel Jacobowitz
@ 2003-12-12 15:07   ` Amit S. Kale
  2003-12-12 18:18     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Amit S. Kale @ 2003-12-12 15:07 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

Implementing the commented out code was trivial for i386 because it already 
has register sets. I implemented all ps_*getregs functions.

A change was needed in gdb. I had to add support for qSymbol in 
remote.c:remote_wait. This was needed for a symbol query from nptl.

I am pasting below code from ps_lsetregs modified by me. I removed creation of 
a register cache. before fetch_registers and fill_function. Is this the right 
way of doing it?

----
ps_err_e
ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
{
  struct thread_info *reg_inferior, *save_inferior;

  reg_inferior = (struct thread_info *) find_inferior_id (&all_threads,
							  lwpid);
  if (reg_inferior == NULL)
    return PS_ERR;

  save_inferior = current_inferior;
  current_inferior = reg_inferior;

  the_target->fetch_registers (0);
  gregset_info()->fill_function (gregset);

  current_inferior = save_inferior;
  return PS_OK;
}
-----



On Thursday 11 Dec 2003 7:44 pm, Daniel Jacobowitz wrote:
> On Thu, Dec 11, 2003 at 03:13:23PM +0530, Amit S. Kale wrote:
> > Hi,
> >
> > I am trying to debug nptl programs using gdbserver on x86 platform. First
> > problem I found was missing ps_get_thread_area, which was easy to copy
> > from the implementation in gdb. Then error return from ps_lgetregs caused
> > a problem. ps_lgetregs has come code, though it's commented out. Any
> > ideas on completing that code?
>
> I've been meaning to make it work with NPTL and not found the time...
> However, it will take more than making it load to make it work.  I
> expect that it will also require an extension to the remote protocol to
> query the thread base address.
>
> ps_get_thread_area in LinuxThreads was only called by functions that
> gdbserver did not use.  If it's necessary for LinuxThreads - it appears
> to be - then you'll have to supply a working version.  This will
> require describing register sets in gdbserver, which it already can do
> on some platforms (see the code that uses PTRACE_GETREGS).

-- 
Amit Kale
EmSysSoft (http://www.emsyssoft.com)
KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver ps_lgetregs implementation for nptl
  2003-12-12 15:07   ` Amit S. Kale
@ 2003-12-12 18:18     ` Daniel Jacobowitz
  2003-12-13 18:39       ` Jim Blandy
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-12-12 18:18 UTC (permalink / raw)
  To: Amit S. Kale; +Cc: gdb

On Fri, Dec 12, 2003 at 08:36:57PM +0530, Amit S. Kale wrote:
> Implementing the commented out code was trivial for i386 because it already 
> has register sets. I implemented all ps_*getregs functions.
> 
> A change was needed in gdb. I had to add support for qSymbol in 
> remote.c:remote_wait. This was needed for a symbol query from nptl.
> 
> I am pasting below code from ps_lsetregs modified by me. I removed creation of 
> a register cache. before fetch_registers and fill_function. Is this the right 
> way of doing it?

<snip>

Before I look at your code, do you have or plan to have an FSF
copyright assignment for GDB?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver ps_lgetregs implementation for nptl
  2003-12-12 18:18     ` Daniel Jacobowitz
@ 2003-12-13 18:39       ` Jim Blandy
  2003-12-15  6:08         ` Amit S. Kale
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2003-12-13 18:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Amit S. Kale, gdb


Daniel Jacobowitz <drow@mvista.com> writes:
> On Fri, Dec 12, 2003 at 08:36:57PM +0530, Amit S. Kale wrote:
> > Implementing the commented out code was trivial for i386 because it already 
> > has register sets. I implemented all ps_*getregs functions.
> > 
> > A change was needed in gdb. I had to add support for qSymbol in 
> > remote.c:remote_wait. This was needed for a symbol query from nptl.
> > 
> > I am pasting below code from ps_lsetregs modified by me. I removed creation of 
> > a register cache. before fetch_registers and fill_function. Is this the right 
> > way of doing it?
> 
> <snip>
> 
> Before I look at your code, do you have or plan to have an FSF
> copyright assignment for GDB?

I wasn't able to find one, so I sent Amit the form off-list.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver ps_lgetregs implementation for nptl
  2003-12-13 18:39       ` Jim Blandy
@ 2003-12-15  6:08         ` Amit S. Kale
  0 siblings, 0 replies; 6+ messages in thread
From: Amit S. Kale @ 2003-12-15  6:08 UTC (permalink / raw)
  To: Jim Blandy, Daniel Jacobowitz; +Cc: gdb

Sorry, I wasn't aware of the legal implications of sending  this code.
I'll get the legal issues sorted out in a couple of days and send it again.

On Sunday 14 Dec 2003 12:06 am, Jim Blandy wrote:
> Daniel Jacobowitz <drow@mvista.com> writes:
> > On Fri, Dec 12, 2003 at 08:36:57PM +0530, Amit S. Kale wrote:
> > > Implementing the commented out code was trivial for i386 because it
> > > already has register sets. I implemented all ps_*getregs functions.
> > >
> > > A change was needed in gdb. I had to add support for qSymbol in
> > > remote.c:remote_wait. This was needed for a symbol query from nptl.
> > >
> > > I am pasting below code from ps_lsetregs modified by me. I removed
> > > creation of a register cache. before fetch_registers and fill_function.
> > > Is this the right way of doing it?
> >
> > <snip>
> >
> > Before I look at your code, do you have or plan to have an FSF
> > copyright assignment for GDB?
>
> I wasn't able to find one, so I sent Amit the form off-list.

-- 
Amit Kale
EmSysSoft (http://www.emsyssoft.com)
KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-12-15  6:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-11  9:43 gdbserver ps_lgetregs implementation for nptl Amit S. Kale
2003-12-11 14:14 ` Daniel Jacobowitz
2003-12-12 15:07   ` Amit S. Kale
2003-12-12 18:18     ` Daniel Jacobowitz
2003-12-13 18:39       ` Jim Blandy
2003-12-15  6:08         ` Amit S. Kale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox