Skip to content

Commit 938e424

Browse files
committed
fix(debuginfo): resolve addresses in additional R-E LOAD segments
VG_(find_DebugInfo) used only di->text_avma/text_size for address→DI lookup, which covers the section named ".text" — not the other executable sections (.text.warm, .text.cold, .bolt.org.text) that BOLT-optimized binaries place in a separate R-E PT_LOAD segment. Addresses in that second segment fell through to ob=??? even though the address-space manager already knew they were backed by the same file. Fall back to VG_(am_find_nsegment) and match the segment's filename against debugInfo_list. Reproduced on cpython-3.14 standalone (uv's distribution): obj-skip now catches py_trampoline_evaluator, _PyFunction_Vectorcall.cold, and other functions that previously escaped via ob=???.
1 parent 022ccc3 commit 938e424

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

coregrind/m_debuginfo/debuginfo.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,27 @@ DebugInfo* VG_(find_DebugInfo) ( DiEpoch ep, Addr a )
26172617
return di;
26182618
}
26192619
}
2620+
/* Fallback for ELFs with multiple executable LOAD segments (e.g. BOLT-
2621+
optimized binaries: .bolt.org.text + .text + .text.warm + .text.cold
2622+
live in two separate R-E PT_LOAD segments). The text-range check above
2623+
only covers the section named ".text", so addresses in the other
2624+
executable region are missed and end up attributed to "???". Ask the
2625+
address-space manager which file backs this address, and match it to
2626+
a DebugInfo by filename. */
2627+
if (eq_DiEpoch(ep, VG_(current_DiEpoch)())) {
2628+
const NSegment* seg = VG_(am_find_nsegment)(a);
2629+
const HChar* filename;
2630+
if (seg != NULL && (filename = VG_(am_get_filename)(seg)) != NULL) {
2631+
for (di = debugInfo_list; di != NULL; di = di->next) {
2632+
if (!is_DI_valid_for_epoch(di, ep))
2633+
continue;
2634+
if (di->fsm.filename != NULL
2635+
&& 0 == VG_(strcmp)(di->fsm.filename, filename)) {
2636+
return di;
2637+
}
2638+
}
2639+
}
2640+
}
26202641
return NULL;
26212642
}
26222643

0 commit comments

Comments
 (0)