public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
@ 2022-11-28 16:21 Tom de Vries
  2022-11-28 17:45 ` Carl Love
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2022-11-28 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Carl Love, Ulrich Weigand

On powerpc64le-linux, with test-case gdb.ada/out_of_line_in_inlined.exp I run
into:
...
(gdb) run ^M
Starting program: foo_o224_021-all ^M
^M
Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2 (s=...) at \
  foo_o224_021.adb:24^M
24              function Child2 (S : String) return Boolean is -- STOP^M
(gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
  run to foo_o224_021.child1.child2
...

The breakpoint is correctly set at the local entry point, and given that the
local entry point doesn't correspond to a line number entry, the instruction
address of the breakpoint is shown.

The problem is that test-case doesn't expect the breakpoint address.

Fix this by allowing the breakpoint address to occur.

Tested on powerpc64le-linux.
---
 gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 4bdb4decaaf..621b04e179b 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"

base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a
-- 
2.35.3


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

* Re:  [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 16:21 [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le Tom de Vries
@ 2022-11-28 17:45 ` Carl Love
  2022-11-28 18:08   ` Tom de Vries
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Love @ 2022-11-28 17:45 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, cel

Tom:


On Mon, 2022-11-28 at 17:21 +0100, Tom de Vries wrote:
> On powerpc64le-linux, with test-case
> gdb.ada/out_of_line_in_inlined.exp I run
> into:
> ...
> (gdb) run ^M
> Starting program: foo_o224_021-all ^M
> ^M
> Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2
> (s=...) at \
>   foo_o224_021.adb:24^M
> 24              function Child2 (S : String) return Boolean is --
> STOP^M
> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
>   run to foo_o224_021.child1.child2
> ...
> 
> The breakpoint is correctly set at the local entry point, and given
> that the
> local entry point doesn't correspond to a line number entry, the
> instruction
> address of the breakpoint is shown.
> 
> The problem is that test-case doesn't expect the breakpoint address.
> 
> Fix this by allowing the breakpoint address to occur.
> 
> Tested on powerpc64le-linux.
> ---
>  gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> index 4bdb4decaaf..621b04e179b 100644
> --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
> 
>      gdb_run_cmd
>      gdb_test "" \
> -	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2
> \\(s=\\.\\.\\.\\).*" \
> +	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2
> \\(s=\\.\\.\\.\\).*" \
>  	"run to foo_o224_021.child1.child2"
> 
>      set opt_addr_in "($hex in)?"
> 
> base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a

The commit fixes the two test failures when run on my Power 9 box.  The
test runs without any errors on Power 9 with the fix.

However, with the commit to fix the test on Power 10, I see the
following failures:

(gdb) run 
Starting program: /home/carll/GDB/build-test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_021-all 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at /home/carll/GDB/binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_\
in_inlined/foo_o224_021.adb:27
27                      Do_Nothing (C);
(gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2

...

Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
(gdb) run 
Starting program: /home/carll/GDB/build-test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_021-minimal 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at /home/carll/GDB/binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_\
in_inlined/foo_o224_021.adb:27
27                      Do_Nothing (C);
(gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=minimal: run to foo_o224_021.child1.child2

I backed the gdb tree up to the previous commit on Power 10 with the command:

 git checkout af31506c31a59a6edbb13498d6075fa704b801cd

and re-ran the tests.  I see the same two failures.  These failures
appear to be different than the ones that Tom reported and fixed with
the commit.  

From discussion of previous test fixes, there may be a system
configuration difference here:

My Power 10 system:   Fedora release 36 (Thirty Six),  gcc (GCC) 12.2.1
20220819 (Red Hat 12.2.1-2)

Power 9 system:   Ubuntu 20.04.5 LTS,  gcc (Ubuntu 9.4.0-
1ubuntu1~20.04.1) 9.4.0

From what Tom reported on another test, he is running on (openSUSE Leap
15.4) has system gcc 7.5.0.

                    Carl 




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

* Re: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 17:45 ` Carl Love
@ 2022-11-28 18:08   ` Tom de Vries
  2022-11-28 19:55     ` Carl Love
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2022-11-28 18:08 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey

On 11/28/22 18:45, Carl Love wrote:
> Tom:
> 
> 
> On Mon, 2022-11-28 at 17:21 +0100, Tom de Vries wrote:
>> On powerpc64le-linux, with test-case
>> gdb.ada/out_of_line_in_inlined.exp I run
>> into:
>> ...
>> (gdb) run ^M
>> Starting program: foo_o224_021-all ^M
>> ^M
>> Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2
>> (s=...) at \
>>    foo_o224_021.adb:24^M
>> 24              function Child2 (S : String) return Boolean is --
>> STOP^M
>> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
>>    run to foo_o224_021.child1.child2
>> ...
>>
>> The breakpoint is correctly set at the local entry point, and given
>> that the
>> local entry point doesn't correspond to a line number entry, the
>> instruction
>> address of the breakpoint is shown.
>>
>> The problem is that test-case doesn't expect the breakpoint address.
>>
>> Fix this by allowing the breakpoint address to occur.
>>
>> Tested on powerpc64le-linux.
>> ---
>>   gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>> b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>> index 4bdb4decaaf..621b04e179b 100644
>> --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>> +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>> @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
>>
>>       gdb_run_cmd
>>       gdb_test "" \
>> -	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2
>> \\(s=\\.\\.\\.\\).*" \
>> +	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2
>> \\(s=\\.\\.\\.\\).*" \
>>   	"run to foo_o224_021.child1.child2"
>>
>>       set opt_addr_in "($hex in)?"
>>
>> base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a
> 
> The commit fixes the two test failures when run on my Power 9 box.  The
> test runs without any errors on Power 9 with the fix.
> 
> However, with the commit to fix the test on Power 10, I see the
> following failures:
> 
> (gdb) run
> Starting program: /home/carll/GDB/build-test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_021-all
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> 
> Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at /home/carll/GDB/binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_\
> in_inlined/foo_o224_021.adb:27
> 27                      Do_Nothing (C);
> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2
> 
> ...
> 
> Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
> (gdb) run
> Starting program: /home/carll/GDB/build-test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_021-minimal
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> 
> Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at /home/carll/GDB/binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_\
> in_inlined/foo_o224_021.adb:27
> 27                      Do_Nothing (C);
> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=minimal: run to foo_o224_021.child1.child2
> 
> I backed the gdb tree up to the previous commit on Power 10 with the command:
> 
>   git checkout af31506c31a59a6edbb13498d6075fa704b801cd
> 
> and re-ran the tests.  I see the same two failures.  These failures
> appear to be different than the ones that Tom reported and fixed with
> the commit.
> 
>  From discussion of previous test fixes, there may be a system
> configuration difference here:
> 
> My Power 10 system:   Fedora release 36 (Thirty Six),  gcc (GCC) 12.2.1
> 20220819 (Red Hat 12.2.1-2)
> 
> Power 9 system:   Ubuntu 20.04.5 LTS,  gcc (Ubuntu 9.4.0-
> 1ubuntu1~20.04.1) 9.4.0
> 
>  From what Tom reported on another test, he is running on (openSUSE Leap
> 15.4) has system gcc 7.5.0.
> 

Hi Carl,

thanks for looking into this.

AFAICT, the FAIL is due to the "1.1" rather than "1" for the breakpoint.

So apparently, the compiler optimizes a bit more, resulting in two 
breakpoints instead of one.

So, this looks like an independent issue, and I think it could be fixed 
by just accepting the 1.1, by something like replacing "$decimal" with 
"$decimal(\\.$decimal)?".

Thanks,
- Tom

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

* RE: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 18:08   ` Tom de Vries
@ 2022-11-28 19:55     ` Carl Love
  2022-11-28 20:46       ` Tom de Vries
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Love @ 2022-11-28 19:55 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, cel, Will Schmidt

Tom:

On Mon, 2022-11-28 at 19:08 +0100, Tom de Vries wrote:
> On 11/28/22 18:45, Carl Love wrote:
> > Tom:
> > 
> > 
> > On Mon, 2022-11-28 at 17:21 +0100, Tom de Vries wrote:
> > > On powerpc64le-linux, with test-case
> > > gdb.ada/out_of_line_in_inlined.exp I run
> > > into:
> > > ...
> > > (gdb) run ^M
> > > Starting program: foo_o224_021-all ^M
> > > ^M
> > > Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2
> > > (s=...) at \
> > >    foo_o224_021.adb:24^M
> > > 24              function Child2 (S : String) return Boolean is --
> > > STOP^M
> > > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
> > >    run to foo_o224_021.child1.child2
> > > ...
> > > 
> > > The breakpoint is correctly set at the local entry point, and
> > > given
> > > that the
> > > local entry point doesn't correspond to a line number entry, the
> > > instruction
> > > address of the breakpoint is shown.
> > > 
> > > The problem is that test-case doesn't expect the breakpoint
> > > address.
> > > 
> > > Fix this by allowing the breakpoint address to occur.
> > > 
> > > Tested on powerpc64le-linux.
> > > ---
> > >   gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > index 4bdb4decaaf..621b04e179b 100644
> > > --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
> > > 
> > >       gdb_run_cmd
> > >       gdb_test "" \
> > > -	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2
> > > \\(s=\\.\\.\\.\\).*" \
> > > +	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2
> > > \\(s=\\.\\.\\.\\).*" \
> > >   	"run to foo_o224_021.child1.child2"
> > > 
> > >       set opt_addr_in "($hex in)?"
> > > 
> > > base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a
> > 
> > The commit fixes the two test failures when run on my Power 9
> > box.  The
> > test runs without any errors on Power 9 with the fix.
> > 
> > However, with the commit to fix the test on Power 10, I see the
> > following failures:
> > 
> > (gdb) run
> > Starting program: /home/carll/GDB/build-
> > test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_
> > 021-all
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib64/libthread_db.so.1".
> > 
> > Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
> > /home/carll/GDB/binutils-gdb-
> > test/gdb/testsuite/gdb.ada/out_of_line_\
> > in_inlined/foo_o224_021.adb:27
> > 27                      Do_Nothing (C);
> > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run
> > to foo_o224_021.child1.child2
> > 
> > ...
> > 
> > Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3
> > locations)
> > (gdb) run
> > Starting program: /home/carll/GDB/build-
> > test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_
> > 021-minimal
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib64/libthread_db.so.1".
> > 
> > Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
> > /home/carll/GDB/binutils-gdb-
> > test/gdb/testsuite/gdb.ada/out_of_line_\
> > in_inlined/foo_o224_021.adb:27
> > 27                      Do_Nothing (C);
> > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=minimal:
> > run to foo_o224_021.child1.child2
> > 
> > I backed the gdb tree up to the previous commit on Power 10 with
> > the command:
> > 
> >   git checkout af31506c31a59a6edbb13498d6075fa704b801cd
> > 
> > and re-ran the tests.  I see the same two failures.  These failures
> > appear to be different than the ones that Tom reported and fixed
> > with
> > the commit.
> > 
> >  From discussion of previous test fixes, there may be a system
> > configuration difference here:
> > 
> > My Power 10 system:   Fedora release 36 (Thirty Six),  gcc (GCC)
> > 12.2.1
> > 20220819 (Red Hat 12.2.1-2)
> > 
> > Power 9 system:   Ubuntu 20.04.5 LTS,  gcc (Ubuntu 9.4.0-
> > 1ubuntu1~20.04.1) 9.4.0
> > 
> >  From what Tom reported on another test, he is running on (openSUSE
> > Leap
> > 15.4) has system gcc 7.5.0.
> > 
> 
> Hi Carl,
> 
> thanks for looking into this.
> 
> AFAICT, the FAIL is due to the "1.1" rather than "1" for the
> breakpoint.
> 
> So apparently, the compiler optimizes a bit more, resulting in two 
> breakpoints instead of one.
> 
> So, this looks like an independent issue, and I think it could be
> fixed 
> by just accepting the 1.1, by something like replacing "$decimal"
> with 
> "$decimal(\\.$decimal)?".
> 
> Thanks,
> - Tom

Thanks for the help.  I hadn't had time yet to dig into it before
posting the failure.  Trying to do too many things all at the same
time.

I tried your suggested fix.  GDB didn't take the parenthesis around
\\.$decimal.  I made the change   $decimal\\.$decimal?  and that seemed
to work on my system.  I tried the test on my X86 box but it is not
supported.  Looks like the system doesn't have the ada compiler
installed.

Can you verify that the change works on your system and if the patch
looks ok.  Thanks.

                   Carl
---------------------------------------------------------
Additional Fix for gdb.ada/out_of_line_in_inlined.exp for ppc64le

The command to set the breakpoing on foo_o224_021.child1.child2 with
Power 10, Fedora release 36 (Thirty Six) gives the following output:

  (gdb) break foo_o224_021.child1.child2^M
  Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
  (gdb) run
  Starting program: ...gdb.ada/out_of_line_in_inlined/foo_o224_021-all
  Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib64/libthread_db.so.1".

  Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at ...gdb.ada/out_of_line_in_inlined/foo_o224_021.adb:27^M
  27                      Do_Nothing (C);
  (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2
bt

The issue appears to be that gdb prints the breakpoint number as 1.1
instead of the expected value of 1.  It appears this is due to a compile
optimization resulting in two breakpoints.

This patch fixes the issue by accepting both breakpoint numbers.

This patch has been tested on Power 10.
---
 gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 621b04e179b..da80a4f7dd9 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint $decimal\\.$decimal?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"
-- 
2.37.2





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

* Re: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 19:55     ` Carl Love
@ 2022-11-28 20:46       ` Tom de Vries
  2022-11-28 21:07         ` Carl Love
  2022-11-28 21:33         ` Carl Love
  0 siblings, 2 replies; 12+ messages in thread
From: Tom de Vries @ 2022-11-28 20:46 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt

On 11/28/22 20:55, Carl Love wrote:
> Tom:
> 
> On Mon, 2022-11-28 at 19:08 +0100, Tom de Vries wrote:
>> On 11/28/22 18:45, Carl Love wrote:
>>> Tom:
>>>
>>>
>>> On Mon, 2022-11-28 at 17:21 +0100, Tom de Vries wrote:
>>>> On powerpc64le-linux, with test-case
>>>> gdb.ada/out_of_line_in_inlined.exp I run
>>>> into:
>>>> ...
>>>> (gdb) run ^M
>>>> Starting program: foo_o224_021-all ^M
>>>> ^M
>>>> Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2
>>>> (s=...) at \
>>>>     foo_o224_021.adb:24^M
>>>> 24              function Child2 (S : String) return Boolean is --
>>>> STOP^M
>>>> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
>>>>     run to foo_o224_021.child1.child2
>>>> ...
>>>>
>>>> The breakpoint is correctly set at the local entry point, and
>>>> given
>>>> that the
>>>> local entry point doesn't correspond to a line number entry, the
>>>> instruction
>>>> address of the breakpoint is shown.
>>>>
>>>> The problem is that test-case doesn't expect the breakpoint
>>>> address.
>>>>
>>>> Fix this by allowing the breakpoint address to occur.
>>>>
>>>> Tested on powerpc64le-linux.
>>>> ---
>>>>    gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>>>> b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>>>> index 4bdb4decaaf..621b04e179b 100644
>>>> --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>>>> +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
>>>> @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
>>>>
>>>>        gdb_run_cmd
>>>>        gdb_test "" \
>>>> -	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2
>>>> \\(s=\\.\\.\\.\\).*" \
>>>> +	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2
>>>> \\(s=\\.\\.\\.\\).*" \
>>>>    	"run to foo_o224_021.child1.child2"
>>>>
>>>>        set opt_addr_in "($hex in)?"
>>>>
>>>> base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a
>>>
>>> The commit fixes the two test failures when run on my Power 9
>>> box.  The
>>> test runs without any errors on Power 9 with the fix.
>>>
>>> However, with the commit to fix the test on Power 10, I see the
>>> following failures:
>>>
>>> (gdb) run
>>> Starting program: /home/carll/GDB/build-
>>> test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_
>>> 021-all
>>> [Thread debugging using libthread_db enabled]
>>> Using host libthread_db library "/lib64/libthread_db.so.1".
>>>
>>> Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
>>> /home/carll/GDB/binutils-gdb-
>>> test/gdb/testsuite/gdb.ada/out_of_line_\
>>> in_inlined/foo_o224_021.adb:27
>>> 27                      Do_Nothing (C);
>>> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run
>>> to foo_o224_021.child1.child2
>>>
>>> ...
>>>
>>> Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3
>>> locations)
>>> (gdb) run
>>> Starting program: /home/carll/GDB/build-
>>> test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_
>>> 021-minimal
>>> [Thread debugging using libthread_db enabled]
>>> Using host libthread_db library "/lib64/libthread_db.so.1".
>>>
>>> Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
>>> /home/carll/GDB/binutils-gdb-
>>> test/gdb/testsuite/gdb.ada/out_of_line_\
>>> in_inlined/foo_o224_021.adb:27
>>> 27                      Do_Nothing (C);
>>> (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=minimal:
>>> run to foo_o224_021.child1.child2
>>>
>>> I backed the gdb tree up to the previous commit on Power 10 with
>>> the command:
>>>
>>>    git checkout af31506c31a59a6edbb13498d6075fa704b801cd
>>>
>>> and re-ran the tests.  I see the same two failures.  These failures
>>> appear to be different than the ones that Tom reported and fixed
>>> with
>>> the commit.
>>>
>>>   From discussion of previous test fixes, there may be a system
>>> configuration difference here:
>>>
>>> My Power 10 system:   Fedora release 36 (Thirty Six),  gcc (GCC)
>>> 12.2.1
>>> 20220819 (Red Hat 12.2.1-2)
>>>
>>> Power 9 system:   Ubuntu 20.04.5 LTS,  gcc (Ubuntu 9.4.0-
>>> 1ubuntu1~20.04.1) 9.4.0
>>>
>>>   From what Tom reported on another test, he is running on (openSUSE
>>> Leap
>>> 15.4) has system gcc 7.5.0.
>>>
>>
>> Hi Carl,
>>
>> thanks for looking into this.
>>
>> AFAICT, the FAIL is due to the "1.1" rather than "1" for the
>> breakpoint.
>>
>> So apparently, the compiler optimizes a bit more, resulting in two
>> breakpoints instead of one.
>>
>> So, this looks like an independent issue, and I think it could be
>> fixed
>> by just accepting the 1.1, by something like replacing "$decimal"
>> with
>> "$decimal(\\.$decimal)?".
>>
>> Thanks,
>> - Tom
> 
> Thanks for the help.  I hadn't had time yet to dig into it before
> posting the failure.  Trying to do too many things all at the same
> time.

Yeah, I known what you mean :)

> I tried your suggested fix.  GDB didn't take the parenthesis around
> \\.$decimal.

Hmm, that sounds unexpected to me.  Can you post the exact patch that 
didn't work for you?  Note that the regexp uses the same construct in 
the "($hex in )?" bit.

>  I made the change   $decimal\\.$decimal?  and that seemed
> to work on my system.  I tried the test on my X86 box but it is not
> supported.  Looks like the system doesn't have the ada compiler
> installed.
> 
> Can you verify that the change works on your system and if the patch
> looks ok.  Thanks.
> 

It doesn't work, as expected, because the output is:
...
Breakpoint 1, foo_o224_021.child1.child2 (s=...) at 
/home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb:24^M
...
and $decimal\\.$decimal? does not match "1".

Thanks,
- Tom

>                     Carl
> ---------------------------------------------------------
> Additional Fix for gdb.ada/out_of_line_in_inlined.exp for ppc64le
> 
> The command to set the breakpoing on foo_o224_021.child1.child2 with
> Power 10, Fedora release 36 (Thirty Six) gives the following output:
> 
>    (gdb) break foo_o224_021.child1.child2^M
>    Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
>    (gdb) run
>    Starting program: ...gdb.ada/out_of_line_in_inlined/foo_o224_021-all
>    Thread debugging using libthread_db enabled]
>    Using host libthread_db library "/lib64/libthread_db.so.1".
> 
>    Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at ...gdb.ada/out_of_line_in_inlined/foo_o224_021.adb:27^M
>    27                      Do_Nothing (C);
>    (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2
> bt
> 
> The issue appears to be that gdb prints the breakpoint number as 1.1
> instead of the expected value of 1.  It appears this is due to a compile
> optimization resulting in two breakpoints.
> 
> This patch fixes the issue by accepting both breakpoint numbers.
> 
> This patch has been tested on Power 10.
> ---
>   gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> index 621b04e179b..da80a4f7dd9 100644
> --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
>   
>       gdb_run_cmd
>       gdb_test "" \
> -	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
> +	"Breakpoint $decimal\\.$decimal?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
>   	"run to foo_o224_021.child1.child2"
>   
>       set opt_addr_in "($hex in)?"

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

* RE: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 20:46       ` Tom de Vries
@ 2022-11-28 21:07         ` Carl Love
  2022-11-28 21:31           ` Tom de Vries
  2022-11-28 21:33         ` Carl Love
  1 sibling, 1 reply; 12+ messages in thread
From: Carl Love @ 2022-11-28 21:07 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt, cel

Tom:

On Mon, 2022-11-28 at 21:46 +0100, Tom de Vries wrote:
> >   I made the change   $decimal\\.$decimal?  and that seemed
> > to work on my system.  I tried the test on my X86 box but it is not
> > supported.  Looks like the system doesn't have the ada compiler
> > installed.
> > 
> > Can you verify that the change works on your system and if the
> > patch
> > looks ok.  Thanks.
> > 
> 
> It doesn't work, as expected, because the output is:
> ...
> Breakpoint 1, foo_o224_021.child1.child2 (s=...) at 
> /home/vries/gdb_versions/devel/binutils-
> gdb.git/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
> :24^M
> ...
> and $decimal\\.$decimal? does not match "1".

If I use the original suggestion, here is the patch I ran:

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 621b04e179b..54c55bc6f7e 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint $decimal(\\.$decimal)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"

then I run the test I get:

make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb  gdb.ada/out_of_line_in_inlined.exp   ' > out
WARNING: Couldn't find the global config file.
WARNING: Couldn't find tool init file
WARNING: Couldn't find the global config file.
WARNING: Couldn't find tool init file
WARNING: Couldn't find the global config file.
WARNING: Couldn't find tool init file
WARNING: Couldn't find the global config file.
WARNING: No tool specified
WARNING: Couldn't find the global config file.
ERROR: tcl error sourcing /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp.
ERROR: tcl error code TCL LOOKUP VARNAME decimal
ERROR: can't read "decimal(\.[0-9]+)": variable isn't array
    while executing
"gdb_test ""  "Breakpoint $decimal(\\.$decimal)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*"  "run to foo_o224_021.child1.child2""
    ("uplevel" body line 13)
    invoked from within
"uplevel 1 $body"
    invoked from within
"foreach_with_prefix scenario {all minimal} {
    set flags [list debug \
		   optimize=-O2 \
		   additional_flags=-fgnat-encodings=$scenario]

    if..."
    (file "/home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp" line 22)
    invoked from within
"source /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name" msg"
ERROR: -------------------------------------------
ERROR: in testcase /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
ERROR:  can't read "decimal(\.[0-9]+)": variable isn't array
ERROR:  tcl error code TCL LOOKUP VARNAME decimal
ERROR:  tcl error info:
can't read "decimal(\.[0-9]+)": variable isn't array
    while executing
"gdb_test ""  "Breakpoint $decimal(\\.$decimal)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*"  "run to foo_o224_021.child1.child2""
    ("uplevel" body line 13)
    invoked from within
"uplevel 1 $body"
    invoked from within
"foreach_with_prefix scenario {all minimal} {
    set flags [list debug \
		   optimize=-O2 \
		   additional_flags=-fgnat-encodings=$scenario]

    if..."
    (file "/home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp" line 22)
    invoked from within
"source /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name" msg"
--------------------------------------------------
make[4]: *** [Makefile:226: do-check-single] Error 1
make[3]: *** [Makefile:161: check] Error 2
make[2]: *** [Makefile:1922: check] Error 2
make[1]: *** [Makefile:13585: check-gdb] Error 2
make: *** [Makefile:2531: do-check] Error 2


The error seems to be that it is looking for an array???

Second attempt, maybe the parenthesis need to be escaped, i.e. 

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 621b04e179b..de1a6d053f1 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint $decimal\\(\\.$decimal\\)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"

GDB seems to accept this, but I get the test failure:

  (gdb) break foo_o224_021.child1.child2^M
  Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
  (gdb) run 
  Starting program: /home/carll/GDB/build-test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o224_021-all 
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib64/libthread_db.so.1".

  Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at /home/carll/GDB/binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb:27^M
  27                      Do_Nothing (C);
  (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2



So it doesn't match.  I am guessing it is looking for the parentheses
in the string to match and of course doesn't see them.

          Carl 



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

* Re: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 21:07         ` Carl Love
@ 2022-11-28 21:31           ` Tom de Vries
  2022-11-28 21:44             ` Carl Love
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2022-11-28 21:31 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt

On 11/28/22 22:07, Carl Love wrote:
> Tom:
> 
> On Mon, 2022-11-28 at 21:46 +0100, Tom de Vries wrote:
>>>    I made the change   $decimal\\.$decimal?  and that seemed
>>> to work on my system.  I tried the test on my X86 box but it is not
>>> supported.  Looks like the system doesn't have the ada compiler
>>> installed.
>>>
>>> Can you verify that the change works on your system and if the
>>> patch
>>> looks ok.  Thanks.
>>>
>>
>> It doesn't work, as expected, because the output is:
>> ...
>> Breakpoint 1, foo_o224_021.child1.child2 (s=...) at
>> /home/vries/gdb_versions/devel/binutils-
>> gdb.git/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
>> :24^M
>> ...
>> and $decimal\\.$decimal? does not match "1".
> 
> If I use the original suggestion, here is the patch I ran:
> 
> diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> index 621b04e179b..54c55bc6f7e 100644
> --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
>   
>       gdb_run_cmd
>       gdb_test "" \
> -	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
> +	"Breakpoint $decimal(\\.$decimal)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
>   	"run to foo_o224_021.child1.child2"
>   
>       set opt_addr_in "($hex in)?"
> 
> then I run the test I get:
> 
> make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb  gdb.ada/out_of_line_in_inlined.exp   ' > out
> WARNING: Couldn't find the global config file.
> WARNING: Couldn't find tool init file
> WARNING: Couldn't find the global config file.
> WARNING: Couldn't find tool init file
> WARNING: Couldn't find the global config file.
> WARNING: Couldn't find tool init file
> WARNING: Couldn't find the global config file.
> WARNING: No tool specified
> WARNING: Couldn't find the global config file.
> ERROR: tcl error sourcing /home/carll/GDB/build-test/gdb/testsuite/../../../binutils-gdb-test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp.
> ERROR: tcl error code TCL LOOKUP VARNAME decimal
> ERROR: can't read "decimal(\.[0-9]+)": variable isn't array

Ah I see, yes the $var($index) is tcl syntax for accessing an array element.

So, this should work: ${decimal}(\\.$decimal)?

Thanks,
- Tom

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

* RE: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 20:46       ` Tom de Vries
  2022-11-28 21:07         ` Carl Love
@ 2022-11-28 21:33         ` Carl Love
  1 sibling, 0 replies; 12+ messages in thread
From: Carl Love @ 2022-11-28 21:33 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt, cel

Tom:

On Mon, 2022-11-28 at 21:46 +0100, Tom de Vries wrote:
> On 11/28/22 20:55, Carl Love wrote:
> > Tom:
> > 
> > On Mon, 2022-11-28 at 19:08 +0100, Tom de Vries wrote:
> > > On 11/28/22 18:45, Carl Love wrote:
> > > > Tom:
> > > > 
> > > > 
> > > > On Mon, 2022-11-28 at 17:21 +0100, Tom de Vries wrote:
> > > > > On powerpc64le-linux, with test-case
> > > > > gdb.ada/out_of_line_in_inlined.exp I run
> > > > > into:
> > > > > ...
> > > > > (gdb) run ^M
> > > > > Starting program: foo_o224_021-all ^M
> > > > > ^M
> > > > > Breakpoint 1, 0x0000000010002f48 in
> > > > > foo_o224_021.child1.child2
> > > > > (s=...) at \
> > > > >     foo_o224_021.adb:24^M
> > > > > 24              function Child2 (S : String) return Boolean
> > > > > is --
> > > > > STOP^M
> > > > > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all:
> > > > > \
> > > > >     run to foo_o224_021.child1.child2
> > > > > ...
> > > > > 
> > > > > The breakpoint is correctly set at the local entry point, and
> > > > > given
> > > > > that the
> > > > > local entry point doesn't correspond to a line number entry,
> > > > > the
> > > > > instruction
> > > > > address of the breakpoint is shown.
> > > > > 
> > > > > The problem is that test-case doesn't expect the breakpoint
> > > > > address.
> > > > > 
> > > > > Fix this by allowing the breakpoint address to occur.
> > > > > 
> > > > > Tested on powerpc64le-linux.
> > > > > ---
> > > > >    gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
> > > > >    1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > > > b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > > > index 4bdb4decaaf..621b04e179b 100644
> > > > > --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > > > +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
> > > > > @@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal}
> > > > > {
> > > > > 
> > > > >        gdb_run_cmd
> > > > >        gdb_test "" \
> > > > > -	"Breakpoint $decimal, foo_o224_021\\.child1\\.child2
> > > > > \\(s=\\.\\.\\.\\).*" \
> > > > > +	"Breakpoint $decimal, ($hex in
> > > > > )?foo_o224_021\\.child1\\.child2
> > > > > \\(s=\\.\\.\\.\\).*" \
> > > > >    	"run to foo_o224_021.child1.child2"
> > > > > 
> > > > >        set opt_addr_in "($hex in)?"
> > > > > 
> > > > > base-commit: 76cd77dc729b03d6b33c683323594479e33a3f9a
> > > > 
> > > > The commit fixes the two test failures when run on my Power 9
> > > > box.  The
> > > > test runs without any errors on Power 9 with the fix.
> > > > 
> > > > However, with the commit to fix the test on Power 10, I see the
> > > > following failures:
> > > > 
> > > > (gdb) run
> > > > Starting program: /home/carll/GDB/build-
> > > > test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o
> > > > 224_
> > > > 021-all
> > > > [Thread debugging using libthread_db enabled]
> > > > Using host libthread_db library "/lib64/libthread_db.so.1".
> > > > 
> > > > Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
> > > > /home/carll/GDB/binutils-gdb-
> > > > test/gdb/testsuite/gdb.ada/out_of_line_\
> > > > in_inlined/foo_o224_021.adb:27
> > > > 27                      Do_Nothing (C);
> > > > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all:
> > > > run
> > > > to foo_o224_021.child1.child2
> > > > 
> > > > ...
> > > > 
> > > > Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3
> > > > locations)
> > > > (gdb) run
> > > > Starting program: /home/carll/GDB/build-
> > > > test/gdb/testsuite/outputs/gdb.ada/out_of_line_in_inlined/foo_o
> > > > 224_
> > > > 021-minimal
> > > > [Thread debugging using libthread_db enabled]
> > > > Using host libthread_db library "/lib64/libthread_db.so.1".
> > > > 
> > > > Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at
> > > > /home/carll/GDB/binutils-gdb-
> > > > test/gdb/testsuite/gdb.ada/out_of_line_\
> > > > in_inlined/foo_o224_021.adb:27
> > > > 27                      Do_Nothing (C);
> > > > (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp:
> > > > scenario=minimal:
> > > > run to foo_o224_021.child1.child2
> > > > 
> > > > I backed the gdb tree up to the previous commit on Power 10
> > > > with
> > > > the command:
> > > > 
> > > >    git checkout af31506c31a59a6edbb13498d6075fa704b801cd
> > > > 
> > > > and re-ran the tests.  I see the same two failures.  These
> > > > failures
> > > > appear to be different than the ones that Tom reported and
> > > > fixed
> > > > with
> > > > the commit.
> > > > 
> > > >   From discussion of previous test fixes, there may be a system
> > > > configuration difference here:
> > > > 
> > > > My Power 10 system:   Fedora release 36 (Thirty Six),  gcc
> > > > (GCC)
> > > > 12.2.1
> > > > 20220819 (Red Hat 12.2.1-2)
> > > > 
> > > > Power 9 system:   Ubuntu 20.04.5 LTS,  gcc (Ubuntu 9.4.0-
> > > > 1ubuntu1~20.04.1) 9.4.0
> > > > 
> > > >   From what Tom reported on another test, he is running on
> > > > (openSUSE
> > > > Leap
> > > > 15.4) has system gcc 7.5.0.
> > > > 
> > > 
> > > Hi Carl,
> > > 
> > > thanks for looking into this.
> > > 
> > > AFAICT, the FAIL is due to the "1.1" rather than "1" for the
> > > breakpoint.
> > > 
> > > So apparently, the compiler optimizes a bit more, resulting in
> > > two
> > > breakpoints instead of one.
> > > 
> > > So, this looks like an independent issue, and I think it could be
> > > fixed
> > > by just accepting the 1.1, by something like replacing "$decimal"
> > > with
> > > "$decimal(\\.$decimal)?".
> > > 
> > > Thanks,
> > > - Tom
> > 
> > Thanks for the help.  I hadn't had time yet to dig into it before
> > posting the failure.  Trying to do too many things all at the same
> > time.
> 
> Yeah, I known what you mean :)
> 
> > I tried your suggested fix.  GDB didn't take the parenthesis around
> > \\.$decimal.
> 
> Hmm, that sounds unexpected to me.  Can you post the exact patch
> that 
> didn't work for you?  Note that the regexp uses the same construct
> in 
> the "($hex in )?" bit.
> 
> >  I made the change   $decimal\\.$decimal?  and that seemed
> > to work on my system.  I tried the test on my X86 box but it is not
> > supported.  Looks like the system doesn't have the ada compiler
> > installed.
> > 
> > Can you verify that the change works on your system and if the
> > patch
> > looks ok.  Thanks.
> > 
> 
> It doesn't work, as expected, because the output is:
> ...
> Breakpoint 1, foo_o224_021.child1.child2 (s=...) at 
> /home/vries/gdb_versions/devel/binutils-
> gdb.git/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
> :24^M
> ...
> and $decimal\\.$decimal? does not match "1".
> 
Digging around looking for the definition of $decimal, I ran into: 

# A regular expression that matches a breakpoint hit with a breakpoint         
# having several code locations.                                               
set bkptno_num_re "$decimal\\.$decimal"

in lib/gdb.exp.

I tried changing the patch to 

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 621b04e179b..ca3798ea9db 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint $bkptno_num_re, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"

That seems to work on Power 10.  See if that works for you.

                     Carl 



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

* RE: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 21:31           ` Tom de Vries
@ 2022-11-28 21:44             ` Carl Love
  2022-11-28 22:09               ` Tom de Vries
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Love @ 2022-11-28 21:44 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt, cel

On Mon, 2022-11-28 at 22:31 +0100, Tom de Vries wrote:
> > then I run the test I get:
> > 
> > make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb 
> > gdb.ada/out_of_line_in_inlined.exp   ' > out
> > WARNING: Couldn't find the global config file.
> > WARNING: Couldn't find tool init file
> > WARNING: Couldn't find the global config file.
> > WARNING: Couldn't find tool init file
> > WARNING: Couldn't find the global config file.
> > WARNING: Couldn't find tool init file
> > WARNING: Couldn't find the global config file.
> > WARNING: No tool specified
> > WARNING: Couldn't find the global config file.
> > ERROR: tcl error sourcing /home/carll/GDB/build-
> > test/gdb/testsuite/../../../binutils-gdb-
> > test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp.
> > ERROR: tcl error code TCL LOOKUP VARNAME decimal
> > ERROR: can't read "decimal(\.[0-9]+)": variable isn't array
> 
> Ah I see, yes the $var($index) is tcl syntax for accessing an array
> element.
> 
> So, this should work: ${decimal}(\\.$decimal)?

Yes, that also works for me as well as $bkptno_num_re which I mentioned
in my previous email work for me.  I guess my preference would be
$bkptno_num_re if it also works for you.

                Carl 


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

* Re: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 21:44             ` Carl Love
@ 2022-11-28 22:09               ` Tom de Vries
  2022-11-28 23:01                 ` Carl Love
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2022-11-28 22:09 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt

On 11/28/22 22:44, Carl Love wrote:
> On Mon, 2022-11-28 at 22:31 +0100, Tom de Vries wrote:
>>> then I run the test I get:
>>>
>>> make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb
>>> gdb.ada/out_of_line_in_inlined.exp   ' > out
>>> WARNING: Couldn't find the global config file.
>>> WARNING: Couldn't find tool init file
>>> WARNING: Couldn't find the global config file.
>>> WARNING: Couldn't find tool init file
>>> WARNING: Couldn't find the global config file.
>>> WARNING: Couldn't find tool init file
>>> WARNING: Couldn't find the global config file.
>>> WARNING: No tool specified
>>> WARNING: Couldn't find the global config file.
>>> ERROR: tcl error sourcing /home/carll/GDB/build-
>>> test/gdb/testsuite/../../../binutils-gdb-
>>> test/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp.
>>> ERROR: tcl error code TCL LOOKUP VARNAME decimal
>>> ERROR: can't read "decimal(\.[0-9]+)": variable isn't array
>>
>> Ah I see, yes the $var($index) is tcl syntax for accessing an array
>> element.
>>
>> So, this should work: ${decimal}(\\.$decimal)?
> 
> Yes, that also works for me as well as $bkptno_num_re which I mentioned
> in my previous email work for me.  I guess my preference would be
> $bkptno_num_re if it also works for you.

That one doesn't work.  As mentioned in the comment, it attempts to match:
...
# A regular expression that matches a breakpoint hit with a breakpoint 

# having several code locations. 

set bkptno_num_re "$decimal\\.$decimal"
...
in other words, "1.1" and in my case there's only one code location, in 
other words, "1".

Thanks,
- Tom

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

* RE: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 22:09               ` Tom de Vries
@ 2022-11-28 23:01                 ` Carl Love
  2022-11-29  7:24                   ` Tom de Vries
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Love @ 2022-11-28 23:01 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt, cel

Tom:

On Mon, 2022-11-28 at 23:09 +0100, Tom de Vries wrote:
>  Yes, that also works for me as well as $bkptno_num_re which I
> mentioned
> > in my previous email work for me.  I guess my preference would be
> > $bkptno_num_re if it also works for you.
> 
> That one doesn't work.  As mentioned in the comment, it attempts to
> match:
> ...
> # A regular expression that matches a breakpoint hit with a
> breakpoint 
> 
> # having several code locations. 
> 
> set bkptno_num_re "$decimal\\.$decimal"
> ...
> in other words, "1.1" and in my case there's only one code location,
> in 
> other words, "1".

Yea, right.  So I think we are down to the following patch that works
on my Power 10 with no regressions.  It sounds like this one works for
you as well.  

          Carl 
------------------------------------------
Additional Fix for gdb.ada/out_of_line_in_inlined.exp for ppc64le

The command to set the breakpoing on foo_o224_021.child1.child2 with
Power 10, Fedora release 36 (Thirty Six) gives the following output:

  (gdb) break foo_o224_021.child1.child2^M
  Breakpoint 1 at 0x10011870: foo_o224_021.child1.child2. (3 locations)
  (gdb) run
  Starting program: ...gdb.ada/out_of_line_in_inlined/foo_o224_021-all
  Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib64/libthread_db.so.1".

  Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at ...gdb.ada/out_of_line_in_inlined/foo_o224_021.adb:27
  27                      Do_Nothing (C);
  (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: run to foo_o224_021.child1.child2


The issue appears to be that gdb prints the breakpoint number as 1.1
instead of the expected value of 1.  It appears this is due to a compile
optimization resulting in two breakpoints.

This patch fixes the issue by accepting both breakpoint numbers.

This patch has been tested on Power 10.
---
 gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 621b04e179b..5698a0632a1 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} {
 
     gdb_run_cmd
     gdb_test "" \
-	"Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
+	"Breakpoint ${decimal}(\\.$decimal)?, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
 	"run to foo_o224_021.child1.child2"
 
     set opt_addr_in "($hex in)?"
-- 
2.37.2



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

* Re: [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
  2022-11-28 23:01                 ` Carl Love
@ 2022-11-29  7:24                   ` Tom de Vries
  0 siblings, 0 replies; 12+ messages in thread
From: Tom de Vries @ 2022-11-29  7:24 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, Will Schmidt

On 11/29/22 00:01, Carl Love wrote:
> Tom:
> 
> On Mon, 2022-11-28 at 23:09 +0100, Tom de Vries wrote:
>>   Yes, that also works for me as well as $bkptno_num_re which I
>> mentioned
>>> in my previous email work for me.  I guess my preference would be
>>> $bkptno_num_re if it also works for you.
>>
>> That one doesn't work.  As mentioned in the comment, it attempts to
>> match:
>> ...
>> # A regular expression that matches a breakpoint hit with a
>> breakpoint
>>
>> # having several code locations.
>>
>> set bkptno_num_re "$decimal\\.$decimal"
>> ...
>> in other words, "1.1" and in my case there's only one code location,
>> in
>> other words, "1".
> 
> Yea, right.  So I think we are down to the following patch that works
> on my Power 10 with no regressions.  It sounds like this one works for
> you as well.
> 

LGTM.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

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

end of thread, other threads:[~2022-11-29  7:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 16:21 [pushed] [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le Tom de Vries
2022-11-28 17:45 ` Carl Love
2022-11-28 18:08   ` Tom de Vries
2022-11-28 19:55     ` Carl Love
2022-11-28 20:46       ` Tom de Vries
2022-11-28 21:07         ` Carl Love
2022-11-28 21:31           ` Tom de Vries
2022-11-28 21:44             ` Carl Love
2022-11-28 22:09               ` Tom de Vries
2022-11-28 23:01                 ` Carl Love
2022-11-29  7:24                   ` Tom de Vries
2022-11-28 21:33         ` Carl Love

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).