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]

[PATCH]: Tweak testsuite/gdb.base/completion.exp test


Hi,

the attached patch solves the following problem in completion.exp.

The test expects an output which it can't get from some small or
simulated targets. Line 352ff:

send_gdb "p \"a\t"
sleep 1
gdb_expect  {
   -re "^p \"a\\\x07$"\
       { send_gdb "\n"
         gdb_expect {
           -re "Unterminated string in expression\\..*$gdb_prompt $"\

As you can see, it expects

        p "a^G

on the line since the `a' is ambiguous here.   

Unfortunately it's not _that_ ambiguous. On the target I'm just working
there are only two file starting with `a' involved: atexit.c and atoi.c.
The result is that gdb completes to

        p "a^Gt

The patch avoids that problem by doing the following:

The completion.exp test uses break.c as testsource currently.
Instead, create a file `completion.c' by copying it from
break.c. Since `atoi()' and `atexit()' are known to be called
in that source, just add a dummy call to `abort()'. This
results in `abort.c' linked in so that the above test now
works as expected.


ChangeLog:

2001-08-29  Corinna Vinschen  <vinschen@redhat.com>

	* gdb.base/completion.c: New file.
	* gdb.base/completion.exp: Use completion.c as testfile.


Index: completion.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
retrieving revision 1.6
diff -u -p -r1.6 completion.exp
--- completion.exp	2001/08/06 22:08:12	1.6
+++ completion.exp	2001/08/29 18:38:06
@@ -60,7 +60,7 @@ global usestubs
 set prms_id 0
 set bug_id 0
 
-set testfile "break"
+set testfile "completion"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
@@ -576,7 +576,7 @@ gdb_expect  {
                       -re "marker1.*$gdb_prompt info func marker$"\
                       { send_gdb "\n"
                         gdb_expect {
-                                -re "All functions matching regular expression \"marker\":.*File.*break.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\
+                                -re "All functions matching regular expression \"marker\":.*File.*completion.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\
                                                   { pass "complete 'info func mar'"}
                                 -re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
                                 timeout           {fail "(timeout) complete 'info func mar'"}


Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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