]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/mi: add no-history stop reason
authorBruno Larsen <blarsen@redhat.com>
Mon, 2 Jan 2023 13:35:50 +0000 (14:35 +0100)
committerBruno Larsen <blarsen@redhat.com>
Fri, 6 Jan 2023 09:51:50 +0000 (10:51 +0100)
When executing in reverse and runs out of recorded history, GDB prints
a warning to the user, but does not add a reason in the stopped record,
for example:

*stopped,frame={addr="0x000000000040113e",func="main",args=[],file="/home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c",fullname="/home/blarsen/Documents/binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c",line="27",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1"

This problem was reported as record/29260.

This commit adds the reason no-history to the record, making it easier
for interfaces using the mi interpreter to report the result.  It also
changes the test gdb.mi/mi-reverse.exp to test that the reason shows up
correctly.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29260

gdb/NEWS
gdb/doc/gdb.texinfo
gdb/infrun.c
gdb/mi/mi-common.c
gdb/mi/mi-common.h
gdb/testsuite/gdb.mi/mi-reverse.exp

index d8f4f396712b87b3fcd5714f710d689071857212..c0aac212e30cf5f450e76eb0223742846b4031ed 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -17,6 +17,11 @@ maintenance print record-instruction [ N ]
   prints how GDB would undo the N-th previous instruction, and if N is
   positive, it prints how GDB will redo the N-th following instruction.
 
+* MI changes
+
+** mi now reports 'no-history' as a stop reason when hitting the end of the
+   reverse execution history.
+
 *** Changes in GDB 13
 
 * MI version 1 is deprecated, and will be removed in GDB 14.
index dd8f8bc757c66ec87e40382ae0fdeb5348e9f91c..2f5b4bb4c61ad326db6b0ce75e2ea6e84fab2a0f 100644 (file)
@@ -30860,6 +30860,8 @@ The inferior returned from a system call.  This is reported when
 @item exec
 The inferior called @code{exec}.  This is reported when @code{catch exec}
 (@pxref{Set Catchpoints}) has been used.
+@item no-history
+There isn't enough history recorded to continue reverse execution.
 @end table
 
 The @var{id} field identifies the global thread ID of the thread
index d5f97e3362583781055fe182c37a5046f5c0f2a1..181d961d80d76e531e7e1aa61d05a7616b55d292 100644 (file)
@@ -8406,7 +8406,10 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
 void
 print_no_history_reason (struct ui_out *uiout)
 {
-  uiout->text ("\nNo more reverse-execution history.\n");
+  if (uiout->is_mi_like_p ())
+    uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_NO_HISTORY));
+  else
+    uiout->text ("\nNo more reverse-execution history.\n");
 }
 
 /* Print current location without a level number, if we have changed
index 51a8aaa8d0e538df08327c96547b12dc72975d03..ce70d11a912845eb9fd465006495c4eb0c7b76db 100644 (file)
@@ -39,6 +39,7 @@ static const char * const async_reason_string_lookup[] =
   "syscall-entry",
   "syscall-return",
   "exec",
+  "no-history",
   NULL
 };
 
index 6a1aea3539d555c567a284a9f61c87c5af20d82e..dfb83535b0b63ab07a9ef0126f19ce1bc04d4c26 100644 (file)
@@ -42,6 +42,7 @@ enum async_reply_reason
   EXEC_ASYNC_SYSCALL_ENTRY,
   EXEC_ASYNC_SYSCALL_RETURN,
   EXEC_ASYNC_EXEC,
+  EXEC_ASYNC_NO_HISTORY,
   /* This is here only to represent the number of enums.  */
   EXEC_ASYNC_LAST
 };
index e761ede03f53ee9b29f6085a7401ec734340e6c8..d631beb17c83d7a21401f8da818ed5ee84731ca1 100644 (file)
@@ -159,7 +159,7 @@ proc test_controlled_execution_reverse {} {
         "reverse-continue at callee3"
 
     mi_execute_to "exec-continue --reverse" \
-        "" "main" "" \
+        "no-history" "main" "" \
         "basics.c" $line_main_body "" \
         "reverse-continue at main"
 }