Skip to content

Commit 6617f4c

Browse files
committed
wip: compare ELF type and DWARF version, rust vs C
1 parent 0fbe6d5 commit 6617f4c

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,27 @@ jobs:
333333
- name: DIAGNOSE (temporary)
334334
if: runner.os == 'Linux'
335335
run: |
336-
echo "##### rust toy: where do the samples go?"
337-
COZ_DEBUG_SAMPLES=1 timeout 120 ./coz run -o /tmp/r.jsonl --- ./rust/target/release/examples/toy 2>&1 | grep coz-dbg || echo " (no coz-dbg line)"
338-
339-
echo "##### C toy, same instrumentation, for comparison"
340336
g++ -g -O2 -c benchmarks/toy/toy.cpp -Iinclude -o /tmp/t.o
341337
g++ -g /tmp/t.o -o /tmp/ctoy -ldl -lpthread
342-
COZ_DEBUG_SAMPLES=1 timeout 120 ./coz run -o /tmp/c.jsonl --- /tmp/ctoy 2>&1 | grep coz-dbg || echo " (no coz-dbg line)"
338+
RTOY=./rust/target/release/examples/toy
339+
340+
echo "##### ELF type (EXEC = non-PIE, DYN = PIE)"
341+
echo -n " rust toy: "; readelf -h $RTOY | awk '/Type:/{print $2, $3}'
342+
echo -n " C toy: "; readelf -h /tmp/ctoy | awk '/Type:/{print $2, $3}'
343+
344+
echo "##### DWARF version of the first CU"
345+
echo -n " rust toy: "; readelf --debug-dump=info $RTOY 2>/dev/null | grep -m1 -i 'Version:' | tr -s ' '
346+
echo -n " C toy: "; readelf --debug-dump=info /tmp/ctoy 2>/dev/null | grep -m1 -i 'Version:' | tr -s ' '
347+
348+
echo "##### rustc"
349+
rustc --version; rustc --print cfg 2>/dev/null | grep -i relocation || true
350+
351+
echo "##### DWARF sections present in the rust toy"
352+
readelf -SW $RTOY | awk '$2 ~ /debug/ {print " ", $2, $6}' | head -10
343353
344-
echo "##### is toy.rs actually in scope?"
345-
timeout 30 ./coz run --verbose -o /tmp/v.jsonl --- /bin/true 2>&1 | head -2 || true
346-
timeout 60 ./coz run --verbose -o /tmp/v2.jsonl --- ./rust/target/release/examples/toy 2>/tmp/v2.txt >/dev/null || true
347-
grep -a 'Included source file' /tmp/v2.txt | grep -aE 'toy.rs|rust/src/lib.rs' | sed 's/^/ /' || echo " toy.rs NOT in scope"
354+
echo "##### sample/match counters"
355+
COZ_DEBUG_SAMPLES=1 timeout 100 ./coz run -o /tmp/r.jsonl --- $RTOY 2>&1 | grep coz-dbg | sed 's/^/ rust: /' || true
356+
COZ_DEBUG_SAMPLES=1 timeout 100 ./coz run -o /tmp/c.jsonl --- /tmp/ctoy 2>&1 | grep coz-dbg | sed 's/^/ C: /' || true
348357
349358
- name: Profile the Rust toy under coz
350359
run: |

0 commit comments

Comments
 (0)