From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8D5243858017 for ; Wed, 4 Oct 2023 02:30:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D5243858017 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 3942U3th029756 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Oct 2023 22:30:08 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 3942U3th029756 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1696386608; bh=QCqS9hxpESqKJp7Upkr3URDlS8nsyTwcENeXG++xN7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z632L7tdP/lv/D6EhlGuc1KyVEmMfBEtEzg6lfX4cat3x3kOuja+E7+9kDoHRi/6c kui4WoJjxyI0eleVZ7nWguVz/Che17/lUQgVAdRzWQgiVQvTx9MVdCZGqOB9XnWvco Bo9lIU10enjcmrqOeSTy8avjPg41ej1kSpMh7+14= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0165E1E1A6; Tue, 3 Oct 2023 22:23:07 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 7/8] gdb: remove unnecessary nullptr check in free_objfile observers Date: Tue, 3 Oct 2023 22:20:22 -0400 Message-ID: <20231004022305.298534-8-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004022305.298534-1-simon.marchi@polymtl.ca> References: <20231004022305.298534-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 4 Oct 2023 02:30:03 +0000 X-Spam-Status: No, score=-3188.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Simon Marchi The free_objfile observable is never called with a nullptr objfile. Change-Id: I1e990edeb45bc38009ccb129c623911097ab65fe --- gdb/breakpoint.c | 3 --- gdb/printcmd.c | 7 +------ gdb/symfile.c | 3 +-- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f378edf865ea..db7d2e6a8e53 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8065,9 +8065,6 @@ disable_breakpoints_in_unloaded_shlib (program_space *pspace, so_list *solib) static void disable_breakpoints_in_freed_objfile (struct objfile *objfile) { - if (objfile == NULL) - return; - /* OBJF_SHARED|OBJF_USERLOADED objfiles are dynamic modules manually managed by the user with add-symbol-file/remove-symbol-file. Similarly to how breakpoints in shared libraries are handled in diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7e5f062caec3..d29a57f89b55 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2355,12 +2355,7 @@ disable_display_command (const char *args, int from_tty) static void clear_dangling_display_expressions (struct objfile *objfile) { - struct program_space *pspace; - - /* With no symbol file we cannot have a block or expression from it. */ - if (objfile == NULL) - return; - pspace = objfile->pspace; + program_space *pspace = objfile->pspace; if (objfile->separate_debug_objfile_backlink) { objfile = objfile->separate_debug_objfile_backlink; diff --git a/gdb/symfile.c b/gdb/symfile.c index d8b67d094ab2..c2779681cd21 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3736,8 +3736,7 @@ static void symfile_free_objfile (struct objfile *objfile) { /* Remove the target sections owned by this objfile. */ - if (objfile != NULL) - current_program_space->remove_target_sections ((void *) objfile); + current_program_space->remove_target_sections (objfile); } /* Wrapper around the quick_symbol_functions expand_symtabs_matching "method". -- 2.42.0