Bug 15420 - Thread support broken on 64-bit Solaris/x86
Summary: Thread support broken on 64-bit Solaris/x86
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: tdep (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.6
Assignee: Joel Brobecker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-30 14:56 UTC by Rainer Orth
Modified: 2013-05-10 12:37 UTC (History)
2 users (show)

See Also:
Host: amd64-pc-solaris2.1[01]
Target: amd64-pc-solaris2.1[01]
Build: amd64-pc-solaris2.1[01]
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2013-04-30 14:56:57 UTC
This report is about gdb 7.6, but bugzilla doesn't yet provide that version.

When I start gdb, configured on Solaris 10/x86 with

configure CFLAGS='-g -O2 -m64' --prefix=/vol/gcc --disable-nls --without-python

I get this warning:

[GDB will not be able to debug user-mode threads: ld.so.1: gdb-7.6: fatal: relocation error: file /lib/64/libthread_db.so.1: symbol ps_lgetxregsize: referenced symbol not found]

This is a regression from gdb 7.5 where this worked and the function (required
by libthread_db.so.1) was provided by the gdb binary.  This is obviously due to
this change:

2012-09-27  Joel Brobecker  <brobecker@adacore.com>

        * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs):
        Move these functions to sparc-sol-thread.c.
        * sparc-sol-thread.c: New file.
        * configure.ac: Add sparc-sol-thread.o to CONFIG_OBS and
        sparc-sol-thread.c to CONFIG_SRCS for sparc-solaris native
        configurations.
        * configure: Regenerate.

The functions are incorrectly taken to be sparc-specific.  If I add
sparc-sol-thread.c to the Solaris/x86 build by editing configure, gdb starts
again as expected.

  Rainer
Comment 1 Joel Brobecker 2013-05-01 06:43:33 UTC
Sorry for the breakage. Will fix.
Comment 2 Joel Brobecker 2013-05-06 11:35:14 UTC
Rainer,

The Solaris 10 man page is absolutely explicit about these routines:

  SPARC Only
     ps_lgetxregsize(),ps_lgetxregs(),   andps_lsetxregs()    are
     SPARC-specific. They do not need to be defined by a control-
     ling process on  non-SPARC  architecture.  ps_lgetxregsize()
     returns  in *xregsize the size of the architecture-dependent
     extra state registers. ps_lgetxregs() gets the  extra  state
     registers, and ps_lsetxregs() sets them.

This may be obsolete info, but I am testing on ia32-solaris, and I am not seeing the problem either. I wonder if the 'x' might mean 'cross' meaning that the routines are only used when in 64bit mode...

I will send a patch...
Comment 3 Rainer Orth 2013-05-06 11:48:08 UTC
> --- Comment #2 from Joel Brobecker <brobecker at gnat dot com> 2013-05-06 11:35:14 UTC ---
> Rainer,
>
> The Solaris 10 man page is absolutely explicit about these routines:
>
>   SPARC Only
>      ps_lgetxregsize(),ps_lgetxregs(),   andps_lsetxregs()    are
>      SPARC-specific. They do not need to be defined by a control-
>      ling process on  non-SPARC  architecture.  ps_lgetxregsize()
>      returns  in *xregsize the size of the architecture-dependent
>      extra state registers. ps_lgetxregs() gets the  extra  state
>      registers, and ps_lsetxregs() sets them.

I'm seeing this only in the Solaris 9 man page.  On Solaris 10 (Update
11, man page dated 13 Sep 2010), I have

     ps_lgetxregsize(), ps_lgetxregs(),  and  ps_lsetxregs()  are
     system dependent. ps_lgetxregsize() returns in *xregsize the
     size of the architecture-dependent  extra  state  registers.
     ps_lgetxregs()   gets   the   extra   state  registers,  and
     ps_lsetxregs() sets them. On systems  that  do  not  support
     extra   state   registers,   these   functions  will  return
     PS_NOXREGS.

> This may be obsolete info, but I am testing on ia32-solaris, and I am not
> seeing the problem either. I wonder if the 'x' might mean 'cross' meaning that
> the routines are only used when in 64bit mode...

I suppose the x means extra, as in proc(4):

  xregs
     Extra state registers.  The  extra  state  register  set  is
     architecture  dependent;  this  file  is empty if the system
     does not support extra state registers. If the file is  non-
     empty,  it  contains  an architecture dependent structure of
     type prxregset_t, defined in <procfs.h>, with the values  of
     the  lwp's extra state registers. If the lwp is not stopped,
     all register values are undefined. See also the PCSXREG con-
     trol operation, below.

> I will send a patch...

Fine, thanks.

	Rainer
Comment 4 Joel Brobecker 2013-05-06 12:12:03 UTC
Patch sent.

For the record, the system I copied the man page from is running x86-solaris 2.10.
Comment 5 cvs-commit@gcc.gnu.org 2013-05-10 12:10:22 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2013-05-10 12:10:20

Modified files:
	gdb            : ChangeLog configure configure.ac sol-thread.c 
Removed files:
	gdb            : sparc-sol-thread.c 

Log message:
	move sparc-sol-thread.c back into sol-thread.c.
	
	The routines in sparc-sol-thread used to be SPARC-specific (and
	documented as such in the ptrace man page), and therefore hosting them
	in a sparc-specific file made sense.  However, newer versions of
	Solaris now use those callbacks (Solaris 10 Update 10, apparently),
	and thus the note about these callbacks being specific to SPARC
	was removed.
	
	So this patch deletes sparc-sol-thread.c and moves the code back
	inside sol-thread.c.
	
	gdb/ChangeLog:
	
	PR tdep/15420:
	* sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs):
	New functions, directly copied from sparc-sol-thread.c.
	* sparc-sol-thread.c: Delete.
	* configure.ac: Remove code handling sparc-solaris-thread.c.
	* configure: Regenerate.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15540&r2=1.15541
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/configure.diff?cvsroot=src&r1=1.389&r2=1.390
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/configure.ac.diff?cvsroot=src&r1=1.201&r2=1.202
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/sol-thread.c.diff?cvsroot=src&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/sparc-sol-thread.c.diff?cvsroot=src&r1=1.2&r2=NONE
Comment 6 cvs-commit@gcc.gnu.org 2013-05-10 12:30:07 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_6-branch
Changes by:	brobecke@sourceware.org	2013-05-10 12:30:05

Modified files:
	gdb            : ChangeLog configure configure.ac sol-thread.c 
Removed files:
	gdb            : sparc-sol-thread.c 

Log message:
	move sparc-sol-thread.c back into sol-thread.c.
	
	The routines in sparc-sol-thread used to be SPARC-specific (and
	documented as such in the ptrace man page), and therefore hosting them
	in a sparc-specific file made sense.  However, newer versions of
	Solaris now use those callbacks (Solaris 10 Update 10, apparently),
	and thus the note about these callbacks being specific to SPARC
	was removed.
	
	So this patch deletes sparc-sol-thread.c and moves the code back
	inside sol-thread.c.
	
	gdb/ChangeLog:
	
	PR tdep/15420:
	* sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs):
	New functions, directly copied from sparc-sol-thread.c.
	* sparc-sol-thread.c: Delete.
	* configure.ac: Remove code handling sparc-solaris-thread.c.
	* configure: Regenerate.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.15260.2.51&r2=1.15260.2.52
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/configure.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.385.2.1&r2=1.385.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/configure.ac.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.197.2.1&r2=1.197.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/sol-thread.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.94&r2=1.94.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/sparc-sol-thread.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.2&r2=NONE
Comment 7 Joel Brobecker 2013-05-10 12:37:02 UTC
Fixed.