Message ID | 20240827140021.32660-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 5F2FE3860C36 for <patchwork@sourceware.org>; Tue, 27 Aug 2024 13:59:56 +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 9DBB33860743 for <gdb-patches@sourceware.org>; Tue, 27 Aug 2024 13:59:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9DBB33860743 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 9DBB33860743 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=1724767159; cv=none; b=XOSsvK378mYXeUUbHG3lNxpXXqAQhCqR4QidktU9Z+yQG3xLNCbV84dnFP+dA3xy/YFuCZBCEZVhsl1J3od0NLzbjn+3NcZBZ38z3ZIDRYqIfKOs1zMCrvdKL5F9Hh7oRE/LILqGN5kTUyyrjFX+NwQdcGwlkmmQhl+umxgIrU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724767159; c=relaxed/simple; bh=6J6RfY0W8RgusXpw6JG6/okO4/R9IJdTjf97XIDcMv4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=sFqRNB/KLin6sc0m+AoUQcWF4DVYUe1HeW3KzrEg6qOapeS6tGOV5hOQXEeB8ZdRir5cGle5HZ1wGvA2R09rGoJU9we5EEGZ4ShwcJC7gJiJKV9bo5cBALoJ/4p2bgX9vXALu8RY0D+Sb8rfDWbRirjIeWLOwEJgYUSqpG2fdB0= 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 6818121B07 for <gdb-patches@sourceware.org>; Tue, 27 Aug 2024 13:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724767155; 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=0EV6FnGDusQl4HQIvXbXVkhnz5oF3V8ahA6ZtxxaW6I=; b=qO9TrvWcSdjdv8jTlbx7IA+XopHzBFCOfVcjHU7ethBBp/7PKLk1zlyryJWGqXm3qESEQ0 PNRKj6iKliMT9IgOvSHNPYQ078aPfLKmLFbqG7/sVBZZz5KD4wofnIcYyFiGUkEEktnASo ZYYPfYnLY8dcp/KGAjmaRUM6NkwDW/E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724767155; 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=0EV6FnGDusQl4HQIvXbXVkhnz5oF3V8ahA6ZtxxaW6I=; b=qQgVDQn4Q74N6HA73o/nVn0GYuECZFzhiJSeQpOkuimWM6rnMh0ddRs0qvvKJ/qHb/kuka g0CrFavgrObxfMCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724767155; 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=0EV6FnGDusQl4HQIvXbXVkhnz5oF3V8ahA6ZtxxaW6I=; b=qO9TrvWcSdjdv8jTlbx7IA+XopHzBFCOfVcjHU7ethBBp/7PKLk1zlyryJWGqXm3qESEQ0 PNRKj6iKliMT9IgOvSHNPYQ078aPfLKmLFbqG7/sVBZZz5KD4wofnIcYyFiGUkEEktnASo ZYYPfYnLY8dcp/KGAjmaRUM6NkwDW/E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724767155; 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=0EV6FnGDusQl4HQIvXbXVkhnz5oF3V8ahA6ZtxxaW6I=; b=qQgVDQn4Q74N6HA73o/nVn0GYuECZFzhiJSeQpOkuimWM6rnMh0ddRs0qvvKJ/qHb/kuka g0CrFavgrObxfMCA== 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 5001B13A44 for <gdb-patches@sourceware.org>; Tue, 27 Aug 2024 13:59:15 +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 KQEfErPbzWbvBgAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Tue, 27 Aug 2024 13:59:15 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH 1/7] [gdb] Handle ^C in gnu_source_highlight_test Date: Tue, 27 Aug 2024 16:00:15 +0200 Message-Id: <20240827140021.32660-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: 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,imap1.dmz-prg2.suse.org:helo]; 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-Score: -2.80 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 | [1/7] Handle ^C in gnu_source_highlight_test | |
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. 27, 2024, 2 p.m. UTC
In gnu_source_highlight_test we have: ... try { res = try_source_highlight (styled_prog, language_c, fullname); } catch (...) { saw_exception = true; } ... This also swallows gdb_exception_quit and gdb_exception_forced_quit. I don't know whether these can actually happen here, but if not it's better to accommodate for the possibility anyway. Fix this by handling gdb_exception explicitly, and rethrowing gdb_exception_quit and gdb_exception_forced_quit. Tested on aarch64-linux. --- gdb/source-cache.c | 6 ++++++ 1 file changed, 6 insertions(+) base-commit: fd8ec8ed8258990700aaf422cea0e12208356014
Comments
On 8/27/24 16:00, Tom de Vries wrote: > In gnu_source_highlight_test we have: > ... > try > { > res = try_source_highlight (styled_prog, language_c, fullname); > } > catch (...) > { > saw_exception = true; > } > ... > > This also swallows gdb_exception_quit and gdb_exception_forced_quit. I don't > know whether these can actually happen here, but if not it's better to > accommodate for the possibility anyway. > > Fix this by handling gdb_exception explicitly, and rethrowing > gdb_exception_quit and gdb_exception_forced_quit. > Ping. Thanks, - Tom > Tested on aarch64-linux. > --- > gdb/source-cache.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gdb/source-cache.c b/gdb/source-cache.c > index 6af984fb88b..5486c1b8c2d 100644 > --- a/gdb/source-cache.c > +++ b/gdb/source-cache.c > @@ -282,6 +282,12 @@ static void gnu_source_highlight_test () > { > res = try_source_highlight (styled_prog, language_c, fullname); > } > + catch (const gdb_exception &e) > + { > + if (e.reason != RETURN_ERROR) > + throw; > + saw_exception = true; > + } > catch (...) > { > saw_exception = true; > > base-commit: fd8ec8ed8258990700aaf422cea0e12208356014
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> In gnu_source_highlight_test we have:
Tom> ...
Tom> try
Tom> {
Tom> res = try_source_highlight (styled_prog, language_c, fullname);
Tom> }
Tom> catch (...)
Tom> {
Tom> saw_exception = true;
Tom> }
Tom> ...
Tom> This also swallows gdb_exception_quit and gdb_exception_forced_quit. I don't
Tom> know whether these can actually happen here, but if not it's better to
Tom> accommodate for the possibility anyway.
It's doubtful but safe enough.
Tom> Fix this by handling gdb_exception explicitly, and rethrowing
Tom> gdb_exception_quit and gdb_exception_forced_quit.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 9/23/24 19:45, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes: > > Tom> In gnu_source_highlight_test we have: > Tom> ... > Tom> try > Tom> { > Tom> res = try_source_highlight (styled_prog, language_c, fullname); > Tom> } > Tom> catch (...) > Tom> { > Tom> saw_exception = true; > Tom> } > Tom> ... > > Tom> This also swallows gdb_exception_quit and gdb_exception_forced_quit. I don't > Tom> know whether these can actually happen here, but if not it's better to > Tom> accommodate for the possibility anyway. > > It's doubtful but safe enough. > > Tom> Fix this by handling gdb_exception explicitly, and rethrowing > Tom> gdb_exception_quit and gdb_exception_forced_quit. > > Approved-By: Tom Tromey <tom@tromey.com> I've pushed this series as posted, unless mentioned otherwise in an individual reply. Thanks for the reviews. - Tom
diff --git a/gdb/source-cache.c b/gdb/source-cache.c index 6af984fb88b..5486c1b8c2d 100644 --- a/gdb/source-cache.c +++ b/gdb/source-cache.c @@ -282,6 +282,12 @@ static void gnu_source_highlight_test () { res = try_source_highlight (styled_prog, language_c, fullname); } + catch (const gdb_exception &e) + { + if (e.reason != RETURN_ERROR) + throw; + saw_exception = true; + } catch (...) { saw_exception = true;