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]

Re: [RFA/TESTSUITE] annota1.exp fixes


David Carlton writes:
 > On Tue, 8 Apr 2003 18:53:21 -0400, Elena Zannoni <ezannoni at redhat dot com> said:
 > 
 > > The test was too eager in matching the whole path to the source file.
 > > What's really happening is that it wouldn't match a '+' in the
 > > directory name. (In RedHat gdb the source directory is named the same
 > > as the sourceware snapshots i.e. gdb+dejagnu, which now I know not to
 > > do again).
 > 
 > For what it's worth, I had another problem with those regexps a while
 > ago: I'm getting output that included subdir but not srcdir.
 > (Presumably I'm the only one seeing this because I actually build in
 > the source directory.)  I submitted a patch to allow that; Fernando's
 > response was that he didn't know if that was allowable output, so we
 > should check with annotation users to make sure.  And nobody ever did
 > that.
 > 
 > Your regexps accept the output that I'm seeing.  So if we're really
 > nervous about not wanting to accept my output, then probably your
 > patches aren't a great idea, and we should instead modify them to
 > create new variables srcdir-regexp and subdir-regexp (or whatever)
 > that are regexp-protected, and use them.  On the other hand, I'm
 > inclined to go with your patches: the regexps already accept it if
 > both srcdir and subdir are missing, so could it really be any worse if
 > just srcdir is missing?
 > 
 > By the way, my original message was in a thread titled
 > "[rfa/testsuite] make annota1 regexps more generous"; see also a
 > threat titled "[RFA] annota1.exp: Don't require complete pathname in
 > info break test".
 > 

Hmm, I've reread the threads and I am none the wiser. We didn't ask the 
emacs people, like Eli suggested.

I have a revised patch, which works for my problem, but doesn't help
you.  I was wondering if using something like matching on
(${longversion}|${shortversion}) would work.


Index: annota1.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/annota1.exp,v
retrieving revision 1.11
diff -u -p -r1.11 annota1.exp
--- annota1.exp	28 Sep 2002 01:12:04 -0000	1.11
+++ annota1.exp	10 Apr 2003 17:27:39 -0000
@@ -87,6 +87,11 @@ gdb_test "break main" \
 set old_gdb_prompt $gdb_prompt
 set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
 
+#
+# Escape all the characters in the path that need it. For instance 
+# the directory name could contain '+'.
+#
+set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
 
 
 #
@@ -115,7 +120,7 @@ gdb_expect {
 #
 send_gdb "info break\n" 
 gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType           \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress    +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1   \r\n\032\032field 1\r\nbreakpoint     \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny   \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at (${srcdir}/${subdir}/)?${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \
+    -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType           \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress    +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1   \r\n\032\032field 1\r\nbreakpoint     \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny   \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \
 	{pass "breakpoint info"}
    -re ".*$gdb_prompt$" { fail "breakpoint info" }
    timeout { fail "breakpoint info (timeout)" }
@@ -247,7 +252,7 @@ gdb_expect {
 #
 send_gdb "backtrace\n"
 gdb_expect {
-  -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0  \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1  \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \
+    -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0  \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1  \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \
 	  { pass "backtrace from shlibrary" }
   -re ".*$gdb_prompt$"     { fail "backtrace from shlibrary" }
   timeout	            { fail "backtrace from shlibrary (timeout)" }
@@ -263,7 +268,7 @@ gdb_expect {
 #
 send_gdb "signal SIGUSR1\n"
 gdb_expect {
-  -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
+    -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
 	{ pass "send SIGUSR1" }
   -re ".*$gdb_prompt$"     { fail "send SIGUSR1" }
   timeout	            { fail "send SIGUSR1 (timeout)" }
@@ -322,7 +327,7 @@ gdb_expect {
 #
 send_gdb "break main\n"
 gdb_expect {
-     -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${srcdir}/${subdir}/${srcfile}, line $main_line.*$gdb_prompt$" \
+    -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" \
 	     { pass "break at 28" }
      -re ".*$gdb_prompt$"  { fail "break at 28" }
      timeout { fail "break at 28 (timeout)" }


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