mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix issue with complication of -debug that is caused sometimes due to lambda procedures.
This commit is contained in:
+7
-3
@@ -958,11 +958,15 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
|||||||
|
|
||||||
if hash do write_byte(fi.buf, '\n');
|
if hash do write_byte(fi.buf, '\n');
|
||||||
|
|
||||||
for _, i in b.names {
|
field_count := -1;
|
||||||
if !hash && i > 0 do write_string(fi.buf, ", ");
|
for name, i in b.names {
|
||||||
|
// if len(name) > 0 && name[0] == '_' do continue;
|
||||||
|
field_count += 1;
|
||||||
|
|
||||||
|
if !hash && field_count > 0 do write_string(fi.buf, ", ");
|
||||||
if hash do for in 0..fi.indent-1 do write_byte(fi.buf, '\t');
|
if hash do for in 0..fi.indent-1 do write_byte(fi.buf, '\t');
|
||||||
|
|
||||||
write_string(fi.buf, b.names[i]);
|
write_string(fi.buf, name);
|
||||||
write_string(fi.buf, " = ");
|
write_string(fi.buf, " = ");
|
||||||
|
|
||||||
if t := b.types[i]; types.is_any(t) {
|
if t := b.types[i]; types.is_any(t) {
|
||||||
|
|||||||
+10
-5
@@ -2116,6 +2116,9 @@ irDebugInfo *ir_add_debug_info_proc_type(irModule *module, Type *type) {
|
|||||||
// gb_max(result_count, 1) because llvm expects explicit "null" return type
|
// gb_max(result_count, 1) because llvm expects explicit "null" return type
|
||||||
di->ProcType.types = ir_add_debug_info_array(module, 0, gb_max(result_count, 1) + param_count);
|
di->ProcType.types = ir_add_debug_info_array(module, 0, gb_max(result_count, 1) + param_count);
|
||||||
|
|
||||||
|
// TODO(bill): Is this even correct?!
|
||||||
|
irDebugInfo *scope = di;
|
||||||
|
|
||||||
// Result/return types
|
// Result/return types
|
||||||
if (result_count >= 1) {
|
if (result_count >= 1) {
|
||||||
TypeTuple *results_tuple = &type->Proc.results->Tuple;
|
TypeTuple *results_tuple = &type->Proc.results->Tuple;
|
||||||
@@ -2125,7 +2128,7 @@ irDebugInfo *ir_add_debug_info_proc_type(irModule *module, Type *type) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
irDebugInfo *type_di = ir_add_debug_info_type(module, e->type, e, nullptr, nullptr);
|
irDebugInfo *type_di = ir_add_debug_info_type(module, e->type, e, scope, nullptr);
|
||||||
GB_ASSERT_NOT_NULL(type_di);
|
GB_ASSERT_NOT_NULL(type_di);
|
||||||
array_add(&di->ProcType.types->DebugInfoArray.elements, type_di);
|
array_add(&di->ProcType.types->DebugInfoArray.elements, type_di);
|
||||||
}
|
}
|
||||||
@@ -2143,7 +2146,7 @@ irDebugInfo *ir_add_debug_info_proc_type(irModule *module, Type *type) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
irDebugInfo *type_di = ir_add_debug_info_type(module, e->type, e, nullptr, nullptr);
|
irDebugInfo *type_di = ir_add_debug_info_type(module, e->type, e, scope, nullptr);
|
||||||
GB_ASSERT_NOT_NULL(type_di);
|
GB_ASSERT_NOT_NULL(type_di);
|
||||||
array_add(&di->ProcType.types->DebugInfoArray.elements, type_di);
|
array_add(&di->ProcType.types->DebugInfoArray.elements, type_di);
|
||||||
}
|
}
|
||||||
@@ -2490,7 +2493,7 @@ irDebugInfo *ir_add_debug_info_global(irModule *module, irValue *v) {
|
|||||||
// unique for the DIGlobalVariable's hash.
|
// unique for the DIGlobalVariable's hash.
|
||||||
map_set(&module->debug_info, hash_pointer(var_di), var_di);
|
map_set(&module->debug_info, hash_pointer(var_di), var_di);
|
||||||
|
|
||||||
var_di->GlobalVariable.type = ir_add_debug_info_type(module, e->type, nullptr, nullptr, nullptr);
|
var_di->GlobalVariable.type = ir_add_debug_info_type(module, e->type, nullptr, scope, nullptr);
|
||||||
GB_ASSERT_NOT_NULL(var_di->GlobalVariable.type);
|
GB_ASSERT_NOT_NULL(var_di->GlobalVariable.type);
|
||||||
|
|
||||||
di->GlobalVariableExpression.var = var_di;
|
di->GlobalVariableExpression.var = var_di;
|
||||||
@@ -2657,9 +2660,11 @@ void ir_value_set_debug_location(irProcedure *proc, irValue *v) {
|
|||||||
irModule *m = proc->module;
|
irModule *m = proc->module;
|
||||||
GB_ASSERT(m->debug_location_stack.count > 0);
|
GB_ASSERT(m->debug_location_stack.count > 0);
|
||||||
v->loc = *array_end_ptr(&m->debug_location_stack);
|
v->loc = *array_end_ptr(&m->debug_location_stack);
|
||||||
if (v->loc == nullptr) {
|
|
||||||
|
if (v->loc == nullptr && proc->entity != nullptr) {
|
||||||
// NOTE(lachsinc): Entry point (main()) and runtime_startup are the only ones where null location is considered valid.
|
// NOTE(lachsinc): Entry point (main()) and runtime_startup are the only ones where null location is considered valid.
|
||||||
GB_ASSERT(proc->is_entry_point || (string_compare(proc->name, str_lit(IR_STARTUP_RUNTIME_PROC_NAME)) == 0));
|
GB_ASSERT_MSG(proc->is_entry_point || (string_compare(proc->name, str_lit(IR_STARTUP_RUNTIME_PROC_NAME)) == 0),
|
||||||
|
"%.*s %p", LIT(proc->name), proc->entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -227,7 +227,9 @@ bool ir_print_debug_location(irFileBuffer *f, irModule *m, irValue *v) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
irProcedure *proc = v->Instr.block->proc;
|
irProcedure *proc = v->Instr.block->proc;
|
||||||
GB_ASSERT(proc->is_entry_point || (string_compare(proc->name, str_lit(IR_STARTUP_RUNTIME_PROC_NAME)) == 0));
|
if (proc->entity != nullptr) {
|
||||||
|
GB_ASSERT(proc->is_entry_point || (string_compare(proc->name, str_lit(IR_STARTUP_RUNTIME_PROC_NAME)) == 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user