]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.python/py-format-string.exp
Fix gdb.python/py-format-string.exp with Clang
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-format-string.exp
index ad71fe0e51b69ff5312d3c39d179a8792e8efd49..b7acc242ed320cb1ce2ad53930b5962f0bc4bf44 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2019 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,11 @@ if [get_compiler_info c++] {
     return -1
 }
 
+# Skip all tests if Python scripting is not enabled.
+gdb_exit
+gdb_start
+if { [skip_python_tests] } { continue }
+
 # Build inferior to language specification.
 proc build_inferior {exefile lang} {
   global srcdir subdir srcfile testfile hex
@@ -45,9 +50,6 @@ proc prepare_gdb {exefile} {
   gdb_reinitialize_dir $srcdir/$subdir
   gdb_load ${exefile}
 
-  # Skip all tests if Python scripting is not enabled.
-  if { [skip_python_tests] } { continue }
-
   if ![runto_main] then {
       perror "couldn't run to breakpoint"
       return
@@ -291,9 +293,9 @@ proc test_raw {} {
 proc test_pretty_arrays {} {
   global current_lang
 
-  set an_array_pretty "  \\{2,\[\r\n\]+  3,\[\r\n\]+  5\\}"
+  set an_array_pretty "\\{\[\r\n\]+  2,\[\r\n\]+  3,\[\r\n\]+  5\[\r\n\]+\\}"
   set an_array_with_repetition_pretty \
-    "  \\{1,\[\r\n\]+  3 <repeats 12 times>,\[\r\n\]+  5,\[\r\n\]+  5,\[\r\n\]+  5\\}"
+    "\\{\[\r\n\]+  1,\[\r\n\]+  3 <repeats 12 times>,\[\r\n\]+  5,\[\r\n\]+  5,\[\r\n\]+  5\[\r\n\]+\\}"
 
   check_var_with_bool_opt "pretty_arrays" "a_point_t"
   check_var_with_bool_opt "pretty_arrays" "a_point_t_pointer"
@@ -507,7 +509,7 @@ proc test_deref_refs {} {
   if { $current_lang == "c++" } {
     check_var_with_bool_opt "deref_refs" "a_point_t_ref"
     check_var_with_bool_opt "deref_refs" "a_base_ref" \
-      "${default_ref_regexp}: \\{_vptr\\.Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42, static a_static_member = 2019\\}"
+       "${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42, static a_static_member = 2019\\}"
   }
 }
 
@@ -886,7 +888,7 @@ proc test_mixed {} {
 
   check_format_string "an_array" \
     "array_indexes=True, pretty_arrays=True" \
-    "  \\{\\\[0\\\] = 2,\[\r\n\]+  \\\[1\\\] = 3,\[\r\n\]+  \\\[2\\\] = 5\\}"
+    "\\{\[\r\n\]+  \\\[0\\\] = 2,\[\r\n\]+  \\\[1\\\] = 3,\[\r\n\]+  \\\[2\\\] = 5\[\r\n\]+\\}"
 
   check_format_string "a_struct_with_union" \
     "pretty_structs=True, unions=False" \
@@ -903,7 +905,7 @@ proc test_mixed {} {
 
     check_format_string "a_base_ref" \
       "deref_refs=True, static_members=False" \
-      "${default_ref_regexp}: \\{_vptr\\.Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42\\}"
+      "${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42\\}"
   }
 }