Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix gstack issues
@ 2025-03-27 15:54 Keith Seitz
  2025-03-27 18:02 ` Guinevere Larsen
  2025-03-27 18:15 ` Tom Tromey
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Seitz @ 2025-03-27 15:54 UTC (permalink / raw)
  To: gdb-patches

With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
Fedora's gstack script to gdb.  Some issues have arisen since
then, and this patch addresses those issues:

. As Sam James recently noted[1], PKGVERSION and VERSION
  need to be quoted.
. A Fedora user reported the misuse of --readnever, which
  causes gstack to omit filename and line number information in the
  backtrace[Red Hat BZ 2354997].

[1] https://inbox.sourceware.org/gdb-patches/d19d6bc17e0a160ce27fc572079f11a587c0e168.1742424869.git.sam@gentoo.org/
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2354997
---
 gdb/gstack-1.in                   | 8 ++++----
 gdb/testsuite/gdb.base/gstack.exp | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
index 5e413290c9a..25339d9877d 100755
--- a/gdb/gstack-1.in
+++ b/gdb/gstack-1.in
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,8 +22,8 @@
 GDB=${GDB:-$(command -v gdb)}
 GDBARGS=${GDBARGS:-}
 AWK=${AWK:-}
-PKGVERSION=@PKGVERSION@
-VERSION=@VERSION@
+PKGVERSION="@PKGVERSION@"
+VERSION="@VERSION@"
 
 # Find an appropriate awk interpreter if one was not specified
 # via the environment.
@@ -132,7 +132,7 @@ EOF
 	  )
 
 # Run GDB and remove some unwanted noise.
-"$GDB" --quiet -nx --readnever $GDBARGS <<EOF |
+"$GDB" --quiet -nx $GDBARGS <<EOF |
 set width 0
 set height 0
 set pagination no
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
index 8df36b1b3bc..89be67619bc 100644
--- a/gdb/testsuite/gdb.base/gstack.exp
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -62,8 +62,10 @@ if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } $test] } {
 set test "got backtrace"
 set saw_backtrace false
 set no_awk false
+set location_re ${srcfile}:${decimal}
+
 gdb_expect {
-    -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*\r\nGSTACK-END\r\n\$" {
+    -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*$location_re.*\r\nGSTACK-END\r\n\$" {
 	set saw_backtrace true
 	pass $test
 	exp_continue

base-commit: 08ed5584d871a1d3fee92917805bda86ce45fac9
-- 
2.48.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-27 15:54 [PATCH] Fix gstack issues Keith Seitz
@ 2025-03-27 18:02 ` Guinevere Larsen
  2025-03-27 18:15 ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: Guinevere Larsen @ 2025-03-27 18:02 UTC (permalink / raw)
  To: Keith Seitz, gdb-patches

On 3/27/25 12:54 PM, Keith Seitz wrote:
> With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
> Fedora's gstack script to gdb.  Some issues have arisen since
> then, and this patch addresses those issues:
>
> . As Sam James recently noted[1], PKGVERSION and VERSION
>    need to be quoted.
> . A Fedora user reported the misuse of --readnever, which
>    causes gstack to omit filename and line number information in the
>    backtrace[Red Hat BZ 2354997].
>
> [1] https://inbox.sourceware.org/gdb-patches/d19d6bc17e0a160ce27fc572079f11a587c0e168.1742424869.git.sam@gentoo.org/
> Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2354997
> ---

Thanks for the quick turnaround in this!

I tested this and it works now, thanks!

Tested-By: Guinevere Larsen <guinevere@redhat.com>

>   gdb/gstack-1.in                   | 8 ++++----
>   gdb/testsuite/gdb.base/gstack.exp | 6 ++++--
>   2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
> index 5e413290c9a..25339d9877d 100755
> --- a/gdb/gstack-1.in
> +++ b/gdb/gstack-1.in
> @@ -1,6 +1,6 @@
>   #!/usr/bin/env bash
>   
> -# Copyright (C) 2024 Free Software Foundation, Inc.
> +# Copyright (C) 2024-2025 Free Software Foundation, Inc.
>   
>   # This program is free software; you can redistribute it and/or modify
>   # it under the terms of the GNU General Public License as published by
> @@ -22,8 +22,8 @@
>   GDB=${GDB:-$(command -v gdb)}
>   GDBARGS=${GDBARGS:-}
>   AWK=${AWK:-}
> -PKGVERSION=@PKGVERSION@
> -VERSION=@VERSION@
> +PKGVERSION="@PKGVERSION@"
> +VERSION="@VERSION@"
>   
>   # Find an appropriate awk interpreter if one was not specified
>   # via the environment.
> @@ -132,7 +132,7 @@ EOF
>   	  )
>   
>   # Run GDB and remove some unwanted noise.
> -"$GDB" --quiet -nx --readnever $GDBARGS <<EOF |
> +"$GDB" --quiet -nx $GDBARGS <<EOF |
>   set width 0
>   set height 0
>   set pagination no
> diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
> index 8df36b1b3bc..89be67619bc 100644
> --- a/gdb/testsuite/gdb.base/gstack.exp
> +++ b/gdb/testsuite/gdb.base/gstack.exp
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2024 Free Software Foundation, Inc.
> +# Copyright (C) 2024-2025 Free Software Foundation, Inc.
>   
>   # This program is free software; you can redistribute it and/or modify
>   # it under the terms of the GNU General Public License as published by
> @@ -62,8 +62,10 @@ if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } $test] } {
>   set test "got backtrace"
>   set saw_backtrace false
>   set no_awk false
> +set location_re ${srcfile}:${decimal}
> +
>   gdb_expect {
> -    -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*\r\nGSTACK-END\r\n\$" {
> +    -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*$location_re.*\r\nGSTACK-END\r\n\$" {
>   	set saw_backtrace true
>   	pass $test
>   	exp_continue
>
> base-commit: 08ed5584d871a1d3fee92917805bda86ce45fac9


-- 
Cheers,
Guinevere Larsen
She/Her/Hers


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-27 15:54 [PATCH] Fix gstack issues Keith Seitz
  2025-03-27 18:02 ` Guinevere Larsen
@ 2025-03-27 18:15 ` Tom Tromey
  2025-03-28 15:17   ` Keith Seitz
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2025-03-27 18:15 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
Keith> Fedora's gstack script to gdb.  Some issues have arisen since
Keith> then, and this patch addresses those issues:

Keith> . As Sam James recently noted[1], PKGVERSION and VERSION
Keith>   need to be quoted.
Keith> . A Fedora user reported the misuse of --readnever, which
Keith>   causes gstack to omit filename and line number information in the
Keith>   backtrace[Red Hat BZ 2354997].

Makes sense to me.  Thanks for doing this.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-27 18:15 ` Tom Tromey
@ 2025-03-28 15:17   ` Keith Seitz
  2025-03-28 16:25     ` Keith Seitz
  0 siblings, 1 reply; 9+ messages in thread
From: Keith Seitz @ 2025-03-28 15:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 3/27/25 11:15 AM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
> 
> Keith> With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
> Keith> Fedora's gstack script to gdb.  Some issues have arisen since
> Keith> then, and this patch addresses those issues:
> 
> Keith> . As Sam James recently noted[1], PKGVERSION and VERSION
> Keith>   need to be quoted.
> Keith> . A Fedora user reported the misuse of --readnever, which
> Keith>   causes gstack to omit filename and line number information in the
> Keith>   backtrace[Red Hat BZ 2354997].
> 
> Makes sense to me.  Thanks for doing this.
> Approved-By: Tom Tromey <tom@tromey.com>

Thanks, Tom. I've waited until this morning to push, fearing that
various CIs would detect something, but I think there's been time
for that, and I've pushed the patch.

Keith


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-28 15:17   ` Keith Seitz
@ 2025-03-28 16:25     ` Keith Seitz
  2025-03-28 18:56       ` Tom Tromey
  2025-03-28 18:57       ` Sam James
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Seitz @ 2025-03-28 16:25 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 3/28/25 8:17 AM, Keith Seitz wrote:
> On 3/27/25 11:15 AM, Tom Tromey wrote:
>>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>>
>> Makes sense to me.  Thanks for doing this.
>> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Thanks, Tom. I've waited until this morning to push, fearing that
> various CIs would detect something, but I think there's been time
> for that, and I've pushed the patch.

BTW, Gwen raises the question: Is this something we want to include
for 16.3?

Keith


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-28 16:25     ` Keith Seitz
@ 2025-03-28 18:56       ` Tom Tromey
  2025-03-29 23:44         ` Keith Seitz
  2025-03-28 18:57       ` Sam James
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2025-03-28 18:56 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Tom Tromey, gdb-patches

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> BTW, Gwen raises the question: Is this something we want to include
Keith> for 16.3?

It's fine by me, I think it's safe & fixes a real bug.
You'll have to file it in bugzilla to do that.

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-28 16:25     ` Keith Seitz
  2025-03-28 18:56       ` Tom Tromey
@ 2025-03-28 18:57       ` Sam James
  2025-03-28 21:33         ` Keith Seitz
  1 sibling, 1 reply; 9+ messages in thread
From: Sam James @ 2025-03-28 18:57 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Tom Tromey, gdb-patches

Keith Seitz <keiths@redhat.com> writes:

> On 3/28/25 8:17 AM, Keith Seitz wrote:
>> On 3/27/25 11:15 AM, Tom Tromey wrote:
>>>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>>>
>>> Makes sense to me.  Thanks for doing this.
>>> Approved-By: Tom Tromey <tom@tromey.com>
>> Thanks, Tom. I've waited until this morning to push, fearing that
>> various CIs would detect something, but I think there's been time
>> for that, and I've pushed the patch.
>
> BTW, Gwen raises the question: Is this something we want to include
> for 16.3?

(If so, please backport my fixes as well -- thank you!)

>
> Keith

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-28 18:57       ` Sam James
@ 2025-03-28 21:33         ` Keith Seitz
  0 siblings, 0 replies; 9+ messages in thread
From: Keith Seitz @ 2025-03-28 21:33 UTC (permalink / raw)
  To: Sam James; +Cc: gdb-patches

On 3/28/25 11:57 AM, Sam James wrote:
> 
> (If so, please backport my fixes as well -- thank you!)
> 

Is this for the quoting issues w/PKGVERSION and VERSION?

Those aren't in gdb-16 wrt gcore and gdb-add-index AFAICT.
Only gstack is currently included on the release branch,
and cherry-picking this patch will fix that quoting issue.

Keith


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix gstack issues
  2025-03-28 18:56       ` Tom Tromey
@ 2025-03-29 23:44         ` Keith Seitz
  0 siblings, 0 replies; 9+ messages in thread
From: Keith Seitz @ 2025-03-29 23:44 UTC (permalink / raw)
  To: gdb-patches

On 3/28/25 11:56 AM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
> 
> Keith> BTW, Gwen raises the question: Is this something we want to include
> Keith> for 16.3?
> 
> It's fine by me, I think it's safe & fixes a real bug.
> You'll have to file it in bugzilla to do that.

I neglected to mention it, but I filed gdb/32828 for this.

Keith


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-29 23:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-27 15:54 [PATCH] Fix gstack issues Keith Seitz
2025-03-27 18:02 ` Guinevere Larsen
2025-03-27 18:15 ` Tom Tromey
2025-03-28 15:17   ` Keith Seitz
2025-03-28 16:25     ` Keith Seitz
2025-03-28 18:56       ` Tom Tromey
2025-03-29 23:44         ` Keith Seitz
2025-03-28 18:57       ` Sam James
2025-03-28 21:33         ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox