+2009-11-11 Keith Seitz <keiths@redhat.com>
+
+ * gdb.cp/cplusfuncs.cc (class foo): Add operators
+ new[] and delete[].
+ * gdb.cp/cplusfuncs.exp (dm_type_void): Change to
+ "void".
+ (probe_demangler): Remove all single-quoting of
+ method and variable names.
+ (info_func_regexp): Remove the word "void" from any
+ occurrence of "(void)".
+ (print_addr_2): Remove all single-quoting of
+ method names.
+ (print_addr_2_kfail): Likewise.
+ (print_addr): Single-quote C function names before
+ passing to print_addr_2.
+ (test_paddr_operator_functions): Remove single-quoting
+ for method names.
+ Add tests for operator new[] and operator delete[].
+
2009-11-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-ranges.exp: Call runto_main.
set dm_type_int_star "int*"
set dm_type_long_star "long*"
set dm_type_unsigned_int "unsigned"
-set dm_type_void ""
+set dm_type_void "void"
set dm_type_void_star "void*"
proc probe_demangler { } {
global dm_type_void
global dm_type_void_star
- send_gdb "print &'foo::operator,(foo&)'\n"
+ send_gdb "print &foo::operator,(foo&)\n"
gdb_expect {
-re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_char_star'\n"
+ send_gdb "print &dm_type_char_star\n"
gdb_expect {
-re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_foo_ref'\n"
+ send_gdb "print &dm_type_foo_ref\n"
gdb_expect {
-re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_int_star'\n"
+ send_gdb "print &dm_type_int_star\n"
gdb_expect {
-re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_long_star'\n"
+ send_gdb "print &dm_type_long_star\n"
gdb_expect {
-re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_unsigned_int'\n"
+ send_gdb "print &dm_type_unsigned_int\n"
gdb_expect {
-re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_void'\n"
+ send_gdb "print &dm_type_void\n"
gdb_expect {
-re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_void_star'\n"
+ send_gdb "print &dm_type_void_star\n"
gdb_expect {
-re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
global gdb_prompt
send_gdb "info function $name\n"
+ set demangled [regsub {\\\(void\\\)} $demangled {\(\)}]
gdb_expect {
-re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" {
pass "info function for \"$name\""
set good_pattern [string_to_regexp $good]
- send_gdb "print &'$name'\n"
+ send_gdb "print &$name\n"
gdb_expect {
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
- pass "print &'$name'"
+ pass "print &$name"
}
-re ".*$gdb_prompt $" {
- fail "print &'$name'"
+ fail "print &$name"
}
timeout {
- fail "print &'$name' (timeout)"
+ fail "print &$name (timeout)"
}
}
}
set good_pattern [string_to_regexp $good]
set bad_pattern [string_to_regexp $bad]
- send_gdb "print &'$name'\n"
+ send_gdb "print &$name\n"
gdb_expect {
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
- pass "print &'$name'"
+ pass "print &$name"
}
-re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" {
- kfail $bugid "print &'$name'"
+ kfail $bugid "print &$name"
}
-re ".*$gdb_prompt $" {
- fail "print &'$name'"
+ fail "print &$name"
}
timeout {
- fail "print &'$name' (timeout)"
+ fail "print &$name (timeout)"
}
}
}
#
proc print_addr { name } {
- print_addr_2 "$name" "$name"
+ set expected [regsub {\(void\)} $name {()}]
+ if {[string first "::" $name] == -1} {
+ # C function -- must be qutoed
+ set name "'$name'"
+ }
+ print_addr_2 "$name" $expected
}
#
print_addr "foo::operator\[\]($dm_type_foo_ref)"
print_addr "foo::operator()($dm_type_foo_ref)"
- gdb_test "print &'foo::operator new'" \
+ gdb_test "print &foo::operator new" \
" = .* $hex <foo::operator new\\(.*\\)(| static)>"
+ gdb_test "print &foo::operator new\[\]" \
+ " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
if { !$hp_aCC_compiler } {
print_addr "foo::operator delete($dm_type_void_star)"
+ print_addr "foo::operator delete[]($dm_type_void_star)"
} else {
gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \
" = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>"