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] Modifications to gdb/testsuite/gdb.base/attach.exp


1. Systems that use /proc produce slightly different error and informational
messages in response to the attach.exp script, which the changes below
address.

2. While looking at this, I found the following:

gdb_expect {
# This reponse is expected on HP-UX 10.20 (i.e., ptrace-based).
-re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\
{pass "attach to nonexistent process is prohibited"}

Gotcha, it appears! That "comment" is not a comment so far as Tcl is concerned. It tries to match against the strings "#", "reponse", "expected",
etc. It was indeed fortunate that this intended comment (and the one just
below it) had an even number of words in it (if they INTENTIONALLY had an
even number of words, my apologies).
Yes, ``#'' is a command, just like ``:'' in SH, so it can only appear where a command can.

P. Hilfinger
ACT Inc.

2002-04-12  Paul N. Hilfinger  <hilfingr@otisco.mckusick.com>

	* gdb.base/attach.exp: Add patterns to match output from /proc-based
	systems.
	Move comments in expect statements to inside the actions, so that they
	don't get matched against.

Yep fine (which reminds me, I should add a few my self :-).

Andrew
[for fernando]

--- Begin Message ---
1. Systems that use /proc produce slightly different error and informational
messages in response to the attach.exp script, which the changes below
address.

2. While looking at this, I found the following:

   gdb_expect {
      # This reponse is expected on HP-UX 10.20 (i.e., ptrace-based).
      -re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\
                      {pass "attach to nonexistent process is prohibited"}

Gotcha, it appears!  That "comment" is not a comment so far as Tcl is 
concerned.  It tries to match against the strings "#", "reponse", "expected",
etc.  It was indeed fortunate that this intended comment (and the one just
below it) had an even number of words in it (if they INTENTIONALLY had an
even number of words, my apologies).  

P. Hilfinger
ACT Inc.

2002-04-12  Paul N. Hilfinger  <hilfingr@otisco.mckusick.com>

	* gdb.base/attach.exp: Add patterns to match output from /proc-based
	systems.
	Move comments in expect statements to inside the actions, so that they
	don't get matched against.

Index: gdb/testsuite/gdb.base/attach.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/attach.exp,v
retrieving revision 1.6
diff -u -r1.6 attach.exp
--- gdb/testsuite/gdb.base/attach.exp	9 Apr 2002 20:48:45 -0000	1.6
+++ gdb/testsuite/gdb.base/attach.exp	13 Apr 2002 06:43:44 -0000
@@ -113,6 +113,11 @@
    gdb_expect {
       -re ".*Illegal process-id: abc.*$gdb_prompt $"\
                       {pass "attach to nonsense is prohibited"}
+      -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
+                      {
+                        # Response expected from /proc-based systems.
+                        pass "attach to nonsense is prohibited" 
+                      }
       -re "Attaching to.*$gdb_prompt $"\
                       {fail "attach to nonsense is prohibited (bogus pid allowed)"}
       -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"}
@@ -125,14 +130,23 @@
    #
    send_gdb "attach 0\n"
    gdb_expect {
-      # This reponse is expected on HP-UX 10.20 (i.e., ptrace-based).
       -re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\
-                      {pass "attach to nonexistent process is prohibited"}
-      # This response is expected on HP-UX 11.0 (i.e., ttrace-based).
+                      {
+                        # Response expected on HP-UX 10.20 (i.e., ptrace-based).
+                        pass "attach to nonexistent process is prohibited"
+                      }
       -re "Attaching to.*, process 0 failed.*Hint.*$gdb_prompt $"\
-                      {pass "attach to nonexistent process is prohibited"}
+                      {
+                        # Response expected on HP-UX 11.0 (i.e., ttrace-based).
+                        pass "attach to nonexistent process is prohibited"
+                      }
       -re "Attaching to.*, process 0.*denied.*$gdb_prompt $"\
                       {pass "attach to nonexistent process is prohibited"}
+      -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
+                      {
+                        # Response expected from /proc-based systems.
+                        pass "attach to nonexistent process is prohibited"
+                      }
       -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"}
       timeout         {fail "(timeout) attach to nonexistent process is prohibited"}
    }
@@ -164,7 +178,7 @@
 
    send_gdb "attach $testpid\n"
    gdb_expect {
-      -re "Attaching to program.*$binfile, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
+      -re "Attaching to program.*`?$binfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
                       {pass "attach1, after setting file"}
       -re "$gdb_prompt $" {fail "attach1, after setting file"}
       timeout         {fail "(timeout) attach1, after setting file"}

--- End Message ---

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