public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] [gdb/testsuite] Use require in gdb.dwarf2/implptr.exp
@ 2023-06-17 10:30 Tom de Vries
  2023-06-17 10:30 ` [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases Tom de Vries
  2023-06-17 10:30 ` [PATCH 3/3] [gdb/testsuite] Remove f-string in gdb.python/py-unwind.py Tom de Vries
  0 siblings, 2 replies; 6+ messages in thread
From: Tom de Vries @ 2023-06-17 10:30 UTC (permalink / raw)
  To: gdb-patches

In test-case gdb.dwarf2/implptr.exp I noticed:
...
} elseif {![is_x86_like_target]} {
    # This test can only be run on x86 targets.
    unsupported "needs x86-like target"
    return 0
}
...

Use instead "require is_x86_like_target".

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.dwarf2/implptr.exp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index 70d86ddf19a..71fb1e443ef 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -19,6 +19,9 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
+# This test can only be run on x86 targets.
+require is_x86_like_target
+
 standard_testfile .S
 set csrcfile ${testfile}.c
 set opts {}
@@ -27,10 +30,6 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS='gdb.dwarf2/implptr.exp COMPILE=1 CC_FOR_TARGET=gcc\ -m32'
     set srcfile ${csrcfile}
     lappend opts debug optimize=-O2
-} elseif {![is_x86_like_target]} {
-    # This test can only be run on x86 targets.
-    unsupported "needs x86-like target"
-    return 0  
 }
 
 if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {

base-commit: 6a4058a60683ea096683d441cb78e3ad686f134f
-- 
2.35.3


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

* [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases
  2023-06-17 10:30 [PATCH 1/3] [gdb/testsuite] Use require in gdb.dwarf2/implptr.exp Tom de Vries
@ 2023-06-17 10:30 ` Tom de Vries
  2023-07-01  2:55   ` Simon Marchi
  2023-06-17 10:30 ` [PATCH 3/3] [gdb/testsuite] Remove f-string in gdb.python/py-unwind.py Tom de Vries
  1 sibling, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2023-06-17 10:30 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.arch/i386-disp-step.exp with target board
unix/-m32/-fPIE/-pie we run into:
...
gdb compile failed, ld: i386-disp-step0.o: warning: relocation in read-only section `.text'
ld: warning: creating DT_TEXTREL in a PIE
...

Fix this by adding nopie in the compilation flags.

Likewise in a few other test-cases.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.arch/i386-disp-step.exp         | 6 +++++-
 gdb/testsuite/gdb.dwarf2/implptr.exp              | 2 ++
 gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp | 6 +++++-
 gdb/testsuite/gdb.dwarf2/typeddwarf.exp           | 7 ++++++-
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/i386-disp-step.exp b/gdb/testsuite/gdb.arch/i386-disp-step.exp
index 02f74136507..45fad094a67 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/i386-disp-step.exp
@@ -22,7 +22,11 @@ require is_x86_like_target
 
 standard_testfile .S
 
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+set opts {}
+lappend opts debug
+lappend opts nopie
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index 71fb1e443ef..d8d5ff9abd5 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -26,6 +26,8 @@ standard_testfile .S
 set csrcfile ${testfile}.c
 set opts {}
 
+lappend opts nopie
+
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS='gdb.dwarf2/implptr.exp COMPILE=1 CC_FOR_TARGET=gcc\ -m32'
     set srcfile ${csrcfile}
diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
index b0e01afd06e..bdb7fc8141e 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
@@ -22,7 +22,11 @@ require dwarf2_support is_x86_like_target
 standard_testfile .S
 set csrcfile ${testfile}.c
 
-if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile]} {
+set opts {}
+lappend opts debug
+lappend opts nopie
+
+if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
index 3fafe9cf6f8..1e46cab03ef 100644
--- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
+++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
@@ -29,7 +29,12 @@ if { [is_x86_like_target] } {
     return 0
 }
 
-if { [prepare_for_testing "failed to prepare" "${test}" ${sfile} {nodebug additional_flags=-nostdlib}] } {
+set opts {}
+lappend opts nodebug
+lappend opts additional_flags=-nostdlib
+lappend opts nopie
+
+if { [prepare_for_testing "failed to prepare" "${test}" ${sfile} $opts] } {
     return -1
 }
 
-- 
2.35.3


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

* [PATCH 3/3] [gdb/testsuite] Remove f-string in gdb.python/py-unwind.py
  2023-06-17 10:30 [PATCH 1/3] [gdb/testsuite] Use require in gdb.dwarf2/implptr.exp Tom de Vries
  2023-06-17 10:30 ` [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases Tom de Vries
@ 2023-06-17 10:30 ` Tom de Vries
  1 sibling, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2023-06-17 10:30 UTC (permalink / raw)
  To: gdb-patches

on openSUSE Leap 42.3, with python 3.4, I run into a
"SyntaxError: invalid syntax" due to usage of an f-string in test-case
gdb.python/py-unwind.py.

Fix this by using string concatenation using '+' instead.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.python/py-unwind.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-unwind.py b/gdb/testsuite/gdb.python/py-unwind.py
index 8e24a3190c7..1dcc240c988 100644
--- a/gdb/testsuite/gdb.python/py-unwind.py
+++ b/gdb/testsuite/gdb.python/py-unwind.py
@@ -254,7 +254,7 @@ class validating_unwinder(Unwinder):
         assert not old_info["matched"]
 
         for key, value in info.items():
-            assert key in old_info, f"{key} not in old_info"
+            assert key in old_info, key + " not in old_info"
             assert type(value) == type(old_info[key])
             if isinstance(value, gdb.Block):
                 assert value.start == old_info[key].start
-- 
2.35.3


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

* Re: [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases
  2023-06-17 10:30 ` [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases Tom de Vries
@ 2023-07-01  2:55   ` Simon Marchi
  2023-07-12 15:01     ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2023-07-01  2:55 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 6/17/23 06:30, Tom de Vries via Gdb-patches wrote:
> When running test-case gdb.arch/i386-disp-step.exp with target board
> unix/-m32/-fPIE/-pie we run into:
> ...
> gdb compile failed, ld: i386-disp-step0.o: warning: relocation in read-only section `.text'
> ld: warning: creating DT_TEXTREL in a PIE
> ...
> 
> Fix this by adding nopie in the compilation flags.
> 
> Likewise in a few other test-cases.
> 
> Tested on x86_64-linux.

Hi Tom,

Just to note that this causes a regression on Ubuntu 22.04.  Before:

    target remote localhost:2346

    Remote debugging using localhost:2346

    Reading symbols from /lib64/ld-linux-x86-64.so.2...

    Reading symbols from /usr/lib/debug/.build-id/61/ef896a699bb1c2e4e231642b2e1688b2f1a61e.debug...

    0x00007ffff7fe32b0 in _start () from /lib64/ld-linux-x86-64.so.2

    (gdb) continue

    Continuing.



    Breakpoint 1, main () at typeddwarf.c:87

    87	{

After:

    target remote localhost:2346

    Remote debugging using localhost:2346

    main () at typeddwarf.c:87

    87	{

    (gdb) continue

    Continuing.



    Program received signal SIGSEGV, Segmentation fault.

    0x0000000000000001 in ?? ()

    (gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main

Simon

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

* Re: [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases
  2023-07-01  2:55   ` Simon Marchi
@ 2023-07-12 15:01     ` Tom de Vries
  2023-07-13 13:41       ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2023-07-12 15:01 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 7/1/23 04:55, Simon Marchi wrote:
> On 6/17/23 06:30, Tom de Vries via Gdb-patches wrote:
>> When running test-case gdb.arch/i386-disp-step.exp with target board
>> unix/-m32/-fPIE/-pie we run into:
>> ...
>> gdb compile failed, ld: i386-disp-step0.o: warning: relocation in read-only section `.text'
>> ld: warning: creating DT_TEXTREL in a PIE
>> ...
>>
>> Fix this by adding nopie in the compilation flags.
>>
>> Likewise in a few other test-cases.
>>
>> Tested on x86_64-linux.
> 
> Hi Tom,
> 
> Just to note that this causes a regression on Ubuntu 22.04.  Before:
> 

Hi Simon,

thanks for reporting this.

Is this is with a specific target board?

Thanks,
- Tom

>      target remote localhost:2346
> 
>      Remote debugging using localhost:2346
> 
>      Reading symbols from /lib64/ld-linux-x86-64.so.2...
> 
>      Reading symbols from /usr/lib/debug/.build-id/61/ef896a699bb1c2e4e231642b2e1688b2f1a61e.debug...
> 
>      0x00007ffff7fe32b0 in _start () from /lib64/ld-linux-x86-64.so.2
> 
>      (gdb) continue
> 
>      Continuing.
> 
> 
> 
>      Breakpoint 1, main () at typeddwarf.c:87
> 
>      87	{
> 
> After:
> 
>      target remote localhost:2346
> 
>      Remote debugging using localhost:2346
> 
>      main () at typeddwarf.c:87
> 
>      87	{
> 
>      (gdb) continue
> 
>      Continuing.
> 
> 
> 
>      Program received signal SIGSEGV, Segmentation fault.
> 
>      0x0000000000000001 in ?? ()
> 
>      (gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
> 
> Simon


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

* Re: [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases
  2023-07-12 15:01     ` Tom de Vries
@ 2023-07-13 13:41       ` Tom de Vries
  0 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2023-07-13 13:41 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 7/12/23 17:01, Tom de Vries wrote:
> On 7/1/23 04:55, Simon Marchi wrote:
>> On 6/17/23 06:30, Tom de Vries via Gdb-patches wrote:
>>> When running test-case gdb.arch/i386-disp-step.exp with target board
>>> unix/-m32/-fPIE/-pie we run into:
>>> ...
>>> gdb compile failed, ld: i386-disp-step0.o: warning: relocation in 
>>> read-only section `.text'
>>> ld: warning: creating DT_TEXTREL in a PIE
>>> ...
>>>
>>> Fix this by adding nopie in the compilation flags.
>>>
>>> Likewise in a few other test-cases.
>>>
>>> Tested on x86_64-linux.
>>
>> Hi Tom,
>>
>> Just to note that this causes a regression on Ubuntu 22.04.  Before:
>>
> 
> Hi Simon,
> 
> thanks for reporting this.
> 
> Is this is with a specific target board?

I've managed to reproduce this now, filed as 
https://sourceware.org/bugzilla/show_bug.cgi?id=30633 .

Thanks,
- Tom

>>      target remote localhost:2346
>>
>>      Remote debugging using localhost:2346
>>
>>      Reading symbols from /lib64/ld-linux-x86-64.so.2...
>>
>>      Reading symbols from 
>> /usr/lib/debug/.build-id/61/ef896a699bb1c2e4e231642b2e1688b2f1a61e.debug...
>>
>>      0x00007ffff7fe32b0 in _start () from /lib64/ld-linux-x86-64.so.2
>>
>>      (gdb) continue
>>
>>      Continuing.
>>
>>
>>
>>      Breakpoint 1, main () at typeddwarf.c:87
>>
>>      87    {
>>
>> After:
>>
>>      target remote localhost:2346
>>
>>      Remote debugging using localhost:2346
>>
>>      main () at typeddwarf.c:87
>>
>>      87    {
>>
>>      (gdb) continue
>>
>>      Continuing.
>>
>>
>>
>>      Program received signal SIGSEGV, Segmentation fault.
>>
>>      0x0000000000000001 in ?? ()
>>
>>      (gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
>>
>> Simon
> 


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

end of thread, other threads:[~2023-07-13 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17 10:30 [PATCH 1/3] [gdb/testsuite] Use require in gdb.dwarf2/implptr.exp Tom de Vries
2023-06-17 10:30 ` [PATCH 2/3] [gdb/testsuite] Add nopie in a few test-cases Tom de Vries
2023-07-01  2:55   ` Simon Marchi
2023-07-12 15:01     ` Tom de Vries
2023-07-13 13:41       ` Tom de Vries
2023-06-17 10:30 ` [PATCH 3/3] [gdb/testsuite] Remove f-string in gdb.python/py-unwind.py Tom de Vries

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