This is the mail archive of the gdb@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: gdbserver ps_lgetregs implementation for nptl


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)


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