public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/3] [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp with -m32
@ 2021-11-29  8:55 Tom de Vries
  2021-11-29  8:55 ` [pushed 2/3] [gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp Tom de Vries
  2021-11-29  8:55 ` [pushed 3/3] [gdb/testsuite] Fix typo in proc lines Tom de Vries
  0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2021-11-29  8:55 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.dwarf2/dw2-lines.exp with target board -unix/-m32,
we run into another instance of PR28383, where the dwarf assembler generates
64-bit relocations which are not supported by the 32-bit assembler:
...
dw2-lines-dw.S: Assembler messages:^M
outputs/gdb.dwarf2/dw2-lines/dw2-lines-dw.S:76: Error: \
  cannot represent relocation type BFD_RELOC_64^M
...

Fix this by using _op_offset in _line_finalize_header.

Tested on x86_64-linux.
---
 gdb/testsuite/lib/dwarf.exp | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index cbb1bf6985a..94f67652e19 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2349,11 +2349,7 @@ namespace eval Dwarf {
 				string_ptr:
 				_op .ascii [_quote $dirname]
 			    }
-			    if { $_line_is_64 } {
-				_op .8byte $string_ptr
-			    } else {
-				_op .4byte $string_ptr
-			    }
+			    _op_offset [expr $_line_is_64 ? 8 : 4] $string_ptr
 			}
 		    }
 		}
@@ -2398,11 +2394,7 @@ namespace eval Dwarf {
 				string_ptr:
 				_op .ascii [_quote $filename]
 			    }
-			    if { $_line_is_64 } {
-				_op .8byte $string_ptr
-			    } else {
-				_op .4byte $string_ptr
-			    }
+			    _op_offset [expr $_line_is_64 ? 8 : 4] $string_ptr
 			}
 		    }
 		    _op .uleb128 $diridx
-- 
2.31.1


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

* [pushed 2/3] [gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp
  2021-11-29  8:55 [pushed 1/3] [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp with -m32 Tom de Vries
@ 2021-11-29  8:55 ` Tom de Vries
  2021-11-29  8:55 ` [pushed 3/3] [gdb/testsuite] Fix typo in proc lines Tom de Vries
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2021-11-29  8:55 UTC (permalink / raw)
  To: gdb-patches

While debugging a problem in gdb.dwarf2/dw2-lines.exp, I realized that the
test-case generates all executables and associated temporary files using the
same filenames.

Fix this by adding a new proc prefix_id in lib/gdb.exp, and using it in the
test-case.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.dwarf2/dw2-lines.exp |  6 ++++--
 gdb/testsuite/lib/gdb.exp              | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
index 9cc24955102..09b60527640 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -20,7 +20,7 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support 1
 
-standard_testfile .c -dw.S
+standard_testfile .c
 
 with_shared_gdb {
     set func_info_vars \
@@ -46,6 +46,8 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
     set ldw64 $_ldw64
     set string_form $_string_form
 
+    standard_testfile .c [prefix_id]-dw.S
+
     set asm_file [standard_output_file $srcfile2]
     Dwarf::assemble $asm_file {
 	declare_labels Llines
@@ -103,7 +105,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
 	}
     }
 
-    if { [prepare_for_testing "failed to prepare" ${testfile} \
+    if { [prepare_for_testing "failed to prepare" ${testfile}.[prefix_id] \
 	      [list $srcfile $asm_file] {nodebug}] } {
 	return -1
     }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 77f889e7404..b145fe8e2e8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2498,6 +2498,32 @@ proc proc_with_prefix {name arguments body} {
     proc $name $arguments [list with_test_prefix $name $body]
 }
 
+# Return an id corresponding to the test prefix stored in $pf_prefix, which
+# is more suitable for use in a file name.
+# F.i., for a pf_prefix:
+#   gdb.dwarf2/dw2-lines.exp: \
+#     cv=5: cdw=64: lv=5: ldw=64: string_form=line_strp:
+# return an id:
+#   cv-5-cdw-32-lv-5-ldw-64-string_form-line_strp
+
+proc prefix_id {} {
+    global pf_prefix
+    set id $pf_prefix
+
+    # Strip ".exp: " prefix.
+    set id [regsub  {.*\.exp: } $id {}]
+
+    # Strip colon suffix.
+    set id [regsub  {:$} $id {}]
+
+    # Strip spaces.
+    set id [regsub -all { } $id {}]
+
+    # Replace colons, equal signs.
+    set id [regsub -all \[:=\] $id -]
+
+    return $id
+}
 
 # Run BODY in the context of the caller.  After BODY is run, the variables
 # listed in VARS will be reset to the values they had before BODY was run.
-- 
2.31.1


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

* [pushed 3/3] [gdb/testsuite] Fix typo in proc lines
  2021-11-29  8:55 [pushed 1/3] [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp with -m32 Tom de Vries
  2021-11-29  8:55 ` [pushed 2/3] [gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp Tom de Vries
@ 2021-11-29  8:55 ` Tom de Vries
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2021-11-29  8:55 UTC (permalink / raw)
  To: gdb-patches

Proc lines contains a typo:
...
  string_form { set $_line_string_form $value }
...

Remove the incorrect '$' in '$_line_string_form'.

Tested on x86_64-linux.
---
 gdb/testsuite/lib/dwarf.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 94f67652e19..96978b8386a 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2209,7 +2209,7 @@ namespace eval Dwarf {
 		addr_size { set _unit_addr_size $value }
 		seg_sel_size { set _seg_sel_size $value }
 		default_is_stmt { set _default_is_stmt $value }
-		string_form { set $_line_string_form $value }
+		string_form { set _line_string_form $value }
 		default { error "unknown option $name" }
 	    }
 	}
-- 
2.31.1


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

end of thread, other threads:[~2021-11-29  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29  8:55 [pushed 1/3] [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp with -m32 Tom de Vries
2021-11-29  8:55 ` [pushed 2/3] [gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp Tom de Vries
2021-11-29  8:55 ` [pushed 3/3] [gdb/testsuite] Fix typo in proc lines 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).