From patchwork Sat Mar 2 07:26:11 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: 86697 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 F01833858413 for ; Sat, 2 Mar 2024 07:26:12 +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 752D63858D1E for ; Sat, 2 Mar 2024 07:25:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 752D63858D1E 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 752D63858D1E 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=1709364353; cv=none; b=RMY9HMWNpapHegBtugw8TxafV9Ft2THIFDa0bmfG+Xrqa9Kb+ZSBsY7DaIRoMp2i12iZSFPpro20G6P/w/0sgaY8PxjYk0XBBGIw32/XevI7Sq2ogM1bOcNMWxvqqeruSyQT3pjpMt/ut8z06z9nEV4uagXdNh84QVrqCtlKrPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709364353; c=relaxed/simple; bh=u7zTTezIXGBT3bc7oUjM5nbBGU0NrJjMT0/rixPJN38=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=pJNNrFGypIM7sdkyR0f1lEMdKqmz8gLD8RWjjlNjG4UWNmPo1JxL8DCGS988+xp3JYMLHtHmtn7FOQjKHaoc/xgrguruNDVPOiK/cux2rW5kD7FbOl5elGK3e102Z9+VbRb7f0hHfOETcKVdJYBQtUTkkSkLrJpAI3sn2OgmsQ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 653B035013 for ; Sat, 2 Mar 2024 07:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709364350; 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=woZg/ZTR+hqjwmQxNlANlfQyTmXrfUUH/kUc9hnizu8=; b=0FyJ3aAiHkkeBrzbrxCh4BIOAB0FMdS0Lbbn7VZPENcr23JoZy/6NpQAyJHV63WbNRDhJ+ rQ23YQDiOkYa/yf8QJvL/X7BNv9rV3DC6Jawhlnv7lAHOgL9Rxszl2hYRrexIorBs6O5Sq aJfd3uHjMwKILpnyVdtKz6dl0XF66IA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709364350; 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=woZg/ZTR+hqjwmQxNlANlfQyTmXrfUUH/kUc9hnizu8=; b=FK+PdJ9oqdQLqoi1Ka+mNKhc0QjkMCyR5V1OOr28M7LlwwV3234/L7bLKeK0Y37YIghxNl ejXH4fUiibGPknCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709364350; 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=woZg/ZTR+hqjwmQxNlANlfQyTmXrfUUH/kUc9hnizu8=; b=0FyJ3aAiHkkeBrzbrxCh4BIOAB0FMdS0Lbbn7VZPENcr23JoZy/6NpQAyJHV63WbNRDhJ+ rQ23YQDiOkYa/yf8QJvL/X7BNv9rV3DC6Jawhlnv7lAHOgL9Rxszl2hYRrexIorBs6O5Sq aJfd3uHjMwKILpnyVdtKz6dl0XF66IA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709364350; 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=woZg/ZTR+hqjwmQxNlANlfQyTmXrfUUH/kUc9hnizu8=; b=FK+PdJ9oqdQLqoi1Ka+mNKhc0QjkMCyR5V1OOr28M7LlwwV3234/L7bLKeK0Y37YIghxNl ejXH4fUiibGPknCg== 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 4CB0613A59 for ; Sat, 2 Mar 2024 07:25:50 +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 qZIeEX7U4mWpWgAAD6G6ig (envelope-from ) for ; Sat, 02 Mar 2024 07:25:50 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb] Further fix "value is not available" with debug frame Date: Sat, 2 Mar 2024 08:26:11 +0100 Message-Id: <20240302072611.30526-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [1.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: 1.90 X-Spam-Status: No, score=-12.3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org In commit 2aaba744467 ("[gdb] Fix "value is not available" with debug frame") I fixed a case in frame_unwind_register_value where using "set debug frame on" caused an "info frame" command to abort, reporting a "value is not available" error, due to the tpidruro register being unavailable. Subsequently, commit bbb12eb9c84 ("gdb/arm: Remove tpidruro register from non-FreeBSD target descriptions") removed the unavailable register, which caused a progression on test-case gdb.base/inline-frame-cycle-unwind.exp. While investigating the progression (see PR python/31437), I found that the "debug frame" output of the test-case (when reverting commit bbb12eb9c84) showed a smilar problem: ... Python Exception : value is not available^M ... that was absent without "debug frame". Fix this likewise in fetch_lazy_register, and update the test-case to check for the exception. Furthermore, I realized that there's both value::entirely_available and value::entirely_unavailable, and that commit 2aaba744467 handled the case of !entirely_available by printing unavailable. Instead, print: - "unavailable" for entirely_unavailable, and - "partly unavailable" for !entirely_unavailable && !entirely_available. Tested on x86_64-linux and arm-linux. --- gdb/frame.c | 8 ++++--- .../gdb.base/inline-frame-cycle-unwind.exp | 7 +++++- gdb/value.c | 23 ++++++++++++------- 3 files changed, 26 insertions(+), 12 deletions(-) base-commit: 5c97cb1c80994462632ba7c62a54a3fbecaff2ca diff --git a/gdb/frame.c b/gdb/frame.c index 5c7aae9edf4..c56655c55c1 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1315,9 +1315,7 @@ frame_unwind_register_value (const frame_info_ptr &next_frame, int regnum) if (value->lazy ()) gdb_printf (&debug_file, " lazy"); - else if (!value->entirely_available ()) - gdb_printf (&debug_file, " unavailable"); - else + else if (value->entirely_available ()) { int i; gdb::array_view buf = value->contents (); @@ -1328,6 +1326,10 @@ frame_unwind_register_value (const frame_info_ptr &next_frame, int regnum) gdb_printf (&debug_file, "%02x", buf[i]); gdb_printf (&debug_file, "]"); } + else if (value->entirely_unavailable ()) + gdb_printf (&debug_file, " unavailable"); + else + gdb_printf (&debug_file, " partly unavailable"); } frame_debug_printf ("%s", debug_file.c_str ()); diff --git a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp index 82632757f13..85e3cc32f0e 100644 --- a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp +++ b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp @@ -131,9 +131,14 @@ with_test_prefix "cycle at level 1" { gdb_test "maint flush register-cache" \ "Register cache flushed\\." "" gdb_test_no_output "set debug frame 1" +set ok 1 gdb_test_multiple "bt" "backtrace with debugging on" { -re "^$gdb_prompt $" { - pass $gdb_test_name + gdb_assert { $ok } $gdb_test_name + } + -re "Python Exception : \[^\r\n\]*\r\n" { + set ok 0 + exp_continue } -re "\[^\r\n\]+\r\n" { exp_continue diff --git a/gdb/value.c b/gdb/value.c index a2b2721d183..7ddfeb7c728 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -4014,9 +4014,6 @@ value::fetch_lazy_register () } else { - int i; - gdb::array_view buf = new_val->contents (); - if (new_val->lval () == lval_register) gdb_printf (&debug_file, " register=%d", new_val->regnum ()); else if (new_val->lval () == lval_memory) @@ -4026,11 +4023,21 @@ value::fetch_lazy_register () else gdb_printf (&debug_file, " computed"); - gdb_printf (&debug_file, " bytes="); - gdb_printf (&debug_file, "["); - for (i = 0; i < register_size (gdbarch, regnum); i++) - gdb_printf (&debug_file, "%02x", buf[i]); - gdb_printf (&debug_file, "]"); + if (new_val->entirely_available ()) + { + int i; + gdb::array_view buf = new_val->contents (); + + gdb_printf (&debug_file, " bytes="); + gdb_printf (&debug_file, "["); + for (i = 0; i < register_size (gdbarch, regnum); i++) + gdb_printf (&debug_file, "%02x", buf[i]); + gdb_printf (&debug_file, "]"); + } + else if (new_val->entirely_unavailable ()) + gdb_printf (&debug_file, " unavailable"); + else + gdb_printf (&debug_file, " partly unavailable"); } frame_debug_printf ("%s", debug_file.c_str ());