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.129.124]) by sourceware.org (Postfix) with ESMTPS id 8232A3858D35 for ; Wed, 4 Jan 2023 14:41:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8232A3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672843263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EWWA1XETvO3IfE44FI8E18xM8ENwL92nz7uVBASDZF0=; b=KhB13mBkq1mH82W77b+R0vlJj0B94Psb6Our0SvDgppd9vGtSMb4Z19wQnUGpEwGrCKcuj NgpBV5RBzbspSUsYPq8xr0wduesSLhhEsGThnytA78rfXUvWLv2dutNj8wOAyvyOx6wmEX ciRw9c8XobB3shsTENA4xTPAQA8896g= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-307-i2ls74-YO-WvVBYgy76ZVg-1; Wed, 04 Jan 2023 09:41:02 -0500 X-MC-Unique: i2ls74-YO-WvVBYgy76ZVg-1 Received: by mail-ej1-f69.google.com with SMTP id dn11-20020a17090794cb00b007c14ea70afcso20945718ejc.0 for ; Wed, 04 Jan 2023 06:41:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EWWA1XETvO3IfE44FI8E18xM8ENwL92nz7uVBASDZF0=; b=V93ygMvNq9+RCQ6kuidxabatL4d38qvgHPfWkNwblj+mK7SdX3oV2B4sDTe8wiU4bK OMzGZUpPIo/l6Onb1Wbl94uN+MNlqRdgxtxpK7NE2/vEKWhnIw+A2kVvVekOhZk+qkrp Zlk6laAlXSDQwNexZxFC2z9cK81UUrZzBb4lDfyMuBgYYMSADmTNAkGiYzOGj0jpXxEo msvfBhWwglJ7U5W+T+p8qeW8jMGb5TWYsmkripD8z57McCI5JOPWwoYRPD+/jlmIjiLF DAPNKA37YojHJyohy6JGhyKQRuJTvQ6AEm2arZ90X4vyL7HJlxUL9Mcjg+Id7IWcmKv9 Adjg== X-Gm-Message-State: AFqh2koLkjIVLXGkC6YSU5DxMWE8aNKRLGWTHEICafnGgPEvnhN+Mkb8 LHMPUPhcw7GNURWKH5ANztb48cI2UDkwRaqKqc4UMpX277/A30X3pPRmMPx76KyN4AZ2/cq7gTq 5AYGC08oCJqPXYRoUyq5v5A== X-Received: by 2002:a17:907:c68a:b0:84c:e9c4:5751 with SMTP id ue10-20020a170907c68a00b0084ce9c45751mr5146699ejc.74.1672843260408; Wed, 04 Jan 2023 06:41:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXteBW4HYa9HI0zJcYR5FIo8z+lOwoQ0FqvosORoxLn1zunl60EH7y0t9+ToLerMjSDTNSu4PA== X-Received: by 2002:a17:907:c68a:b0:84c:e9c4:5751 with SMTP id ue10-20020a170907c68a00b0084ce9c45751mr5146689ejc.74.1672843260204; Wed, 04 Jan 2023 06:41:00 -0800 (PST) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id la26-20020a170907781a00b0084767d40f0dsm15084469ejc.115.2023.01.04.06.40.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 06:40:59 -0800 (PST) Message-ID: <91615296-aa10-b8b5-dd77-3502036500ce@redhat.com> Date: Wed, 4 Jan 2023 15:40:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] gdb/mi: add no-history stop reason To: Andrew Burgess , Bruno Larsen via Gdb-patches References: <20230102155645.66733-1-blarsen@redhat.com> <87r0wbygct.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <87r0wbygct.fsf@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,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: On 03/01/2023 13:04, Andrew Burgess wrote: > 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/. There is already a test called gdb.mi/mi-reverse that handles executing reverse instructions in mi mode, including running till the end of the history.  I forgot to change it, but it will cover this change. > >> 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. I did see other places doing it, but I thought this was used for more complex stuff. Thanks for explaining! > > 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 -- Cheers, Bruno