Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed] gdb.base/nodebug.exp: Rename called functions
@ 2017-09-14 17:46 Pedro Alves
  2017-09-14 17:48 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Alves @ 2017-09-14 17:46 UTC (permalink / raw)
  To: gdb-patches

I'm seeing these failures on my system:

  FAIL: gdb.base/nodebug.exp: p (double) mult (2.0, 3.0)
  FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2.0f, 3.0f)
  FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2, 3)

The problem is simply that GDB is finding a symbol named "mult" from
glibc's debug info:

  (gdb) ptype mult
  type = enum expression_operator {var, num, lnot, mult, divide, module, plus, minus, less_than, greater_than, less_or_equal, greater_or_equal, equal, not_equal, land, lor,  qmop}

  (gdb) info types expression_operator
  All types matching regular expression "expression_operator":

  File plural-exp.h:
  enum expression_operator;

Fix this by unloading symbols from shared libraries.

gdb/testsuite/ChangeLog:
2017-09-14  Pedro Alves  <palves@redhat.com>

	* gdb.base/nodebug.exp (nodebug_runto): New procedure.
	(top level): Use it instead of runto.
---
 gdb/testsuite/ChangeLog            |  5 +++++
 gdb/testsuite/gdb.base/nodebug.exp | 19 +++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2726d46..745d2d1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-14  Pedro Alves  <palves@redhat.com>
+
+	* gdb.base/nodebug.exp (nodebug_runto): New procedure.
+	(top level): Use it instead of runto.
+
 2017-09-11  Tom Tromey  <tom@tromey.com>
 
 	* gdb.base/ena-dis-br.exp (test_ena_dis_br): Update test.
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 2099456..3a2a821 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -39,6 +39,21 @@ if  { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "
 
 clean_restart $binfile
 
+# Run to FUNC and unload symbols from system shared libraries, to
+# avoid conflicts with the minsyms in the program.  E.g.,
+# intl/plural-exp.h has 'enum expression_operator {..., mult, ...}'.
+
+proc nodebug_runto {func} {
+    with_test_prefix $func {
+	if ![runto $func] {
+	    return false
+	}
+	gdb_test_no_output "nosharedlibrary" \
+	    "unload symbols from system libraries"
+	return true
+    }
+}
+
 # Test calling no-debug functions involving argument types that may
 # require coercion/promotion, both prototyped and unprototyped, both
 # return-type-cast style, and function-pointer-cast styles.
@@ -73,7 +88,7 @@ proc test_call_promotion {} {
     gdb_test "p /d ((uint8 (*) ()) add8_noproto)((uint8) 2, (uint8) 3)" " = 5"
 }
 
-if [runto inner] then {
+if [nodebug_runto inner] then {
     
     # Expect to find global/local symbols in each of text/data/bss.
     
@@ -273,7 +288,7 @@ if [runto inner] then {
 
     # Now, try that we can give names of file-local symbols which happen
     # to be unique, and have it still work
-    if [runto middle] then {
+    if [nodebug_runto middle] then {
 	gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
 	    "backtrace from middle in nodebug.exp"
     }
-- 
2.5.5


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

* Re: [pushed] gdb.base/nodebug.exp: Rename called functions
  2017-09-14 17:46 [pushed] gdb.base/nodebug.exp: Rename called functions Pedro Alves
@ 2017-09-14 17:48 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2017-09-14 17:48 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

The $subject is incorrect, but I failed to notice it until it was
too late.  I was originally going to rename the functions,
until I realized that unloading symbols was a more complete fix.

Thanks,
Pedro Alves

On 09/14/2017 06:46 PM, Pedro Alves wrote:
> I'm seeing these failures on my system:
> 
>   FAIL: gdb.base/nodebug.exp: p (double) mult (2.0, 3.0)
>   FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2.0f, 3.0f)
>   FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2, 3)
> 
> The problem is simply that GDB is finding a symbol named "mult" from
> glibc's debug info:
> 
>   (gdb) ptype mult
>   type = enum expression_operator {var, num, lnot, mult, divide, module, plus, minus, less_than, greater_than, less_or_equal, greater_or_equal, equal, not_equal, land, lor,  qmop}
> 
>   (gdb) info types expression_operator
>   All types matching regular expression "expression_operator":
> 
>   File plural-exp.h:
>   enum expression_operator;
> 
> Fix this by unloading symbols from shared libraries.
> 
> gdb/testsuite/ChangeLog:
> 2017-09-14  Pedro Alves  <palves@redhat.com>
> 
> 	* gdb.base/nodebug.exp (nodebug_runto): New procedure.
> 	(top level): Use it instead of runto.
> ---
>  gdb/testsuite/ChangeLog            |  5 +++++
>  gdb/testsuite/gdb.base/nodebug.exp | 19 +++++++++++++++++--
>  2 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index 2726d46..745d2d1 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2017-09-14  Pedro Alves  <palves@redhat.com>
> +
> +	* gdb.base/nodebug.exp (nodebug_runto): New procedure.
> +	(top level): Use it instead of runto.
> +
>  2017-09-11  Tom Tromey  <tom@tromey.com>
>  
>  	* gdb.base/ena-dis-br.exp (test_ena_dis_br): Update test.
> diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
> index 2099456..3a2a821 100644
> --- a/gdb/testsuite/gdb.base/nodebug.exp
> +++ b/gdb/testsuite/gdb.base/nodebug.exp
> @@ -39,6 +39,21 @@ if  { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "
>  
>  clean_restart $binfile
>  
> +# Run to FUNC and unload symbols from system shared libraries, to
> +# avoid conflicts with the minsyms in the program.  E.g.,
> +# intl/plural-exp.h has 'enum expression_operator {..., mult, ...}'.
> +
> +proc nodebug_runto {func} {
> +    with_test_prefix $func {
> +	if ![runto $func] {
> +	    return false
> +	}
> +	gdb_test_no_output "nosharedlibrary" \
> +	    "unload symbols from system libraries"
> +	return true
> +    }
> +}
> +
>  # Test calling no-debug functions involving argument types that may
>  # require coercion/promotion, both prototyped and unprototyped, both
>  # return-type-cast style, and function-pointer-cast styles.
> @@ -73,7 +88,7 @@ proc test_call_promotion {} {
>      gdb_test "p /d ((uint8 (*) ()) add8_noproto)((uint8) 2, (uint8) 3)" " = 5"
>  }
>  
> -if [runto inner] then {
> +if [nodebug_runto inner] then {
>      
>      # Expect to find global/local symbols in each of text/data/bss.
>      
> @@ -273,7 +288,7 @@ if [runto inner] then {
>  
>      # Now, try that we can give names of file-local symbols which happen
>      # to be unique, and have it still work
> -    if [runto middle] then {
> +    if [nodebug_runto middle] then {
>  	gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
>  	    "backtrace from middle in nodebug.exp"
>      }
> 



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

end of thread, other threads:[~2017-09-14 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14 17:46 [pushed] gdb.base/nodebug.exp: Rename called functions Pedro Alves
2017-09-14 17:48 ` Pedro Alves

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