From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2HjgADIKq1+VGAAAWB0awg (envelope-from ) for ; Tue, 10 Nov 2020 16:46:26 -0500 Received: by simark.ca (Postfix, from userid 112) id E4F821F09C; Tue, 10 Nov 2020 16:46:24 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DCA281E58E for ; Tue, 10 Nov 2020 16:46:21 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EC063987002; Tue, 10 Nov 2020 21:46:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EC063987002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605044781; bh=WC2Apgp9Ch380eM7B2rHXOgsB4UTxCSbeH2zjmX/Z98=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=nl1KR8oc3Gq9oeUICyEmkzHYYhHZCjkmfVfOckd58ELs2c0OfBr392U4VWfOhoKiJ gHRVRfMnevvMq+4VThBoSJYoUr8H96S6kolp7wHuWMimWWoD/IA9pfMULO4AVgO2AB jNJ5UoHKjeigtGisf0hMXKgC4n8jnh7+Pm5fJuDs= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 669B33986826 for ; Tue, 10 Nov 2020 21:46:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 669B33986826 X-ASG-Debug-ID: 1605044776-0c856e6cd571450001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 3xtVdswWrgC4kDQE (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Nov 2020 16:46:16 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by smtp.ebox.ca (Postfix) with ESMTP id E93F9441B21; Tue, 10 Nov 2020 16:46:15 -0500 (EST) X-Barracuda-RBL-IP: 192.222.181.218 X-Barracuda-Effective-Source-IP: 192-222-181-218.qc.cable.ebox.net[192.222.181.218] X-Barracuda-Apparent-Source-IP: 192.222.181.218 To: gdb-patches@sourceware.org Subject: [PATCH 03/12] gdb: rename things related to step over chains Date: Tue, 10 Nov 2020 16:46:05 -0500 X-ASG-Orig-Subj: [PATCH 03/12] gdb: rename things related to step over chains Message-Id: <20201110214614.2842615-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201110214614.2842615-1-simon.marchi@efficios.com> References: <20201110214614.2842615-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1605044776 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 11342 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.85785 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Rename step_over_queue_head to global_thread_step_over_chain_head, to make it more obvious when reading code that we are touching the global queue. Rename all functions that operate on it to have "global" in their name, to make it clear on which chain they operate on. Also, in a subsequent patch, we'll need both global and non-global versions of these functions, so it will be easier to do the distinction if they are named properly. Normalize the naming to use "chain" everywhere instead of sometimes "queue", sometimes "chain". I also reworded a few comments in gdbthread.h. They implied that the step over chain is per-inferior, when in reality there is only one global chain, not one per inferior, as far as I understand. gdb/ChangeLog: * gdbthread.h (thread_step_over_chain_enqueue): Rename to... (global_thread_step_over_chain_enqueue): ... this. Update all users. (thread_step_over_chain_remove): Rename to... (global_thread_step_over_chain_remove): ... this. Update all users. (thread_step_over_chain_next): Rename to... (global_thread_step_over_chain_next): ... this. Update all users. * infrun.h (step_over_queue_head): Rename to... (global_thread_step_over_chain_head): ... this. Update all users. * infrun.c (step_over_queue_head): Rename to... (global_thread_step_over_chain_head): ... this. Update all users. * thread.c (step_over_chain_remove): Rename to... (thread_step_over_chain_remove): ... this. Update all users. (thread_step_over_chain_next): Rename to... (global_thread_step_over_chain_next): ... this. Update all users. (thread_step_over_chain_enqueue): Rename to... (global_thread_step_over_chain_enqueue): ... this. Update all users. (thread_step_over_chain_remove): Rename to... (global_thread_step_over_chain_remove): ... this. Update all users. Change-Id: Iabbf57d83c01321ca199d83fadb57f5b04e4d6d9 --- gdb/gdbthread.h | 16 ++++++++-------- gdb/infrun.c | 26 +++++++++++++------------- gdb/infrun.h | 4 ++-- gdb/thread.c | 18 +++++++++--------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 630727e2fb5..b5a32087289 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -741,20 +741,20 @@ extern value *get_last_thread_stack_temporary (struct thread_info *tp); extern bool value_in_thread_stack_temporaries (struct value *, struct thread_info *thr); -/* Add TP to the end of its inferior's pending step-over chain. */ +/* Add TP to the end of the global pending step-over chain. */ -extern void thread_step_over_chain_enqueue (struct thread_info *tp); +extern void global_thread_step_over_chain_enqueue (struct thread_info *tp); -/* Remove TP from its inferior's pending step-over chain. */ +/* Remove TP from the global pending step-over chain. */ -extern void thread_step_over_chain_remove (struct thread_info *tp); +extern void global_thread_step_over_chain_remove (struct thread_info *tp); -/* Return the next thread in the step-over chain starting at TP. NULL - if TP is the last entry in the chain. */ +/* Return the thread following TP in the global step-over chain, or NULL if TP + is the last entry in the chain. */ -extern struct thread_info *thread_step_over_chain_next (struct thread_info *tp); +extern struct thread_info *global_thread_step_over_chain_next (struct thread_info *tp); -/* Return true if TP is in the step-over chain. */ +/* Return true if TP is in any step-over chain. */ extern int thread_is_in_step_over_chain (struct thread_info *tp); diff --git a/gdb/infrun.c b/gdb/infrun.c index bb881f3510d..917a35c23ab 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1237,14 +1237,14 @@ follow_exec (ptid_t ptid, const char *exec_file_target) matically get reset there in the new process.). */ } -/* The queue of threads that need to do a step-over operation to get +/* The chain of threads that need to do a step-over operation to get past e.g., a breakpoint. What technique is used to step over the breakpoint/watchpoint does not matter -- all threads end up in the same queue, to maintain rough temporal order of execution, in order to avoid starvation, otherwise, we could e.g., find ourselves constantly stepping the same couple threads past their breakpoints over and over, if the single-step finish fast enough. */ -struct thread_info *step_over_queue_head; +struct thread_info *global_thread_step_over_chain_head; /* Bit flags indicating what the thread needs to step over. */ @@ -1692,7 +1692,7 @@ displaced_step_prepare_throw (thread_info *tp) displaced_debug_printf ("deferring step of %s", target_pid_to_str (tp->ptid).c_str ()); - thread_step_over_chain_enqueue (tp); + global_thread_step_over_chain_enqueue (tp); return 0; } else @@ -1947,7 +1947,7 @@ start_step_over (void) if (step_over_info_valid_p ()) return false; - for (tp = step_over_queue_head; tp != NULL; tp = next) + for (tp = global_thread_step_over_chain_head; tp != NULL; tp = next) { struct execution_control_state ecss; struct execution_control_state *ecs = &ecss; @@ -1956,7 +1956,7 @@ start_step_over (void) gdb_assert (!tp->stop_requested); - next = thread_step_over_chain_next (tp); + next = global_thread_step_over_chain_next (tp); /* If this inferior already has a displaced step in process, don't start a new one. */ @@ -1974,9 +1974,9 @@ start_step_over (void) if (must_be_in_line && displaced_step_in_progress_any_inferior ()) return false; - thread_step_over_chain_remove (tp); + global_thread_step_over_chain_remove (tp); - if (step_over_queue_head == NULL) + if (global_thread_step_over_chain_head == NULL) infrun_debug_printf ("step-over queue now empty"); if (tp->control.trap_expected @@ -3033,7 +3033,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) infrun_debug_printf ("need to step-over [%s] first", target_pid_to_str (tp->ptid).c_str ()); - thread_step_over_chain_enqueue (tp); + global_thread_step_over_chain_enqueue (tp); } switch_to_thread (cur_thr); @@ -3042,7 +3042,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) /* Enqueue the current thread last, so that we move all other threads over their breakpoints first. */ if (cur_thr->stepping_over_breakpoint) - thread_step_over_chain_enqueue (cur_thr); + global_thread_step_over_chain_enqueue (cur_thr); /* If the thread isn't started, we'll still need to set its prev_pc, so that switch_back_to_stepped_thread knows the thread hasn't @@ -3226,7 +3226,7 @@ infrun_thread_stop_requested (ptid_t ptid) start_step_over doesn't try to resume them automatically. */ if (thread_is_in_step_over_chain (tp)) - thread_step_over_chain_remove (tp); + global_thread_step_over_chain_remove (tp); /* If the thread is stopped, but the user/frontend doesn't know about that yet, queue a pending event, as if the @@ -4830,7 +4830,7 @@ stop_all_threads (void) target_pid_to_str (t->ptid).c_str ()); t->control.trap_expected = 0; - thread_step_over_chain_enqueue (t); + global_thread_step_over_chain_enqueue (t); } } else @@ -4853,7 +4853,7 @@ stop_all_threads (void) { /* Add it back to the step-over queue. */ t->control.trap_expected = 0; - thread_step_over_chain_enqueue (t); + global_thread_step_over_chain_enqueue (t); } regcache = get_thread_regcache (t); @@ -7781,7 +7781,7 @@ keep_going_pass_signal (struct execution_control_state *ecs) infrun_debug_printf ("step-over already in progress: " "step-over for %s deferred", target_pid_to_str (tp->ptid).c_str ()); - thread_step_over_chain_enqueue (tp); + global_thread_step_over_chain_enqueue (tp); } else { diff --git a/gdb/infrun.h b/gdb/infrun.h index 2084d3d16b5..ca0774e8e6b 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -262,9 +262,9 @@ extern void infrun_async (int enable); loop. */ extern void mark_infrun_async_event_handler (void); -/* The global queue of threads that need to do a step-over operation +/* The global chain of threads that need to do a step-over operation to get past e.g., a breakpoint. */ -extern struct thread_info *step_over_queue_head; +extern struct thread_info *global_thread_step_over_chain_head; /* Remove breakpoints if possible (usually that means, if everything is stopped). On failure, print a message. */ diff --git a/gdb/thread.c b/gdb/thread.c index 32d14e8662c..ceb19df1db6 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -207,7 +207,7 @@ set_thread_exited (thread_info *tp, bool silent) { /* Dead threads don't need to step-over. Remove from queue. */ if (tp->step_over_next != NULL) - thread_step_over_chain_remove (tp); + global_thread_step_over_chain_remove (tp); if (tp->state != THREAD_EXITED) { @@ -365,7 +365,7 @@ step_over_chain_enqueue (struct thread_info **list_p, struct thread_info *tp) /* Remove TP from step-over chain LIST_P. */ static void -step_over_chain_remove (struct thread_info **list_p, struct thread_info *tp) +thread_step_over_chain_remove (struct thread_info **list_p, struct thread_info *tp) { gdb_assert (tp->step_over_next != NULL); gdb_assert (tp->step_over_prev != NULL); @@ -386,11 +386,11 @@ step_over_chain_remove (struct thread_info **list_p, struct thread_info *tp) /* See gdbthread.h. */ struct thread_info * -thread_step_over_chain_next (struct thread_info *tp) +global_thread_step_over_chain_next (struct thread_info *tp) { struct thread_info *next = tp->step_over_next; - return (next == step_over_queue_head ? NULL : next); + return (next == global_thread_step_over_chain_head ? NULL : next); } /* See gdbthread.h. */ @@ -404,17 +404,17 @@ thread_is_in_step_over_chain (struct thread_info *tp) /* See gdbthread.h. */ void -thread_step_over_chain_enqueue (struct thread_info *tp) +global_thread_step_over_chain_enqueue (struct thread_info *tp) { - step_over_chain_enqueue (&step_over_queue_head, tp); + step_over_chain_enqueue (&global_thread_step_over_chain_head, tp); } /* See gdbthread.h. */ void -thread_step_over_chain_remove (struct thread_info *tp) +global_thread_step_over_chain_remove (struct thread_info *tp) { - step_over_chain_remove (&step_over_queue_head, tp); + thread_step_over_chain_remove (&global_thread_step_over_chain_head, tp); } /* Delete the thread referenced by THR. If SILENT, don't notify @@ -805,7 +805,7 @@ set_running_thread (struct thread_info *tp, bool running) the step-over queue, so that we don't try to resume it until the user wants it to. */ if (tp->step_over_next != NULL) - thread_step_over_chain_remove (tp); + global_thread_step_over_chain_remove (tp); } return started; -- 2.28.0