From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 0984A38493CA for ; Mon, 13 Feb 2023 14:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0984A38493CA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 44F7D21866; Mon, 13 Feb 2023 14:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1676298189; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/pAt67f6nzWRr09oNVqVbQ6nO8M1Q171Gjs0AMVBduA=; b=Nb7OpL4Mv8nvdDY5BDxuudAHtPwsIDmJwPDrPsl3JtwtjAjz5Ue9Sdh4weHt3Iijr9LmeT AQEe1gDOo2Gm7BJ9mLtgigHt+0qqGzdMs97EmSgMqDc71KNCVYCioBE+dbnfzuZvX1s8uv uoX4FHiaYpLRAiI2iU+698pgNUW49lI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1676298189; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/pAt67f6nzWRr09oNVqVbQ6nO8M1Q171Gjs0AMVBduA=; b=KDEaEUSr1rL5D7hXgOX0GUzXzB1iYRLZHXh+DNrItoqpfr4ueAaI9PmqDUvvCQY2VAuPyJ NtpcWLnI2V/zKaCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2E720138E6; Mon, 13 Feb 2023 14:23:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6C06Cs1H6mOwfgAAMHmgww (envelope-from ); Mon, 13 Feb 2023 14:23:09 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 1/5] [gdb/symtab] Factor out compunit_epilogue_unwind_valid Date: Mon, 13 Feb 2023 15:23:05 +0100 Message-Id: <20230213142309.24366-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230213142309.24366-1-tdevries@suse.de> References: <20230213142309.24366-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,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: Factor out compunit_epilogue_unwind_valid from both amd64_stack_frame_destroyed_p and i386_stack_frame_destroyed_p. NFC. Also add a comment in the new function about the assumption that in absence of producer information, epilogue unwind info is invalid. --- gdb/amd64-tdep.c | 4 +--- gdb/i386-tdep.c | 4 +--- gdb/symtab.h | 13 +++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 328e001f5bb..d2e683b6fa8 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2902,10 +2902,8 @@ static int amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; - struct compunit_symtab *cust; - cust = find_pc_compunit_symtab (pc); - if (cust != NULL && cust->epilogue_unwind_valid ()) + if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc))) return 0; if (target_read_memory (pc, &insn, 1)) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 8dccae633f7..3fe548d8c68 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2219,10 +2219,8 @@ static int i386_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; - struct compunit_symtab *cust; - cust = find_pc_compunit_symtab (pc); - if (cust != NULL && cust->epilogue_unwind_valid ()) + if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc))) return 0; if (target_read_memory (pc, &insn, 1)) diff --git a/gdb/symtab.h b/gdb/symtab.h index 11ff875c6b8..cd6b5f722fd 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1917,6 +1917,19 @@ is_main_symtab_of_compunit_symtab (struct symtab *symtab) { return symtab == symtab->compunit ()->primary_filetab (); } + +/* Return true if epilogue unwind info of CUST is valid. */ + +static inline bool +compunit_epilogue_unwind_valid (struct compunit_symtab *cust) +{ + /* In absence of producer information, assume epilogue unwind info is + invalid. */ + if (cust == nullptr) + return false; + + return cust->epilogue_unwind_valid (); +} /* The virtual function table is now an array of structures which have the -- 2.35.3