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]

[PATCH] Detect leading underscore in assembly source test



Some targets strip the leading underscores from symbols.
This change prevents the assembly source test from stumbling
over "_start" vs. "start", and incidentally adds a couple of
more tests: one for "info target" and one for "info symbol".

2001-12-06  Michael Snyder  <msnyder@redhat.com>

	* gdb.asm/asm-source.exp: Add tests for info target, info symbol, 
	and detect whether the start symbol has a leading underscore.

Index: asm-source.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asm-source.exp,v
retrieving revision 1.11
diff -c -3 -p -r1.11 asm-source.exp
*** asm-source.exp	2001/12/04 19:45:57	1.11
--- asm-source.exp	2001/12/07 02:48:39
*************** gdb_test "n" "33\[ 	\]*.*foo2" "next ove
*** 99,106 ****
  # See if we can properly `step' into a subroutine call.
  gdb_test "s" "8\[ 	\]*.*" "step into foo2"
  
  # Now try a 'list' from the other source file.
! gdb_test "list _start" ".*gdbasm_startup.*" "list"
  
  # Now try a source file search
  gdb_test "search A routine for foo2 to call" \
--- 99,141 ----
  # See if we can properly `step' into a subroutine call.
  gdb_test "s" "8\[ 	\]*.*" "step into foo2"
  
+ # Test 'info target', and incidentally capture the entry point address.
+ set entry_point 0
+ send_gdb "info target\n"
+ gdb_expect {
+     -re "Symbols from .*asm-source.*Entry point: 0x(\[01232456789abcdefABCDEF\]+).*$gdb_prompt $" {
+ 	set entry_point $expect_out(1,string)
+ 	pass "info target"
+     }
+     -re ".*$gdb_prompt $" {
+ 	fail "info target"
+     }
+     timeout {
+ 	fail "info target (timeout)"
+     }
+ }
+ 
+ # Capture the start symbol (may be '_start' or 'start')
+ set entry_symbol ""
+ send_gdb "info symbol 0x$entry_point\n"
+ gdb_expect {
+     -re "info symbol 0x$entry_point\[\r\n\]*" {
+ 	exp_continue
+     }
+     -re "(.*) in section .*$gdb_prompt $" {
+ 	set entry_symbol $expect_out(1,string)
+ 	pass "info symbol"
+     }
+     -re ".*$gdb_prompt $" {
+ 	fail "info symbol"
+     }
+     timeout {
+ 	fail "info symbol (timeout)"
+     }
+ }
+ 
  # Now try a 'list' from the other source file.
! gdb_test "list $entry_symbol" ".*gdbasm_startup.*" "list"
  
  # Now try a source file search
  gdb_test "search A routine for foo2 to call" \


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