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: [RFC/commit 3/3] Delete unused variable in lynx_resume


> Error handling in gdbserver is poor.  The Windows ports
> ignore errors (I think errors there would be very rare).
> The Linux ports do error out, see bottom of linux_resume_one_lwp.

Thanks for the tip :). Attached are the two patches I committed.
One removes the unused variable. The other applies the same
treatment as in linux_resume_one_lwp.

gdb/gdbserver/ChangeLog:

        * lynx-low.c (lynx_resume): Delete variable ret.

        * lynx-low.c (lynx_resume): Call perror_with_name if lynx_ptrace
        sets errno.

Tested on ppc-lynx178, with no regressions. Applied.

Thank you,
-- 
Joel
>From eb807cbc8e31aa06e4de461a904c4023d0ef73c8 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 17 May 2012 14:40:08 -0400
Subject: [PATCH 1/6] Delete unused variable in lynx_resume

gdb/gdbserver/ChangeLog:

        * lynx-low.c (lynx_resume): Delete variable ret.
---
 gdb/gdbserver/ChangeLog  |    4 ++++
 gdb/gdbserver/lynx-low.c |    3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0c4a286..4aeb3f9 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-07  Joel Brobecker  <brobecker@adacore.com>
+
+	* lynx-low.c (lynx_resume): Delete variable ret.
+
 2013-01-01  Joel Brobecker  <brobecker@adacore.com>
 
 	* gdbreplay.c (gdbreplay_version): Update copyright year.
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 36bfd6d..9aa0140 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -354,10 +354,9 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
   const int request = (resume_info[0].kind == resume_step
                        ? PTRACE_SINGLESTEP : PTRACE_CONT);
   const int signal = resume_info[0].sig;
-  int ret;
 
   regcache_invalidate ();
-  ret = lynx_ptrace (request, inferior_ptid, 1, signal, 0);
+  lynx_ptrace (request, inferior_ptid, 1, signal, 0);
 }
 
 /* Resume the execution of the given PTID.  */
-- 
1.7.10.4

>From 8000502b584d143a8e327e54c5fc72f9923ae985 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Mon, 7 Jan 2013 02:36:36 -0500
Subject: [PATCH 5/6] Add ptrace error handling in lynx_resume

gdb/gdbserver/ChangeLog:

        * lynx-low.c (lynx_resume): Call perror_with_name if lynx_ptrace
        sets errno.
---
 gdb/gdbserver/ChangeLog  |    5 +++++
 gdb/gdbserver/lynx-low.c |    4 ++++
 2 files changed, 9 insertions(+)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 49aa286..581a864 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
 2013-01-07  Joel Brobecker  <brobecker@adacore.com>
 
+	* lynx-low.c (lynx_resume): Call perror_with_name if lynx_ptrace
+	sets errno.
+
+2013-01-07  Joel Brobecker  <brobecker@adacore.com>
+
 	* configure.srv (i[34567]86-*-lynxos*): Set srv_xmlfiles.
 
 2013-01-07  Joel Brobecker  <brobecker@adacore.com>
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 4aba379..ccee8c8 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -359,7 +359,11 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
     ptid = thread_to_gdb_id (current_inferior);
 
   regcache_invalidate ();
+
+  errno = 0;
   lynx_ptrace (request, ptid, 1, signal, 0);
+  if (errno)
+    perror_with_name ("ptrace");
 }
 
 /* Resume the execution of the given PTID.  */
-- 
1.7.10.4


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