From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /mJAIv89jGYj9B8AWB0awg (envelope-from ) for ; Mon, 08 Jul 2024 15:29:03 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lRHGWZ7Z; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 77AF51E0C3; Mon, 8 Jul 2024 15:29:03 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 016D01E030 for ; Mon, 8 Jul 2024 15:29:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D57D139ADB7C for ; Mon, 8 Jul 2024 19:28:13 +0000 (GMT) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 80A7E38739F4 for ; Mon, 8 Jul 2024 19:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80A7E38739F4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 80A7E38739F4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720466869; cv=none; b=LD9RIeziZvmuY62VjiKyMXeLtuymXZE7zBWZZi0c7hZkTXEjwlTubQVXd5YeETpl/y24xRWh7C6np2VBtrm/X+uwvtN9mqy7ul6uVkMbpA800DbpTXRQNcc6V44vSMv0ysOIuvcz+BeAWwaUmp5xmjAWfJ7cnXrh8Jng4JuLZ5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720466869; c=relaxed/simple; bh=R+88oUAOrrTG4tqRQ6tdQHg0ddPoK3VhzmOx5JrBh/E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HdkfoGAFIPRhm+SnfJsjbTD+eWvL+eLoc+vWlblcUPPXczv/hxPMTLdcPkcIYjzKifTVCdaqWGBXe2BEiyijZyrznnoA/48ktcBNvw/XYmiGb+OkMPY/+z3oxckBoN1E2BdzN4mEhI5T/xlerN6tLUbK0bQSe4U2D9xjVy4R5W4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-58b3fee65d8so4814058a12.3 for ; Mon, 08 Jul 2024 12:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720466856; x=1721071656; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PSUFcdeYv5H6pCd3eCCYJFnorKoY2mQzUHtmG778YA0=; b=lRHGWZ7Z28sIzNmByhnqKEOraCLFuBsiZNvUamb8vOe6/9DqHXpxJAbAwtCkxlOsRc WDghRqhM+l2nPFdD4Oaa21OuGaBz5g6ZFYdsuPhWidxcNfJntn3DaRLtg3l3Bx1ghEmC mUIXkQ3aoUNrVIm5P5N3uF329XQ3rjXpY+YByQlbc4ryLQMx5R5FeHSHhDk3NY02cRw+ tMe1i2kU71S12jGd7V3Eg9EPbnelK3hurHL/ULxqi3YwSBoE8rGMPwzVWkPv51yunQwF HgrvN36EvnUVU8ibX2rYvFYFQjREHKL+IDCJg4r4QA6tjeavzkXIF0HJX/SbFbzFjpaC dSAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720466856; x=1721071656; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PSUFcdeYv5H6pCd3eCCYJFnorKoY2mQzUHtmG778YA0=; b=jHdP3V/pe2vCpzXLWHPDaJ/nq3QUxP+yFlDOpH0iiOX2P/eT5OPR+eZdI/WBUokx66 thb9dFrARSC/M6UHU9mJHOV+GE2X+qz0qt2XY1MiBr6OsJF/9b4ky15XZpprbK12FX6F MJrCaguMn/t96w48DrN8bOhGOLPCW9lf2jS5yZUhcGpRNKsmSYb7OHgYmtzwHI7iYVIW CN+eCPsTjKBZUG3vCrAA4e+8HnOVh0/l8n8GsLa3ip0tCKsZYhaPtrTf8ObrTnjcnHSd /Je1y30DxQFu0NefaF/+uVf0Vt09DnhCyqchN+obxGN121YlwwlC0QQWj50Ee36J8lyh vh+w== X-Gm-Message-State: AOJu0YxII/pbPkEMWb9gy+Wo0D1G5ICz1JyHV+0cDM8pr9tR8OOXiFb2 h5fZ4lfB6d+GZL7cu+wNdWpZWl4PhzoCQziVBUNvpeHEEwZVOFEXARY1vw== X-Google-Smtp-Source: AGHT+IEsV5pyAJOqpToMqiBdV7QbUlVOs7gFPm07DbQGNmZ5Q566ON650kDsxdfWBZ5JQMgV5OJ5qA== X-Received: by 2002:aa7:d44b:0:b0:58c:f5bd:eb60 with SMTP id 4fb4d7f45d1cf-594bc7c821cmr289375a12.33.1720466855117; Mon, 08 Jul 2024 12:27:35 -0700 (PDT) Received: from fedora.home (2a02-a45d-88ac-0-c83c-1ca9-fff1-a85f.fixed6.kpn.net. [2a02:a45d:88ac:0:c83c:1ca9:fff1:a85f]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bda30f76sm161535a12.97.2024.07.08.12.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:27:34 -0700 (PDT) From: Alex Chronopoulos To: gdb-patches@sourceware.org Cc: Alex Chronopoulos Subject: [PATCH v5] Change message when reaching end of reverse history. Date: Mon, 8 Jul 2024 21:27:30 +0200 Message-ID: <20240708192730.264313-1-achronop@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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~public-inbox=simark.ca@sourceware.org In a record session, when we move backward, GDB switches from normal execution to simulation. Moving forward again, the emulation continues until the end of the reverse history. When the end is reached, the execution stops, and a warning message is shown. This message has been modified to indicate that the forward emulation has reached the end, but the execution can continue as normal, and the recording will also continue. Before this patch, the warning message shown in that case was the same as in the reverse case. This meant that when the end of history was reached in either backward or forward emulation, the same message was displayed: "No more reverse-execution history." This message has changed for these two cases. Backward emulation: "Reached end of recorded history; stopping. Backward execution from here not possible." Forward emulation: "Reached end of recorded history; stopping. Following forward execution will be added to history." The reason for this change is that the initial message was deceiving, for the forward case, making the user believe that forward debugging could not continue. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31224 --- gdb/NEWS | 5 +++ gdb/infrun.c | 9 +++++- gdb/testsuite/gdb.btrace/non-stop.exp | 32 ++++++++++++------- gdb/testsuite/gdb.reverse/break-precsave.exp | 6 ++-- gdb/testsuite/gdb.reverse/break-reverse.exp | 4 +-- .../gdb.reverse/machinestate-precsave.exp | 2 +- gdb/testsuite/gdb.reverse/sigall-precsave.exp | 2 +- 7 files changed, 41 insertions(+), 19 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 47677cb773a..ebec7d0a1bc 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -13,6 +13,11 @@ This may cause breakage when using an incompatible libc, like uclibc or newlib, or an older glibc. +* In a record session, when a forward emulation reaches the end of the reverse + history, the warning message has been changed to indicate that the end of the + history has been reached. It also specifies that the forward execution can + continue, and the recording will also continue. + *** Changes in GDB 15 * The MPX commands "show/set mpx bound" have been deprecated, as Intel diff --git a/gdb/infrun.c b/gdb/infrun.c index 1f32a63ad54..83030db543d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9266,8 +9266,15 @@ print_no_history_reason (struct ui_out *uiout) { if (uiout->is_mi_like_p ()) uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_NO_HISTORY)); + else if (execution_direction == EXEC_FORWARD) + uiout->text ("\nReached end of recorded history; stopping.\nFollowing " + "forward execution will be added to history.\n"); else - uiout->text ("\nNo more reverse-execution history.\n"); + { + gdb_assert (execution_direction == EXEC_REVERSE); + uiout->text ("\nReached end of recorded history; stopping.\nBackward " + "execution from here not possible.\n"); + } } /* Print current location without a level number, if we have changed diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp b/gdb/testsuite/gdb.btrace/non-stop.exp index 62c940e4cd6..5e43545f6a9 100644 --- a/gdb/testsuite/gdb.btrace/non-stop.exp +++ b/gdb/testsuite/gdb.btrace/non-stop.exp @@ -79,16 +79,26 @@ proc gdb_cont_to_bp_line { line threads nthreads } { $nthreads } -proc gdb_cont_to_no_history { threads cmd nthreads } { +proc gdb_cont_to_no_history_backward { threads cmd nthreads } { gdb_cont_to $threads $cmd \ [multi_line \ - "No more reverse-execution history\." \ + "Reached end of recorded.*Backward execution.*" \ "\[^\\\r\\\n\]*" \ "\[^\\\r\\\n\]*" \ ] \ $nthreads } +proc gdb_cont_to_no_history_forward { threads cmd nthreads } { + gdb_cont_to $threads $cmd \ + [multi_line \ + "Reached end of recorded.*Following forward.*" \ + "\[^\\\r\\\n\]*" \ + "\[^\\\r\\\n\]*" \ + ] \ + $nthreads +} + # trace the code between the two breakpoints with_test_prefix "prepare" { gdb_cont_to_bp_line "$srcfile:$bp_1" all 2 @@ -176,14 +186,14 @@ with_test_prefix "reverse-step" { with_test_prefix "continue" { with_test_prefix "thread 1" { with_test_prefix "continue" { - gdb_cont_to_no_history 1 "continue" 1 + gdb_cont_to_no_history_forward 1 "continue" 1 gdb_test "thread apply 1 info record" \ ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" gdb_test "thread apply 2 info record" \ ".*Replay in progress\. At instruction 5\." } with_test_prefix "reverse-continue" { - gdb_cont_to_no_history 1 "reverse-continue" 1 + gdb_cont_to_no_history_backward 1 "reverse-continue" 1 gdb_test "thread apply 1 info record" \ ".*Replay in progress\. At instruction 1\." gdb_test "thread apply 2 info record" \ @@ -193,14 +203,14 @@ with_test_prefix "continue" { with_test_prefix "thread 2" { with_test_prefix "continue" { - gdb_cont_to_no_history 2 "continue" 1 + gdb_cont_to_no_history_forward 2 "continue" 1 gdb_test "thread apply 1 info record" \ ".*Replay in progress\. At instruction 1\." gdb_test "thread apply 2 info record" \ ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" } with_test_prefix "reverse-continue" { - gdb_cont_to_no_history 2 "reverse-continue" 1 + gdb_cont_to_no_history_backward 2 "reverse-continue" 1 gdb_test "thread apply 1 info record" \ ".*Replay in progress\. At instruction 1\." gdb_test "thread apply 2 info record" \ @@ -215,8 +225,8 @@ with_test_prefix "no progress" { gdb_test "thread apply 1 record goto end" ".*" gdb_test "thread apply 2 record goto begin" ".*" - gdb_cont_to_no_history 1 "continue" 1 - gdb_cont_to_no_history 1 "step" 1 + gdb_cont_to_no_history_forward 1 "continue" 1 + gdb_cont_to_no_history_forward 1 "step" 1 gdb_test "thread apply 1 info record" \ ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" gdb_test "thread apply 2 info record" \ @@ -227,8 +237,8 @@ with_test_prefix "no progress" { gdb_test "thread apply 1 record goto begin" ".*" gdb_test "thread apply 2 record goto end" ".*" - gdb_cont_to_no_history 2 "continue" 1 - gdb_cont_to_no_history 2 "step" 1 + gdb_cont_to_no_history_forward 2 "continue" 1 + gdb_cont_to_no_history_forward 2 "step" 1 gdb_test "thread apply 1 info record" \ ".*Replay in progress\. At instruction 1\." gdb_test "thread apply 2 info record" \ @@ -238,7 +248,7 @@ with_test_prefix "no progress" { with_test_prefix "all" { gdb_test "thread apply all record goto begin" ".*" - gdb_cont_to_no_history all "continue" 2 + gdb_cont_to_no_history_forward all "continue" 2 gdb_test "thread apply 1 info record" \ ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" gdb_test "thread apply 2 info record" \ diff --git a/gdb/testsuite/gdb.reverse/break-precsave.exp b/gdb/testsuite/gdb.reverse/break-precsave.exp index b9d94681247..6d9b312185f 100644 --- a/gdb/testsuite/gdb.reverse/break-precsave.exp +++ b/gdb/testsuite/gdb.reverse/break-precsave.exp @@ -73,7 +73,7 @@ proc precsave_tests {} { -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" { pass "go to end of main forward" } - -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded.*Following forward.* end of main .*" { pass "go to end of main forward" } } @@ -87,7 +87,7 @@ proc precsave_tests {} { -re ".*Breakpoint $decimal,.*$srcfile:$main_location.*$gdb_prompt $" { pass "main backward" } - -re "No more reverse-execution history.* break in main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded.*Backward execution.* break in main .*" { pass "main backward" } } @@ -103,7 +103,7 @@ proc precsave_tests {} { -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" { pass "end of record log" } - -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded.*Following forward.* end of main .*" { pass "end of record log" } } diff --git a/gdb/testsuite/gdb.reverse/break-reverse.exp b/gdb/testsuite/gdb.reverse/break-reverse.exp index 1dd327ca654..66e9712707f 100644 --- a/gdb/testsuite/gdb.reverse/break-reverse.exp +++ b/gdb/testsuite/gdb.reverse/break-reverse.exp @@ -64,7 +64,7 @@ gdb_test_multiple "continue" "main backward" { -re ".*Breakpoint $decimal,.*$srcfile:$main_location.*$gdb_prompt $" { pass "main backward" } - -re "No more reverse-execution history.* break in main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded history.*Backward execution.*" { pass "main backward" } } @@ -80,7 +80,7 @@ gdb_test_multiple "continue" "end of record log" { -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" { pass "end of record log" } - -re "No more reverse-execution history.* end of main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded history.*Following forward.*" { pass "end of record log" } } diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp index 19c5934bfdf..cedca0f9b65 100644 --- a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp +++ b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp @@ -85,7 +85,7 @@ gdb_test_multiple "continue" "go to end of main forward" { -re ".*Breakpoint $decimal,.*$srcfile:$endmain.*$gdb_prompt $" { pass "go to end of main forward" } - -re "No more reverse-execution history.* end main .*$gdb_prompt $" { + -re -wrap "Reached end of recorded history.*Following forward.*" { pass "go to end of main forward" } } diff --git a/gdb/testsuite/gdb.reverse/sigall-precsave.exp b/gdb/testsuite/gdb.reverse/sigall-precsave.exp index e5890ad7af7..aab4551c874 100644 --- a/gdb/testsuite/gdb.reverse/sigall-precsave.exp +++ b/gdb/testsuite/gdb.reverse/sigall-precsave.exp @@ -128,7 +128,7 @@ proc test_one_sig_reverse {prevsig} { xfail "$testmsg (handled)" } } - -re "No more reverse-execution history.*kill.*$gdb_prompt " { + -re "Reached end of recorded history.*Backward execution.*kill.*$gdb_prompt " { if {$saw_signal} { pass "$testmsg (handled)" } else { -- 2.42.0