From c291fffce1972fcfc631dd4c6f623e3f5055f74b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 12 Feb 2024 12:29:37 +0000 Subject: Add metadata type to `map`s debug information to aid debuggers knowing what is in it it --- src/llvm_backend_debug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/llvm_backend_debug.cpp') diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index e053c5b40..894c60729 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -710,7 +710,7 @@ gb_internal void lb_debug_complete_types(lbModule *m) { case Type_Map: GB_ASSERT(t_raw_map != nullptr); - bt = base_type(t_raw_map); + bt = base_type(t->Map.debug_metadata_type); /*fallthrough*/ case Type_Struct: if (file == nullptr) { -- cgit v1.2.3 From 5cd57a3a7f96e4966a7a17f99363893911fbad0d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 13 Feb 2024 15:50:07 +0000 Subject: Use `Raw_Map` as the debug information for a `map` --- src/check_type.cpp | 2 ++ src/llvm_backend_debug.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/llvm_backend_debug.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 01bb36255..03c7474fb 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2307,6 +2307,7 @@ gb_internal void init_map_internal_types(Type *type) { metadata_type->Struct.fields[3] = alloc_entity_field(metadata_scope, make_token_ident("key_cell"), key_cell, false, 3, EntityState_Resolved); metadata_type->Struct.fields[4] = alloc_entity_field(metadata_scope, make_token_ident("value_cell"), value_cell, false, 4, EntityState_Resolved); metadata_type->Struct.scope = metadata_scope; + metadata_type->Struct.node = nullptr; gb_unused(type_size_of(metadata_type)); @@ -2323,6 +2324,7 @@ gb_internal void init_map_internal_types(Type *type) { 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; gb_unused(type_size_of(debug_type)); diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index 894c60729..6bcbac13f 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -710,7 +710,9 @@ gb_internal void lb_debug_complete_types(lbModule *m) { case Type_Map: GB_ASSERT(t_raw_map != nullptr); - bt = base_type(t->Map.debug_metadata_type); + // bt = base_type(t->Map.debug_metadata_type); + bt = base_type(t_raw_map); + GB_ASSERT(bt->kind == Type_Struct); /*fallthrough*/ case Type_Struct: if (file == nullptr) { -- cgit v1.2.3 From 912c326d8b05dba282a9a58e2405b09f774dbe34 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 13 Feb 2024 17:06:04 +0000 Subject: Fix typo that causes map info debug issues --- src/llvm_backend_debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/llvm_backend_debug.cpp') diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index 6bcbac13f..f45cf0cbc 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -710,8 +710,8 @@ gb_internal void lb_debug_complete_types(lbModule *m) { case Type_Map: GB_ASSERT(t_raw_map != nullptr); - // bt = base_type(t->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: -- cgit v1.2.3