Message ID | 20240821150654.27255-1-tdevries@suse.de |
---|---|
State | Committed |
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> 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 6EBA63870896 for <patchwork@sourceware.org>; Wed, 21 Aug 2024 15:06:27 +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 [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 18EFF385B50C for <gdb-patches@sourceware.org>; Wed, 21 Aug 2024 15:06:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 18EFF385B50C 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 18EFF385B50C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724252766; cv=none; b=YtyvlkuhX2N/YJXCJ9M+BdH0xk9dw38sUBOloa/kVy89PctNuvh3uy4vfcLTjdRQz918exp09FjlamL601ClZgzCXWsJpQh9krfIK93ThASjolo/I2mdUK147W1GZs0i9zhIeYRqXkWuRxQcQvgvP/LDAYoLMjXjDj5ypd2Gc7c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724252766; c=relaxed/simple; bh=+z7Cx2QyBeRVYold3f4Ms/RmF7OQT2zOVGM4SAKsJmk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=GpvAbsJussJZK4GSFwxZU6v0MZ36kSyqitWyHGFFLMf1Ln2H7dOcjwCgxILP+XgvV/l05N35CAmfgfvMDHuO9IvAaqTvVc85ju6KoXq1X/S9KnO4DBT0brYnsvbI0zlhzmXznQdeygH38P4I9qSNEO7Ddia7LmYSZwlh9OfGtxE= 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 2B0A721B39 for <gdb-patches@sourceware.org>; Wed, 21 Aug 2024 15:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724252764; 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=xQZzPWzGkSNsK6+pKI3k+UtMQwBsex5hzdKgwcV4aXs=; b=Bn64+S0F37u9sqgHRNyzLX6VvupGiJLzAPSL9SpeVjQq1AFSuRsrik/JnxbYEgluxI6D42 1Bt5xtTf1RKr/RJ+5z7R9wBtJT7uyRIHMR0as6aQKrXu7vJO1ekjMM5tRDh/1IRnXgf2Dy 9pVvwbiJJNlQ8aS6J+T+EmwqVP9RE1g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724252764; 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=xQZzPWzGkSNsK6+pKI3k+UtMQwBsex5hzdKgwcV4aXs=; b=G4qOaJBSqbLhz5r1Uky1Qfm3d35TI78seoRaupbzQrMEDFTwgOiBCpkSxss2kLuFHRHZ6n baAShWN1axVfuaCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=JQ2nvn70; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gJxFQpUs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724252763; 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=xQZzPWzGkSNsK6+pKI3k+UtMQwBsex5hzdKgwcV4aXs=; b=JQ2nvn70Yo+HZj9Jx3tGv5JlzkcG1bLvgkiXysunKYgWoP+uqI+12erLROOeafteOsDJXC mH/7gQzzl2fRanR8glSyIos47XqAScDNrp4lCKEMfV40dSANnDW1N92IgCOi4kTm6PtkOr DT1ND3XIbNbVQTryE8H+xuIUeFKSzk0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724252763; 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=xQZzPWzGkSNsK6+pKI3k+UtMQwBsex5hzdKgwcV4aXs=; b=gJxFQpUsLhML+cHFUvt0Xsmm6m/n+G1tdPtbtdcO0Qkty7SBeYkIRNRVNROmGZHbqv86VV GaHmdqKkacilS+Bg== 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 11AB013770 for <gdb-patches@sourceware.org>; Wed, 21 Aug 2024 15:06:03 +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 jBVWAlsCxmZ4QgAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Wed, 21 Aug 2024 15:06:03 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/python] Eliminate catch(...) in type_to_type_object Date: Wed, 21 Aug 2024 17:06:54 +0200 Message-Id: <20240821150654.27255-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B0A721B39 X-Spam-Score: -5.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-5.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:dkim] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[gdb/python] Eliminate catch(...) in type_to_type_object
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Test passed |
Commit Message
Tom de Vries
Aug. 21, 2024, 3:06 p.m. UTC
In type_to_type_object we have: ... try { if (type->is_stub ()) type = check_typedef (type); } catch (...) { /* Just ignore failures in check_typedef. */ } ... The catch is supposed to catch gdb_exception_error, but it catches any exception. Fix that by only ignoring gdb_exception_error. Also handle gdb_exception_quit / gdb_exception_forced_quit. I'm not sure if they can occur here, but handling them is trivial using GDB_PY_HANDLE_EXCEPTION, so why not? Tested on x86_64-linux. --- gdb/python/py-type.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) base-commit: 28c3bf55f0f9aca8619c6d01be34a02a887c5577
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> The catch is supposed to catch gdb_exception_error, but it catches any
Tom> exception.
Tom> Fix that by only ignoring gdb_exception_error.
Tom> Also handle gdb_exception_quit / gdb_exception_forced_quit. I'm not sure if
Tom> they can occur here, but handling them is trivial using
Tom> GDB_PY_HANDLE_EXCEPTION, so why not?
I think this is the right approach -- if a QUIT does happen in
check_typedef, and it propagates past here, it could cause a crash.
I suspect a failure like this is indeed possible because check_typedef
might result in CU expansion, which is maybe interruptible (or anyway we
want it to be someday).
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 8/21/24 19:03, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes: > > Tom> The catch is supposed to catch gdb_exception_error, but it catches any > Tom> exception. > > Tom> Fix that by only ignoring gdb_exception_error. > > Tom> Also handle gdb_exception_quit / gdb_exception_forced_quit. I'm not sure if > Tom> they can occur here, but handling them is trivial using > Tom> GDB_PY_HANDLE_EXCEPTION, so why not? > > I think this is the right approach -- if a QUIT does happen in > check_typedef, and it propagates past here, it could cause a crash. > > I suspect a failure like this is indeed possible because check_typedef > might result in CU expansion, which is maybe interruptible (or anyway we > want it to be someday). > OK, thanks for the confirmation, I've made the commit message less tentative, and pushed. Thanks, - Tom
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 863e6f6175f..c13b8610d37 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -1465,10 +1465,14 @@ type_to_type_object (struct type *type) if (type->is_stub ()) type = check_typedef (type); } - catch (...) + catch (const gdb_exception_error &) { /* Just ignore failures in check_typedef. */ } + catch (const gdb_exception &except) + { + GDB_PY_HANDLE_EXCEPTION (except); + } type_obj = PyObject_New (type_object, &type_object_type); if (type_obj)