aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2009-11-11 16:45:16 +0000
committerKeith Seitz <keiths@redhat.com>2009-11-11 16:45:16 +0000
commita4216f37f01bff1fbed08d32ab6bf1f34d2ea3d2 (patch)
tree171459e87e9ff7de6ea3064bf48f6c560dc10957 /gdb/testsuite
parenta5832c8fbd24da54ac7f53ed7a3aeed4569922fb (diff)
downloadgdb-a4216f37f01bff1fbed08d32ab6bf1f34d2ea3d2.zip
gdb-a4216f37f01bff1fbed08d32ab6bf1f34d2ea3d2.tar.gz
gdb-a4216f37f01bff1fbed08d32ab6bf1f34d2ea3d2.tar.bz2
* 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[].
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog19
-rw-r--r--gdb/testsuite/gdb.cp/cplusfuncs.cc4
-rw-r--r--gdb/testsuite/gdb.cp/cplusfuncs.exp49
3 files changed, 52 insertions, 20 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b89a23e..44a67f0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+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.
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc
index 7f033d6..f4f78a6 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.cc
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc
@@ -46,7 +46,9 @@ public:
void operator [] (foo&);
void operator () (foo&);
void* operator new (size_t) throw ();
+ void* operator new[] (size_t) throw ();
void operator delete (void *);
+ void operator delete[] (void *);
/**/ operator int ();
/**/ operator char* ();
@@ -115,7 +117,9 @@ void foo::operator ->* (foo& afoo) { afoo.ifoo = 0; }
void foo::operator [] (foo& afoo) { afoo.ifoo = 0; }
void foo::operator () (foo& afoo) { afoo.ifoo = 0; }
void* foo::operator new (size_t ival) throw () { ival = 0; return 0; }
+void* foo::operator new[] (size_t ival) throw () { ival = 0; return 0; }
void foo::operator delete (void *ptr) { ptr = 0; }
+void foo::operator delete[] (void *ptr) { ptr = 0; }
/**/ foo::operator int () { return 0; }
/**/ foo::operator char* () { return 0; }
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index 56702ed..607dceb 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -63,7 +63,7 @@ set dm_type_foo_ref "foo&"
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 { } {
@@ -78,7 +78,7 @@ 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
@@ -97,7 +97,7 @@ proc probe_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
@@ -117,7 +117,7 @@ proc probe_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
@@ -136,7 +136,7 @@ proc probe_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
@@ -155,7 +155,7 @@ proc probe_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
@@ -174,7 +174,7 @@ proc probe_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
@@ -193,7 +193,7 @@ proc probe_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
@@ -212,7 +212,7 @@ proc probe_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
@@ -241,6 +241,7 @@ proc info_func_regexp { name demangled } {
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\""
@@ -277,16 +278,16 @@ proc print_addr_2 { name good } {
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)"
}
}
}
@@ -305,19 +306,19 @@ proc print_addr_2_kfail { name good bad bugid } {
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)"
}
}
}
@@ -327,7 +328,12 @@ proc print_addr_2_kfail { name good bad bugid } {
#
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
}
#
@@ -460,10 +466,13 @@ proc test_paddr_operator_functions {} {
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.*>"