Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ jobs:
- name: Run the benchmarks
uses: CodSpeedHQ/action@main
continue-on-error: ${{ matrix.valgrind != 'local' }}
env:
CODSPEED_PERF_ENABLED: false
Comment thread
not-matthias marked this conversation as resolved.
with:
working-directory: bench
mode: walltime
Expand Down
3 changes: 2 additions & 1 deletion callgrind/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ EXTRA_DIST = \
ann1.post.exp ann1.stderr.exp ann1.vgtest \
ann2.post.exp ann2.stderr.exp ann2.vgtest \
clreq.vgtest clreq.stderr.exp \
find_debuginfo.vgtest find_debuginfo.stderr.exp find_debuginfo.post.exp \
runtime_obj_skip_py.vgtest runtime_obj_skip_py.stderr.exp runtime_obj_skip_py.post.exp \
runtime_obj_skip_py.py runtime_obj_skip_py_shim.c \
bug497723.stderr.exp bug497723.post.exp bug497723.vgtest \
Expand All @@ -30,7 +31,7 @@ EXTRA_DIST = \
inline-crossfile.vgtest inline-crossfile.stderr.exp inline-crossfile.stdout.exp inline-crossfile.post.exp \
inline-crossfile-helper1.h inline-crossfile-helper2.h filter_inline

check_PROGRAMS = clreq simwork threads inline-samefile inline-crossfile
check_PROGRAMS = clreq find_debuginfo simwork threads inline-samefile inline-crossfile

AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
Expand Down
26 changes: 26 additions & 0 deletions callgrind/tests/find_debuginfo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Exercise VG_(find_DebugInfo) including the filename fallback for
executable code that lives outside the section named ".text".

Functions placed in orphan sections "warm_code" and "cold_code" end up
in their own ELF sections (PROGBITS, AX) inside the same R-E LOAD as
.text but *outside* di->text_avma/text_size. Calls into them force
VG_(find_DebugInfo) past the primary text-range check and into the
am_find_nsegment + filename match path added in commit 938e424b1. */

static int hot_fn(int x) { return x + 1; }

__attribute__((noinline, section("warm_code")))
static int warm_fn(int x) { return x * 3 + 7; }

__attribute__((noinline, section("cold_code")))
static int cold_fn(int x) { return x ^ 0x5a; }

int main(void)
{
int y = 0;
for (int i = 0; i < 1000; i++)
y = hot_fn(y);
y = warm_fn(y);
y = cold_fn(y);
return y & 0xff;
}
3 changes: 3 additions & 0 deletions callgrind/tests/find_debuginfo.post.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
find_debuginfo
ld-linux-x86-64.so.2
libc.so.6
6 changes: 6 additions & 0 deletions callgrind/tests/find_debuginfo.stderr.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


Events : Ir
Collected :

I refs:
4 changes: 4 additions & 0 deletions callgrind/tests/find_debuginfo.vgtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prog: find_debuginfo
vgopts: --compress-strings=no --callgrind-out-file=callgrind.out.find_debuginfo
post: sh -c 'sed -n "s|^ob=.*/||p" callgrind.out.find_debuginfo | grep -v "^vgpreload" | sort -u'
cleanup: rm -f callgrind.out.find_debuginfo
35 changes: 21 additions & 14 deletions coregrind/m_debuginfo/debuginfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,21 +2621,28 @@ DebugInfo* VG_(find_DebugInfo) ( DiEpoch ep, Addr a )
optimized binaries: .bolt.org.text + .text + .text.warm + .text.cold
live in two separate R-E PT_LOAD segments). The text-range check above
only covers the section named ".text", so addresses in the other
executable region are missed and end up attributed to "???". Ask the
address-space manager which file backs this address, and match it to
a DebugInfo by filename. */
executable region are missed and end up attributed to "???". Match
against the rx mappings recorded for each DebugInfo. find_rx_mapping
keeps a per-DI single-entry cache (last_rx_map) so the hot case is
O(1) after the first hit. */
if (eq_DiEpoch(ep, VG_(current_DiEpoch)())) {
const NSegment* seg = VG_(am_find_nsegment)(a);
const HChar* filename;
if (seg != NULL && (filename = VG_(am_get_filename)(seg)) != NULL) {
for (di = debugInfo_list; di != NULL; di = di->next) {
if (!is_DI_valid_for_epoch(di, ep))
continue;
if (di->fsm.filename != NULL
&& 0 == VG_(strcmp)(di->fsm.filename, filename)) {
return di;
}
}
for (di = debugInfo_list; di != NULL; di = di->next) {
if (!is_DI_valid_for_epoch(di, ep))
continue;

const DebugInfoMapping* map = ML_(find_rx_mapping)(di, a, a);
if (map == NULL)
continue;

if (VG_(clo_verbosity) >= 2) {
VG_(message)(Vg_DebugMsg,
"find_DebugInfo: rx-mapping fallback matched 0x%lx -> "
"DI %p (%s) [avma=0x%lx size=%lu]\n",
a, di,
di->fsm.filename ? di->fsm.filename : "(no filename)",
map->avma, map->size);
}
return di;
}
}
return NULL;
Expand Down
Loading