This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: But there *is* a variable named `b'. Sort of.
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 4 Dec 2001 11:40:04 -0500 (EST)
- Subject: RFA: But there *is* a variable named `b'. Sort of.
2001-12-04 Jim Blandy <jimb@redhat.com>
* gdb.base/completion.exp: On some systems, there is, in fact, a
variable named `b' in scope, since GDB treats all static
variables as being in scope. So use `no_var_named_this'
instead of `b'.
Index: gdb/testsuite/gdb.base/completion.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
retrieving revision 1.8
diff -c -r1.8 completion.exp
*** gdb/testsuite/gdb.base/completion.exp 2001/12/04 16:18:15 1.8
--- gdb/testsuite/gdb.base/completion.exp 2001/12/04 16:34:59
***************
*** 468,572 ****
}
! send_gdb "p b-a\t"
sleep 1
gdb_expect {
! -re "^p b-a\\\x07$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
! pass "complete 'p b-a'"
}
-re ".*$gdb_prompt $" {
! fail "complete 'p b-a'"
}
timeout {
! fail "(timeout) complete 'p b-a'"
}
}
}
-re ".*$gdb_prompt $" {
! fail "complete 'p b-a'"
}
timeout {
! fail "(timeout) complete 'p b-a'"
}
}
! send_gdb "p b-a\t"
sleep 1
gdb_expect {
! -re "^p b-a\\\x07$" {
send_gdb "\t"
gdb_expect {
! -re ".*argv.*$gdb_prompt p b-a$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p b-a'"
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
! timeout { fail "(timeout) complete (2) 'p b-a'" }
}
}
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
send_gdb "n"
gdb_expect {
! -re "\\(gdb\\) p b-a$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p b-a'"
}
-re ".*$gdb_prompt $" {
! fail "complete (2) 'p b-a'"
}
! timeout { fail "(timeout) complete (2) 'p b-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
! timeout { fail "(timeout) complete (2) 'p b-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
! timeout { fail "(timeout) complete (2) 'p b-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
! timeout { fail "(timeout) complete (2) 'p b-a'" }
}
! send_gdb "p b-\t"
sleep 1
gdb_expect {
! -re "^p b-\\\x07$" {
send_gdb "\t"
gdb_expect {
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
send_gdb "n"
gdb_expect {
! -re "\\(gdb\\) p b-$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"b\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p b-'"
}
-re ".*$gdb_prompt $" {
! fail "complete (2) 'p b-'"
}
! timeout { fail "(timeout) complete (2) 'p b-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
! timeout { fail "(timeout) complete (2) 'p b-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
! timeout { fail "(timeout) complete (2) 'p b-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
! timeout { fail "(timeout) complete (2) 'p b-'" }
}
send_gdb "file ${objdir}/Make\t"
--- 468,588 ----
}
! # These tests used to try completing the simpler "p b-a".
! # Unfortunately, on some systems, there are .o files in system
! # libraries which declare static variables named `b'. GDB, in an
! # effort to be helpful, finds these, and we get random error messages.
! #
! # For example, on S/390 linux, the file s_atan.c in libm.a declares a
! # `b', which is a structure containing an int and a float, so GDB says
! # ``Argument to arithmetic operation not a number or boolean'' instead
! # of ``No symbol ...''.
! #
! # So, I'm hoping that there is no system with a static library variable named
! # `no_var_by_this_name'. Where's Quine when you need him?
! send_gdb "p no_var_by_this_name-a\t"
sleep 1
gdb_expect {
! -re "^p no_var_by_this_name-a\\\x07$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"no_var_by_this_name\" in current context\\..*$gdb_prompt $" {
! pass "complete 'p no_var_by_this_name-a'"
}
-re ".*$gdb_prompt $" {
! fail "complete 'p no_var_by_this_name-a'"
}
timeout {
! fail "(timeout) complete 'p no_var_by_this_name-a'"
}
}
}
-re ".*$gdb_prompt $" {
! fail "complete 'p no_var_by_this_name-a'"
}
timeout {
! fail "(timeout) complete 'p no_var_by_this_name-a'"
}
}
! send_gdb "p no_var_by_this_name-a\t"
sleep 1
gdb_expect {
! -re "^p no_var_by_this_name-a\\\x07$" {
send_gdb "\t"
gdb_expect {
! -re ".*argv.*$gdb_prompt p no_var_by_this_name-a$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"no_var_by_this_name\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p no_var_by_this_name-a'"
}
! -re ".*$gdb_prompt $" {
! fail "complete (2) 'p no_var_by_this_name-a'"
! }
! timeout {
! fail "(timeout) complete (2) 'p no_var_by_this_name-a'"
! }
}
}
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
send_gdb "n"
gdb_expect {
! -re "\\(gdb\\) p no_var_by_this_name-a$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"no_var_by_this_name\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p no_var_by_this_name-a'"
}
-re ".*$gdb_prompt $" {
! fail "complete (2) 'p no_var_by_this_name-a'"
}
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-a'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-a'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-a'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-a'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-a'" }
}
! send_gdb "p no_var_by_this_name-\t"
sleep 1
gdb_expect {
! -re "^p no_var_by_this_name-\\\x07$" {
send_gdb "\t"
gdb_expect {
-re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" {
send_gdb "n"
gdb_expect {
! -re "\\(gdb\\) p no_var_by_this_name-$" {
send_gdb "\n"
gdb_expect {
! -re "No symbol \"no_var_by_this_name\" in current context\\..*$gdb_prompt $" {
! pass "complete (2) 'p no_var_by_this_name-'"
}
-re ".*$gdb_prompt $" {
! fail "complete (2) 'p no_var_by_this_name-'"
}
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}
}
! -re ".*$gdb_prompt $" { fail "complete (2) 'p no_var_by_this_name-'" }
! timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}
send_gdb "file ${objdir}/Make\t"