This is the mail archive of the gdb-prs@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]

gdb/387: libthread_db gives relocation error at the gdb run time



>Number:         387
>Category:       gdb
>Synopsis:       libthread_db gives relocation error at the gdb run time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 01 02:18:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        all
>Organization:
>Environment:
SunOS 2.9, Sparc Architecture 
>Description:
Invoking gdb 5.1.1 (& all other previous version) 
in Solaris 2.9 machine gives relocation error that 
the symbol 'ps_pread' not found. The error message 
is generated from libthread_db.so.1 . The errorneous
output is given below - 

$uname -a
SunOS ultra9 5.9 s81_53 sun4u sparc SUNW,Ultra-5_10
$pwd
/h/mahatad/DBG/gdb-5.1.1/gdb
$./gdb -v
[GDB will not be able to debug user-mode threads: ld.so.1: ./gdb: fatal: relocat
ion error: file /usr/lib/libthread_db.so.1: symbol ps_pread: referenced symbol n
ot found]
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.9".
$


Analysis
---------
It is observed that in the old (up to 2.8) version of 
Solaris libthread_db.so.1 uses the symbols 'ps_pdread'
and 'ps_pdwrite' which are defined in GDB 
(file: sol-thread.c). 

For 2.8 Solaris, 
$uname -a
SunOS ultra7 5.8 Generic sun4u sparc SUNW,Ultra-5_10
$nm libthread_db.so | grep ps_p
[137]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pcontinue
[181]   |         0|       0|NOTY |WEAK |0    |UNDEF  |ps_pdmodel
[136]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pdread
[202]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pdwrite
[209]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pglobal_lookup
[125]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pstop
$

However in Solaris 2.9, libthread_db.so.1 do not use the
symbols 'ps_pdread' and 'ps_pdwrite', instead it uses
'ps_pread' and 'ps_pwrite'.

For 2.9 Solaris,
$uname -a
SunOS ultra9 5.9 s81_53 sun4u sparc SUNW,Ultra-5_10
$nm libthread_db.so.1 | grep ps_p
[189]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pcontinue
[76]    |         0|       0|FUNC |WEAK |0    |UNDEF  |ps_pdmodel
[194]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pglobal_lookup
[190]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pread
[119]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pstop
[143]   |         0|       0|FUNC |GLOB |0    |UNDEF  |ps_pwrite
$


The symbols 'ps_pread' and 'ps_pwrite' are not defined in
the GDB file sol-thread.c. However the symbols 'ps_pdread',
'ps_pdwrite', 'ps_ptread' and 'ps_ptwrite' are defined in 
sol-thread.c. And the man pages of ps_pread in Solaris 
say that the functionality of 'ps_pread' is same as 
'ps_pdread' and 'ps_ptread'. It is true for 'ps_pwrite' 
also.


So probably sol-thread.c requires a definition for the 
symbols 'ps_pread' and 'ps_pwrite'.
>How-To-Repeat:
Invoke gdb in Solaris 2.9 box. You can use the command
'gdb -v' or simply 'gdb'. GDB displays the error message.
>Fix:
Give the function definition of ps_pread and ps_pwrite in 
file sol-thread.c . I am appending the diff between the 
original sol-thread.c (taken from 5.1.1 and named as 
sol-thread.c.org) and the updated 
file (named as sol-thread.c) .

$cleartool diff -ser sol-thread.c.org sol-thread.c
cleartool: Warning: No type info, using text file type manager.
********************************
<<< file 1: sol-thread.c.org
> >> file 2: sol-thread.c
********************************
-----[after 1068 inserted 1069-1086]-----
> /* Copies SIZE bytes from target process to debugger memory.  */
> 
> ps_err_e
> ps_pread (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
>          gdb_ps_read_buf_t buf, gdb_ps_size_t size)
> {
>   return rw_common (0, ph, addr, buf, size);
> }
> 
> /* Copies SIZE bytes from debugger memory to target process.  */
> 
> ps_err_e
> ps_pwrite (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
>           gdb_ps_write_buf_t buf, gdb_ps_size_t size)
> {
>   return rw_common (1, ph, addr, (char *) buf, size);
> }
> 
$
>Release-Note:
>Audit-Trail:
>Unformatted:


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