This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] adapt gdb tests for leading-underscore symbols


This is an effort at a generalized solution to testing with targets
where minimal symbols have a prefixed underscore.


2003-07-23  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/nodebug.exp: Prepend leading underscore to symbols
	for selected targets.
	* gdb.base/remote.exp: Ditto.
	* gdb.base/maint.exp: Ditto.
	* gdb.base/display.exp: Ditto.

Index: gdb.base/nodebug.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/nodebug.exp,v
retrieving revision 1.2
diff -p -r1.2 nodebug.exp
*** gdb.base/nodebug.exp	6 Mar 2001 08:21:50 -0000	1.2
--- gdb.base/nodebug.exp	23 Jul 2003 19:16:58 -0000
*************** gdb_start
*** 46,52 ****
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load $binfile
  
! if [runto inner] then {
      
      # Expect to find global/local symbols in each of text/data/bss.
      
--- 46,58 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load $binfile
  
! if [target_info exists uses_underscores] then {
!     set under "_"
! } else {
!     set under ""
! }
! 
! if [runto ${under}inner] then {
      
      # Expect to find global/local symbols in each of text/data/bss.
      
*************** if [runto inner] then {
*** 67,99 ****
      # even without -g, which should be accepted.
      # Irix5, even though it is ELF, counts as "ecoff" because it
      # encapsulates ecoff debugging info in a .mdebug section.
!     # Irix6 gcc omits no debug info at all for static functions and
      # variables, so all tests involving statics fail.
      
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
!     gdb_test "p top" \
! 	"\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <top(\\(int\\)|)>"
!     if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
!     gdb_test "whatis top" \
  	"(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype top" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
      
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "p middle" \
! 	"\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <middle(\\(int\\)|)>"
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "whatis middle" \
  	"(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "ptype middle" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
      
!     gdb_test "p dataglobal" "= 3"
!     gdb_test "whatis dataglobal" \
  	"<(data variable|variable), no debug info>|int"
!     gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>|int"
      
      # The only symbol xcoff puts out for statics is for the TOC entry.
      # Possible, but hairy, for gdb to deal.  Right now it doesn't, it
--- 73,109 ----
      # even without -g, which should be accepted.
      # Irix5, even though it is ELF, counts as "ecoff" because it
      # encapsulates ecoff debugging info in a .mdebug section.
!     # Irix6 gcc emits no debug info at all for static functions and
      # variables, so all tests involving statics fail.
      
+     if {!$gcc_compiled} then { 
+ 	setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" 
+     }
+     gdb_test "p ${under}top" \
+ 	"\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <${under}top(\\(int\\)|)>"
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
!     gdb_test "whatis ${under}top" \
  	"(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype ${under}top" \
! 	    "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
      
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "p ${under}middle" \
! 	"\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <${under}middle(\\(int\\)|)>"
      if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "whatis ${under}middle" \
  	"(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))"
      setup_xfail "mips-sgi-irix6*"
!     gdb_test "ptype ${under}middle" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
      
!     gdb_test "p ${under}dataglobal" "= 3"
!     gdb_test "whatis ${under}dataglobal" \
  	"<(data variable|variable), no debug info>|int"
!     gdb_test "ptype ${under}dataglobal" \
! 	    "<(data variable|variable), no debug info>|int"
      
      # The only symbol xcoff puts out for statics is for the TOC entry.
      # Possible, but hairy, for gdb to deal.  Right now it doesn't, it
*************** if [runto inner] then {
*** 102,138 ****
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "p datalocal" "= 4"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
      
!     gdb_test "p bssglobal" "= 0"
!     gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>|int"
!     gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>|int"
      
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "p bsslocal" "= 0"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
      
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
      gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
--- 112,154 ----
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "p ${under}datalocal" "= 4"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "whatis ${under}datalocal" \
! 	    "<(data variable|variable), no debug info>"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype ${under}datalocal" \
! 	    "<(data variable|variable), no debug info>"
      
!     gdb_test "p ${under}bssglobal" "= 0"
!     gdb_test "whatis ${under}bssglobal" \
! 	    "<(data variable|variable), no debug info>|int"
!     gdb_test "ptype ${under}bssglobal" \
! 	    "<(data variable|variable), no debug info>|int"
      
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "p ${under}bsslocal" "= 0"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "whatis ${under}bsslocal" \
! 	    "<(data variable|variable), no debug info>"
      setup_xfail "rs6000*-*-aix*"
      setup_xfail "powerpc*-*-aix*"
      if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     gdb_test "ptype ${under}bsslocal" \
! 	    "<(data variable|variable), no debug info>"
      
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
      gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
*************** if [runto inner] then {
*** 156,180 ****
  	# the inferior was compiled with -g.  Thus, we expect this
  	# testpoint to fail on HP-UX.
  	if { [istarget "hppa*-hpux*"] } {
! 	    send_gdb "p/c array_index(\"abcdef\",2)\n"
  	    gdb_expect {
! 		-re ".*Suggest linking executable with -g.*$gdb_prompt $" { pass "p/c array_index(\"abcdef\",2)" }
! 		-re ".*Cannot find __wdb_call_dummy in.*end.o.*" { pass "p/c array_index(\"abcdef\",2)" }
! 		-re ".*99 'c'.*" { pass "p/c array_index(\"abcdef\",2)" }
  		timeout { fail "(timeout) p/c array_index" }
  	    }
  	} else {
! 	    # We need to up this because this can be really slow on some boards.
  	    # (malloc() is called as part of the test).
  	    set timeout 60;    
! 	    gdb_test {p/c array_index("abcdef",2)} " = 99 'c'"
  	}
      }
      
      # Now, try that we can give names of file-local symbols which happen
      # to be unique, and have it still work
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     if [runto middle] then {
  	gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
  	    "backtrace from middle in nodebug.exp"
      }
--- 172,203 ----
  	# the inferior was compiled with -g.  Thus, we expect this
  	# testpoint to fail on HP-UX.
  	if { [istarget "hppa*-hpux*"] } {
! 	    send_gdb "p/c ${under}array_index(\"abcdef\",2)\n"
  	    gdb_expect {
! 		-re ".*Suggest linking executable with -g.*$gdb_prompt $" { 
! 		    pass "p/c array_index(\"abcdef\",2)" 
! 		}
! 		-re ".*Cannot find __wdb_call_dummy in.*end.o.*" { 
! 		    pass "p/c array_index(\"abcdef\",2)" 
! 		}
! 		-re ".*99 'c'.*" { 
! 		    pass "p/c array_index(\"abcdef\",2)" 
! 		}
  		timeout { fail "(timeout) p/c array_index" }
  	    }
  	} else {
! 	    # We need to up this because this can be 
! 	    # really slow on some boards.
  	    # (malloc() is called as part of the test).
  	    set timeout 60;    
! 	    gdb_test "p/c ${under}array_index(\"abcdef\",2)" " = 99 'c'"
  	}
      }
      
      # Now, try that we can give names of file-local symbols which happen
      # to be unique, and have it still work
      if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
!     if [runto ${under}middle] then {
  	gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
  	    "backtrace from middle in nodebug.exp"
      }
Index: gdb.base/remote.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/remote.exp,v
retrieving revision 1.3
diff -p -r1.3 remote.exp
*** gdb.base/remote.exp	17 Jul 2001 21:47:19 -0000	1.3
--- gdb.base/remote.exp	23 Jul 2003 19:16:58 -0000
*************** if $tracelevel then {
*** 24,29 ****
--- 24,34 ----
  set prms_id 0
  set bug_id 0
  
+ if [target_info exists uses_underscores] then {
+     set under "_"
+ } else {
+     set under ""
+ }
  
  # test only on a remote target board
  if {! [is_remote target]} {
*************** if ![runto_main] then {
*** 173,186 ****
  # conditions
  
  gdb_test "x/8ub random_data" \
! 	"<random_data>:\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44"
  
  gdb_test "x/8ub random_data + 400 - 4" \
! 	"<random_data\\+396>:\[ \t\]+185\[ \t\]+255\[ \t\]+50\[ \t\]+140\[ \t\]+237\[ \t\]+172\[ \t\]+143\[ \t\]+93"
  
  if {$sizeof_random_data > 16380 } then {
      gdb_test "x/8ub random_data + 16384 - 4" \
! 	"<random_data\\+16380>:\[ \t\]+178\[ \t\]+180\[ \t\]+135\[ \t\]+93\[ \t\]+70\[ \t\]+62\[ \t\]+205\[ \t\]+76"
  }
  
  # Read a chunk just larger than the packet size (reduce the packet
--- 178,191 ----
  # conditions
  
  gdb_test "x/8ub random_data" \
! 	"<${under}random_data>:\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44"
  
  gdb_test "x/8ub random_data + 400 - 4" \
! 	"<${under}random_data\\+396>:\[ \t\]+185\[ \t\]+255\[ \t\]+50\[ \t\]+140\[ \t\]+237\[ \t\]+172\[ \t\]+143\[ \t\]+93"
  
  if {$sizeof_random_data > 16380 } then {
      gdb_test "x/8ub random_data + 16384 - 4" \
! 	    "<${under}random_data\\+16380>:\[ \t\]+178\[ \t\]+180\[ \t\]+135\[ \t\]+93\[ \t\]+70\[ \t\]+62\[ \t\]+205\[ \t\]+76"
  }
  
  # Read a chunk just larger than the packet size (reduce the packet
*************** gdb_test "set remote memory-read-packet-
*** 190,195 ****
  gdb_test "show remote memory-read-packet-size" \
  	"The memory-read-packet-size is 16. Packets are limited to 16 bytes."
  gdb_test "x/17ub random_data" \
! 	"<random_data>:\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44.*<random_data\\+8>:\[ \t\]+124\[ \t\]+38\[ \t\]+93\[ \t\]+125\[ \t\]+232\[ \t\]+67\[ \t\]+228\[ \t\]+56.*<random_data\\+16>:\[ \t\]+161"
  
  gdb_exit
--- 195,200 ----
  gdb_test "show remote memory-read-packet-size" \
  	"The memory-read-packet-size is 16. Packets are limited to 16 bytes."
  gdb_test "x/17ub random_data" \
! 	"<${under}random_data>:\[ \t\]+60\[ \t\]+74\[ \t\]+216\[ \t\]+38\[ \t\]+149\[ \t\]+49\[ \t\]+207\[ \t\]+44.*<${under}random_data\\+8>:\[ \t\]+124\[ \t\]+38\[ \t\]+93\[ \t\]+125\[ \t\]+232\[ \t\]+67\[ \t\]+228\[ \t\]+56.*<${under}random_data\\+16>:\[ \t\]+161"
  
  gdb_exit
Index: gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.19
diff -p -r1.19 maint.exp
*** gdb.base/maint.exp	5 May 2003 18:33:11 -0000	1.19
--- gdb.base/maint.exp	23 Jul 2003 19:16:58 -0000
*************** gdb_start
*** 77,82 ****
--- 77,88 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
+ if [target_info exists uses_underscores] then {
+     set under "_"
+ } else {
+     set under ""
+ }
+ 
  if ![runto_main] then {
          perror "tests suppressed"
  }
*************** gdb_expect  {
*** 286,292 ****
                   {
                    send_gdb "shell grep factorial msymbols_output\n"
                    gdb_expect {
!                         -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\
                                                 { pass "maint print msymbols" }
                          -re ".*$gdb_prompt $"       { fail "maint print msymbols" }
                           timeout         { fail "(timeout) maint print msymbols" }
--- 292,298 ----
                   {
                    send_gdb "shell grep factorial msymbols_output\n"
                    gdb_expect {
! 		      -re "\\\[ *$decimal\\\] T\[ \t\]+$hex ${under}factorial.*$gdb_prompt $"\
                                                 { pass "maint print msymbols" }
                          -re ".*$gdb_prompt $"       { fail "maint print msymbols" }
                           timeout         { fail "(timeout) maint print msymbols" }
Index: gdb.base/display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/display.exp,v
retrieving revision 1.6
diff -p -r1.6 display.exp
*** gdb.base/display.exp	20 Jan 2003 15:40:07 -0000	1.6
--- gdb.base/display.exp	23 Jul 2003 19:16:58 -0000
*************** gdb_start
*** 52,57 ****
--- 52,63 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
+ if [target_info exists uses_underscores] then {
+     set under "_"
+ } else {
+     set under ""
+ }
+ 
  # Some coverage stuff
  #
  if ![target_info exists use_gdb_stub] {
*************** if [istarget "hppa*-hp-hpux*"] {
*** 197,203 ****
  gdb_test "print/0 j" ".*Item count other than 1 is meaningless.*" "print/0 j"
  gdb_test "print/s sum" ".*Format letter.*is meaningless.*" " no s"
  gdb_test "print/i sum" ".*Format letter.*is meaningless.*.*" "no i"
! gdb_test "print/a &sum" ".*= $hex.*<sum>.*"
  # If the constant below is larger than the length of main, then
  # this test will (incorrectly) fail.  So use a small number.
  gdb_test "print/a main+4" ".*= $hex.*<.*>.*"
--- 203,209 ----
  gdb_test "print/0 j" ".*Item count other than 1 is meaningless.*" "print/0 j"
  gdb_test "print/s sum" ".*Format letter.*is meaningless.*" " no s"
  gdb_test "print/i sum" ".*Format letter.*is meaningless.*.*" "no i"
! gdb_test "print/a &sum" ".*= $hex.*<${under}sum>.*"
  # If the constant below is larger than the length of main, then
  # this test will (incorrectly) fail.  So use a small number.
  gdb_test "print/a main+4" ".*= $hex.*<.*>.*"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]