diff options
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r-- | gdb/testsuite/gdb.python/py-block.exp | 18 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-events.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-parameter.exp | 82 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symbol.exp | 64 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symtab.exp | 34 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.exp | 58 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-value.exp | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-xmethods.exp | 66 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 58 |
9 files changed, 215 insertions, 215 deletions
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp index 45e4f07..e04cb76 100644 --- a/gdb/testsuite/gdb.python/py-block.exp +++ b/gdb/testsuite/gdb.python/py-block.exp @@ -39,24 +39,24 @@ gdb_continue_to_breakpoint "Block break here." # Test initial innermost block. gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0 gdb_py_test_silent_cmd "python block = frame.block()" "Get block" 0 -gdb_test "python print (block)" "<gdb.Block object at $hex>" "Check block not None" -gdb_test "python print (block.function)" "None" "First anonymous block" -gdb_test "python print (block.start)" "${decimal}" "Check start not None" -gdb_test "python print (block.end)" "${decimal}" "Check end not None" +gdb_test "python print (block)" "<gdb.Block object at $hex>" "check block not None" +gdb_test "python print (block.function)" "None" "first anonymous block" +gdb_test "python print (block.start)" "${decimal}" "check start not None" +gdb_test "python print (block.end)" "${decimal}" "check end not None" # Test global/static blocks gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0 gdb_py_test_silent_cmd "python block = frame.block()" "Get block" 0 -gdb_test "python print (block.is_global)" "False" "Not a global block" -gdb_test "python print (block.is_static)" "False" "Not a static block" +gdb_test "python print (block.is_global)" "False" "not a global block" +gdb_test "python print (block.is_static)" "False" "not a static block" gdb_py_test_silent_cmd "python gblock = block.global_block" "Get block" 1 gdb_py_test_silent_cmd "python sblock = block.static_block" "Get block" 1 -gdb_test "python print (gblock.is_global)" "True" "Is the global block" -gdb_test "python print (sblock.is_static)" "True" "Is the static block" +gdb_test "python print (gblock.is_global)" "True" "is the global block" +gdb_test "python print (sblock.is_static)" "True" "is the static block" # Move up superblock(s) until we reach function block_func. gdb_test_no_output "python block = block.superblock" "Get superblock" -gdb_test "python print (block.function)" "None" "Second anonymous block" +gdb_test "python print (block.function)" "None" "second anonymous block" gdb_test_no_output "python block = block.superblock" "Get superblock 2" gdb_test "python print (block.function)" "block_func" \ "Print superblock 2 function" diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp index 547870a..144cc4b 100644 --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -49,7 +49,7 @@ gdb_test "test-objfile-events" "Object file events registered." gdb_breakpoint "main" {temporary} -gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification" +gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "new objfile notification" gdb_test_no_output "set detach-on-fork off" "" diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp index 28b5d65..35fcb7f 100644 --- a/gdb/testsuite/gdb.python/py-parameter.exp +++ b/gdb/testsuite/gdb.python/py-parameter.exp @@ -57,14 +57,14 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ "test_param = TestParam ('print test-param')" ""\ "end" -gdb_test "python print (test_param.value)" "True" "Test parameter value" -gdb_test "show print test-param" "The state of the Test Parameter is on.*" "Show parameter on" -gdb_test "set print test-param off" "Test Parameter has been set to off" "Turn off parameter" -gdb_test "show print test-param" "The state of the Test Parameter is off.*" "Show parameter off" -gdb_test "python print (test_param.value)" "False" "Test parameter value" -gdb_test "help show print test-param" "Show the state of the boolean test-param.*" "Test show help" -gdb_test "help set print test-param" "Set the state of the boolean test-param.*" "Test set help" -gdb_test "help set print" "set print test-param -- Set the state of the boolean test-param.*" "Test general help" +gdb_test "python print (test_param.value)" "True" "test parameter value" +gdb_test "show print test-param" "The state of the Test Parameter is on.*" "show parameter on" +gdb_test "set print test-param off" "Test Parameter has been set to off" "turn off parameter" +gdb_test "show print test-param" "The state of the Test Parameter is off.*" "show parameter off" +gdb_test "python print (test_param.value)" "False" "test parameter value" +gdb_test "help show print test-param" "Show the state of the boolean test-param.*" "test show help" +gdb_test "help set print test-param" "Set the state of the boolean test-param.*" "test set help" +gdb_test "help set print" "set print test-param -- Set the state of the boolean test-param.*" "test general help" # Test an enum parameter. @@ -84,12 +84,12 @@ gdb_py_test_multiple "enum gdb parameter" \ "test_enum_param = TestEnumParam ('print test-enum-param')" ""\ "end" -gdb_test "python print (test_enum_param.value)" "one" "Test enum parameter value" -gdb_test "show print test-enum-param" "The state of the enum is one.*" "Show parameter is initial value" -gdb_test "set print test-enum-param two" "The state of the enum has been set to two" "Set enum to two" -gdb_test "show print test-enum-param" "The state of the enum is two.*" "Show parameter is new value" -gdb_test "python print (test_enum_param.value)" "two" "Test enum parameter value" -gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "Set invalid enum parameter" +gdb_test "python print (test_enum_param.value)" "one" "test enum parameter value" +gdb_test "show print test-enum-param" "The state of the enum is one.*" "show parameter is initial value" +gdb_test "set print test-enum-param two" "The state of the enum has been set to two" "set enum to two" +gdb_test "show print test-enum-param" "The state of the enum is two.*" "show parameter is new value" +gdb_test "python print (test_enum_param.value)" "two" "test enum parameter value" +gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "set invalid enum parameter" # Test a file parameter. gdb_py_test_multiple "file gdb parameter" \ @@ -108,11 +108,11 @@ gdb_py_test_multiple "file gdb parameter" \ "test_file_param = TestFileParam ('test-file-param')" ""\ "end" -gdb_test "python print (test_file_param.value)" "foo.txt" "Test file parameter value" -gdb_test "show test-file-param" "The name of the file is foo.txt.*" "Show initial file value" -gdb_test "set test-file-param bar.txt" "The name of the file has been changed to bar.txt" "Set new file parameter" 1 -gdb_test "show test-file-param" "The name of the file is bar.txt.*" "Show new file value" -gdb_test "python print (test_file_param.value)" "bar.txt" "Test new file parameter value" +gdb_test "python print (test_file_param.value)" "foo.txt" "test file parameter value" +gdb_test "show test-file-param" "The name of the file is foo.txt.*" "show initial file value" +gdb_test "set test-file-param bar.txt" "The name of the file has been changed to bar.txt" "set new file parameter" 1 +gdb_test "show test-file-param" "The name of the file is bar.txt.*" "show new file value" +gdb_test "python print (test_file_param.value)" "bar.txt" "test new file parameter value" gdb_test "set test-file-param" "Argument required.*" # Test a parameter that is not documented. @@ -132,13 +132,13 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ "test_undoc_param = TestUndocParam ('print test-undoc-param')" ""\ "end" -gdb_test "show print test-undoc-param" "The state of the Test Parameter is on.*" "Show parameter on" -gdb_test "set print test-undoc-param off" "Test Parameter has been set to off" "Turn off parameter" -gdb_test "show print test-undoc-param" "The state of the Test Parameter is off.*" "Show parameter off" -gdb_test "python print (test_undoc_param.value)" "False" "Test parameter value" -gdb_test "help show print test-undoc-param" "This command is not documented.*" "Test show help" -gdb_test "help set print test-undoc-param" "This command is not documented.*" "Test set help" -gdb_test "help set print" "set print test-undoc-param -- This command is not documented.*" "Test general help" +gdb_test "show print test-undoc-param" "The state of the Test Parameter is on.*" "show parameter on" +gdb_test "set print test-undoc-param off" "Test Parameter has been set to off" "turn off parameter" +gdb_test "show print test-undoc-param" "The state of the Test Parameter is off.*" "show parameter off" +gdb_test "python print (test_undoc_param.value)" "False" "test parameter value" +gdb_test "help show print test-undoc-param" "This command is not documented.*" "test show help" +gdb_test "help set print test-undoc-param" "This command is not documented.*" "test set help" +gdb_test "help set print" "set print test-undoc-param -- This command is not documented.*" "test general help" # Test a parameter that is not documented in any way.. gdb_py_test_multiple "Simple gdb booleanparameter" \ @@ -150,13 +150,13 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ "test_nodoc_param = TestNodocParam ('print test-nodoc-param')" ""\ "end" -gdb_test "show print test-nodoc-param" "This command is not documented.*" "Show parameter on" -gdb_test "set print test-nodoc-param off" "This command is not documented.*" "Turn off parameter" -gdb_test "show print test-nodoc-param" "This command is not documented.*.*" "Show parameter off" -gdb_test "python print (test_nodoc_param.value)" "False" "Test parameter value" -gdb_test "help show print test-nodoc-param" "This command is not documented.*" "Test show help" -gdb_test "help set print test-nodoc-param" "This command is not documented.*" "Test set help" -gdb_test "help set print" "set print test-nodoc-param -- This command is not documented.*" "Test general help" +gdb_test "show print test-nodoc-param" "This command is not documented.*" "show parameter on" +gdb_test "set print test-nodoc-param off" "This command is not documented.*" "turn off parameter" +gdb_test "show print test-nodoc-param" "This command is not documented.*.*" "show parameter off" +gdb_test "python print (test_nodoc_param.value)" "False" "test parameter value" +gdb_test "help show print test-nodoc-param" "This command is not documented.*" "test show help" +gdb_test "help set print test-nodoc-param" "This command is not documented.*" "test set help" +gdb_test "help set print" "set print test-nodoc-param -- This command is not documented.*" "test general help" # Test deprecated API. Do not use in your own implementations. gdb_py_test_multiple "Simple gdb booleanparameter" \ @@ -171,11 +171,11 @@ gdb_py_test_multiple "Simple gdb booleanparameter" \ "test_param = TestParam ('print test-param')" ""\ "end" -gdb_test "python print (test_param.value)" "True" "Test parameter value" -gdb_test "show print test-param" "State of the Test Parameter on.*" "Show parameter on" -gdb_test "set print test-param off" "Set the state of the Test Parameter.*" "Turn off parameter" -gdb_test "show print test-param" "State of the Test Parameter off.*" "Show parameter off" -gdb_test "python print (test_param.value)" "False" "Test parameter value" -gdb_test "help show print test-param" "State of the Test Parameter.*" "Test show help" -gdb_test "help set print test-param" "Set the state of the Test Parameter.*" "Test set help" -gdb_test "help set print" "set print test-param -- Set the state of the Test Parameter.*" "Test general help" +gdb_test "python print (test_param.value)" "True" "test parameter value" +gdb_test "show print test-param" "State of the Test Parameter on.*" "show parameter on" +gdb_test "set print test-param off" "Set the state of the Test Parameter.*" "turn off parameter" +gdb_test "show print test-param" "State of the Test Parameter off.*" "show parameter off" +gdb_test "python print (test_param.value)" "False" "test parameter value" +gdb_test "help show print test-param" "State of the Test Parameter.*" "test show help" +gdb_test "help set print test-param" "Set the state of the Test Parameter.*" "test set help" +gdb_test "help set print" "set print test-param -- Set the state of the Test Parameter.*" "test general help" diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp index 41c4a9e..fa05962 100644 --- a/gdb/testsuite/gdb.python/py-symbol.exp +++ b/gdb/testsuite/gdb.python/py-symbol.exp @@ -31,8 +31,8 @@ if { [skip_python_tests] } { continue } # point where we don't have a current frame, and we don't want to # require one. gdb_py_test_silent_cmd "python main_func = gdb.lookup_global_symbol(\"main\")" "Lookup main" 1 -gdb_test "python print (main_func.is_function)" "True" "Test main_func.is_function" -gdb_test "python print (gdb.lookup_global_symbol(\"junk\"))" "None" "Test lookup_global_symbol(\"junk\")" +gdb_test "python print (main_func.is_function)" "True" "test main_func.is_function" +gdb_test "python print (gdb.lookup_global_symbol(\"junk\"))" "None" "test lookup_global_symbol(\"junk\")" gdb_test "python print (gdb.lookup_global_symbol('main').value())" "$hex .main." \ "print value of main" @@ -63,23 +63,23 @@ gdb_py_test_silent_cmd "python block = frame.block()" "Get block" 0 # Test is_argument attribute. gdb_py_test_silent_cmd "python arg = gdb.lookup_symbol(\"arg\")" "Get variable arg" 0 -gdb_test "python print (arg\[0\].is_variable)" "False" "Test arg.is_variable" -gdb_test "python print (arg\[0\].is_constant)" "False" "Test arg.is_constant" -gdb_test "python print (arg\[0\].is_argument)" "True" "Test arg.is_argument" -gdb_test "python print (arg\[0\].is_function)" "False" "Test arg.is_function" +gdb_test "python print (arg\[0\].is_variable)" "False" "test arg.is_variable" +gdb_test "python print (arg\[0\].is_constant)" "False" "test arg.is_constant" +gdb_test "python print (arg\[0\].is_argument)" "True" "test arg.is_argument" +gdb_test "python print (arg\[0\].is_function)" "False" "test arg.is_function" # Test is_function attribute. gdb_py_test_silent_cmd "python func = block.function" "Get block function" 0 -gdb_test "python print (func.is_variable)" "False" "Test func.is_variable" -gdb_test "python print (func.is_constant)" "False" "Test func.is_constant" -gdb_test "python print (func.is_argument)" "False" "Test func.is_argument" -gdb_test "python print (func.is_function)" "True" "Test func.is_function" +gdb_test "python print (func.is_variable)" "False" "test func.is_variable" +gdb_test "python print (func.is_constant)" "False" "test func.is_constant" +gdb_test "python print (func.is_argument)" "False" "test func.is_argument" +gdb_test "python print (func.is_function)" "True" "test func.is_function" # Test attributes of func. -gdb_test "python print (func.name)" "func" "Test func.name" -gdb_test "python print (func.print_name)" "func" "Test func.print_name" -gdb_test "python print (func.linkage_name)" "func" "Test func.linkage_name" -gdb_test "python print (func.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "Test func.addr_class" +gdb_test "python print (func.name)" "func" "test func.name" +gdb_test "python print (func.print_name)" "func" "test func.print_name" +gdb_test "python print (func.linkage_name)" "func" "test func.linkage_name" +gdb_test "python print (func.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "test func.addr_class" gdb_breakpoint [gdb_get_line_number "Break at end."] gdb_continue_to_breakpoint "Break at end for variable a" ".*Break at end.*" @@ -87,13 +87,13 @@ gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0 # Test is_variable attribute. gdb_py_test_silent_cmd "python a = gdb.lookup_symbol(\'a\')" "Get variable a" 0 -gdb_test "python print (a\[0\].is_variable)" "True" "Test a.is_variable" -gdb_test "python print (a\[0\].is_constant)" "False" "Test a.is_constant" -gdb_test "python print (a\[0\].is_argument)" "False" "Test a.is_argument" -gdb_test "python print (a\[0\].is_function)" "False" "Test a.is_function" +gdb_test "python print (a\[0\].is_variable)" "True" "test a.is_variable" +gdb_test "python print (a\[0\].is_constant)" "False" "test a.is_constant" +gdb_test "python print (a\[0\].is_argument)" "False" "test a.is_argument" +gdb_test "python print (a\[0\].is_function)" "False" "test a.is_function" # Test attributes of a. -gdb_test "python print (a\[0\].addr_class == gdb.SYMBOL_LOC_COMPUTED)" "True" "Test a.addr_class" +gdb_test "python print (a\[0\].addr_class == gdb.SYMBOL_LOC_COMPUTED)" "True" "test a.addr_class" gdb_test "python print (a\[0\].value())" \ "symbol requires a frame to compute its value.*"\ @@ -105,16 +105,16 @@ gdb_test "python print (a\[0\].needs_frame)" "True" \ # Test is_constant attribute gdb_py_test_silent_cmd "python t = gdb.lookup_symbol(\"one\")" "Get constant t" 0 -gdb_test "python print (t\[0\].is_variable)" "False" "Test t.is_variable" -gdb_test "python print (t\[0\].is_constant)" "True" "Test t.is_constant" -gdb_test "python print (t\[0\].is_argument)" "False" "Test t.is_argument" -gdb_test "python print (t\[0\].is_function)" "False" "Test t.is_function" +gdb_test "python print (t\[0\].is_variable)" "False" "test t.is_variable" +gdb_test "python print (t\[0\].is_constant)" "True" "test t.is_constant" +gdb_test "python print (t\[0\].is_argument)" "False" "test t.is_argument" +gdb_test "python print (t\[0\].is_function)" "False" "test t.is_function" # Test attributes of t. -gdb_test "python print (t\[0\].addr_class == gdb.SYMBOL_LOC_CONST)" "True" "Test t.addr_class" +gdb_test "python print (t\[0\].addr_class == gdb.SYMBOL_LOC_CONST)" "True" "test t.addr_class" # Test type attribute. -gdb_test "python print (t\[0\].type)" "enum tag" "Get type" +gdb_test "python print (t\[0\].type)" "enum tag" "get type" # Test symtab attribute. if { [is_remote host] } { @@ -122,7 +122,7 @@ if { [is_remote host] } { } else { set py_symbol_c [string_to_regexp ${srcdir}/${subdir}/${srcfile}] } -gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "Get symtab" +gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "get symtab" # C++ tests # Recompile binary. @@ -157,10 +157,10 @@ gdb_test "python print (cplusfunc.is_argument)" \ gdb_test "python print (cplusfunc.is_function)" \ "True" "Test cplusfunc.is_function" -gdb_test "python print (cplusfunc.name)" "SimpleClass::valueofi().*" "Test method.name" -gdb_test "python print (cplusfunc.print_name)" "SimpleClass::valueofi().*" "Test method.print_name" -gdb_test "python print (cplusfunc.linkage_name)" "SimpleClass::valueofi().*" "Test method.linkage_name" -gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "Test method.addr_class" +gdb_test "python print (cplusfunc.name)" "SimpleClass::valueofi().*" "test method.name" +gdb_test "python print (cplusfunc.print_name)" "SimpleClass::valueofi().*" "test method.print_name" +gdb_test "python print (cplusfunc.linkage_name)" "SimpleClass::valueofi().*" "test method.linkage_name" +gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "test method.addr_class" # Test is_valid when the objfile is unloaded. This must be the last # test as it unloads the object file in GDB. @@ -174,8 +174,8 @@ if ![runto_main] then { gdb_breakpoint [gdb_get_line_number "Break at end."] gdb_continue_to_breakpoint "Break at end for symbol validity" ".*Break at end.*" gdb_py_test_silent_cmd "python a = gdb.lookup_symbol(\'a\')" "Get variable a" 0 -gdb_test "python print (a\[0\].is_valid())" "True" "Test symbol validity" +gdb_test "python print (a\[0\].is_valid())" "True" "test symbol validity" delete_breakpoints gdb_unload -gdb_test "python print (a\[0\].is_valid())" "False" "Test symbol non-validity" +gdb_test "python print (a\[0\].is_valid())" "False" "test symbol non-validity" gdb_test_no_output "python a = None" "Test symbol destructor" diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp index 95c83c9..2acfe1c 100644 --- a/gdb/testsuite/gdb.python/py-symtab.exp +++ b/gdb/testsuite/gdb.python/py-symtab.exp @@ -58,29 +58,29 @@ if { [is_remote host] } { set full_py_symbol_c [string_to_regexp testsuite/${subdir}/${srcfile}] } -gdb_test "python print (sal.symtab)" ".*${py_symbol_c}" "Test symtab" -gdb_test "python print (sal.pc)" "${decimal}" "Test sal.pc" -gdb_test "python print (sal.last == (new_pc - 1))" "True" "Test sal.last" -gdb_test "python print (sal.line)" "$line_no" "Test sal.line" -gdb_test "python print (sal.is_valid())" "True" "Test sal.is_valid" +gdb_test "python print (sal.symtab)" ".*${py_symbol_c}" "test symtab" +gdb_test "python print (sal.pc)" "${decimal}" "test sal.pc" +gdb_test "python print (sal.last == (new_pc - 1))" "True" "test sal.last" +gdb_test "python print (sal.line)" "$line_no" "test sal.line" +gdb_test "python print (sal.is_valid())" "True" "test sal.is_valid" # Test symbol table. -gdb_test "python print (symtab.filename)" ".*${py_symbol_c}" "Test symtab.filename" -gdb_test "python print (symtab.objfile)" "<gdb.Objfile object at ${hex}>" "Test symtab.objfile" -gdb_test "python print (symtab.fullname())" ".*${full_py_symbol_c}" "Test symtab.fullname" -gdb_test "python print (symtab.is_valid())" "True" "Test symtab.is_valid()" -gdb_test "python print (\"qq\" in global_symbols)" "True" "Test qq in global symbols" -gdb_test "python print (\"func\" in global_symbols)" "True" "Test func in global symbols" -gdb_test "python print (\"main\" in global_symbols)" "True" "Test main in global symbols" -gdb_test "python print (\"int\" in static_symbols)" "True" "Test int in static symbols" -gdb_test "python print (\"char\" in static_symbols)" "True" "Test char in static symbols" -gdb_test "python print (\"simple_struct\" in static_symbols)" "True" "Test simple_struct in static symbols" +gdb_test "python print (symtab.filename)" ".*${py_symbol_c}" "test symtab.filename" +gdb_test "python print (symtab.objfile)" "<gdb.Objfile object at ${hex}>" "test symtab.objfile" +gdb_test "python print (symtab.fullname())" ".*${full_py_symbol_c}" "test symtab.fullname" +gdb_test "python print (symtab.is_valid())" "True" "test symtab.is_valid()" +gdb_test "python print (\"qq\" in global_symbols)" "True" "test qq in global symbols" +gdb_test "python print (\"func\" in global_symbols)" "True" "test func in global symbols" +gdb_test "python print (\"main\" in global_symbols)" "True" "test main in global symbols" +gdb_test "python print (\"int\" in static_symbols)" "True" "test int in static symbols" +gdb_test "python print (\"char\" in static_symbols)" "True" "test char in static symbols" +gdb_test "python print (\"simple_struct\" in static_symbols)" "True" "test simple_struct in static symbols" # Test is_valid when the objfile is unloaded. This must be the last # test as it unloads the object file in GDB. gdb_unload -gdb_test "python print (sal.is_valid())" "False" "Test sal.is_valid" -gdb_test "python print (symtab.is_valid())" "False" "Test symtab.is_valid()" +gdb_test "python print (sal.is_valid())" "False" "test sal.is_valid" +gdb_test "python print (symtab.is_valid())" "False" "test symtab.is_valid()" gdb_test_no_output "python sal = None" "Test sal destructor" gdb_test_no_output "python symtab = None" "Test symtab destructor" diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 61c8c2f..782bd43 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -70,9 +70,9 @@ proc test_fields {lang} { gdb_py_test_silent_cmd "print (c)" "print value (c)" 1 gdb_py_test_silent_cmd "python c = gdb.history (0)" "get value (c) from history" 1 gdb_py_test_silent_cmd "python fields = c.type.fields()" "get fields from c.type" 1 - gdb_test "python print (len(fields))" "2" "Check number of fields (c)" - gdb_test "python print (fields\[0\].name)" "c" "Check class field c name" - gdb_test "python print (fields\[1\].name)" "d" "Check class field d name" + gdb_test "python print (len(fields))" "2" "check number of fields (c)" + gdb_test "python print (fields\[0\].name)" "c" "check class field c name" + gdb_test "python print (fields\[1\].name)" "d" "check class field d name" gdb_test "python print (c.type == gdb.parse_and_eval('d').type)" "False" gdb_test "python print (c.type == gdb.parse_and_eval('d').type.fields()\[0\].type)" \ @@ -98,15 +98,15 @@ proc test_fields {lang} { gdb_py_test_silent_cmd "print (st)" "print value (st)" 1 gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value (st) from history" 1 gdb_py_test_silent_cmd "python fields = st.type.fields()" "get fields from st.type" 1 - gdb_test "python print (len(fields))" "2" "Check number of fields (st)" - gdb_test "python print (fields\[0\].name)" "a" "Check structure field a name" - gdb_test "python print (fields\[1\].name)" "b" "Check structure field b name" + gdb_test "python print (len(fields))" "2" "check number of fields (st)" + gdb_test "python print (fields\[0\].name)" "a" "check structure field a name" + gdb_test "python print (fields\[1\].name)" "b" "check structure field b name" # Test that unamed fields have 'None' for name. gdb_py_test_silent_cmd "python ss = gdb.parse_and_eval('ss')" "init ss" 1 gdb_py_test_silent_cmd "python ss_fields = ss.type.fields()" \ "get fields from ss.type" 1 - gdb_test "python print(len(ss_fields))" "2" "Check length of ss_fields" + gdb_test "python print(len(ss_fields))" "2" "check length of ss_fields" gdb_test "python print(ss_fields\[0\].name is None)" "True" \ "Check ss_fields\[0\].name" gdb_test "python print(ss_fields\[1\].name is None)" "True" \ @@ -117,13 +117,13 @@ proc test_fields {lang} { "Check that dir includes name" # Test Python mapping behavior of gdb.Type for structs/classes - gdb_test "python print (len(st.type))" "2" "Check number of fields (st.type)" - gdb_test "python print (st.type\['a'\].name)" "a" "Check fields lookup by name" + gdb_test "python print (len(st.type))" "2" "check number of fields (st.type)" + gdb_test "python print (st.type\['a'\].name)" "a" "check fields lookup by name" gdb_test "python print (\[v.bitpos for v in st.type.itervalues()\])" {\[0L?, 32L?\]} "Check fields iteration over values" gdb_test "python print (\[(n, v.bitpos) for (n, v) in st.type.items()\])" {\[\('a', 0L?\), \('b', 32L?\)\]} "Check fields items list" - gdb_test "python print ('a' in st.type)" "True" "Check field name exists test" - gdb_test "python print ('nosuch' in st.type)" "False" "Check field name nonexists test" - gdb_test "python print (not not st.type)" "True" "Check conversion to bool" + gdb_test "python print ('a' in st.type)" "True" "check field name exists test" + gdb_test "python print ('nosuch' in st.type)" "False" "check field name nonexists test" + gdb_test "python print (not not st.type)" "True" "check conversion to bool" # Test rejection of mapping operations on scalar types gdb_test "python print (len (st.type\['a'\].type))" "TypeError: Type is not a structure, union, enum, or function type.*" @@ -138,8 +138,8 @@ proc test_fields {lang} { gdb_py_test_silent_cmd "print (ar)" "print value (ar)" 1 gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 gdb_test "python fields = ar.type.fields()" - gdb_test "python print (len(fields))" "1" "Check the number of fields" - gdb_test "python print (fields\[0\].type)" "<range type>" "Check array field type" + gdb_test "python print (len(fields))" "1" "check the number of fields" + gdb_test "python print (fields\[0\].type)" "<range type>" "check array field type" # Test gdb.Type.array. gdb_test "python print (ar\[0\].cast(ar\[0\].type.array(1)))" \ @@ -178,14 +178,14 @@ proc test_enums {} { gdb_py_test_silent_cmd "print (e)" "print value (e)" 1 gdb_py_test_silent_cmd "python (e) = gdb.history (0)" "get value (e) from history" 1 gdb_py_test_silent_cmd "python fields = e.type.fields()" "extract type fields from e" 1 - gdb_test "python print (len(fields))" "3" "Check the number of enum fields" - gdb_test "python print (fields\[0\].name)" "v1" "Check enum field\[0\] name" - gdb_test "python print (fields\[1\].name)" "v2" "Check enum field\[1\]name" + gdb_test "python print (len(fields))" "3" "check the number of enum fields" + gdb_test "python print (fields\[0\].name)" "v1" "check enum field\[0\] name" + gdb_test "python print (fields\[1\].name)" "v2" "check enum field\[1\]name" # Ditto but by mapping operations - gdb_test "python print (len(e.type))" "3" "Check the number of type fields" - gdb_test "python print (e.type\['v1'\].name)" "v1" "Check enum field lookup by name (v1)" - gdb_test "python print (e.type\['v3'\].name)" "v3" "Check enum field lookup by name (v3)" + gdb_test "python print (len(e.type))" "3" "check the number of type fields" + gdb_test "python print (e.type\['v1'\].name)" "v1" "check enum field lookup by name (v1)" + gdb_test "python print (e.type\['v3'\].name)" "v3" "check enum field lookup by name (v3)" gdb_test "python print (\[v.enumval for v in e.type.itervalues()\])" {\[0L?, 1L?, 2L?\]} "Check num fields iteration over values" gdb_test "python print (\[(n, v.enumval) for (n, v) in e.type.items()\])" {\[\('v1', 0L?\), \('v2', 1L?\), \('v3', 2L?\)\]} "Check enum fields items list" } @@ -196,9 +196,9 @@ proc test_base_class {} { gdb_py_test_silent_cmd "print (d)" "print value (d)" 1 gdb_py_test_silent_cmd "python d = gdb.history (0)" "get value (d) from history" 1 gdb_py_test_silent_cmd "python fields = d.type.fields()" "extract type fields from d" 1 - gdb_test "python print (len(fields))" "3" "Check the number of fields" - gdb_test "python print (fields\[0\].is_base_class)" "True" "Check base class (fields\[0\])" - gdb_test "python print (fields\[1\].is_base_class)" "False" "Check base class (fields\[1\])" + gdb_test "python print (len(fields))" "3" "check the number of fields" + gdb_test "python print (fields\[0\].is_base_class)" "True" "check base class (fields\[0\])" + gdb_test "python print (fields\[1\].is_base_class)" "False" "check base class (fields\[1\])" } } @@ -208,9 +208,9 @@ proc test_range {} { # Test a valid range request. gdb_py_test_silent_cmd "print (ar)" "print value (ar)" 1 gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 - gdb_test "python print (len(ar.type.range()))" "2" "Check correct tuple length" - gdb_test "python print (ar.type.range()\[0\])" "0" "Check range low bound" - gdb_test "python print (ar.type.range()\[1\])" "1" "Check range high bound" + gdb_test "python print (len(ar.type.range()))" "2" "check correct tuple length" + gdb_test "python print (ar.type.range()\[0\])" "0" "check range low bound" + gdb_test "python print (ar.type.range()\[1\])" "1" "check range high bound" } with_test_prefix "on ranged type" { @@ -218,15 +218,15 @@ proc test_range {} { gdb_py_test_silent_cmd "print (ar)" "print value (ar)" 1 gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 gdb_py_test_silent_cmd "python fields = ar.type.fields()" "get fields" 1 - gdb_test "python print (fields\[0\].type.range()\[0\])" "0" "Check range low bound" - gdb_test "python print (fields\[0\].type.range()\[1\])" "1" "Check range high bound" + gdb_test "python print (fields\[0\].type.range()\[0\])" "0" "check range low bound" + gdb_test "python print (fields\[0\].type.range()\[1\])" "1" "check range high bound" } with_test_prefix "on unranged value" { # Test where a range does not exist. gdb_py_test_silent_cmd "print (st)" "print value (st)" 1 gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value (st) from history" 1 - gdb_test "python print (st.type.range())" "RuntimeError: This type does not have a range.*" "Check range for non ranged type." + gdb_test "python print (st.type.range())" "RuntimeError: This type does not have a range.*" "check range for non ranged type." } } } diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index 5395f8c..fb489e1 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -74,7 +74,7 @@ proc test_value_creation {} { } # Test address attribute is None in a non-addressable value - gdb_test "python print ('result = %s' % i.address)" "= None" "Test address attribute in non-addressable value" + gdb_test "python print ('result = %s' % i.address)" "= None" "test address attribute in non-addressable value" } proc test_value_numeric_ops {} { @@ -250,10 +250,10 @@ proc test_value_in_inferior {} { } # Smoke-test is_optimized_out attribute - gdb_test "python print ('result = %s' % arg0.is_optimized_out)" "= False" "Test is_optimized_out attribute" + gdb_test "python print ('result = %s' % arg0.is_optimized_out)" "= False" "test is_optimized_out attribute" # Test address attribute - gdb_test "python print ('result = %s' % arg0.address)" "= 0x\[\[:xdigit:\]\]+" "Test address attribute" + gdb_test "python print ('result = %s' % arg0.address)" "= 0x\[\[:xdigit:\]\]+" "test address attribute" # Test displaying a variable that is temporarily at a bad address. # But if we can examine what's at memory address 0, then we'll also be @@ -295,16 +295,16 @@ proc test_value_in_inferior {} { gdb_test "print st" "\"divide et impera\"" gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1 gdb_test "python print (st.string ())" "divide et impera" "Test string with no length" - gdb_test "python print (st.string (length = -1))" "divide et impera" "Test string (length = -1) is all of the string" + gdb_test "python print (st.string (length = -1))" "divide et impera" "test string (length = -1) is all of the string" gdb_test "python print (st.string (length = 6))" "divide" - gdb_test "python print (\"---\"+st.string (length = 0)+\"---\")" "------" "Test string (length = 0) is empty" - gdb_test "python print (len(st.string (length = 0)))" "0" "Test length is 0" + gdb_test "python print (\"---\"+st.string (length = 0)+\"---\")" "------" "test string (length = 0) is empty" + gdb_test "python print (len(st.string (length = 0)))" "0" "test length is 0" # Fetch a string that has embedded nulls. gdb_test "print nullst" "\"divide\\\\000et\\\\000impera\".*" gdb_py_test_silent_cmd "python nullst = gdb.history (0)" "get value from history" 1 - gdb_test "python print (nullst.string ())" "divide" "Test string to first null" + gdb_test "python print (nullst.string ())" "divide" "test string to first null" # Python cannot print strings that contain the null (\0) character. # For the purposes of this test, use repr() gdb_py_test_silent_cmd "python nullst = nullst.string (length = 9)" "get string beyond null" 1 @@ -325,18 +325,18 @@ proc test_lazy_strings {} { gdb_py_test_silent_cmd "python sptr = gdb.history (0)" "Get value from history" 1 gdb_py_test_silent_cmd "python lstr = sptr.lazy_string()" "Aquire lazy string" 1 - gdb_test "python print (lstr.type)" "const char \*." "Test lazy-string type name equality" - gdb_test "python print (sptr.type)" "const char \*." "Test string type name equality" + gdb_test "python print (lstr.type)" "const char \*." "test lazy-string type name equality" + gdb_test "python print (sptr.type)" "const char \*." "test string type name equality" # Prevent symbol on address 0x0 being printed. gdb_test_no_output "set print symbol off" gdb_test "print sn" "0x0" gdb_py_test_silent_cmd "python snptr = gdb.history (0)" "Get value from history" 1 - gdb_test "python snstr = snptr.lazy_string(length=5)" ".*Cannot create a lazy string with address.*" "Test lazy string" + gdb_test "python snstr = snptr.lazy_string(length=5)" ".*Cannot create a lazy string with address.*" "test lazy string" gdb_py_test_silent_cmd "python snstr = snptr.lazy_string(length=0)" "Succesfully create a lazy string" 1 - gdb_test "python print (snstr.length)" "0" "Test lazy string length" - gdb_test "python print (snstr.address)" "0" "Test lazy string address" + gdb_test "python print (snstr.length)" "0" "test lazy string length" + gdb_test "python print (snstr.address)" "0" "test lazy string address" } @@ -389,7 +389,7 @@ proc test_value_after_death {} { gdb_test "kill" "" "kill the inferior" \ "Kill the program being debugged. .y or n. $" \ "y" - gdb_test "file" "" "Discard the symbols" \ + gdb_test "file" "" "discard the symbols" \ "Discard symbol table from.*y or n. $" \ "y" @@ -428,7 +428,7 @@ proc test_subscript_regression {exefile lang} { "Obtain address" 1 gdb_py_test_silent_cmd "python rptr = gdb.history(0)" \ "Obtains value from GDB" 1 - gdb_test "python print (rptr\[0\])" "2" "Check pointer passed as reference" + gdb_test "python print (rptr\[0\])" "2" "check pointer passed as reference" # Just the most basic test of dynamic_cast -- it is checked in # the C++ tests. @@ -454,19 +454,19 @@ proc test_subscript_regression {exefile lang} { "Create a value for subscript test" 1 # Try to access an int with a subscript. This should fail. - gdb_test "python print (intv)" "1" "Baseline print of an int Python value" + gdb_test "python print (intv)" "1" "baseline print of an int Python value" gdb_test "python print (intv\[0\])" "gdb.error: Cannot subscript requested type.*" \ "Attempt to access an integer with a subscript" # Try to access a string with a subscript. This should pass. - gdb_test "python print (stringv)" "foo." "Baseline print of a string Python value" - gdb_test "python print (stringv\[0\])" "f." "Attempt to access a string with a subscript" + gdb_test "python print (stringv)" "foo." "baseline print of a string Python value" + gdb_test "python print (stringv\[0\])" "f." "attempt to access a string with a subscript" # Try to access an int array via a pointer with a subscript. This should pass. gdb_py_test_silent_cmd "print p" "Build pointer to array" 1 gdb_py_test_silent_cmd "python pointer = gdb.history(0)" "" 1 - gdb_test "python print (pointer\[0\])" "1" "Access array via pointer with int subscript" - gdb_test "python print (pointer\[intv\])" "2" "Access array via pointer with value subscript" + gdb_test "python print (pointer\[0\])" "1" "access array via pointer with int subscript" + gdb_test "python print (pointer\[intv\])" "2" "access array via pointer with value subscript" # Try to access a single dimension array with a subscript to the # result. This should fail. @@ -477,7 +477,7 @@ proc test_subscript_regression {exefile lang} { # dimensions. This should pass. gdb_py_test_silent_cmd "print {\"fu \",\"foo\",\"bar\"}" "Build array" 1 gdb_py_test_silent_cmd "python marray = gdb.history(0)" "" 1 - gdb_test "python print (marray\[1\]\[2\])" "o." "Test multiple subscript" + gdb_test "python print (marray\[1\]\[2\])" "o." "test multiple subscript" } # A few tests of gdb.parse_and_eval. @@ -500,10 +500,10 @@ proc test_value_hash {} { "three = gdb.Value(3)" "" \ "vdict = {one:\"one str\",two:\"two str\",three:\"three str\"}" "" \ "end" - gdb_test "python print (vdict\[one\])" "one str" "Test dictionary hash" - gdb_test "python print (vdict\[two\])" "two str" "Test dictionary hash" - gdb_test "python print (vdict\[three\])" "three str" "Test dictionary hash" - gdb_test "python print (one.__hash__() == hash(one))" "True" "Test inbuilt hash" + gdb_test "python print (vdict\[one\])" "one str" "test dictionary hash" + gdb_test "python print (vdict\[two\])" "two str" "test dictionary hash" + gdb_test "python print (vdict\[three\])" "three str" "test dictionary hash" + gdb_test "python print (one.__hash__() == hash(one))" "True" "test inbuilt hash" } # Build C version of executable. C++ is built later. diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp index abe609b..5490c03 100644 --- a/gdb/testsuite/gdb.python/py-xmethods.exp +++ b/gdb/testsuite/gdb.python/py-xmethods.exp @@ -40,44 +40,44 @@ gdb_breakpoint [gdb_get_line_number "Break here."] gdb_continue_to_breakpoint "Break here" ".*Break here.*" # Tests before loading the debug methods. -gdb_test "p a1 + a2" ".* = 15" "Before: a1 + a2" -gdb_test "p a_plus_a" ".* = 1" "Before: a_plus_a 1" +gdb_test "p a1 + a2" ".* = 15" "before: a1 + a2" +gdb_test "p a_plus_a" ".* = 1" "before: a_plus_a 1" -gdb_test "p a2 - a1" ".* = 5" "Before: a2 - a1" -gdb_test "p a_minus_a" ".* = 1" "Before: a_minus_a 1" +gdb_test "p a2 - a1" ".* = 5" "before: a2 - a1" +gdb_test "p a_minus_a" ".* = 1" "before: a_minus_a 1" -gdb_test "p b1 - a1" ".* = 25" "Before: b1 - a1" -gdb_test "p a_minus_a" ".* = 2" "Before: a_minus_a 2" +gdb_test "p b1 - a1" ".* = 25" "before: b1 - a1" +gdb_test "p a_minus_a" ".* = 2" "before: a_minus_a 2" -gdb_test "p a1.geta()" ".* = 5" "Before: a1.geta()" -gdb_test "p a_geta" ".* = 1" "Before: a_geta 1" +gdb_test "p a1.geta()" ".* = 5" "before: a1.geta()" +gdb_test "p a_geta" ".* = 1" "before: a_geta 1" -gdb_test "p ++a1" "No symbol.*" "Before: ++a1" +gdb_test "p ++a1" "No symbol.*" "before: ++a1" gdb_test "p a1.getarrayind(5)" "Couldn't find method.*" \ "Before: a1.getarrayind(5)" -gdb_test "p a_ptr->geta()" ".* = 60" "Before: a_ptr->geta()" -gdb_test "p b_geta" ".* = 1" "Before: b_geta 1" +gdb_test "p a_ptr->geta()" ".* = 60" "before: a_ptr->geta()" +gdb_test "p b_geta" ".* = 1" "before: b_geta 1" -gdb_test "p e.geta()" ".* = 100" "Before: e.geta()" -gdb_test "p a_geta" ".* = 2" "Before: a_geta 2" +gdb_test "p e.geta()" ".* = 100" "before: e.geta()" +gdb_test "p a_geta" ".* = 2" "before: a_geta 2" # Since g.size_diff operates of sizes of int and float, do not check for # actual result value as it could be different on different platforms. -gdb_test "p g.size_diff<float>()" ".*" "Before: call g.size_diff<float>()" -gdb_test "p g_size_diff" ".* = 2" "Before: g_size_diff 2" +gdb_test "p g.size_diff<float>()" ".*" "before: call g.size_diff<float>()" +gdb_test "p g_size_diff" ".* = 2" "before: g_size_diff 2" gdb_test "p g.size_diff<unsigned long>()" "Couldn't find method.*" \ "Before: g.size_diff<unsigned long>()" -gdb_test "p g.size_mul<2>()" ".*" "Before: g.size_mul<2>()" -gdb_test "p g_size_mul" ".* = 2" "Before: g_size_mul 2" +gdb_test "p g.size_mul<2>()" ".*" "before: g.size_mul<2>()" +gdb_test "p g_size_mul" ".* = 2" "before: g_size_mul 2" gdb_test "p g.size_mul<5>()" "Couldn't find method.*" \ "Before: g.size_mul<5>()" -gdb_test "p g.mul<double>(2.0)" ".* = 10" "Before: g.mul<double>(2.0)" -gdb_test "p g_mul" ".* = 2" "Before: g_mul 2" +gdb_test "p g.mul<double>(2.0)" ".* = 10" "before: g.mul<double>(2.0)" +gdb_test "p g_mul" ".* = 2" "before: g_mul 2" gdb_test "p g.mul<char>('a')" "Couldn't find method.*" \ "Before: g.mul<char>('a')" @@ -86,29 +86,29 @@ gdb_test "p g.mul<char>('a')" "Couldn't find method.*" \ gdb_test_no_output "source ${xmethods_script}" "load the script file" # Tests after loading debug methods. -gdb_test "p a1 + a2" "From Python <A_plus_A>.*15" "After: a1 + a2" +gdb_test "p a1 + a2" "From Python <A_plus_A>.*15" "after: a1 + a2" -gdb_test "p a2 - a1" ".* = 5" "After: a2 - a1" -gdb_test "p a_minus_a" ".* = 3" "After: a_minus_a 3" +gdb_test "p a2 - a1" ".* = 5" "after: a2 - a1" +gdb_test "p a_minus_a" ".* = 3" "after: a_minus_a 3" -gdb_test "p b1 + a1" "From Python <A_plus_A>.*35" "After: b1 + a1" +gdb_test "p b1 + a1" "From Python <A_plus_A>.*35" "after: b1 + a1" -gdb_test "p b1 - a1" ".* = 25" "After: b1 - a1" -gdb_test "p a_minus_a" ".* = 4" "After: a_minus_a 4" +gdb_test "p b1 - a1" ".* = 25" "after: b1 - a1" +gdb_test "p a_minus_a" ".* = 4" "after: a_minus_a 4" -gdb_test "p a1.geta()" "From Python <A_geta>.*5" "After: a1.geta()" -gdb_test "p ++a1" "From Python <plus_plus_A>.*6" "After: ++a1" +gdb_test "p a1.geta()" "From Python <A_geta>.*5" "after: a1.geta()" +gdb_test "p ++a1" "From Python <plus_plus_A>.*6" "after: ++a1" gdb_test "p a1.getarrayind(5)" "From Python <A_getarrayind>.*5" \ "After: a1.getarrayind(5)" -gdb_test "P a1\[6\]" ".*int &.*6" "After a1\[\]" -gdb_test "P b1\[7\]" ".*const int &.*7" "After b1\[\]" +gdb_test "P a1\[6\]" ".*int &.*6" "after a1\[\]" +gdb_test "P b1\[7\]" ".*const int &.*7" "after b1\[\]" # Note the following test. Xmethods on dynamc types are not looked up # currently. Hence, even though a_ptr points to a B object, the xmethod # defined for A objects is invoked. -gdb_test "p a_ptr->geta()" "From Python <A_geta>.*30" "After: a_ptr->geta()" -gdb_test "p e.geta()" "From Python <A_geta>.*100" "After: e.geta()" -gdb_test "p e_ptr->geta()" "From Python <A_geta>.*100" "After: e_ptr->geta()" -gdb_test "p e_ref.geta()" "From Python <A_geta>.*100" "After: e_ref.geta()" +gdb_test "p a_ptr->geta()" "From Python <A_geta>.*30" "after: a_ptr->geta()" +gdb_test "p e.geta()" "From Python <A_geta>.*100" "after: e.geta()" +gdb_test "p e_ptr->geta()" "From Python <A_geta>.*100" "after: e_ptr->geta()" +gdb_test "p e_ref.geta()" "From Python <A_geta>.*100" "after: e_ref.geta()" gdb_test "p e.method(10)" "From Python <E_method_int>.* = void" \ "After: e.method(10)" gdb_test "p e.method('a')" "From Python <E_method_char>.* = void" \ diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 2ff1f14..14cfffe 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -131,7 +131,7 @@ gdb_py_test_multiple "post event insertion" \ "end" "" gdb_test "python print (someVal)" "1" "test post event execution" -gdb_test "python gdb.post_event(str(1))" "RuntimeError: Posted event is not callable.*" "Test non callable class" +gdb_test "python gdb.post_event(str(1))" "RuntimeError: Posted event is not callable.*" "test non callable class" # Test (no) pagination of the executed command. gdb_test "show height" {Number of lines gdb thinks are in a page is unlimited\.} @@ -177,7 +177,7 @@ gdb_test "python print (a)" ".*aliases -- Aliases of other commands.*" "verify h # Test PR 12212, using InfThread.selected_thread() when no inferior is # loaded. gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aquire thread with no inferior" 1 -gdb_test "python print (nothread == None)" "True" "Ensure that no threads are returned" +gdb_test "python print (nothread == None)" "True" "ensure that no threads are returned" gdb_py_test_multiple "register atexit function" \ "python" "" \ @@ -215,56 +215,56 @@ gdb_test "python gdb.decode_line(\"main.c:43\")" \ "gdb.error: No source file named main.c.*" "test decode_line no source named main" gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line current location" 1 -gdb_test "python print (len(symtab))" "2" "Test decode_line current location" -gdb_test "python print (symtab\[0\])" "None" "Test decode_line expression parse" -gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line current location" +gdb_test "python print (len(symtab))" "2" "test decode_line current location" +gdb_test "python print (symtab\[0\])" "None" "test decode_line expression parse" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line current location" if { [is_remote host] } { set python_c [string_to_regexp "python.c"] } else { set python_c [string_to_regexp "gdb.python/python.c"] } -gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line current location filename" -gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "Test decode_line current location line number" +gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line current location filename" +gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "test decode_line current location line number" gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26" 1 -gdb_test "python print (len(symtab))" "2" "Test decode_line python.c:26 length" -gdb_test "python print (symtab\[0\])" "if foo" "Test decode_line expression parse" -gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line python.c:26 length" -gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line python.c:26 filename" -gdb_test "python print (symtab\[1\]\[0\].line)" "26" "Test decode_line python.c:26 line number" +gdb_test "python print (len(symtab))" "2" "test decode_line python.c:26 length" +gdb_test "python print (symtab\[0\])" "if foo" "test decode_line expression parse" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line python.c:26 length" +gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line python.c:26 filename" +gdb_test "python print (symtab\[1\]\[0\].line)" "26" "test decode_line python.c:26 line number" gdb_test "python gdb.decode_line(\"randomfunc\")" \ "gdb.error: Function \"randomfunc\" not defined.*" "test decode_line randomfunc" gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode_line func1()" 1 -gdb_test "python print (len(symtab))" "2" "Test decode_line func1 length" -gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line func1 length" +gdb_test "python print (len(symtab))" "2" "test decode_line func1 length" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line func1 length" if { [is_remote host] } { set python_1_c [string_to_regexp "python-1.c"] } else { set python_1_c [string_to_regexp "gdb.python/python-1.c"] } -gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "Test decode_line func1 filename" -gdb_test "python print (symtab\[1\]\[0\].line)" "19" "Test decode_line func1 line number" +gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "test decode_line func1 filename" +gdb_test "python print (symtab\[1\]\[0\].line)" "19" "test decode_line func1 line number" gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \ "test decode_line func1,func2" 1 gdb_test {python print (symtab[0])} ",func2" "stop at comma in linespec" gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"*0\")" "Test decode_line *0" 1 -gdb_test "python print (len(symtab))" "2" "Test decode_line *0 result length" -gdb_test "python print (symtab\[0\])" "None" "Test decode_line *0 unparsed" -gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line *0 locations length" -gdb_test "python print (symtab\[1\]\[0\].symtab)" "None" "Test decode_line *0 filename" -gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "Test decode_line *0 pc" +gdb_test "python print (len(symtab))" "2" "test decode_line *0 result length" +gdb_test "python print (symtab\[0\])" "None" "test decode_line *0 unparsed" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line *0 locations length" +gdb_test "python print (symtab\[1\]\[0\].symtab)" "None" "test decode_line *0 filename" +gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "test decode_line *0 pc" # gdb.write -gdb_test "python print (sys.stderr)" ".*gdb.GdbOutputErrorFile (instance|object) at.*" "Test stderr location" -gdb_test "python print (sys.stdout)" ".*gdb.GdbOutputFile (instance|object) at.*" "Test stdout location" -gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "Test default write" -gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "Test stderr write" -gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "Test stdout write" -gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "Test stdlog write" +gdb_test "python print (sys.stderr)" ".*gdb.GdbOutputErrorFile (instance|object) at.*" "test stderr location" +gdb_test "python print (sys.stdout)" ".*gdb.GdbOutputFile (instance|object) at.*" "test stdout location" +gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "test default write" +gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "test stderr write" +gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "test stdout write" +gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "test stdlog write" # Turn on full stack printing for subsequent tests. gdb_py_test_silent_cmd "set python print-stack full" \ @@ -454,9 +454,9 @@ if ![runto_main] then { runto [gdb_get_line_number "Break at func2 call site."] gdb_py_test_silent_cmd "python line = gdb.selected_frame().find_sal().line" "Get line number of func2 call site" 1 -gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line == line)" "True" "Test find_pc_line at func2 call site" +gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line == line)" "True" "test find_pc_line at func2 call site" gdb_py_test_silent_cmd "step" "Step into func2" 1 gdb_py_test_silent_cmd "up" "Step out of func2" 1 -gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True" "Test find_pc_line with resume address" +gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True" "test find_pc_line with resume address" |