From patchwork Mon Oct 28 12:40:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 99702 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 6361B3858424 for ; Mon, 28 Oct 2024 12:41:24 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 0C9973858D26 for ; Mon, 28 Oct 2024 12:40:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C9973858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C9973858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119260; cv=none; b=U8r2wSWxgeAz4882+j7pJoFjSWZOaCeHfdPb6i/WEPROxE9nfg/M4vb9++BMRE3jRq0T7NsoCqvguDwjDnBBXlsDq9T+YV3KlY7etykssYSTx/FmX9tmPnlw8bkDKYxHQMxFyDlikagypt1iyyV4kdVxE9pfcQg8vLenjpVKJ2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119260; c=relaxed/simple; bh=+5b8wJA/0UaSesVzHDoPs9FGEMVBYGkHP9+XbN/whls=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=oEVFH7I10OygZpPggt49m/hCffkjhto6zbdWh5TjRJTFb+0TE6QPamGZTTAWX0rUkU+IiXXTozqBjgeNEpZjLdS4G79ZPILJOEpQGFf7lz5EVvyOxTs7BI+9Ov8+GXRxsONfqURbeXyunYoHSQCkVEBH5SzJyCSsqSLJGiVFugQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DBBC021C18 for ; Mon, 28 Oct 2024 12:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=1m4/acKgjxLCQyoH5DUPknwiXM+nSNDjqFgeVUp+Ub8j5yxs+xpugSoCPu1SEd7GogTsy0 o2QGIJckRE5SSpT28iSB6KESQ3cluNnlgeBphEptW7vTwtZM9LO1ithdhsCBx0p6/XN8Bv X+T/sQObmFnIRZ/ERx9n06cYqRo69wk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=ekc1vkSPIE9TzjlgGwN/PEnpitsNARls19XLP/t0Og/Za+jOWCAwr5H1VhE+TOBiT36Myj UhvW96/Ba3Et4XBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=SejRIC2HaplDuTyuMDg0X8kxZGbK4MUYjzi2po9xr4amiTQOI4+glhIpHR9z6GzVC43NXm cZWdDmyzgA/HBWeH8DI1SnND6hCQPy39igCuzNM1XcXuja5iGsZztiZT2WWstxemTw9eGA oeNoZHF1+TuHfFJoNBL+gTjJgtikyAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=JgPZSpsOSbxUeCi6XKoOSjJrBmxxs0wHpSrBgKJEsCdgat72VlfYsDcta5j/yzXzyt1V8G sLY04Bt+5t1TajCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C49B8137D4 for ; Mon, 28 Oct 2024 12:40:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IlmBLleGH2cjYAAAD6G6ig (envelope-from ) for ; Mon, 28 Oct 2024 12:40:55 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 1/2] [gdb/symtab] Fix dwarf version of DWO TU Date: Mon, 28 Oct 2024 13:40:39 +0100 Message-Id: <20241028124040.19601-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org When running test-case gdb.ada/access_tagged_param.exp with target board fission, we run into: ... (gdb) break pck.adb:19^M gdb/dwarf2/read.h:289: internal-error: version: \ Assertion `m_dwarf_version != 0' failed.^M ... The assertion happens when calling cu->per_cu->version () in this workaround in read_subroutine_type: ... /* PR gas/29517 occurs in 2.39, and is fixed in 2.40, but it's only fixed for dwarf version >= 3 which supports DW_TAG_unspecified_type. */ if (type->code () == TYPE_CODE_VOID && !type->is_stub () && die->child == nullptr && (cu->per_cu->version () == 2 || producer_is_gas_2_39 (cu))) { ... for a TU in a dwo file. Fix this by: - adding a dwarf_version field to struct dwo_unit, - initializing the new field in create_debug_type_hash_table, and - using the new field in fill_in_sig_entry_from_dwo_entry to set the sig_entry dwarf version. Tested on aarch64-linux. PR symtab/32309 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32309 --- gdb/dwarf2/read.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 917ed12066382c48459f85124cbeca1286c3bb53 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6ac6f7c6a39..b407f0a47aa 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -324,6 +324,9 @@ struct dwo_unit /* For types, offset in the type's DIE of the type defined by this TU. */ cu_offset type_offset_in_tu; + + /* DWARF standard version of this DWO unit. */ + unsigned char dwarf_version; }; /* include/dwarf2.h defines the DWP section codes. @@ -3449,6 +3452,7 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile, dwo_tu->section = section; dwo_tu->sect_off = sect_off; dwo_tu->length = length; + dwo_tu->dwarf_version = header.version; slot = htab_find_slot (types_htab.get (), dwo_tu, INSERT); gdb_assert (slot != NULL); @@ -3545,6 +3549,7 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile, sig_entry->per_bfd = per_bfd; sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu; sig_entry->dwo_unit = dwo_entry; + sig_entry->set_version (dwo_entry->dwarf_version); } /* Subroutine of lookup_signatured_type. From patchwork Mon Oct 28 12:40:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 99703 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 770E6385840B for ; Mon, 28 Oct 2024 12:41:30 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 0C84E3858D20 for ; Mon, 28 Oct 2024 12:40:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C84E3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C84E3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119268; cv=none; b=eZdv97YCyPUqVK7K/859qpqg61ZT958MRBNMclYGUnF2OzY1e/8M79t5P+EbRwZyDUDPSENFNfAaBAht30CYaPExf0zgXc/g8/63tox1etWpRGR9I0QnjWVVur80wIdDbZijM1LoiE463pz0MT2a6qgjW3THcpOiB3goUAmI19s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119268; c=relaxed/simple; bh=yItWft0QMaWVJx/GRdAh46EH3DVRmplEcJStinq8cB8=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=mt/yu6+fut2XCAaIHyVmx3UiQzyJiaQ6T3YOvDbXB/0kJXNUPrZaKky/e0OuYEB1KUQnp9EEjrRLh3ZbZuX257+i1391Vxwe2vejogYNt4S2YN77xE5IPwmkF/ZZxNy5VDrmgbJWsKwJm8B5ZI1FPB33vtiXJC+WBMkgyfGbAKg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 08F9821DF8 for ; Mon, 28 Oct 2024 12:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBb6iBZShPaFiHqIhNqtY6+zAmvx0TUo178Y0OxnndA=; b=cSJMdig6sunzPwxPHvSW+m4pQjttKyDw6c+i7V6+9HiKTaXyhbiAP6Y6JSFuTBwgBMNG9Z AdjZC3WetZadRuavPCI+URh78qVh0vQBcIFn8du60U3FZIBTK00wEHqW5Ec0nxoDWoNa0A Giz9YmlYIHqArdhpoZeWgKHOl7RqZMw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBb6iBZShPaFiHqIhNqtY6+zAmvx0TUo178Y0OxnndA=; b=4LAPqqAA+4NvwVte8z/QnRoc40SQAO17IBpofFTMgZRUKmBeFSMTLrX37y/6oj8LExicLY bipP8FCLgya/6OAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=cSJMdig6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4LAPqqAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBb6iBZShPaFiHqIhNqtY6+zAmvx0TUo178Y0OxnndA=; b=cSJMdig6sunzPwxPHvSW+m4pQjttKyDw6c+i7V6+9HiKTaXyhbiAP6Y6JSFuTBwgBMNG9Z AdjZC3WetZadRuavPCI+URh78qVh0vQBcIFn8du60U3FZIBTK00wEHqW5Ec0nxoDWoNa0A Giz9YmlYIHqArdhpoZeWgKHOl7RqZMw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBb6iBZShPaFiHqIhNqtY6+zAmvx0TUo178Y0OxnndA=; b=4LAPqqAA+4NvwVte8z/QnRoc40SQAO17IBpofFTMgZRUKmBeFSMTLrX37y/6oj8LExicLY bipP8FCLgya/6OAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E315D13866 for ; Mon, 28 Oct 2024 12:40:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id AIUINleGH2cjYAAAD6G6ig (envelope-from ) for ; Mon, 28 Oct 2024 12:40:55 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 2/2] [gdb] Handle exception when getting result of inferior call Date: Mon, 28 Oct 2024 13:40:40 +0100 Message-Id: <20241028124040.19601-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241028124040.19601-1-tdevries@suse.de> References: <20241028124040.19601-1-tdevries@suse.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 08F9821DF8 X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org When running test-case gdb.ada/finish-var-size.exp with target board fission, we first run into PR32315 with the finish command (as reported in that PR), and then again with an inferior call: ... (gdb) print pck.get(True) gdb/dwarf2/read.c:5567: internal-error: load_full_comp_unit: \ Assertion `! this_cu->is_debug_types' failed. ... After the assert for the inferior call, we do: ... Quit this debugging session? (y or n) n ... Create a core file of GDB? (y or n) n ... and run into: ... gdb/infcall.c:1613: internal-error: call_function_by_hand_dummy: \ Assertion `retval != NULL' failed. ... So what happened? Instead of aborting for the first assertion, some error is thrown in call_thread_fsm::should_stop during the call to get_call_return_value, at which point the fsm is already set to finished: ... if (stop_stack_dummy == STOP_STACK_DUMMY) { /* Done. */ set_finished (); /* Stash the return value before the dummy frame is popped and registers are restored to what they were before the call.. */ return_value = get_call_return_value (&return_meta_info); } ... The error is caught by run_inferior_call, and returned to call_function_by_hand_dummy. Then in call_function_by_hand_dummy, we do: ... if (call_thread->state != THREAD_EXITED) { /* The FSM should still be the same. */ gdb_assert (call_thread->thread_fsm () == sm); if (call_thread->thread_fsm ()->finished_p ()) { struct value *retval; infcall_debug_printf ("call completed"); ... and end up in the "call completed" branch, asserting that call_thread->thread_fsm ()->return_value != NULL. Indeed the call completed successfully, but we ran into an exception fetching the return value of the call, so it's not there. Fix this by handling the case that an exception was returned by run_inferior_call in the "call completed" branch, getting us instead: ... (gdb) print pck.get(True) gdb/dwarf2/read.c:5567: internal-error: load_full_comp_unit: \ Assertion `! this_cu->is_debug_types' failed. ... Quit this debugging session? (y or n) n ... Create a core file of GDB? (y or n) n Command aborted. (gdb) ... Tested on aarch64-linux. PR gdb/32316 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32316 --- gdb/infcall.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/gdb/infcall.c b/gdb/infcall.c index 02e3b385bd7..4998b933520 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1610,25 +1610,29 @@ call_function_by_hand_dummy (struct value *function, maybe_remove_breakpoints (); - gdb_assert (retval != NULL); - /* Destruct the pass-by-ref argument clones. */ call_destructors (dtors_to_invoke, default_return_type); - return retval; + if (e.reason >= 0) + { + gdb_assert (retval != NULL); + return retval; + } } else - infcall_debug_printf ("call did not complete"); + { + infcall_debug_printf ("call did not complete"); - /* Didn't complete. Clean up / destroy the call FSM, and restore the - previous state machine, and handle the error. */ - { - std::unique_ptr finalizing - = call_thread->release_thread_fsm (); - call_thread->set_thread_fsm (std::move (saved_sm)); + /* Didn't complete. Clean up / destroy the call FSM, and restore + the previous state machine, and handle the error. */ + { + std::unique_ptr finalizing + = call_thread->release_thread_fsm (); + call_thread->set_thread_fsm (std::move (saved_sm)); - finalizing->clean_up (call_thread.get ()); - } + finalizing->clean_up (call_thread.get ()); + } + } } } @@ -1638,8 +1642,8 @@ call_function_by_hand_dummy (struct value *function, { const char *name = get_function_name (funaddr, name_buf, sizeof (name_buf)); - - discard_infcall_control_state (inf_status.release ()); + if (inf_status != nullptr) + discard_infcall_control_state (inf_status.release ()); /* We could discard the dummy frame here if the program exited, but it will get garbage collected the next time the program is