From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15454 invoked by alias); 24 May 2009 00:48:06 -0000 Received: (qmail 15433 invoked by uid 22791); 24 May 2009 00:48:04 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 May 2009 00:47:58 +0000 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id n4O0luMq022662 for ; Sat, 23 May 2009 17:47:56 -0700 Received: from localhost (ruffy.mtv.corp.google.com [172.18.118.116]) by wpaz5.hot.corp.google.com with ESMTP id n4O0lsBK010066 for ; Sat, 23 May 2009 17:47:55 -0700 Received: by localhost (Postfix, from userid 67641) id 9D429846C2; Sat, 23 May 2009 17:47:54 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [RFA] linux-low.c, linux_resume_one_lwp cleanup Message-Id: <20090524004754.9D429846C2@localhost> Date: Sun, 24 May 2009 00:48:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00524.txt.bz2 Hi. gdbserver's struct lwp_info is defined like so: struct lwp_info { struct inferior_list_entry head; [...] }; The prototype for linux_resume_one_lwp is this: static void linux_resume_one_lwp (struct inferior_list_entry *entry, int step, int signal, siginfo_t *info); Every caller does this to get the type correct: linux_resume_one_lwp (&lwp->head, 0, 0, NULL); and then linux_resume_one_lwp immediately does this to cast the type back to struct lwp_info *. struct lwp_info *lwp = (struct lwp_info *) entry; This patch cleans this up. Ok to check in? 2009-05-23 Doug Evans * linux-low.c (linux_resume_one_lwp): Change type of first arg from struct inferior_list_entry * to struct lwp_info *. All callers updated. Index: linux-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v retrieving revision 1.102 diff -u -p -r1.102 linux-low.c --- linux-low.c 13 May 2009 17:17:22 -0000 1.102 +++ linux-low.c 24 May 2009 00:42:40 -0000 @@ -121,7 +121,7 @@ int using_threads = 1; control of gdbserver have the same architecture. */ static int new_inferior; -static void linux_resume_one_lwp (struct inferior_list_entry *entry, +static void linux_resume_one_lwp (struct lwp_info *lwp, int step, int signal, siginfo_t *info); static void linux_resume (struct thread_resume *resume_info, size_t n); static void stop_all_lwps (void); @@ -323,8 +323,7 @@ handle_extended_wait (struct lwp_info *e /* Always resume the current thread. If we are stopping threads, it will have a pending SIGSTOP; we may as well collect it now. */ - linux_resume_one_lwp (&event_child->head, - event_child->stepping, 0, NULL); + linux_resume_one_lwp (event_child, event_child->stepping, 0, NULL); } } @@ -688,7 +687,7 @@ linux_detach_one_lwp (struct inferior_li /* Clear stop_expected, so that the SIGSTOP will be reported. */ lwp->stop_expected = 0; if (lwp->stopped) - linux_resume_one_lwp (&lwp->head, 0, 0, NULL); + linux_resume_one_lwp (lwp, 0, 0, NULL); linux_wait_for_event (lwp->head.id, &wstat, __WALL); } @@ -849,7 +848,7 @@ status_pending_p (struct inferior_list_e So instead of reporting the old SIGTRAP, pretend we got to the breakpoint just after it was removed instead of just before; resume the process. */ - linux_resume_one_lwp (&lwp->head, 0, 0, NULL); + linux_resume_one_lwp (lwp, 0, 0, NULL); return 0; } @@ -1074,8 +1073,7 @@ linux_wait_for_event_1 (ptid_t ptid, int if (debug_threads) fprintf (stderr, "Expected stop.\n"); event_child->stop_expected = 0; - linux_resume_one_lwp (&event_child->head, - event_child->stepping, 0, NULL); + linux_resume_one_lwp (event_child, event_child->stepping, 0, NULL); continue; } @@ -1117,7 +1115,7 @@ linux_wait_for_event_1 (ptid_t ptid, int info_p = &info; else info_p = NULL; - linux_resume_one_lwp (&event_child->head, + linux_resume_one_lwp (event_child, event_child->stepping, WSTOPSIG (*wstat), info_p); continue; @@ -1147,7 +1145,7 @@ linux_wait_for_event_1 (ptid_t ptid, int event_child->bp_reinsert = 0; /* Clear the single-stepping flag and SIGTRAP as we resume. */ - linux_resume_one_lwp (&event_child->head, 0, 0, NULL); + linux_resume_one_lwp (event_child, 0, 0, NULL); continue; } @@ -1189,18 +1187,18 @@ linux_wait_for_event_1 (ptid_t ptid, int events. */ if (bp_status == 2) /* No need to reinsert. */ - linux_resume_one_lwp (&event_child->head, 0, 0, NULL); + linux_resume_one_lwp (event_child, 0, 0, NULL); else if (the_low_target.breakpoint_reinsert_addr == NULL) { event_child->bp_reinsert = stop_pc; uninsert_breakpoint (stop_pc); - linux_resume_one_lwp (&event_child->head, 1, 0, NULL); + linux_resume_one_lwp (event_child, 1, 0, NULL); } else { reinsert_breakpoint_by_bp (stop_pc, (*the_low_target.breakpoint_reinsert_addr) ()); - linux_resume_one_lwp (&event_child->head, 0, 0, NULL); + linux_resume_one_lwp (event_child, 0, 0, NULL); } continue; @@ -1645,10 +1643,9 @@ stop_all_lwps (void) If SIGNAL is nonzero, give it that signal. */ static void -linux_resume_one_lwp (struct inferior_list_entry *entry, +linux_resume_one_lwp (struct lwp_info *lwp, int step, int signal, siginfo_t *info) { - struct lwp_info *lwp = (struct lwp_info *) entry; struct thread_info *saved_inferior; if (lwp->stopped == 0) @@ -1918,7 +1915,7 @@ linux_resume_one_thread (struct inferior else step = (lwp->resume->kind == resume_step); - linux_resume_one_lwp (&lwp->head, step, lwp->resume->sig, NULL); + linux_resume_one_lwp (lwp, step, lwp->resume->sig, NULL); } else {