Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: gdb/testsuite/gdb.python/lib-types.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.python/lib-types.cc ('k') | gdb/testsuite/gdb.python/py-arch.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010-2012 Free Software Foundation, Inc. 1 # Copyright (C) 2010-2013 Free Software Foundation, Inc.
2 2
3 # This program is free software; you can redistribute it and/or modify 3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by 4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or 5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version. 6 # (at your option) any later version.
7 # 7 #
8 # This program is distributed in the hope that it will be useful, 8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
(...skipping 18 matching lines...) Expand all
30 if ![runto_main] then { 30 if ![runto_main] then {
31 fail "Can't run to main" 31 fail "Can't run to main"
32 return 0 32 return 0
33 } 33 }
34 34
35 gdb_test_no_output "python import gdb.types" 35 gdb_test_no_output "python import gdb.types"
36 36
37 # test get_basic_type const stripping 37 # test get_basic_type const stripping
38 gdb_test_no_output "python const_class1_obj = gdb.parse_and_eval ('const_class1_ obj')" 38 gdb_test_no_output "python const_class1_obj = gdb.parse_and_eval ('const_class1_ obj')"
39 gdb_test_no_output "python basic_type_const_class1_obj = gdb.types.get_basic_typ e (const_class1_obj.type)" 39 gdb_test_no_output "python basic_type_const_class1_obj = gdb.types.get_basic_typ e (const_class1_obj.type)"
40 gdb_test "python print str (const_class1_obj.type)" "const class1" 40 gdb_test "python print (str (const_class1_obj.type))" "const class1"
41 set test "const stripping" 41 set test "const stripping"
42 gdb_test_multiple "python print str (basic_type_const_class1_obj)" $test { 42 gdb_test_multiple "python print (str (basic_type_const_class1_obj))" $test {
43 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 43 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
44 pass $test 44 pass $test
45 } 45 }
46 } 46 }
47 47
48 # test get_basic_type volatile stripping 48 # test get_basic_type volatile stripping
49 gdb_test_no_output "python volatile_class1_obj = gdb.parse_and_eval ('volatile_c lass1_obj')" 49 gdb_test_no_output "python volatile_class1_obj = gdb.parse_and_eval ('volatile_c lass1_obj')"
50 gdb_test_no_output "python basic_type_volatile_class1_obj = gdb.types.get_basic_ type (volatile_class1_obj.type)" 50 gdb_test_no_output "python basic_type_volatile_class1_obj = gdb.types.get_basic_ type (volatile_class1_obj.type)"
51 gdb_test "python print str (volatile_class1_obj.type)" "volatile class1" 51 gdb_test "python print (str (volatile_class1_obj.type))" "volatile class1"
52 set test "volatile stripping" 52 set test "volatile stripping"
53 gdb_test_multiple "python print str (basic_type_volatile_class1_obj)" $test { 53 gdb_test_multiple "python print (str (basic_type_volatile_class1_obj))" $test {
54 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 54 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
55 pass $test 55 pass $test
56 } 56 }
57 } 57 }
58 58
59 # test get_basic_type volatile+const stripping 59 # test get_basic_type volatile+const stripping
60 gdb_test_no_output "python const_volatile_class1_obj = gdb.parse_and_eval ('cons t_volatile_class1_obj')" 60 gdb_test_no_output "python const_volatile_class1_obj = gdb.parse_and_eval ('cons t_volatile_class1_obj')"
61 gdb_test_no_output "python basic_type_const_volatile_class1_obj = gdb.types.get_ basic_type (const_volatile_class1_obj.type)" 61 gdb_test_no_output "python basic_type_const_volatile_class1_obj = gdb.types.get_ basic_type (const_volatile_class1_obj.type)"
62 gdb_test "python print str (const_volatile_class1_obj.type)" "const volatile cla ss1" 62 gdb_test "python print (str (const_volatile_class1_obj.type))" "const volatile c lass1"
63 set test "volatile+const stripping" 63 set test "volatile+const stripping"
64 gdb_test_multiple "python print str (basic_type_const_volatile_class1_obj)" $tes t { 64 gdb_test_multiple "python print (str (basic_type_const_volatile_class1_obj))" $t est {
65 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 65 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
66 pass $test 66 pass $test
67 } 67 }
68 } 68 }
69 69
70 # test get_basic_type typedef stripping 70 # test get_basic_type typedef stripping
71 gdb_test_no_output "python typedef_class1_obj = gdb.parse_and_eval ('typedef_cla ss1_obj')" 71 gdb_test_no_output "python typedef_class1_obj = gdb.parse_and_eval ('typedef_cla ss1_obj')"
72 gdb_test_no_output "python basic_type_typedef_class1_obj = gdb.types.get_basic_t ype (typedef_class1_obj.type)" 72 gdb_test_no_output "python basic_type_typedef_class1_obj = gdb.types.get_basic_t ype (typedef_class1_obj.type)"
73 gdb_test "python print str (typedef_class1_obj.type)" "typedef_class1" 73 gdb_test "python print (str (typedef_class1_obj.type))" "typedef_class1"
74 set test "typedef stripping" 74 set test "typedef stripping"
75 gdb_test_multiple "python print str (basic_type_typedef_class1_obj)" $test { 75 gdb_test_multiple "python print (str (basic_type_typedef_class1_obj))" $test {
76 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 76 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
77 pass $test 77 pass $test
78 } 78 }
79 } 79 }
80 80
81 # test get_basic_type reference stripping 81 # test get_basic_type reference stripping
82 gdb_test_no_output "python class1_ref_obj = gdb.parse_and_eval ('class1_ref_obj' )" 82 gdb_test_no_output "python class1_ref_obj = gdb.parse_and_eval ('class1_ref_obj' )"
83 gdb_test_no_output "python basic_type_class1_ref_obj = gdb.types.get_basic_type (class1_ref_obj.type)" 83 gdb_test_no_output "python basic_type_class1_ref_obj = gdb.types.get_basic_type (class1_ref_obj.type)"
84 gdb_test "python print str (class1_ref_obj.type)" "class1 &" 84 gdb_test "python print (str (class1_ref_obj.type))" "class1 &"
85 set test "reference stripping" 85 set test "reference stripping"
86 gdb_test_multiple "python print str (basic_type_class1_ref_obj)" $test { 86 gdb_test_multiple "python print (str (basic_type_class1_ref_obj))" $test {
87 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 87 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
88 pass $test 88 pass $test
89 } 89 }
90 } 90 }
91 91
92 # test nested typedef stripping 92 # test nested typedef stripping
93 gdb_test_no_output "python typedef_const_typedef_class1_obj = gdb.parse_and_eval ('typedef_const_typedef_class1_obj')" 93 gdb_test_no_output "python typedef_const_typedef_class1_obj = gdb.parse_and_eval ('typedef_const_typedef_class1_obj')"
94 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_obj = gdb.typ es.get_basic_type (typedef_const_typedef_class1_obj.type)" 94 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_obj = gdb.typ es.get_basic_type (typedef_const_typedef_class1_obj.type)"
95 gdb_test "python print str (typedef_class1_obj.type)" "typedef_class1" 95 gdb_test "python print (str (typedef_class1_obj.type))" "typedef_class1"
96 set test "nested typedef stripping" 96 set test "nested typedef stripping"
97 gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_obj )" $test { 97 gdb_test_multiple "python print (str (basic_type_typedef_const_typedef_class1_ob j))" $test {
98 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 98 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
99 pass $test 99 pass $test
100 } 100 }
101 } 101 }
102 102
103 # test nested typedef/reference stripping 103 # test nested typedef/reference stripping
104 gdb_test_no_output "python typedef_const_typedef_class1_ref_obj = gdb.parse_and_ eval ('typedef_const_typedef_class1_ref_obj')" 104 gdb_test_no_output "python typedef_const_typedef_class1_ref_obj = gdb.parse_and_ eval ('typedef_const_typedef_class1_ref_obj')"
105 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_ref_obj = gdb .types.get_basic_type (typedef_const_typedef_class1_ref_obj.type)" 105 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_ref_obj = gdb .types.get_basic_type (typedef_const_typedef_class1_ref_obj.type)"
106 gdb_test "python print str (typedef_const_typedef_class1_ref_obj.type)" "const t ypedef_const_typedef_class1_ref" 106 gdb_test "python print (str (typedef_const_typedef_class1_ref_obj.type))" "const typedef_const_typedef_class1_ref"
107 set test "nested typedef/ref stripping" 107 set test "nested typedef/ref stripping"
108 gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_ref _obj)" $test { 108 gdb_test_multiple "python print (str (basic_type_typedef_const_typedef_class1_re f_obj))" $test {
109 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" { 109 -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
110 pass $test 110 pass $test
111 } 111 }
112 } 112 }
113 113
114 # test has_field on simple class 114 # test has_field on simple class
115 gdb_test_no_output "python class1_obj = gdb.parse_and_eval ('class1_obj')" 115 gdb_test_no_output "python class1_obj = gdb.parse_and_eval ('class1_obj')"
116 gdb_test "python print gdb.types.has_field (class1_obj.type, 'x')" "True" 116 gdb_test "python print (gdb.types.has_field (class1_obj.type, 'x'))" "True"
117 gdb_test "python print gdb.types.has_field (class1_obj.type, 'nope')" "False" 117 gdb_test "python print (gdb.types.has_field (class1_obj.type, 'nope'))" "False"
118 118
119 # test has_field in base class 119 # test has_field in base class
120 gdb_test_no_output "python subclass1_obj = gdb.parse_and_eval ('subclass1_obj')" 120 gdb_test_no_output "python subclass1_obj = gdb.parse_and_eval ('subclass1_obj')"
121 gdb_test "python print gdb.types.has_field (subclass1_obj.type, 'x')" "True" 121 gdb_test "python print (gdb.types.has_field (subclass1_obj.type, 'x'))" "True"
122 122
123 # test make_enum_dict 123 # test make_enum_dict
124 gdb_test_no_output "python enum1_obj = gdb.parse_and_eval ('enum1_obj')" 124 gdb_test_no_output "python enum1_obj = gdb.parse_and_eval ('enum1_obj')"
125 gdb_test_no_output "python enum1_dict = gdb.types.make_enum_dict (enum1_obj.type )" 125 gdb_test_no_output "python enum1_dict = gdb.types.make_enum_dict (enum1_obj.type )"
126 gdb_test_no_output "python enum1_list = enum1_dict.items ()" 126 gdb_test_no_output "python enum1_list = sorted (enum1_dict.items ())"
127 gdb_test_no_output "python enum1_list.sort ()" 127 gdb_test "python print (enum1_list)" {\[\('A', 0L?\), \('B', 1L?\), \('C', 2L?\) \]}
128 gdb_test "python print enum1_list" {\[\('A', 0L\), \('B', 1L\), \('C', 2L\)\]}
129 128
130 # test deep_items 129 # test deep_items
131 gdb_test_no_output "python struct_a = gdb.lookup_type ('struct A')" 130 gdb_test_no_output "python struct_a = gdb.lookup_type ('struct A')"
132 gdb_test "python print struct_a.keys ()" {\['a', '', 'c', ''\]} 131 gdb_test "python print (struct_a.keys ())" {\['a', '', 'c', ''\]}
133 gdb_test "python print \[k for k,v in gdb.types.deep_items(struct_a)\]" {\['a', 'b0', 'b1', 'bb0', 'bb1', 'bbb0', 'bbb1', 'c', 'dd0', 'dd1', 'd2', 'd3'\]} 132 gdb_test "python print (\[k for k,v in gdb.types.deep_items(struct_a)\])" {\['a' , 'b0', 'b1', 'bb0', 'bb1', 'bbb0', 'bbb1', 'c', 'dd0', 'dd1', 'd2', 'd3'\]}
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.python/lib-types.cc ('k') | gdb/testsuite/gdb.python/py-arch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698