gdb_test "python print (gdb.parameter ('directories'))" $directories
# Test a simple boolean parameter.
-gdb_py_test_multiple "Simple gdb booleanparameter" \
- "python" "" \
- "class TestParam (gdb.Parameter):" "" \
- " \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
- " show_doc = \"Show the state of the boolean test-param\"" ""\
- " set_doc = \"Set the state of the boolean test-param\"" "" \
- " def get_show_string (self, pvalue):" ""\
- " return \"The state of the Test Parameter is \" + pvalue" ""\
- " def get_set_string (self):" ""\
- " val = \"on\"" ""\
- " if (self.value == False):" ""\
- " val = \"off\"" ""\
- " return \"Test Parameter has been set to \" + val" ""\
- " def __init__ (self, name):" "" \
- " super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
- " self.value = True" "" \
- "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"
+with_test_prefix "boolean parameter" {
+ gdb_py_test_multiple "Simple gdb booleanparameter" \
+ "python" "" \
+ "class TestParam (gdb.Parameter):" "" \
+ " \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
+ " show_doc = \"Show the state of the boolean test-param\"" ""\
+ " set_doc = \"Set the state of the boolean test-param\"" "" \
+ " def get_show_string (self, pvalue):" ""\
+ " return \"The state of the Test Parameter is \" + pvalue" ""\
+ " def get_set_string (self):" ""\
+ " val = \"on\"" ""\
+ " if (self.value == False):" ""\
+ " val = \"off\"" ""\
+ " return \"Test Parameter has been set to \" + val" ""\
+ " def __init__ (self, name):" "" \
+ " super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_param = TestParam ('print test-param')" ""\
+ "end"
+ gdb_test "python print (test_param.value)" "True" \
+ "test boolean parameter value is True"
+ 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 boolean parameter value is False"
+ 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.
-gdb_py_test_multiple "enum gdb parameter" \
- "python" "" \
- "class TestEnumParam (gdb.Parameter):" "" \
- " \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
- " show_doc = \"Show the state of the enum\"" ""\
- " set_doc = \"Set the state of the enum\"" "" \
- " def get_show_string (self, pvalue):" ""\
- " return \"The state of the enum is \" + pvalue" ""\
- " def get_set_string (self):" ""\
- " return \"The state of the enum has been set to \" + self.value" ""\
- " def __init__ (self, name):" "" \
- " super (TestEnumParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_ENUM, \[\"one\", \"two\"\])" "" \
- " self.value = \"one\"" "" \
- "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"
+with_test_prefix "enum parameter" {
+ gdb_py_test_multiple "enum gdb parameter" \
+ "python" "" \
+ "class TestEnumParam (gdb.Parameter):" "" \
+ " \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
+ " show_doc = \"Show the state of the enum\"" ""\
+ " set_doc = \"Set the state of the enum\"" "" \
+ " def get_show_string (self, pvalue):" ""\
+ " return \"The state of the enum is \" + pvalue" ""\
+ " def get_set_string (self):" ""\
+ " return \"The state of the enum has been set to \" + self.value" ""\
+ " def __init__ (self, name):" "" \
+ " super (TestEnumParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_ENUM, \[\"one\", \"two\"\])" "" \
+ " self.value = \"one\"" "" \
+ "test_enum_param = TestEnumParam ('print test-enum-param')" ""\
+ "end"
+
+ gdb_test "python print (test_enum_param.value)" "one" \
+ "test enum parameter value is one"
+ 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 is two"
+ 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" \
- "python" "" \
- "class TestFileParam (gdb.Parameter):" "" \
- " \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
- " show_doc = \"Show the name of the file\"" ""\
- " set_doc = \"Set the name of the file\"" "" \
- " def get_show_string (self, pvalue):" ""\
- " return \"The name of the file is \" + pvalue" ""\
- " def get_set_string (self):" ""\
- " return \"The name of the file has been changed to \" + self.value" ""\
- " def __init__ (self, name):" "" \
- " super (TestFileParam, self).__init__ (name, gdb.COMMAND_FILES, gdb.PARAM_FILENAME)" "" \
- " self.value = \"foo.txt\"" "" \
- "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 "set test-file-param" "Argument required.*"
+with_test_prefix "file parameter" {
+ gdb_py_test_multiple "file gdb parameter" \
+ "python" "" \
+ "class TestFileParam (gdb.Parameter):" "" \
+ " \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
+ " show_doc = \"Show the name of the file\"" ""\
+ " set_doc = \"Set the name of the file\"" "" \
+ " def get_show_string (self, pvalue):" ""\
+ " return \"The name of the file is \" + pvalue" ""\
+ " def get_set_string (self):" ""\
+ " return \"The name of the file has been changed to \" + self.value" ""\
+ " def __init__ (self, name):" "" \
+ " super (TestFileParam, self).__init__ (name, gdb.COMMAND_FILES, gdb.PARAM_FILENAME)" "" \
+ " self.value = \"foo.txt\"" "" \
+ "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 "set test-file-param" "Argument required.*"
+}
# Test a parameter that is not documented.
-gdb_py_test_multiple "Simple gdb booleanparameter" \
- "python" "" \
- "class TestUndocParam (gdb.Parameter):" "" \
- " def get_show_string (self, pvalue):" ""\
- " return \"The state of the Test Parameter is \" + pvalue" ""\
- " def get_set_string (self):" ""\
- " val = \"on\"" ""\
- " if (self.value == False):" ""\
- " val = \"off\"" ""\
- " return \"Test Parameter has been set to \" + val" ""\
- " def __init__ (self, name):" "" \
- " super (TestUndocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
- " self.value = True" "" \
- "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"
+with_test_prefix "undocumented parameter" {
+ gdb_py_test_multiple "Simple gdb booleanparameter" \
+ "python" "" \
+ "class TestUndocParam (gdb.Parameter):" "" \
+ " def get_show_string (self, pvalue):" ""\
+ " return \"The state of the Test Parameter is \" + pvalue" ""\
+ " def get_set_string (self):" ""\
+ " val = \"on\"" ""\
+ " if (self.value == False):" ""\
+ " val = \"off\"" ""\
+ " return \"Test Parameter has been set to \" + val" ""\
+ " def __init__ (self, name):" "" \
+ " super (TestUndocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "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 undocumented parameter value is False"
+ 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" \
- "python" "" \
- "class TestNodocParam (gdb.Parameter):" "" \
- " def __init__ (self, name):" "" \
- " super (TestNodocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
- " self.value = True" "" \
- "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_no_output "set print test-nodoc-param off" "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"
+with_test_prefix "really undocumented parameter" {
+ gdb_py_test_multiple "Simple gdb booleanparameter" \
+ "python" "" \
+ "class TestNodocParam (gdb.Parameter):" "" \
+ " def __init__ (self, name):" "" \
+ " super (TestNodocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "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_no_output "set print test-nodoc-param off" \
+ "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 really undocumented parameter value is False"
+ 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" \
- "python" "" \
- "class TestParam (gdb.Parameter):" "" \
- " \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
- " show_doc = \"State of the Test Parameter\"" ""\
- " set_doc = \"Set the state of the Test Parameter\"" "" \
- " def __init__ (self, name):" "" \
- " super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
- " self.value = True" "" \
- "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_no_output "set print test-param off" "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"
+with_test_prefix "deprecated API parameter" {
+ gdb_py_test_multiple "Simple gdb booleanparameter" \
+ "python" "" \
+ "class TestParam (gdb.Parameter):" "" \
+ " \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
+ " show_doc = \"State of the Test Parameter\"" ""\
+ " set_doc = \"Set the state of the Test Parameter\"" "" \
+ " def __init__ (self, name):" "" \
+ " super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_param = TestParam ('print test-param')" ""\
+ "end"
+
+ gdb_test "python print (test_param.value)" "True" \
+ "test deprecated API parameter value is True"
+ gdb_test "show print test-param" \
+ "State of the Test Parameter on.*" "show parameter on"
+ gdb_test_no_output "set print test-param off" "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 deprecated API parameter value is False"
+ 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"
+}
foreach kind {PARAM_ZUINTEGER PARAM_ZUINTEGER_UNLIMITED} {
gdb_py_test_multiple "Simple gdb $kind" \
gdb_test "py test_bool (gdb.Value (0))" "nay" "check evaluation of false integer value in expression"
- gdb_test "py test_bool (gdb.Value (5.2))" "yay" "check evaluation of true integer value in expression"
+ gdb_test "py test_bool (gdb.Value (5.2))" "yay" "check evaluation of true float value in expression"
- gdb_test "py test_bool (gdb.Value (0.0))" "nay" "check evaluation of false integer value in expression"
+ gdb_test "py test_bool (gdb.Value (0.0))" "nay" "check evaluation of false float value in expression"
}
proc test_value_compare {} {
global gdb_py_is_py3k
gdb_breakpoint [gdb_get_line_number "break to inspect struct and union"]
-
gdb_continue_to_breakpoint "break to inspect struct and union"
# Just get inferior variable s in the value history, available to python.
gdb_test "print s" " = {a = 3, b = 5}" ""
- gdb_py_test_silent_cmd "python s = gdb.history (0)" "get value from history" 1
+ gdb_py_test_silent_cmd "python s = gdb.history (0)" "get value s from history" 1
gdb_test "python print ('result = ' + str(s\['a'\]))" " = 3" "access element inside struct using 8-bit string name"
if { $gdb_py_is_py3k == 0 } {
} else {
gdb_test "python inval = gdb.parse_and_eval('*(int*)0')"
gdb_test "python print (inval.is_lazy)" "True"
- gdb_test "python inval2 = inval+1" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test
- gdb_test "python inval.fetch_lazy ()" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test
+ gdb_test "python inval2 = inval+1" \
+ "gdb.MemoryError: Cannot access memory at address 0x0.*" \
+ "$test, first test"
+ gdb_test "python inval.fetch_lazy ()" \
+ "gdb.MemoryError: Cannot access memory at address 0x0.*" \
+ "$test, second test"
}
set argc_value [get_integer_valueof "argc" 0]
gdb_test "python argc_lazy = gdb.parse_and_eval('argc')"
gdb_test "python argc_notlazy = gdb.parse_and_eval('argc')"
gdb_test "python argc_notlazy.fetch_lazy()"
- gdb_test "python print (argc_lazy.is_lazy)" "True"
+ gdb_test "python print (argc_lazy.is_lazy)" "True" \
+ "python print (argc_lazy.is_lazy) the first time"
gdb_test "python print (argc_notlazy.is_lazy)" "False"
gdb_test "print argc" " = $argc_value" "sanity check argc"
- gdb_test "python print (argc_lazy.is_lazy)" "\r\nTrue"
+ gdb_test "python print (argc_lazy.is_lazy)" "\r\nTrue" \
+ "python print (argc_lazy.is_lazy) the second time"
gdb_test_no_output "set argc=[expr $argc_value + 1]" "change argc"
gdb_test "python print (argc_notlazy)" "\r\n$argc_value"
gdb_test "python print (argc_lazy)" "\r\n[expr $argc_value + 1]"
# Test string fetches, both partial and whole.
gdb_test "print st" "\"divide et impera\""
- gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1
+ gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value st 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 = 6))" "divide"
# 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_py_test_silent_cmd "python nullst = gdb.history (0)" "get value nullst from history" 1
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()
# Correct inferior call without arguments.
gdb_test "p/x fp1" " = $hex.*"
- gdb_py_test_silent_cmd "python fp1 = gdb.history (0)" "get value from history" 1
+ gdb_py_test_silent_cmd "python fp1 = gdb.history (0)" "get value fp1 from history" 1
gdb_test "python fp1 = fp1.dereference()" ""
gdb_test "python result = fp1()" ""
gdb_test "python print (result)" "void"
# Correct inferior call with arguments.
- gdb_test "p/x fp2" " = $hex.*"
- gdb_py_test_silent_cmd "python fp2 = gdb.history (0)" "get value from history" 1
+ gdb_test "p/x fp2" " = $hex.*" \
+ "print fp2 to place it into history"
+ gdb_py_test_silent_cmd "python fp2 = gdb.history (0)" "get value fp2 from history" 1
gdb_test "python fp2 = fp2.dereference()" ""
gdb_test "python result2 = fp2(10,20)" ""
gdb_test "python print (result2)" "30"
# Incorrect to call an int value.
gdb_test "p i" " = $decimal.*"
- gdb_py_test_silent_cmd "python i = gdb.history (0)" "get value from history" 1
+ gdb_py_test_silent_cmd "python i = gdb.history (0)" "get value i from history" 1
gdb_test "python result3 = i()" ".*Value is not callable.*"
# Incorrect number of arguments.
- gdb_test "p/x fp2" " = $hex.*"
- gdb_py_test_silent_cmd "python fp3 = gdb.history (0)" "get value from history" 1
+ gdb_test "p/x fp2" " = $hex.*" \
+ "print fp2 again to place it into history"
+ gdb_py_test_silent_cmd "python fp3 = gdb.history (0)" "get value fp3 from history" 1
gdb_test "python fp3 = fp3.dereference()" ""
gdb_test "python result2 = fp3(10)" ".*Too few arguments in function call.*"
}
}
gdb_breakpoint [gdb_get_line_number "break to inspect struct and union"]
- gdb_continue_to_breakpoint "break to inspect struct and union"
+ gdb_continue_to_breakpoint \
+ "break to inspect struct and union for subscript regression test"
gdb_py_test_silent_cmd "python intv = gdb.Value(1)" \
- "Create a value for subscript test" 1
+ "Create value intv for subscript test" 1
gdb_py_test_silent_cmd "python stringv = gdb.Value(\"foo\")" \
- "Create a value for subscript test" 1
+ "Create value stringv 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"
# 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_py_test_silent_cmd "python pointer = gdb.history(0)" "fetch pointer" 0
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.
gdb_test "python print (pointer\[intv\]\[0\])" "gdb.error: Cannot subscript requested type.*" \
- "Attempt to access an integer with a subscript"
+ "Attempt to access a single dimension array with a two subscripts"
# Lastly, test subscript access to an array with multiple
# 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_py_test_silent_cmd "python marray = gdb.history(0)" "fetch marray" 0
gdb_test "python print (marray\[1\]\[2\])" "o." "test multiple subscript"
}
"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 (vdict\[one\])" "one str" "test dictionary hash for one"
+ gdb_test "python print (vdict\[two\])" "two str" "test dictionary hash for two"
+ gdb_test "python print (vdict\[three\])" "three str" "test dictionary hash for three"
gdb_test "python print (one.__hash__() == hash(one))" "True" "test inbuilt hash"
}