[v6,1/3] gdb/testsuite: tweak compiler flag handling in jit-elf-helpers.exp

Message ID 20201210192807.30372-2-mihails.strasuns@intel.com
State New
Headers show
Series
  • Disable breakpoint locations in unloaded jit objects
Related show

Commit Message

Lancelot SIX via Gdb-patches Dec. 10, 2020, 7:28 p.m.
From: Mihails Strasuns via Gdb-patches <gdb-patches@sourceware.org>


- Unused $options parameter is removed for `compile_jit_elf_main_as_so`.
- New optional compiler flag parameter is added to
  `compile_and_download_n_jit_so`.  Will be used in the following commit.
- Do not pass compiler flag argument in a JIT test case,
  it is already added by the helper proc itself.

gdb/testsuite/ChangeLog:
2020-06-16  Mihails Strasuns  <mihails.strasuns@intel.com>

	* lib/jit-elf-helpers.exp (compile_jit_elf_main_as_so): Remove
	unused parameter.
	(compile_and_download_n_jit_so): Add optional parameter.
	* gdb.base/jit-elf-so.exp: Do not pass compiler flag argument.
---
 gdb/testsuite/gdb.base/jit-elf-so.exp | 3 +--
 gdb/testsuite/lib/jit-elf-helpers.exp | 9 +++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.17.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Comments

Lancelot SIX via Gdb-patches Jan. 8, 2021, 7:25 p.m. | #1
On 2020-12-10 2:28 p.m., Mihails Strasuns via Gdb-patches wrote:
> From: Mihails Strasuns via Gdb-patches <gdb-patches@sourceware.org>

> 

> - Unused $options parameter is removed for `compile_jit_elf_main_as_so`.

> - New optional compiler flag parameter is added to

>   `compile_and_download_n_jit_so`.  Will be used in the following commit.

> - Do not pass compiler flag argument in a JIT test case,

>   it is already added by the helper proc itself.

> 

> gdb/testsuite/ChangeLog:

> 2020-06-16  Mihails Strasuns  <mihails.strasuns@intel.com>

> 

> 	* lib/jit-elf-helpers.exp (compile_jit_elf_main_as_so): Remove

> 	unused parameter.

> 	(compile_and_download_n_jit_so): Add optional parameter.

> 	* gdb.base/jit-elf-so.exp: Do not pass compiler flag argument.


LGTM, thanks.

Simon

Patch

diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index 7e29a99e208..d55e393240e 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -141,8 +141,7 @@  proc one_jit_test {solib_binfiles_target match_str} {
 }
 
 # Compile the main code (which loads the JIT objects) as a shared library.
-if { [compile_jit_elf_main_as_so $main_solib_srcfile $main_solib_binfile \
-	{additional_flags="-DMAIN=jit_dl_main"}] < 0 } {
+if { [compile_jit_elf_main_as_so $main_solib_srcfile $main_solib_binfile] < 0 } {
     return
 }
 
diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index f1e8ad77852..4b720bbb18c 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -52,7 +52,7 @@  proc compile_jit_main {main_srcfile main_binfile options} {
 #
 # On success, return 0.
 # On failure, return -1.
-proc compile_jit_elf_main_as_so {main_solib_srcfile main_solib_binfile options} {
+proc compile_jit_elf_main_as_so {main_solib_srcfile main_solib_binfile} {
     global jit_load_address jit_load_increment
 
     set options [list \
@@ -76,7 +76,7 @@  proc compile_jit_elf_main_as_so {main_solib_srcfile main_solib_binfile options}
 #
 # On success, return a list of target path to the shared libraries.
 # On failure, return -1.
-proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count} {
+proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count {options {}}} {
     global jit_load_address jit_load_increment
     set binfiles_target {}
 
@@ -92,12 +92,13 @@  proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count}
 	# in the compiled shared library against a fixed base address.  Combined
 	# with mapping the resulting binary to the same fixed base it allows
 	# to dynamically execute functions from it without any further adjustments.
-	set options [list \
+	set so_options [concat \
+	    $options \
 	    additional_flags=-DFUNCTION_NAME=[format "jit_function_%04d" $i] \
 	    additional_flags=-Xlinker \
 	    additional_flags=-Ttext-segment=$addr]
 	if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} \
-		  $options] != "" } {
+		  $so_options] != "" } {
 	    set f [file tail $binfile]
 	    untested "failed to compile shared library $f"
 	    return -1