Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Handle multiple sources in build_executable_from_fission_assembler
Date: Thu, 5 Nov 2020 17:40:06 +0100	[thread overview]
Message-ID: <20201105164005.GA26356@delia> (raw)

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
     }

             reply	other threads:[~2020-11-05 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 16:40 Tom de Vries [this message]
2020-11-10 19:12 ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201105164005.GA26356@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox