File tree Expand file tree Collapse file tree 5 files changed +46
-3
lines changed
testsuite/tests/records/derived Expand file tree Collapse file tree 5 files changed +46
-3
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,10 @@ def process_record(r):
193
193
# parts (case <discr> is ... end case, in Ada records) or regular
194
194
# fields.
195
195
for f in r .type .fields ():
196
- if f .name .endswith (union_suffix ):
196
+ if f .name == '_parent' :
197
+ process_record (r [f .name ])
198
+
199
+ elif f .name .endswith (union_suffix ):
197
200
# This is an undecoded variant part, materialized as an union
198
201
# field whose name has follows the <discr>___XVN pattern.
199
202
# Compute the corresponding discriminant and decode the union.
@@ -207,8 +210,8 @@ def process_record(r):
207
210
# Just recurse on that record.
208
211
process_record (r [f .name ])
209
212
210
- else :
211
- # This is a regular field.
213
+ elif not f . name . startswith ( '_' ) :
214
+ # This is a regular field (omit compiler-generated ones)
212
215
result [f .name ] = r [f .name ]
213
216
214
217
def process_union (discr_value , u ):
Original file line number Diff line number Diff line change
1
+ procedure Foo is
2
+
3
+ type Base is tagged record
4
+ I : Integer;
5
+ end record ;
6
+
7
+ type Derived is new Base with record
8
+ C : Character;
9
+ end record ;
10
+
11
+ procedure Process (R : Base'Class) is
12
+ begin
13
+ null ;
14
+ end Process ;
15
+
16
+ R : Derived := (I => 1 , C => ' A' );
17
+
18
+ begin
19
+ Process (R); -- BREAK
20
+ end Foo ;
Original file line number Diff line number Diff line change
1
+ from gnatdbg .records import decoded_record
2
+
3
+
4
+ def print_record (name , value ):
5
+ print ('== {} ==' .format (name ))
6
+ for k , v in decoded_record (value ).items ():
7
+ print (' {}: {}' .format (k , v ))
Original file line number Diff line number Diff line change
1
+ from support .build import gnatmake
2
+ from support .gdb import GDBSession
3
+
4
+
5
+ gnatmake ('foo' )
6
+ gdb = GDBSession ('foo' )
7
+ gdb .run_to (gdb .find_loc ('foo.adb' , 'BREAK' ))
8
+ gdb .test ('source helpers.py' , '' )
9
+ gdb .test ('pi print_record("R", gdb.parse_and_eval("R"))' ,
10
+ '== R ==\n '
11
+ ' i: 1\n '
12
+ ' c: 65 \' A\' ' )
Original file line number Diff line number Diff line change
1
+ driver : python
You can’t perform that action at this time.
0 commit comments