* Various build-related fixes for solaris
@ 2012-09-20 16:34 Joel Brobecker
2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker
` (3 more replies)
0 siblings, 4 replies; 20+ messages in thread
From: Joel Brobecker @ 2012-09-20 16:34 UTC (permalink / raw)
To: gdb-patches
Hello,
I noticed today that the GDB build on solaris breaks. The first
patch fixes the breakage. But while fixing it, I noticied that
there were still so "unused function" warnings. Fixes with the
patches that follow.
I will wait a day or two, and then commit if there are no objections.
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h). 2012-09-20 16:34 Various build-related fixes for solaris Joel Brobecker @ 2012-09-20 16:34 ` Joel Brobecker 2012-09-22 14:22 ` Jan Kratochvil 2012-09-27 12:56 ` checked in: " Joel Brobecker 2012-09-20 16:34 ` [PATCH 1/4] Fix declaration of proc_find_memory_regions Joel Brobecker ` (2 subsequent siblings) 3 siblings, 2 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 16:34 UTC (permalink / raw) To: gdb-patches; +Cc: Joel Brobecker Add a declaration for procfs_find_LDT_entry in order to prevent a compiler warning about this function missing one. This also helps making sure that declaration and definition remain consistent. gdb/ChangeLog: * procfs.h (procfs_find_LDT_entry): Add declaration. * sol-thread.c (ps_lgetLDT): Delete local declaration of function procfs_find_LDT_entry. --- gdb/procfs.h | 7 +++++++ gdb/sol-thread.c | 1 - 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/gdb/procfs.h b/gdb/procfs.h index 8293322..9dbf531 100644 --- a/gdb/procfs.h +++ b/gdb/procfs.h @@ -34,3 +34,10 @@ extern void procfs_use_watchpoints (struct target_ops *t); 'live' procinfo. */ extern ptid_t procfs_first_available (void); + +#if (defined(__i386__) || defined(__x86_64__)) && defined (sun) +struct ssd; + +extern struct ssd *procfs_find_LDT_entry (ptid_t); +#endif + diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 3577b5a..cd37615 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1108,7 +1108,6 @@ ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid, struct ssd *pldt) { /* NOTE: only used on Solaris, therefore OK to refer to procfs.c. */ - extern struct ssd *procfs_find_LDT_entry (ptid_t); struct ssd *ret; /* FIXME: can't I get the process ID from the prochandle or -- 1.6.5.rc2 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h). 2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker @ 2012-09-22 14:22 ` Jan Kratochvil 2012-09-27 12:56 ` checked in: " Joel Brobecker 1 sibling, 0 replies; 20+ messages in thread From: Jan Kratochvil @ 2012-09-22 14:22 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On Thu, 20 Sep 2012 18:34:00 +0200, Joel Brobecker wrote: > --- a/gdb/procfs.h > +++ b/gdb/procfs.h > @@ -34,3 +34,10 @@ extern void procfs_use_watchpoints (struct target_ops *t); > 'live' procinfo. */ > > extern ptid_t procfs_first_available (void); > + > +#if (defined(__i386__) || defined(__x86_64__)) && defined (sun) The first two defined keywords should have a white space. Jan ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h). 2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker 2012-09-22 14:22 ` Jan Kratochvil @ 2012-09-27 12:56 ` Joel Brobecker 1 sibling, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 12:56 UTC (permalink / raw) To: gdb-patches > gdb/ChangeLog: > > * procfs.h (procfs_find_LDT_entry): Add declaration. > * sol-thread.c (ps_lgetLDT): Delete local declaration of > function procfs_find_LDT_entry. Checked in after fixing the formatting issue that Jan pointed out (thank you!). -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/4] Fix declaration of proc_find_memory_regions 2012-09-20 16:34 Various build-related fixes for solaris Joel Brobecker 2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker @ 2012-09-20 16:34 ` Joel Brobecker 2012-09-27 12:55 ` checked in: " Joel Brobecker 2012-09-20 16:34 ` [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static Joel Brobecker 2012-09-20 16:44 ` [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker 3 siblings, 1 reply; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 16:34 UTC (permalink / raw) To: gdb-patches; +Cc: Joel Brobecker This function is used as a target_ops callback. The function implemention was recently changed, but the declaration wasn't updated accordingly. This fixes a build failure on Solaris. gdb/ChangeLog: * procfs.c (proc_find_memory_regions): Fix declaration. --- gdb/procfs.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/gdb/procfs.c b/gdb/procfs.c index ee2b123..3583e8e 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -141,11 +141,7 @@ static int procfs_thread_alive (struct target_ops *ops, ptid_t); static void procfs_find_new_threads (struct target_ops *ops); static char *procfs_pid_to_str (struct target_ops *, ptid_t); -static int proc_find_memory_regions (int (*) (CORE_ADDR, - unsigned long, - int, int, int, - void *), - void *); +static int proc_find_memory_regions (find_memory_region_ftype, void *); static char * procfs_make_note_section (bfd *, int *); -- 1.6.5.rc2 ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: [PATCH 1/4] Fix declaration of proc_find_memory_regions 2012-09-20 16:34 ` [PATCH 1/4] Fix declaration of proc_find_memory_regions Joel Brobecker @ 2012-09-27 12:55 ` Joel Brobecker 0 siblings, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 12:55 UTC (permalink / raw) To: gdb-patches > gdb/ChangeLog: > > * procfs.c (proc_find_memory_regions): Fix declaration. Checked in. -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static 2012-09-20 16:34 Various build-related fixes for solaris Joel Brobecker 2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker 2012-09-20 16:34 ` [PATCH 1/4] Fix declaration of proc_find_memory_regions Joel Brobecker @ 2012-09-20 16:34 ` Joel Brobecker 2012-09-27 12:55 ` checked in: " Joel Brobecker 2012-09-20 16:44 ` [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker 3 siblings, 1 reply; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 16:34 UTC (permalink / raw) To: gdb-patches; +Cc: Joel Brobecker This function is not used outside of procfs.c. gdb/ChangeLog: * procfs.c (proc_get_LDT_entry): Make static. --- gdb/procfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gdb/procfs.c b/gdb/procfs.c index 3583e8e..6ba5bd1 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -2516,7 +2516,7 @@ proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags) register for the LWP that we're interested in. Returns the matching ssh struct (LDT entry). */ -struct ssd * +static struct ssd * proc_get_LDT_entry (procinfo *pi, int key) { static struct ssd *ldt_entry = NULL; -- 1.6.5.rc2 ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static 2012-09-20 16:34 ` [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static Joel Brobecker @ 2012-09-27 12:55 ` Joel Brobecker 0 siblings, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 12:55 UTC (permalink / raw) To: gdb-patches > gdb/ChangeLog: > > * procfs.c (proc_get_LDT_entry): Make static. Checked in. -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 16:34 Various build-related fixes for solaris Joel Brobecker ` (2 preceding siblings ...) 2012-09-20 16:34 ` [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static Joel Brobecker @ 2012-09-20 16:44 ` Joel Brobecker 2012-09-20 17:31 ` Pedro Alves 3 siblings, 1 reply; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 16:44 UTC (permalink / raw) To: gdb-patches; +Cc: Joel Brobecker gdb/ChangeLog: * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Delete. --- gdb/sol-thread.c | 74 ------------------------------------------------------ 1 files changed, 0 insertions(+), 74 deletions(-) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index cd37615..585a77f 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -959,80 +959,6 @@ ps_plog (const char *fmt, ...) vfprintf_filtered (gdb_stderr, fmt, args); } -/* Get size of extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) -{ -#if 0 - int lwp_fd; - int regsize; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCGXREGSIZE, ®size)) - { - if (errno == EINVAL) - return PS_NOFREGS; /* XXX Wrong code, but this is the closest - thing in proc_service.h */ - - print_sys_errmsg ("ps_lgetxregsize (): PIOCGXREGSIZE", errno); - return PS_ERR; - } -#endif - - return PS_OK; -} - -/* Get extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ -#if 0 - int lwp_fd; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCGXREG, xregset)) - { - print_sys_errmsg ("ps_lgetxregs (): PIOCGXREG", errno); - return PS_ERR; - } -#endif - - return PS_OK; -} - -/* Set extra register set. Currently a noop. */ - -ps_err_e -ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ -#if 0 - int lwp_fd; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCSXREG, xregset)) - { - print_sys_errmsg ("ps_lsetxregs (): PIOCSXREG", errno); - return PS_ERR; - } -#endif - - return PS_OK; -} - /* Get floating-point registers for LWP. */ ps_err_e -- 1.6.5.rc2 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 16:44 ` [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker @ 2012-09-20 17:31 ` Pedro Alves 2012-09-20 21:43 ` Joel Brobecker 0 siblings, 1 reply; 20+ messages in thread From: Pedro Alves @ 2012-09-20 17:31 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches Can you expand on what "unused" means? The Solaris man page I peeked at says these functions are SPARC only. Does this mean that current SPARC Solaris libthread_db doesn't call them after all? What about older versions? -- Pedro Alves ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 17:31 ` Pedro Alves @ 2012-09-20 21:43 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker ` (2 more replies) 0 siblings, 3 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 21:43 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 1409 bytes --] > Can you expand on what "unused" means? Good question! > The Solaris man page I peeked at says these functions are SPARC only. > Does this mean that current SPARC Solaris libthread_db doesn't call them > after all? What about older versions? It took me a while to investigate this part because our sparc-solaris machines are just sooooo sloooooowwww. Initially, I thought it might have been something related to OS versions, but the answer was right there in front of me, if I had tested the patch on *sparc* solaris (in addition to *x86* solaris). Basically, /usr/include/proc_service.h: #if defined(__sparc) || defined(__sparcv9) extern ps_err_e ps_lgetxregsize(struct ps_prochandle *, lwpid_t, int *); extern ps_err_e ps_lgetxregs(struct ps_prochandle *, lwpid_t, caddr_t); extern ps_err_e ps_lsetxregs(struct ps_prochandle *, lwpid_t, caddr_t); #endif In other words, these routines are used on sparc-solaris, while they are not expected on x86-solaris. I propose we start with the following patch (0001-[...].patch), and while at it, we remove all the commented out code (0002-[...]). This is a stop-gap measure to allow the build to work with -Werror on x86-solaris. And the next step I propose, to finish the work, is to move these functions to their own file (sol-sparc-thread.c). We would then only build that file for sparc-solaris native GDB. WDYT? Thanks, -- Joel [-- Attachment #2: 0001-sol-thread.c-conditionalize-some-sparc-specific-libt.patch --] [-- Type: text/x-diff, Size: 1051 bytes --] From 01b5ab3a4c11703220543e16e21f140f2eaf33e2 Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Thu, 20 Sep 2012 17:28:01 -0400 Subject: [PATCH 1/2] sol-thread.c: conditionalize some sparc-specific libthread_db functions. gdb/ChangeLog: * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Enable this code for sparc hosts only. --- gdb/sol-thread.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 78dcec3..323a122 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -984,6 +984,8 @@ ps_plog (const char *fmt, ...) vfprintf_filtered (gdb_stderr, fmt, args); } +#if defined(__sparc) || defined(__sparcv9) + /* Get size of extra register set. Currently a noop. */ ps_err_e @@ -1058,6 +1060,8 @@ ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) return PS_OK; } +#endif /* defined(__sparc) || defined(__sparcv9) */ + /* Get floating-point registers for LWP. */ ps_err_e -- 1.7.0.4 [-- Attachment #3: 0002-sol-thread.c-Remove-if-0-ed-code.patch --] [-- Type: text/x-diff, Size: 2143 bytes --] From 5ecc0d7df0ea8f2d53304326147a2a82220de2e8 Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Thu, 20 Sep 2012 17:29:35 -0400 Subject: [PATCH 2/2] sol-thread.c: Remove #if 0-ed code. gdb/ChangeLog: * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Remove commented-out code. --- gdb/sol-thread.c | 50 -------------------------------------------------- 1 files changed, 0 insertions(+), 50 deletions(-) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 323a122..b86079f 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -991,26 +991,6 @@ ps_plog (const char *fmt, ...) ps_err_e ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) { -#if 0 - int lwp_fd; - int regsize; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCGXREGSIZE, ®size)) - { - if (errno == EINVAL) - return PS_NOFREGS; /* XXX Wrong code, but this is the closest - thing in proc_service.h */ - - print_sys_errmsg ("ps_lgetxregsize (): PIOCGXREGSIZE", errno); - return PS_ERR; - } -#endif - return PS_OK; } @@ -1019,21 +999,6 @@ ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) ps_err_e ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) { -#if 0 - int lwp_fd; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCGXREG, xregset)) - { - print_sys_errmsg ("ps_lgetxregs (): PIOCGXREG", errno); - return PS_ERR; - } -#endif - return PS_OK; } @@ -1042,21 +1007,6 @@ ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) ps_err_e ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) { -#if 0 - int lwp_fd; - ps_err_e val; - - val = get_lwp_fd (ph, lwpid, &lwp_fd); - if (val != PS_OK) - return val; - - if (ioctl (lwp_fd, PIOCSXREG, xregset)) - { - print_sys_errmsg ("ps_lsetxregs (): PIOCSXREG", errno); - return PS_ERR; - } -#endif - return PS_OK; } -- 1.7.0.4 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 21:43 ` Joel Brobecker @ 2012-09-20 22:25 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker 2012-09-24 16:18 ` [PATCH 4/4] Delete unused functions in sol-thread.c Pedro Alves 2012-09-27 12:59 ` checked in: [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker 2 siblings, 1 reply; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 22:25 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches > And the next step I propose, to finish the work, is to move these > functions to their own file (sol-sparc-thread.c). We would then > only build that file for sparc-solaris native GDB. And attached is the final step. I can merge all 3 patches into a single delete-commented-out-code-and-move-to-sol-sparc-thread patch. Either way works for me. Tested on both x86-solaris (2.10) and sparc-solaris (2.9). How does it look? Thanks, -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 22:25 ` Joel Brobecker @ 2012-09-20 22:25 ` Joel Brobecker 2012-09-24 16:27 ` Pedro Alves 2012-09-27 13:02 ` checked in: New unit sparc-sol-thread.c extracted from sol-thread.c Joel Brobecker 0 siblings, 2 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-20 22:25 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 74 bytes --] > > And the next step I propose, to finish the work, ENOPATCH. -- Joel [-- Attachment #2: 0003-New-unit-sol-sparc-thread.c-extracted-from-sol-threa.patch --] [-- Type: text/x-diff, Size: 4865 bytes --] From 4cb2459b250fa92cfcdcd40e421ac1c8dbea5368 Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Thu, 20 Sep 2012 18:17:22 -0400 Subject: [PATCH 3/3] New unit sol-sparc-thread.c extracted from sol-thread.c Moving some sparc-specific routines out of sol-thread.c into their own (new) file. gdb/ChangeLog: * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Move these functions to sol-sparc-thread.c. * sol-sparc-thread.c: New file. * configure.ac: Add sol-sparc-thread.o to CONFIG_OBS and sol-sparc-thread.c to CONFIG_SRCS for sparc-solaris native configurations. * configure: Regenerate. --- gdb/configure | 7 +++++++ gdb/configure.ac | 7 +++++++ gdb/sol-sparc-thread.c | 43 +++++++++++++++++++++++++++++++++++++++++++ gdb/sol-thread.c | 28 ---------------------------- 4 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 gdb/sol-sparc-thread.c diff --git a/gdb/configure b/gdb/configure index d9d0aaa..7d14003 100755 --- a/gdb/configure +++ b/gdb/configure @@ -12534,6 +12534,13 @@ $as_echo "#define HAVE_THREAD_DB_LIB 1" >>confdefs.h CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" + # On SPARC CPUs, we also need to build sol-sparc-thread. + case ${host_cpu} in + sparc*) + CONFIG_OBS="${CONFIG_OBS} sol-sparc-thread.o" + CONFIG_SRCS="${CONFIG_SRCS} sol-sparc-thread.c" + ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : diff --git a/gdb/configure.ac b/gdb/configure.ac index 6069c08..15de347 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1781,6 +1781,13 @@ if test ${build} = ${host} -a ${host} = ${target} ; then [Define if using Solaris thread debugging.]) CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" + # On SPARC CPUs, we also need to build sol-sparc-thread. + case ${host_cpu} in + sparc*) + CONFIG_OBS="${CONFIG_OBS} sol-sparc-thread.o" + CONFIG_SRCS="${CONFIG_SRCS} sol-sparc-thread.c" + ;; + esac AC_CHECK_LIB(dl, dlopen) CONFIG_LDFLAGS="${CONFIG_LDFLAGS} $RDYNAMIC" # Sun randomly tweaked the prototypes in <proc_service.h> diff --git a/gdb/sol-sparc-thread.c b/gdb/sol-sparc-thread.c new file mode 100644 index 0000000..6b7c49d --- /dev/null +++ b/gdb/sol-sparc-thread.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "defs.h" +#include <proc_service.h> + +/* Get size of extra register set. Currently a noop. */ + +ps_err_e +ps_lgetxregsize (struct ps_prochandle *ph, lwpid_t lwpid, int *xregsize) +{ + return PS_OK; +} + +/* Get extra register set. Currently a noop. */ + +ps_err_e +ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset) +{ + return PS_OK; +} + +/* Set extra register set. Currently a noop. */ + +ps_err_e +ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset) +{ + return PS_OK; +} diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index b86079f..06a2fb6 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -984,34 +984,6 @@ ps_plog (const char *fmt, ...) vfprintf_filtered (gdb_stderr, fmt, args); } -#if defined(__sparc) || defined(__sparcv9) - -/* Get size of extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) -{ - return PS_OK; -} - -/* Get extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ - return PS_OK; -} - -/* Set extra register set. Currently a noop. */ - -ps_err_e -ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ - return PS_OK; -} - -#endif /* defined(__sparc) || defined(__sparcv9) */ - /* Get floating-point registers for LWP. */ ps_err_e -- 1.7.0.4 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 22:25 ` Joel Brobecker @ 2012-09-24 16:27 ` Pedro Alves 2012-09-24 16:37 ` Joel Brobecker 2012-09-27 13:02 ` checked in: New unit sparc-sol-thread.c extracted from sol-thread.c Joel Brobecker 1 sibling, 1 reply; 20+ messages in thread From: Pedro Alves @ 2012-09-24 16:27 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On 09/20/2012 10:43 PM, Joel Brobecker wrote: > And the next step I propose, to finish the work, is to move these > functions to their own file (sol-sparc-thread.c). We would then > only build that file for sparc-solaris native GDB. Fine with me either way. > > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Move these functions to sol-sparc-thread.c. > * sol-sparc-thread.c: New file. Following gdb naming de facto convention this new file would be named sparc-sol-thread.c though (as e.g., amd64-linux-nat.c, etc.). -- Pedro Alves ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-24 16:27 ` Pedro Alves @ 2012-09-24 16:37 ` Joel Brobecker 0 siblings, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-24 16:37 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches > Fine with me either way. OK - I will fix the formatting issue, and commit separately. > > gdb/ChangeLog: > > > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > > Move these functions to sol-sparc-thread.c. > > * sol-sparc-thread.c: New file. > > Following gdb naming de facto convention this new file would be named > sparc-sol-thread.c though (as e.g., amd64-linux-nat.c, etc.). But we already have ravenscar-sparc-thread.c :). I guess we should fix that too. Global consistency is probably better than per-topic consistency... Thanks for the review. I'll work on the last few details as soon as I have a moment. -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: New unit sparc-sol-thread.c extracted from sol-thread.c 2012-09-20 22:25 ` Joel Brobecker 2012-09-24 16:27 ` Pedro Alves @ 2012-09-27 13:02 ` Joel Brobecker 1 sibling, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 13:02 UTC (permalink / raw) To: gdb-patches [-- Attachment #1: Type: text/plain, Size: 493 bytes --] > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Move these functions to sol-sparc-thread.c. > * sol-sparc-thread.c: New file. > * configure.ac: Add sol-sparc-thread.o to CONFIG_OBS and > sol-sparc-thread.c to CONFIG_SRCS for sparc-solaris native > configurations. > * configure: Regenerate. Here is the patch that I checked in. It only renamed sol-sparc-thread.c into sparc-sol-thread.c. -- Joel [-- Attachment #2: 0003-New-unit-sparc-sol-thread.c-extracted-from-sol-threa.patch --] [-- Type: text/x-diff, Size: 5610 bytes --] From 331eba3bb8038a13df707e5bd4194f1e4f178688 Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Thu, 20 Sep 2012 18:17:22 -0400 Subject: [PATCH 1/2] New unit sparc-sol-thread.c extracted from sol-thread.c Moving some sparc-specific routines out of sol-thread.c into their own (new) file. gdb/ChangeLog: * 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. --- gdb/ChangeLog | 10 ++++++++++ gdb/configure | 7 +++++++ gdb/configure.ac | 7 +++++++ gdb/sol-thread.c | 28 ---------------------------- gdb/sparc-sol-thread.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 gdb/sparc-sol-thread.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fe6bc60..aba3e0f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,16 @@ 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. + +2012-09-27 Joel Brobecker <brobecker@adacore.com> + + * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Remove commented-out code. 2012-09-27 Joel Brobecker <brobecker@adacore.com> diff --git a/gdb/configure b/gdb/configure index f1a8f0f..d913de6 100755 --- a/gdb/configure +++ b/gdb/configure @@ -11969,6 +11969,13 @@ $as_echo "#define HAVE_THREAD_DB_LIB 1" >>confdefs.h CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" + # On SPARC CPUs, we also need to build sparc-sol-thread. + case ${host_cpu} in + sparc*) + CONFIG_OBS="${CONFIG_OBS} sparc-sol-thread.o" + CONFIG_SRCS="${CONFIG_SRCS} sparc-sol-thread.c" + ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : diff --git a/gdb/configure.ac b/gdb/configure.ac index 0c62b46..c0fd0e1 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1719,6 +1719,13 @@ if test ${build} = ${host} -a ${host} = ${target} ; then [Define if using Solaris thread debugging.]) CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" + # On SPARC CPUs, we also need to build sparc-sol-thread. + case ${host_cpu} in + sparc*) + CONFIG_OBS="${CONFIG_OBS} sparc-sol-thread.o" + CONFIG_SRCS="${CONFIG_SRCS} sparc-sol-thread.c" + ;; + esac AC_CHECK_LIB(dl, dlopen) CONFIG_LDFLAGS="${CONFIG_LDFLAGS} $RDYNAMIC" # Sun randomly tweaked the prototypes in <proc_service.h> diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index d948e9c..585a77f 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -959,34 +959,6 @@ ps_plog (const char *fmt, ...) vfprintf_filtered (gdb_stderr, fmt, args); } -#if defined (__sparc) || defined (__sparcv9) - -/* Get size of extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) -{ - return PS_OK; -} - -/* Get extra register set. Currently a noop. */ - -ps_err_e -ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ - return PS_OK; -} - -/* Set extra register set. Currently a noop. */ - -ps_err_e -ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) -{ - return PS_OK; -} - -#endif /* defined (__sparc) || defined (__sparcv9) */ - /* Get floating-point registers for LWP. */ ps_err_e diff --git a/gdb/sparc-sol-thread.c b/gdb/sparc-sol-thread.c new file mode 100644 index 0000000..6b7c49d --- /dev/null +++ b/gdb/sparc-sol-thread.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "defs.h" +#include <proc_service.h> + +/* Get size of extra register set. Currently a noop. */ + +ps_err_e +ps_lgetxregsize (struct ps_prochandle *ph, lwpid_t lwpid, int *xregsize) +{ + return PS_OK; +} + +/* Get extra register set. Currently a noop. */ + +ps_err_e +ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset) +{ + return PS_OK; +} + +/* Set extra register set. Currently a noop. */ + +ps_err_e +ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset) +{ + return PS_OK; +} -- 1.7.9.5 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 21:43 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker @ 2012-09-24 16:18 ` Pedro Alves 2012-09-24 16:40 ` Joel Brobecker 2012-09-27 13:04 ` checked in: sol-thread.c: Remove commented-out code Joel Brobecker 2012-09-27 12:59 ` checked in: [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker 2 siblings, 2 replies; 20+ messages in thread From: Pedro Alves @ 2012-09-24 16:18 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On 09/20/2012 10:43 PM, Joel Brobecker wrote: > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Enable this code for sparc hosts only. Looks good to me, with > +#if defined(__sparc) || defined(__sparcv9) space before parens. > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Remove commented-out code. There's more '#if 0'-related code in the file. I think that if we're removing these, we should get rid of all of it. I found it curious that http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc_db/common/thread_db.c says "Currently unused by dbx"... -- Pedro Alves ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-24 16:18 ` [PATCH 4/4] Delete unused functions in sol-thread.c Pedro Alves @ 2012-09-24 16:40 ` Joel Brobecker 2012-09-27 13:04 ` checked in: sol-thread.c: Remove commented-out code Joel Brobecker 1 sibling, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-24 16:40 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches > There's more '#if 0'-related code in the file. I think that if we're > removing these, we should get rid of all of it. I'll take care of those too... > I found it curious that > http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc_db/common/thread_db.c > says "Currently unused by dbx"... That might explain why it's OK to do nothing inside these routines... -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: sol-thread.c: Remove commented-out code 2012-09-24 16:18 ` [PATCH 4/4] Delete unused functions in sol-thread.c Pedro Alves 2012-09-24 16:40 ` Joel Brobecker @ 2012-09-27 13:04 ` Joel Brobecker 1 sibling, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 13:04 UTC (permalink / raw) To: gdb-patches [-- Attachment #1: Type: text/plain, Size: 401 bytes --] > There's more '#if 0'-related code in the file. I think that if we're > removing these, we should get rid of all of it. Attached is the patch I checked in, removing all thise #if 0's. The code inside them has been there since start of CVS... gdb/ChangeLog: * sol-thread.c (sol_thread_fetch_registers) (sol_thread_store_registers): Delete commented out code. Checked in. -- Joel [-- Attachment #2: 0004-sol-thread.c-Remove-commented-out-code.patch --] [-- Type: text/x-diff, Size: 3855 bytes --] From 6c52bb3ac607244001e00fed5fc489fbabdaf53b Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Thu, 27 Sep 2012 12:40:38 +0200 Subject: [PATCH 2/2] sol-thread.c: Remove commented-out code. gdb/ChangeLog: * sol-thread.c (sol_thread_fetch_registers) (sol_thread_store_registers): Delete commented out code. --- gdb/ChangeLog | 5 +++++ gdb/sol-thread.c | 54 ------------------------------------------------------ 2 files changed, 5 insertions(+), 54 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aba3e0f..8faa029 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2012-09-27 Joel Brobecker <brobecker@adacore.com> + * sol-thread.c (sol_thread_fetch_registers) + (sol_thread_store_registers): Delete commented out code. + +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. diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 585a77f..bd31f4f 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -443,11 +443,6 @@ sol_thread_fetch_registers (struct target_ops *ops, gdb_fpregset_t *fpregset_p = &fpregset; struct target_ops *beneath = find_target_beneath (ops); -#if 0 - int xregsize; - caddr_t xregset; -#endif - if (!is_thread (inferior_ptid)) { /* It's an LWP; pass the request on to the layer beneath. */ @@ -488,23 +483,6 @@ sol_thread_fetch_registers (struct target_ops *ops, supply_gregset (regcache, (const gdb_gregset_t *) gregset_p); supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset_p); - -#if 0 - /* FIXME: libthread_db doesn't seem to handle this right. */ - val = td_thr_getxregsize (&thandle, &xregsize); - if (val != TD_OK && val != TD_NOXREGS) - error (_("sol_thread_fetch_registers: td_thr_getxregsize %s"), - td_err_string (val)); - - if (val == TD_OK) - { - xregset = alloca (xregsize); - val = td_thr_getxregs (&thandle, xregset); - if (val != TD_OK) - error (_("sol_thread_fetch_registers: td_thr_getxregs %s"), - td_err_string (val)); - } -#endif } static void @@ -516,10 +494,6 @@ sol_thread_store_registers (struct target_ops *ops, td_err_e val; prgregset_t gregset; prfpregset_t fpregset; -#if 0 - int xregsize; - caddr_t xregset; -#endif if (!is_thread (inferior_ptid)) { @@ -557,23 +531,6 @@ sol_thread_store_registers (struct target_ops *ops, /* Restore new register value. */ regcache_raw_supply (regcache, regnum, old_value); - -#if 0 - /* FIXME: libthread_db doesn't seem to handle this right. */ - val = td_thr_getxregsize (&thandle, &xregsize); - if (val != TD_OK && val != TD_NOXREGS) - error (_("sol_thread_store_registers: td_thr_getxregsize %s"), - td_err_string (val)); - - if (val == TD_OK) - { - xregset = alloca (xregsize); - val = td_thr_getxregs (&thandle, xregset); - if (val != TD_OK) - error (_("sol_thread_store_registers: td_thr_getxregs %s"), - td_err_string (val)); - } -#endif } fill_gregset (regcache, (gdb_gregset_t *) &gregset, regnum); @@ -587,17 +544,6 @@ sol_thread_store_registers (struct target_ops *ops, if (val != TD_OK) error (_("sol_thread_store_registers: td_thr_setfpregs %s"), td_err_string (val)); - -#if 0 - /* FIXME: libthread_db doesn't seem to handle this right. */ - val = td_thr_getxregsize (&thandle, &xregsize); - if (val != TD_OK && val != TD_NOXREGS) - error (_("sol_thread_store_registers: td_thr_getxregsize %s"), - td_err_string (val)); - - /* ??? Should probably do something about writing the xregs here, - but what are they? */ -#endif } /* Perform partial transfers on OBJECT. See target_read_partial and -- 1.7.9.5 ^ permalink raw reply [flat|nested] 20+ messages in thread
* checked in: [PATCH 4/4] Delete unused functions in sol-thread.c. 2012-09-20 21:43 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker 2012-09-24 16:18 ` [PATCH 4/4] Delete unused functions in sol-thread.c Pedro Alves @ 2012-09-27 12:59 ` Joel Brobecker 2 siblings, 0 replies; 20+ messages in thread From: Joel Brobecker @ 2012-09-27 12:59 UTC (permalink / raw) To: gdb-patches > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Enable this code for sparc hosts only. Checked in, after having fixed the formatting issue. > gdb/ChangeLog: > > * sol-thread.c (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): > Remove commented-out code. Checked in. -- Joel ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-09-27 13:04 UTC | newest] Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-09-20 16:34 Various build-related fixes for solaris Joel Brobecker 2012-09-20 16:34 ` [PATCH 3/4] Add procfs_find_LDT_entry declaration (procfs.h) Joel Brobecker 2012-09-22 14:22 ` Jan Kratochvil 2012-09-27 12:56 ` checked in: " Joel Brobecker 2012-09-20 16:34 ` [PATCH 1/4] Fix declaration of proc_find_memory_regions Joel Brobecker 2012-09-27 12:55 ` checked in: " Joel Brobecker 2012-09-20 16:34 ` [PATCH 2/4] Make procfs.c:proc_get_LDT_entry static Joel Brobecker 2012-09-27 12:55 ` checked in: " Joel Brobecker 2012-09-20 16:44 ` [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker 2012-09-20 17:31 ` Pedro Alves 2012-09-20 21:43 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker 2012-09-20 22:25 ` Joel Brobecker 2012-09-24 16:27 ` Pedro Alves 2012-09-24 16:37 ` Joel Brobecker 2012-09-27 13:02 ` checked in: New unit sparc-sol-thread.c extracted from sol-thread.c Joel Brobecker 2012-09-24 16:18 ` [PATCH 4/4] Delete unused functions in sol-thread.c Pedro Alves 2012-09-24 16:40 ` Joel Brobecker 2012-09-27 13:04 ` checked in: sol-thread.c: Remove commented-out code Joel Brobecker 2012-09-27 12:59 ` checked in: [PATCH 4/4] Delete unused functions in sol-thread.c Joel Brobecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox