Fix gdb.linespec/cpls-ops.exp on 32-bit
authorPedro Alves <palves@redhat.com>
Thu, 30 Nov 2017 16:32:10 +0000 (16:32 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 30 Nov 2017 16:32:10 +0000 (16:32 +0000)
gdb.linespec/cpls-ops.exp is currently failing on x86-64 -m32 and other
32-bit ports:

 b test_op_new::operator new(unsigned int) FAIL: gdb.linespec/cpls-ops.exp: operator-new: tab complete "b test_op_new::operator" (timeout)
 ^CQuit
 (gdb) complete b test_op_new::operator
 b test_op_new::operator new(unsigned int)
 (gdb) FAIL: gdb.linespec/cpls-ops.exp: operator-new: cmd complete "b test_op_new::operator"

The problem is simply that the testcase incorrectly assumes that
size_t is "unsigned long".

Fix this by extracting the right type with the "ptype" command.

gdb/testsuite/ChangeLog:
2017-11-30  Pedro Alves  <palves@redhat.com>

* gdb.linespec/cpls-ops.exp
(check_explicit_skips_function_argument): Extract the underlying
type of size_t instead of hardcoding it.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.linespec/cpls-ops.exp

index d19eca217c461b1170e6775ed3b32db2690108b2..5b8151d51ef257ef30425dbb3f6b493634b61e04 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-30  Pedro Alves  <palves@redhat.com>
+
+       * gdb.linespec/cpls-ops.exp
+       (check_explicit_skips_function_argument): Extract the underlying
+       type of size_t instead of hardcoding it.
+
 2017-11-29  Pedro Alves  <palves@redhat.com>
 
        PR c++/19436
index c1b6c33b7b3c89227e0dc7d034284279200b08ac..d58a6deda20fcfc9d72b400506a0cbb7b26918e7 100644 (file)
@@ -43,8 +43,17 @@ proc check_explicit_skips_function_argument {function} {
 # testing operator new.
 
 proc test_operator_new {class_name brackets} {
-    # The type size_t is typedef-ed to.
-    set size_t "unsigned long"
+    global gdb_prompt
+
+    # Extract the type size_t is typedef-ed to.
+    set size_t ""
+    set test "get size_t underlying type"
+    gdb_test_multiple "ptype size_t" $test {
+       -re " = (\[ a-z\]*)\r\n$gdb_prompt $" {
+           set size_t $expect_out(1,string)
+           pass "$test"
+       }
+    }
 
     # Complete all prefixes between "operato" and the full prototype.
     foreach cmd_prefix {"b" "b -function"} {