|
48 | 48 | TYPE_KIND_REGULAR_UNION = 17
|
49 | 49 | TYPE_KIND_OS_STRING = 18
|
50 | 50 | TYPE_KIND_STD_VECDEQUE = 19
|
| 51 | +TYPE_KIND_STD_BTREESET = 20 |
51 | 52 |
|
52 | 53 | ENCODED_ENUM_PREFIX = "RUST$ENCODED$ENUM$"
|
53 | 54 | ENUM_DISR_FIELD_NAME = "RUST$ENUM$DISR"
|
|
71 | 72 | STD_VECDEQUE_FIELD_NAME_HEAD,
|
72 | 73 | STD_VECDEQUE_FIELD_NAME_BUF]
|
73 | 74 |
|
| 75 | +# std::collections::BTreeSet<> related constants |
| 76 | +STD_BTREESET_FIELD_NAMES = ["map"] |
| 77 | + |
74 | 78 | # std::String related constants
|
75 | 79 | STD_STRING_FIELD_NAMES = ["vec"]
|
76 | 80 |
|
@@ -175,6 +179,11 @@ def __classify_struct(self):
|
175 | 179 | self.__conforms_to_field_layout(STD_VECDEQUE_FIELD_NAMES)):
|
176 | 180 | return TYPE_KIND_STD_VECDEQUE
|
177 | 181 |
|
| 182 | + # STD COLLECTION BTREESET |
| 183 | + if (unqualified_type_name.startswith("BTreeSet<") and |
| 184 | + self.__conforms_to_field_layout(STD_BTREESET_FIELD_NAMES)): |
| 185 | + return TYPE_KIND_STD_BTREESET |
| 186 | + |
178 | 187 | # STD STRING
|
179 | 188 | if (unqualified_type_name.startswith("String") and
|
180 | 189 | self.__conforms_to_field_layout(STD_STRING_FIELD_NAMES)):
|
@@ -358,6 +367,19 @@ def extract_tail_head_ptr_and_cap_from_std_vecdeque(vec_val):
|
358 | 367 | return (tail, head, data_ptr, capacity)
|
359 | 368 |
|
360 | 369 |
|
| 370 | +def extract_length_and_ptr_from_std_btreeset(vec_val): |
| 371 | + assert vec_val.type.get_type_kind() == TYPE_KIND_STD_BTREESET |
| 372 | + map = vec_val.get_child_at_index(0) |
| 373 | + root = map.get_child_at_index(0) |
| 374 | + length = map.get_child_at_index(1).as_integer() |
| 375 | + node = root.get_child_at_index(0) |
| 376 | + ptr = node.get_child_at_index(0) |
| 377 | + unique_ptr_val = ptr.get_child_at_index(0) |
| 378 | + data_ptr = unique_ptr_val.get_child_at_index(0) |
| 379 | + assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR |
| 380 | + return (length, data_ptr) |
| 381 | + |
| 382 | + |
361 | 383 | def extract_length_and_ptr_from_slice(slice_val):
|
362 | 384 | assert (slice_val.type.get_type_kind() == TYPE_KIND_SLICE or
|
363 | 385 | slice_val.type.get_type_kind() == TYPE_KIND_STR_SLICE)
|
|
0 commit comments