aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-03-30 10:29:20 +0000
committergingerBill <bill@gingerbill.org>2024-03-30 10:29:20 +0000
commit4edcaa6124eac5e73359ff98239be6f447a42f47 (patch)
tree929b30f38815cac50ac5c3c5168aabe412a709e0
parentd84d65ba450efbd8d39469da868c973e355339f0 (diff)
Try storing a pointer to a fake metadata type in the debug info for a `map`
-rw-r--r--src/check_type.cpp10
-rw-r--r--src/llvm_backend_debug.cpp4
2 files changed, 6 insertions, 8 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 40a7ec947..2846aae86 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -2526,18 +2526,16 @@ gb_internal void init_map_internal_types(Type *type) {
gb_unused(type_size_of(metadata_type));
- // NOTE(bill): [0]^struct{key: Key, value: Value, hash: uintptr}
- // This is a zero array to a pointer to keep the alignment to that of a pointer, and not effective the size of the final struct
- metadata_type = alloc_type_array(alloc_type_pointer(metadata_type), 0);;
+ // NOTE(bill): ^struct{key: Key, value: Value, hash: uintptr}
+ metadata_type = alloc_type_pointer(metadata_type);
Scope *scope = create_scope(nullptr, nullptr);
Type *debug_type = alloc_type_struct();
- debug_type->Struct.fields = slice_make<Entity *>(permanent_allocator(), 4);
- debug_type->Struct.fields[0] = alloc_entity_field(scope, make_token_ident("data"), t_uintptr, false, 0, EntityState_Resolved);
+ debug_type->Struct.fields = slice_make<Entity *>(permanent_allocator(), 3);
+ debug_type->Struct.fields[0] = alloc_entity_field(scope, make_token_ident("data"), metadata_type, false, 0, EntityState_Resolved);
debug_type->Struct.fields[1] = alloc_entity_field(scope, make_token_ident("len"), t_int, false, 1, EntityState_Resolved);
debug_type->Struct.fields[2] = alloc_entity_field(scope, make_token_ident("allocator"), t_allocator, false, 2, EntityState_Resolved);
- debug_type->Struct.fields[3] = alloc_entity_field(scope, make_token_ident("__metadata"), metadata_type, false, 3, EntityState_Resolved);
debug_type->Struct.scope = scope;
debug_type->Struct.node = nullptr;
wait_signal_set(&debug_type->Struct.fields_wait_signal);
diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp
index 9ecacb4f4..048f5f933 100644
--- a/src/llvm_backend_debug.cpp
+++ b/src/llvm_backend_debug.cpp
@@ -748,8 +748,8 @@ gb_internal void lb_debug_complete_types(lbModule *m) {
case Type_Map:
GB_ASSERT(t_raw_map != nullptr);
- // bt = base_type(bt->Map.debug_metadata_type);
- bt = base_type(t_raw_map);
+ bt = base_type(bt->Map.debug_metadata_type);
+ // bt = base_type(t_raw_map);
GB_ASSERT(bt->kind == Type_Struct);
/*fallthrough*/
case Type_Struct: