improve unresolved symbols diagnostic

* show referenced by function
* show inline site that references unresolved symbol instead of the top function
This commit is contained in:
Nikita Smith authored and Ryan Fleury committed 2026-08-21 10:56:14 -07:00
1 parent 4eae2a2ecc
commit 2abbae4d90
10 files changed
+724 -122

No files matched your search

+14 -40
View File
@@ -1452,6 +1452,7 @@ cv_c13_lines_from_sub_sections(Arena *arena, String8 c13_data, Rng1U64 ss_range)
String8 sub_sect_data = str8_substr(c13_data, ss_range);
for (U64 cursor = 0; cursor + sizeof(CV_C13SubSecLinesHeader) <= sub_sect_data.size; ) {
U64 header_off = cursor;
CV_C13SubSecLinesHeader *hdr = (CV_C13SubSecLinesHeader *)(sub_sect_data.str + cursor);
cursor += sizeof(*hdr);
@@ -1486,6 +1487,7 @@ cv_c13_lines_from_sub_sections(Arena *arena, String8 c13_data, Rng1U64 ss_range)
lines_parsed_node->next = 0;
CV_C13LinesHeader *lines_parsed = &lines_parsed_node->v;
lines_parsed->header_off = ss_range.min + header_off;
lines_parsed->sec_idx = hdr->sec;
lines_parsed->sec_off_lo = hdr->sec_off;
lines_parsed->sec_off_hi = hdr->sec_off + hdr->len;
@@ -1633,6 +1635,12 @@ cv_c13_voff_map_compar(const void *raw_a, const void *raw_b)
return cmp;
}
force_inline int
cv_c13_voff_map_is_before(void *raw_a, void *raw_b)
{
return cv_c13_voff_map_compar(raw_a, raw_b) < 0;
}
internal CV_LinesAccel *
cv_c13_make_lines_accel(Arena *arena, U64 lines_count, CV_LineArray *lines)
{
@@ -1676,56 +1684,22 @@ cv_c13_make_lines_accel(Arena *arena, U64 lines_count, CV_LineArray *lines)
return accel;
}
internal CV_LinesAccel *
cv_lines_accel_from_debug_s(Arena *arena, CV_DebugS debug_s)
{
// parse $$LINES
U64 c13_lines_count = 0;
CV_LineArray *c13_lines = 0;
{
String8List raw_lines_list = cv_sub_section_from_debug_s(debug_s, CV_C13SubSectionKind_Lines);
for (String8Node *raw_lines_node = raw_lines_list.first; raw_lines_node != 0; raw_lines_node = raw_lines_node->next) {
Temp temp = temp_begin(arena);
CV_C13LinesHeaderList parsed_list = cv_c13_lines_from_sub_sections(temp.arena, raw_lines_node->string, rng_1u64(0, raw_lines_node->string.size));
c13_lines_count += parsed_list.count;
temp_end(temp);
}
c13_lines = push_array_no_zero(arena, CV_LineArray, c13_lines_count);
U64 c13_lines_idx = 0;
for (String8Node *raw_lines_node = raw_lines_list.first; raw_lines_node != 0; raw_lines_node = raw_lines_node->next) {
String8 raw_lines = raw_lines_node->string;
CV_C13LinesHeaderList parsed_list = cv_c13_lines_from_sub_sections(arena, raw_lines, rng_1u64(0, raw_lines.size));
for(CV_C13LinesHeaderNode *header_node = parsed_list.first; header_node != 0; header_node = header_node->next) {
c13_lines[c13_lines_idx++] = cv_c13_line_array_from_data(arena, raw_lines, 0, header_node->v);
}
}
}
return cv_c13_make_lines_accel(arena, c13_lines_count, c13_lines);
}
internal U64
cv_nearest_line(CV_Line *arr, U64 count, U64 value)
{
if(count > 1 && arr[0].voff <= value && value < arr[count-1].voff)
{
U64 l = 0;
U64 r = count - 1;
for (; l <= r; ) {
U64 r = count;
for (; l < r; ) {
U64 m = l + (r - l) / 2;
if (arr[m].voff == value) {
return m;
} else if (arr[m].voff < value) {
if (arr[m].voff <= value) {
l = m + 1;
} else {
r = m - 1;
r = m;
}
}
return l;
return l - 1;
}
else if (count == 1 && arr[0].voff == value)
{
@@ -1754,7 +1728,7 @@ cv_line_from_voff(CV_LinesAccel *accel, U64 voff, U64 *out_line_count)
lines = accel->map + map_idx;
for(; map_idx < (accel->map_count-1); map_idx += 1) {
for(; map_idx < accel->map_count; map_idx += 1) {
if(accel->map[map_idx].voff != near_voff) {
break;
}