This is the mail archive of the gdb@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: fail to attach to process on Solaris


The problem appears that thread debug library has callback for register
get operation that's connected to "sol-thread.c:ps_lgetregs()".  In the
case that fails, the thread exists, but the calling sequence tries to
lookup registers for a LWP with the same ID as the thread.

#0  find_procinfo_or_die (pid=12276, tid=67) at procfs.c:489
#1  0x000a1cd0 in procfs_fetch_registers (ops=0x7293d8,
regcache=0x71b1d0, 
    regnum=-1) at procfs.c:3483
#2  0x0012feec in sol_thread_fetch_registers (ops=0x718a70,
regcache=0x71b1d0, 
    regnum=-1) at sol-thread.c:457
#3  0x00231af0 in target_fetch_registers (regcache=0x71b1d0, regno=-1)
    at target.c:3417
#4  0x00130e48 in ps_lgetregs (ph=0x700998, lwpid=67,
gregset=0xffbfe37c)
    at sol-thread.c:923
#5  0xff0735dc in td_thr_getgregs () from /usr/lib/libthread_db.so.1
#6  0x0012fff8 in sol_thread_fetch_registers (ops=0x718a70,
regcache=0x71b3b0, 
    regnum=68) at sol-thread.c:473 

For this stack trace of 'gdb', 'sol_thread_fetch_registers()' is passed 

(gdb) frame
#6  0x0012fff8 in sol_thread_fetch_registers (ops=0x718a70,
regcache=0x71b3b0, 
    regnum=68) at sol-thread.c:473
473       val = p_td_thr_getgregs (&thandle, gregset);
(gdb) p *regcache
$24 = {descr = 0x84fc40, aspace = 0x7aa258, registers = 0x846c48 "", 
  register_status = 0x14f37c0 "", readonly_p = 0, ptid = {pid = 12276, 
    lwp = 0, tid = 67}}

So it's looking for registers from a thread that's not associated with
an LWP.  But the
function 'ps_lgetregs()' is always looking for the registers on the LWP
list.

I can't see how the callback 'ps_lgetregs()' is connected to the thread
debug library.  In fact, the documentation for the thread debug library
seems sparse.  I've only been able to find out about it in the man pages
and comments section of sol-thread.c  So any pointers to documentation
would be helpful.

Also, any theory of operation about gdb's register caching would also be
helpful.

Thanks.

> -----Original Message-----
> From: Pedro Alves [mailto:pedro@codesourcery.com] 
> Sent: Friday, September 02, 2011 5:24 PM
> To: gdb@sourceware.org
> Cc: Burkhardt, Glenn
> Subject: Re: fail to attach to process on Solaris
> 
> 
> On Monday 22 August 2011 16:05:10, Burkhardt, Glenn wrote:
> > I can't seem to attach to a process that's running multiple threads.
> > Any help is appreciated.  I've included the print output from the 
> > whole session, but the problem is the line:
> > 
> > procfs: couldn't find pid 15719 (kernel thread 67) in procinfo list.
> 
> Been a while since I looked at the solaris backend, so I 
> can't help much off hand.  I'm affraid you'll need to debug 
> this yourself.
> Starting with "set debug infrun 1" may help.  I'd start by 
> understanding why does gdb think 67 should be in the list.
> 
> --
> Pedro Alves
> 


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