11import 'package:meta/meta.dart' ;
22
3+ import 'unknown.dart' ;
4+
35/// The list of debug images contains all dynamic libraries loaded into
46/// the process and their memory addresses.
57/// Instruction addresses in the Stack Trace are mapped into the list of debug
@@ -51,6 +53,9 @@ class DebugImage {
5153 /// MachO CPU type identifier.
5254 final int ? cpuType;
5355
56+ @internal
57+ final Map <String , dynamic >? unknown;
58+
5459 const DebugImage ({
5560 required this .type,
5661 this .name,
@@ -65,6 +70,7 @@ class DebugImage {
6570 this .codeId,
6671 this .cpuType,
6772 this .cpuSubtype,
73+ this .unknown,
6874 });
6975
7076 /// Deserializes a [DebugImage] from JSON [Map] .
@@ -83,12 +89,27 @@ class DebugImage {
8389 codeId: json['code_id' ],
8490 cpuType: json['cpu_type' ],
8591 cpuSubtype: json['cpu_subtype' ],
92+ unknown: unknownFrom (json, {
93+ 'type' ,
94+ 'name' ,
95+ 'image_addr' ,
96+ 'image_vmaddr' ,
97+ 'debug_id' ,
98+ 'debug_file' ,
99+ 'image_size' ,
100+ 'uuid' ,
101+ 'code_file' ,
102+ 'arch' ,
103+ 'code_id' ,
104+ 'cpu_type' ,
105+ 'cpu_subtype' ,
106+ }),
86107 );
87108 }
88109
89110 /// Produces a [Map] that can be serialized to JSON.
90111 Map <String , dynamic > toJson () {
91- return {
112+ final json = {
92113 'type' : type,
93114 if (uuid != null ) 'uuid' : uuid,
94115 if (debugId != null ) 'debug_id' : debugId,
@@ -103,6 +124,8 @@ class DebugImage {
103124 if (cpuType != null ) 'cpu_type' : cpuType,
104125 if (cpuSubtype != null ) 'cpu_subtype' : cpuSubtype,
105126 };
127+ json.addAll (unknown ?? {});
128+ return json;
106129 }
107130
108131 DebugImage copyWith ({
@@ -134,5 +157,6 @@ class DebugImage {
134157 codeId: codeId ?? this .codeId,
135158 cpuType: cpuType ?? this .cpuType,
136159 cpuSubtype: cpuSubtype ?? this .cpuSubtype,
160+ unknown: unknown,
137161 );
138162}
0 commit comments