From patchwork Thu May 11 14:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 69153 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4ABC238560A4 for ; Thu, 11 May 2023 14:49:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4ABC238560A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683816540; bh=/5DEvIP8VKXAJ3REonMeLHHO1P0SqvnI3fytnns2IIM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=NP7w7Bze5jjPVUWWy33boc/CoPE4ykEDX9zvA/x/yXkZkX92n3BaQo9/zFTLtq1Hg DjwQiTG5Zwhs3jug6tLXzAtGI9xGYr1mpAdcCQEWXFFfQ3kDI46SGBGZ0Sw2r+PNKx OXLNh7qvgweVAeWrGDri9dEzhWOVnnmqHVfYe0pU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 574C13858C2F for ; Thu, 11 May 2023 14:48:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 574C13858C2F Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (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 ESMTPSA id D89841E11B; Thu, 11 May 2023 10:48:33 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 01/12] gdb: get gdbarch from syscall_catchpoint instead of location Date: Thu, 11 May 2023 10:48:21 -0400 Message-Id: <20230511144832.17974-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230511144832.17974-1-simon.marchi@efficios.com> References: <20230511144832.17974-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3497.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I noticed some methods of syscall_catchpoint doing this: struct gdbarch *gdbarch = loc->owner->gdbarch; `loc` is the list of locations of this catchpoint. Logically, the owner the locations are this catchpoint. So this just ends up getting this->gdbarch. Remove the unnecessary indirection through the loc. syscall_catchpoint::print_recreate does something slightly different, getting its arch from the loc: struct gdbarch *gdbarch = loc->gdbarch; I suppose it's always going to be the same arch, so get it from the catchpoint there too. Change-Id: I6f6a6f8e0cd7cfb754cecfb6249e71ec12ba4855 --- gdb/break-catch-syscall.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index d73f6616c97a..595b05c90c8e 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -197,7 +197,6 @@ syscall_catchpoint::print_it (const bpstat *bs) const must print "called syscall" or "returned from syscall". */ struct target_waitstatus last; struct syscall s; - struct gdbarch *gdbarch = b->gdbarch; get_last_target_status (nullptr, nullptr, &last); @@ -242,7 +241,6 @@ syscall_catchpoint::print_one (bp_location **last_loc) const { struct value_print_options opts; struct ui_out *uiout = current_uiout; - struct gdbarch *gdbarch = loc->owner->gdbarch; get_user_print_options (&opts); /* Field 4, the address, is omitted (which makes the columns not @@ -293,8 +291,6 @@ syscall_catchpoint::print_one (bp_location **last_loc) const void syscall_catchpoint::print_mention () const { - struct gdbarch *gdbarch = loc->owner->gdbarch; - if (!syscalls_to_be_caught.empty ()) { if (syscalls_to_be_caught.size () > 1) @@ -323,8 +319,6 @@ syscall_catchpoint::print_mention () const void syscall_catchpoint::print_recreate (struct ui_file *fp) const { - struct gdbarch *gdbarch = loc->gdbarch; - gdb_printf (fp, "catch syscall"); for (int iter : syscalls_to_be_caught)