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]

Re: [PATCH 4/4] Delete unused functions in sol-thread.c.


> 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
>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

>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, &regsize))
-    {
-      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


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