public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [gdbserver] Remove unused variables
@ 2010-09-02 14:00 Yao Qi
  2010-09-06 10:45 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2010-09-02 14:00 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]


Hi,
This patch is to remove unused variables in order to fix some build
failures I find today on GDB CVS HEAD.

gdb-mainline/gdb/gdbserver/server.c: In function 'start_inferior':
gdb-mainline/gdb/gdbserver/server.c:276:14: error: variable 'ptid' set
but not used [-Werror=unused-but-set-variable]
gdb-mainline/gdb/gdbserver/server.c: In function
'queue_stop_reply_callback':
gdb-mainline/gdb/gdbserver/server.c:2158:32: error: variable 'status'
set but not used [-Werror=unused-but-set-variable]

Tested on X86-64 native build.  No regressions.

-- 
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739

[-- Attachment #2: werror.patch --]
[-- Type: text/x-patch, Size: 3815 bytes --]

gdbserver/
2010-09-02  Yao Qi  <yao@codesourcery.com>

	* linux-low.c (linux_kill): Remove unused variable.
	(linux_fast_tracepoint_collecting): Likewise.
	(linux_stabilize_threads): Likewise.
	* server.c (start_inferior): Likewise.
	(queue_stop_reply_callback): Likewise.
	* tracepoint.c (do_action_at_tracepoint): Likewise.

Index: gdbserver/linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.162
diff -u -p -r1.162 linux-low.c
--- gdbserver/linux-low.c	1 Sep 2010 01:53:43 -0000	1.162
+++ gdbserver/linux-low.c	2 Sep 2010 08:50:09 -0000
@@ -775,7 +775,6 @@ linux_kill (int pid)
 {
   struct process_info *process;
   struct lwp_info *lwp;
-  struct thread_info *thread;
   int wstat;
   int lwpid;
 
@@ -792,7 +791,6 @@ linux_kill (int pid)
   /* See the comment in linux_kill_one_lwp.  We did not kill the first
      thread in the list, so do so now.  */
   lwp = find_lwp_pid (pid_to_ptid (pid));
-  thread = get_lwp_thread (lwp);
 
   if (debug_threads)
     fprintf (stderr, "lk_1: killing lwp %ld, for pid: %d\n",
@@ -1201,9 +1199,6 @@ linux_fast_tracepoint_collecting (struct
 static int
 maybe_move_out_of_jump_pad (struct lwp_info *lwp, int *wstat)
 {
-  struct thread_info *saved_inferior;
-
-  saved_inferior = current_inferior;
   current_inferior = get_lwp_thread (lwp);
 
   if ((wstat == NULL
@@ -1932,13 +1927,12 @@ linux_stabilize_threads (void)
     {
       struct target_waitstatus ourstatus;
       struct lwp_info *lwp;
-      ptid_t ptid;
       int wstat;
 
       /* Note that we go through the full wait even loop.  While
 	 moving threads out of jump pad, we need to be able to step
 	 over internal breakpoints and such.  */
-      ptid = linux_wait_1 (minus_one_ptid, &ourstatus, 0);
+      linux_wait_1 (minus_one_ptid, &ourstatus, 0);
 
       if (ourstatus.kind == TARGET_WAITKIND_STOPPED)
 	{
Index: gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.132
diff -u -p -r1.132 server.c
--- gdbserver/server.c	1 Sep 2010 17:29:32 -0000	1.132
+++ gdbserver/server.c	2 Sep 2010 08:50:09 -0000
@@ -273,13 +273,12 @@ start_inferior (char **argv)
   if (wrapper_argv != NULL)
     {
       struct thread_resume resume_info;
-      ptid_t ptid;
 
       resume_info.thread = pid_to_ptid (signal_pid);
       resume_info.kind = resume_continue;
       resume_info.sig = 0;
 
-      ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+      mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
 
       if (last_status.kind != TARGET_WAITKIND_STOPPED)
 	return signal_pid;
@@ -2155,11 +2154,6 @@ queue_stop_reply_callback (struct inferi
      manage the thread's last_status field.  */
   if (the_target->thread_stopped == NULL)
     {
-      struct target_waitstatus status;
-
-      status.kind = TARGET_WAITKIND_STOPPED;
-      status.value.sig = TARGET_SIGNAL_TRAP;
-
       /* Pass the last stop reply back to GDB, but don't notify
 	 yet.  */
       queue_stop_reply (entry->id, &thread->last_status);
Index: gdbserver/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/tracepoint.c,v
retrieving revision 1.11
diff -u -p -r1.11 tracepoint.c
--- gdbserver/tracepoint.c	1 Sep 2010 17:29:32 -0000	1.11
+++ gdbserver/tracepoint.c	2 Sep 2010 08:50:09 -0000
@@ -4126,13 +4126,10 @@ do_action_at_tracepoint (struct tracepoi
       }
     case 'R':
       {
-	struct collect_registers_action *raction;
-
 	unsigned char *regspace;
 	struct regcache tregcache;
 	struct regcache *context_regcache;
 
-	raction = (struct collect_registers_action *) taction;
 
 	trace_debug ("Want to collect registers");
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gdbserver] Remove unused variables
  2010-09-02 14:00 [gdbserver] Remove unused variables Yao Qi
@ 2010-09-06 10:45 ` Pedro Alves
  2010-09-06 15:22   ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-09-06 10:45 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi

On Thursday 02 September 2010 10:46:27, Yao Qi wrote:
> Hi,
> This patch is to remove unused variables in order to fix some build
> failures I find today on GDB CVS HEAD.

(...)

Most of the patch is okay, except:

>    if (debug_threads)
>      fprintf (stderr, "lk_1: killing lwp %ld, for pid: %d\n",
> @@ -1201,9 +1199,6 @@ linux_fast_tracepoint_collecting (struct
>  static int
>  maybe_move_out_of_jump_pad (struct lwp_info *lwp, int *wstat)
>  {
> -  struct thread_info *saved_inferior;
> -
> -  saved_inferior = current_inferior;
>    current_inferior = get_lwp_thread (lwp);

... this bit, that revealed a bug.  saved_inferior should be used.  Please
add a "current_inferior = saved_inferior;" statement before
every return path in this function instead.  Bonus points
if you do that in a separate patch from the "remove unused
variables" one.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gdbserver] Remove unused variables
  2010-09-06 10:45 ` Pedro Alves
@ 2010-09-06 15:22   ` Yao Qi
  2010-09-06 15:49     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2010-09-06 15:22 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

Pedro Alves wrote:
> 
> ... this bit, that revealed a bug.  saved_inferior should be used.  Please
> add a "current_inferior = saved_inferior;" statement before
> every return path in this function instead.  Bonus points
> if you do that in a separate patch from the "remove unused
> variables" one.
Pedro,
I've submit a separate patch against this issue which you pointed out.
http://sourceware.org/ml/gdb-patches/2010-09/msg00156.html

My updated patch to remove unused variables is attached.

-- 
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739

[-- Attachment #2: werror.patch --]
[-- Type: text/x-patch, Size: 3071 bytes --]

gdbserver/
2010-09-06  Yao Qi  <yao@codesourcery.com>

	* linux-low.c (linux_kill): Remove unused variable.
	(linux_stabilize_threads): Likewise.
	* server.c (start_inferior): Likewise.
	(queue_stop_reply_callback): Likewise.
	* tracepoint.c (do_action_at_tracepoint): Likewise.

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 76a4df1..b798c16 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -775,7 +775,6 @@ linux_kill (int pid)
 {
   struct process_info *process;
   struct lwp_info *lwp;
-  struct thread_info *thread;
   int wstat;
   int lwpid;
 
@@ -792,7 +791,6 @@ linux_kill (int pid)
   /* See the comment in linux_kill_one_lwp.  We did not kill the first
      thread in the list, so do so now.  */
   lwp = find_lwp_pid (pid_to_ptid (pid));
-  thread = get_lwp_thread (lwp);
 
   if (debug_threads)
     fprintf (stderr, "lk_1: killing lwp %ld, for pid: %d\n",
@@ -1935,13 +1933,12 @@ linux_stabilize_threads (void)
     {
       struct target_waitstatus ourstatus;
       struct lwp_info *lwp;
-      ptid_t ptid;
       int wstat;
 
       /* Note that we go through the full wait even loop.  While
 	 moving threads out of jump pad, we need to be able to step
 	 over internal breakpoints and such.  */
-      ptid = linux_wait_1 (minus_one_ptid, &ourstatus, 0);
+      linux_wait_1 (minus_one_ptid, &ourstatus, 0);
 
       if (ourstatus.kind == TARGET_WAITKIND_STOPPED)
 	{
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 528b658..dc6017a 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -273,13 +273,12 @@ start_inferior (char **argv)
   if (wrapper_argv != NULL)
     {
       struct thread_resume resume_info;
-      ptid_t ptid;
 
       resume_info.thread = pid_to_ptid (signal_pid);
       resume_info.kind = resume_continue;
       resume_info.sig = 0;
 
-      ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+      mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
 
       if (last_status.kind != TARGET_WAITKIND_STOPPED)
 	return signal_pid;
@@ -2155,11 +2154,6 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
      manage the thread's last_status field.  */
   if (the_target->thread_stopped == NULL)
     {
-      struct target_waitstatus status;
-
-      status.kind = TARGET_WAITKIND_STOPPED;
-      status.value.sig = TARGET_SIGNAL_TRAP;
-
       /* Pass the last stop reply back to GDB, but don't notify
 	 yet.  */
       queue_stop_reply (entry->id, &thread->last_status);
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 138d920..0e607d6 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -4126,13 +4126,10 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
       }
     case 'R':
       {
-	struct collect_registers_action *raction;
-
 	unsigned char *regspace;
 	struct regcache tregcache;
 	struct regcache *context_regcache;
 
-	raction = (struct collect_registers_action *) taction;
 
 	trace_debug ("Want to collect registers");
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gdbserver] Remove unused variables
  2010-09-06 15:22   ` Yao Qi
@ 2010-09-06 15:49     ` Pedro Alves
  2010-09-06 22:29       ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-09-06 15:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi

On Monday 06 September 2010 15:55:49, Yao Qi wrote:
>   gdbserver/
> 2010-09-06  Yao Qi  <yao@codesourcery.com>
> 
>         * linux-low.c (linux_kill): Remove unused variable.
>         (linux_stabilize_threads): Likewise.
>         * server.c (start_inferior): Likewise.
>         (queue_stop_reply_callback): Likewise.
>         * tracepoint.c (do_action_at_tracepoint): Likewise.

Okay, thanks.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gdbserver] Remove unused variables
  2010-09-06 15:49     ` Pedro Alves
@ 2010-09-06 22:29       ` Yao Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2010-09-06 22:29 UTC (permalink / raw)
  To: gdb-patches

Pedro Alves wrote:
> On Monday 06 September 2010 15:55:49, Yao Qi wrote:
>>   gdbserver/
>> 2010-09-06  Yao Qi  <yao@codesourcery.com>
>>
>>         * linux-low.c (linux_kill): Remove unused variable.
>>         (linux_stabilize_threads): Likewise.
>>         * server.c (start_inferior): Likewise.
>>         (queue_stop_reply_callback): Likewise.
>>         * tracepoint.c (do_action_at_tracepoint): Likewise.
> 
> Okay, thanks.
> 

Committed to GDB mainline.
http://www.cygwin.com/ml/gdb-cvs/2010-09/msg00047.html

-- 
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-06 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02 14:00 [gdbserver] Remove unused variables Yao Qi
2010-09-06 10:45 ` Pedro Alves
2010-09-06 15:22   ` Yao Qi
2010-09-06 15:49     ` Pedro Alves
2010-09-06 22:29       ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).