This is the mail archive of the gdb-patches@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] |
Hello, While testing GDB on x86-solaris, I noticed that the debugger now prints a warning during startup: % ./gdb [GDB will not be able to debug user-mode threads: ld.so.1: gdb.ref: fatal: relocation error: file /usr/lib/libthread_db.so.1: symbol ps_lgetLDT: referenced symbol not found] GNU gdb 6.8.50.20080311-cvs Copyright (C) 2008 Free Software Foundation, Inc. [...] The problem was introduced when we killed the TM file, which was defining the TM_I386SOL2_H macro that a couple of units were actually using (ugh!). Basically, the problem on x86-solaris is that, in order to load libthread_db.so, we need to define ps_lgetLDT or the loading will fail due to this symbol being undefined. This function is defined inside sol-thread.c but is conditionalized on TM_I386SOL2_H being defined: #ifdef TM_I386SOL2_H /* Reads the local descriptor table of a LWP. */ ps_err_e ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid, struct ssd *pldt) { Similarly, a couple of other functions inside procfs.c that this function uses are conditionalized on the same macro: proc_get_LDT_entry and procfs_find_LDT_entry. This stuff is entirely x86-solaris specific, so cannot be enabled on sparc-solaris. I think the most classical way of fixing this would be to move these to their own file, such as sol-x86-thread.c. But I'm not sure whether this is going to be the prefered solution in this case, because the procfs routines need access to certain fields of a structure that is not public (struct procinfo). In this version, I went to the simplest, which is to have configure define a new macro (HAVE_X86_SOLARIS_USER_THREADS) when on x86-solaris and the thread_db library is available. I then replaced TM_I386SOL2_H by the new macro. If I were to move the 3 functions to their own file, I would have to create procfs.h to provide an opaque definition of struct procinfo. I would also add a few accessor routines (to get the pid and the ctl_fd), and make a few routines such as find_procinfo or proc_get_gregs non-static. I don't mind doing this work, but I want to make sure others prefer it too. 2008-03-12 Joel Brobecker <brobecker@adacore.com> * configure.ac (HAVE_X86_SOLARIS_USER_THREADS): Define this macro if we are building a native x86-solaris debugger that has access to user-threads. * configure, config.in: Regenerate. * sol-thread.c, procfs.c : Use HAVE_X86_SOLARIS_USER_THREADS in place of TM_I386SOL2_H. Tested on x86-solaris. No regression. Opinions? BTW: We should fix this in the branch as well. Thanks, -- Joel
Attachment:
x86-user-threads.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |