From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 77B953858D37 for ; Tue, 3 Jan 2023 12:04:06 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672747446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZkD46f8Er74ko79M8E1waW76bkAuzqirFnupRp9oD6M=; b=boEZ0peWat0iQrhjZ8PsrtK3XuLT7UZMJIMgKp0XumOybAqmdcZDPJtIm0Lfj1wf5J2e69 WRkUZ2S1AkyU1TsYJm+qV/LGpn5BXOfvvBZf2VYcFaooxfNpkFdVvzDyCHcCWfeKdqKslK aEKfrDLlRWjlvZnc9Hd0tPKpRdYkt2s= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-670-0xEv5JpkOaWgZssfFlrIIA-1; Tue, 03 Jan 2023 07:04:05 -0500 X-MC-Unique: 0xEv5JpkOaWgZssfFlrIIA-1 Received: by mail-wr1-f69.google.com with SMTP id m10-20020adfa3ca000000b00288d176460bso1688282wrb.11 for ; Tue, 03 Jan 2023 04:04:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZkD46f8Er74ko79M8E1waW76bkAuzqirFnupRp9oD6M=; b=e79ob8s5PPGy2mAW3B8NpfuHpdpPSsRtx/DnQAArae1KOW7oGiM0o5wP0O9/Rm0dp9 hLyJ8LyANvA9QVWViBrCKfCB9wpp54mDEYbhuTnahevSm0kaFf8t44QE6pFjI4PRpPR2 RSyqKL8H36JL41PSHXNbApfrjDRGr9u6Pu/4s9XuREtjRbWyx4V6yAMWoqV+2bpZGhE/ BHIWV843zwi0oExSXV98U/Hu+etOTru9Gd3tY5SzQt4u2g5VVD2VnTDznzCdcm0HdWtm 10s780QbH4u8cEnyCMeKM8GXXG7z6ZOuLxF7p7ZYDMm/4ZtxtxEoUbB+kdNByRj+oFtR Y0ww== X-Gm-Message-State: AFqh2ko2bKj+1qo0YRbqbuPF4+r/MnZmLBYu2GoGciI8CO2Y6OSLmuxz LY0Nt3gkhTV5sy9tS7sx60V9hUmHpIl0ACUtD6W+lUe1kz67q//hEpmU/e9DZifJGkhjihoKTFP m1g4HMKJxxZD+2y+K69Pv99RBiZ45cYEZaNX0CCpSz8a/ALPXeu1hKOzez9D1fU1mWbdbxHdfJQ == X-Received: by 2002:a5d:6d09:0:b0:277:2e27:61e7 with SMTP id e9-20020a5d6d09000000b002772e2761e7mr33668278wrq.17.1672747443849; Tue, 03 Jan 2023 04:04:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXtb9tLPRsvOzjMg1wfUF05CWd3cTZfA/6tQ6EF4FWFXG5h/76gvQ29ymiLyQH/D0/QGC+7qgw== X-Received: by 2002:a5d:6d09:0:b0:277:2e27:61e7 with SMTP id e9-20020a5d6d09000000b002772e2761e7mr33668256wrq.17.1672747443528; Tue, 03 Jan 2023 04:04:03 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id j6-20020a056000124600b0029100e8dedasm11287604wrx.28.2023.01.03.04.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 04:04:03 -0800 (PST) From: Andrew Burgess To: Bruno Larsen via Gdb-patches , gdb-patches@sourceware.org Cc: Bruno Larsen Subject: Re: [PATCH] gdb/mi: add no-history stop reason In-Reply-To: <20230102155645.66733-1-blarsen@redhat.com> References: <20230102155645.66733-1-blarsen@redhat.com> Date: Tue, 03 Jan 2023 12:04:02 +0000 Message-ID: <87r0wbygct.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: Bruno Larsen via Gdb-patches writes: > 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. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29260 > --- > gdb/NEWS | 5 +++++ > gdb/doc/gdb.texinfo | 2 ++ > gdb/infrun.c | 5 ++++- > 3 files changed, 11 insertions(+), 1 deletion(-) I think this should have a test added to gdb.reverse/. > > diff --git a/gdb/NEWS b/gdb/NEWS > index e61f06081de..3673bed8f46 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -5,6 +5,11 @@ > > * MI version 1 has been removed. > > +* MI changes > + > +** mi now reports 'no_history' as a stop reason when hitting the end of the s/no_history/no-history/ > + reverse execution history. > + > *** Changes in GDB 13 > > * MI version 1 is deprecated, and will be removed in GDB 14. > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index a72b2b9eb26..8982151a7e3 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -30851,6 +30851,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 > diff --git a/gdb/infrun.c b/gdb/infrun.c > index d5f97e33625..601d1a54701 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -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", "no-history"); If we look at how similar cases are handled in e.g. breakpoint.c, then we see that GDB looks up all these stop reason strings by calling async_reason_lookup. So, I think we should add a new reason to 'enum async_reply_reason' in mi/mi-common.h. The 'no-history' string should be added to 'async_reason_string_lookup' in mi-common.c, and then you should call async_reason_lookup here. Thanks, Andrew > + else > + uiout->text ("\nNo more reverse-execution history.\n"); > } > > /* Print current location without a level number, if we have changed > -- > 2.39.0