Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler
@ 2020-11-05 16:40 Tom de Vries
  2020-11-10 19:12 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2020-11-05 16:40 UTC (permalink / raw)
  To: gdb-patches

Hi,

The proc build_executable_from_fission_assembler currently only handles
one source file.  Remove that restriction, and add a parameter to specify
regular, non-fission sources.

Tested gdb.dwarf2/*.exp on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler

gdb/testsuite/ChangeLog:

2020-11-05  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/fission-base.exp: Add extra arg to
	* build_executable_from_fission_assembler call.
	* gdb.dwarf2/fission-loclists-pie.exp: Same.
	* gdb.dwarf2/fission-loclists.exp: Same.
	* gdb.dwarf2/fission-multi-cu.exp: Same.
	* gdb.dwarf2/fission-reread.exp: Same.
	* lib/dwarf.exp (build_object_from_fission_assembler): New proc,
	factored out of ...
	(build_executable_from_fission_assembler): ... here.  Handle more than
	one fission source.  Add parameter to handle non-fission sources.

---
 gdb/testsuite/gdb.dwarf2/fission-base.exp         |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-loclists.exp     |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp     |  2 +-
 gdb/testsuite/gdb.dwarf2/fission-reread.exp       |  2 +-
 gdb/testsuite/lib/dwarf.exp                       | 43 +++++++++++++++++------
 6 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp
index 41e30a73fb..ce929dfe04 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp
@@ -33,7 +33,7 @@ if {![istarget x86_64-*] || ![is_lp64_target]} {
 standard_testfile .S
 
 if [build_executable_from_fission_assembler \
-	"$testfile.exp" "$binfile" "$srcfile" {nodebug}] {
+	"$testfile.exp" "$binfile" "$srcfile" {} {nodebug}] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
index 519d4aa5dc..c9ce46ea44 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
@@ -38,7 +38,7 @@ if {![istarget x86_64-*] || ![is_lp64_target]} {
 standard_testfile .S
 
 if [build_executable_from_fission_assembler \
-	"$testfile.exp" "$binfile" "$srcfile" \
+	"$testfile.exp" "$binfile" "$srcfile" {} \
 	[list "nodebug" "ldflags=-pie"]] {
     return -1
 }
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
index d80ec2ba63..b3ce6d2eb1 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
@@ -33,7 +33,7 @@ if {![istarget x86_64-*] || ![is_lp64_target]} {
 standard_testfile .S
 
 if [build_executable_from_fission_assembler \
-	"$testfile.exp" "$binfile" "$srcfile" {nodebug}] {
+	"$testfile.exp" "$binfile" "$srcfile" {} {nodebug}] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
index f2be5b91d6..e1b9351c62 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
@@ -33,7 +33,7 @@ if {![istarget x86_64-*] || ![is_lp64_target]} {
 standard_testfile .S
 
 if [build_executable_from_fission_assembler \
-	"$testfile.exp" "$binfile" "$srcfile" {nodebug}] {
+	"$testfile.exp" "$binfile" "$srcfile" {} {nodebug}] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index 1994ad7a59..1a82cd799c 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -31,7 +31,7 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm]
 standard_testfile .S
 
 if [build_executable_from_fission_assembler \
-	"$testfile.exp" "$binfile" "$srcfile" \
+	"$testfile.exp" "$binfile" "$srcfile" {} \
 	[list nodebug $additional_flags]] {
     return -1
 }
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 7bb745c71d..c18130b74d 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -29,27 +29,20 @@ proc dwarf2_support {} {
     return 0
 }
 
-# Build an executable from a fission-based .S file.
+# Build an object from a fission-based .S file SOURCE.
 # This handles the extra work of splitting the .o into non-dwo and dwo
 # pieces, making sure the .dwo is available if we're using cc-with-tweaks.sh
 # to build a .dwp file.
-# The arguments and results are the same as for build_executable.
+# The options argument is the same as for gdb_compile.
 #
 # Current restrictions:
-# - only supports one source file
 # - cannot be run on remote hosts
 
-proc build_executable_from_fission_assembler { testname executable sources options } {
-    verbose -log "build_executable_from_fission_assembler $testname $executable $sources $options"
-    if { [llength $sources] != 1 } {
-	error "Only one source file supported."
-    }
+proc build_object_from_fission_assembler { source_file options } {
     if [is_remote host] {
 	error "Remote hosts are not supported."
     }
 
-    global srcdir subdir
-    set source_file ${srcdir}/${subdir}/${sources}
     set root_name [file rootname [file tail $source_file]]
     set output_base [standard_output_file $root_name]
     set object_file ${output_base}.o
@@ -78,7 +71,35 @@ proc build_executable_from_fission_assembler { testname executable sources optio
 	return -1
     }
 
-    set result [gdb_compile $object_file $executable executable $options]
+    return $object_file
+}
+
+# Build an executable from fission-based .S files FISSION_SOURCES, and regular
+# SOURCES.  The arguments and results are the same as for build_executable.
+
+# Current restrictions:
+# - cannot be run on remote hosts
+
+proc build_executable_from_fission_assembler { testname executable fission_sources sources options } {
+    verbose -log "build_executable_from_fission_assembler $testname $executable $fission_sources $sources $options"
+    if [is_remote host] {
+	error "Remote hosts are not supported."
+    }
+
+    global srcdir subdir
+
+    set l [list]
+    foreach source $fission_sources {
+	if { [file pathtype $source] ne "absolute" } {
+	    set source ${srcdir}/${subdir}/${source}
+	}
+	set object_file [build_object_from_fission_assembler $source $options]
+	lappend l $object_file
+    }
+    foreach source $sources {
+	lappend l ${srcdir}/${subdir}/$source
+    }
+    set result [gdb_compile $l $executable executable $options]
     if { "$result" != "" } {
 	return -1
     }

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

* Re: [PATCH][gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler
  2020-11-05 16:40 [PATCH][gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler Tom de Vries
@ 2020-11-10 19:12 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2020-11-10 19:12 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 2020-11-05 11:40 a.m., Tom de Vries wrote:
> diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
> index 7bb745c71d..c18130b74d 100644
> --- a/gdb/testsuite/lib/dwarf.exp
> +++ b/gdb/testsuite/lib/dwarf.exp
> @@ -29,27 +29,20 @@ proc dwarf2_support {} {
>      return 0
>  }
>
> -# Build an executable from a fission-based .S file.
> +# Build an object from a fission-based .S file SOURCE.

SOURCE_FILE

> @@ -78,7 +71,35 @@ proc build_executable_from_fission_assembler { testname executable sources optio
>  	return -1
>      }
>
> -    set result [gdb_compile $object_file $executable executable $options]
> +    return $object_file
> +}
> +
> +# Build an executable from fission-based .S files FISSION_SOURCES, and regular
> +# SOURCES.  The arguments and results are the same as for build_executable.
> +
> +# Current restrictions:
> +# - cannot be run on remote hosts
> +
> +proc build_executable_from_fission_assembler { testname executable fission_sources sources options } {
> +    verbose -log "build_executable_from_fission_assembler $testname $executable $fission_sources $sources $options"
> +    if [is_remote host] {
> +	error "Remote hosts are not supported."
> +    }
> +
> +    global srcdir subdir
> +
> +    set l [list]

Naming this variable "objects" would be a bit more expressive.

No other comments, thanks.

Simon

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

end of thread, other threads:[~2020-11-10 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 16:40 [PATCH][gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler Tom de Vries
2020-11-10 19:12 ` Simon Marchi

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