* [PATCH] gdb/mi: add no-history stop reason
@ 2023-01-02 15:56 Bruno Larsen
2023-01-03 12:04 ` Andrew Burgess
2023-01-10 15:36 ` Pedro Alves
0 siblings, 2 replies; 5+ messages in thread
From: Bruno Larsen @ 2023-01-02 15:56 UTC (permalink / raw)
To: gdb-patches; +Cc: Bruno Larsen
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(-)
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
+ 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");
+ else
+ uiout->text ("\nNo more reverse-execution history.\n");
}
/* Print current location without a level number, if we have changed
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb/mi: add no-history stop reason
2023-01-02 15:56 [PATCH] gdb/mi: add no-history stop reason Bruno Larsen
@ 2023-01-03 12:04 ` Andrew Burgess
2023-01-04 14:40 ` Bruno Larsen
2023-01-10 15:36 ` Pedro Alves
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Burgess @ 2023-01-03 12:04 UTC (permalink / raw)
To: Bruno Larsen via Gdb-patches, gdb-patches; +Cc: Bruno Larsen
Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb/mi: add no-history stop reason
2023-01-03 12:04 ` Andrew Burgess
@ 2023-01-04 14:40 ` Bruno Larsen
0 siblings, 0 replies; 5+ messages in thread
From: Bruno Larsen @ 2023-01-04 14:40 UTC (permalink / raw)
To: Andrew Burgess, Bruno Larsen via Gdb-patches
On 03/01/2023 13:04, Andrew Burgess wrote:
> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb/mi: add no-history stop reason
2023-01-02 15:56 [PATCH] gdb/mi: add no-history stop reason Bruno Larsen
2023-01-03 12:04 ` Andrew Burgess
@ 2023-01-10 15:36 ` Pedro Alves
2023-01-10 15:39 ` Bruno Larsen
1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2023-01-10 15:36 UTC (permalink / raw)
To: Bruno Larsen, gdb-patches
Can we have a testcase for this?
Pedro Alves
On 2023-01-02 3:56 p.m., Bruno Larsen via Gdb-patches wrote:
> 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(-)
>
> 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
> + 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");
> + else
> + uiout->text ("\nNo more reverse-execution history.\n");
> }
>
> /* Print current location without a level number, if we have changed
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb/mi: add no-history stop reason
2023-01-10 15:36 ` Pedro Alves
@ 2023-01-10 15:39 ` Bruno Larsen
0 siblings, 0 replies; 5+ messages in thread
From: Bruno Larsen @ 2023-01-10 15:39 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
The v2 of this patch has a test case (and was approved by tromey and
already pushed)
--
Cheers,
Bruno
On 10/01/2023 16:36, Pedro Alves wrote:
> Can we have a testcase for this?
>
> Pedro Alves
>
> On 2023-01-02 3:56 p.m., Bruno Larsen via Gdb-patches wrote:
>> 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(-)
>>
>> 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
>> + 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");
>> + else
>> + uiout->text ("\nNo more reverse-execution history.\n");
>> }
>>
>> /* Print current location without a level number, if we have changed
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-10 15:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 15:56 [PATCH] gdb/mi: add no-history stop reason Bruno Larsen
2023-01-03 12:04 ` Andrew Burgess
2023-01-04 14:40 ` Bruno Larsen
2023-01-10 15:36 ` Pedro Alves
2023-01-10 15:39 ` Bruno Larsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).