Skip to content

Commit fd99fc9

Browse files
committed
[temp] probe: ask the debugger where the call came from
1 parent 5679261 commit fd99fc9

1 file changed

Lines changed: 72 additions & 19 deletions

File tree

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
name: "[temp] probe: the Windows unit fault and the llvm payload's MinGW builtins"
1+
name: "[temp] probe: the Windows unit fault, under a debugger"
22

3-
# A measurement, not a check; this branch is not merged. main's unit tests fault
4-
# on Windows in PackCompress/AStatedLevelIsHonoured (an access violation at the
5-
# image base) since the llvm 23.1.3 payload gained
6-
# lib/clang/23/lib/{x86_64,aarch64}-w64-windows-gnu/libclang_rt.builtins.a
7-
# (revision 2, 2026-11-11); the code of main did not change between its last
8-
# green run and its first red one. Leg A runs the test as it is; leg B removes
9-
# the two directories from the installed payload and runs it again.
3+
# A measurement, not a check; this branch is not merged. A freshly built
4+
# compat.xz faults in PackCompress/AStatedLevelIsHonoured at the image base
5+
# (the passing runs took its objects from the global cache). This asks the
6+
# debugger where the call came from.
107
on:
118
push:
129
branches: [ probe/win-unit-av ]
@@ -18,23 +15,79 @@ jobs:
1815
steps:
1916
- uses: actions/checkout@v4
2017
- uses: ./.github/actions/bootstrap-mcpp
21-
- name: A — the payload as the index serves it
18+
- name: build the test and see it fail
2219
shell: bash
2320
continue-on-error: true
2421
run: |
2522
export MCPP_VENDORED_XLINGS=$(cygpath -w "$USERPROFILE/.xlings/subos/default/bin/xlings.exe")
2623
mcpp --version
27-
mcpp test test_pack_distribution 2>&1 | tail -25
28-
echo "A exit: ${PIPESTATUS[0]}"
29-
ls "$USERPROFILE/.mcpp/registry/data/xpkgs/xim-x-llvm/"*/lib/clang/*/lib/
30-
- name: B — without the MinGW builtins directories
24+
mcpp test test_pack_distribution 2>&1 | tail -12
25+
mcpp test test_pack_distribution --print-launch > launch.json 2> launch.err || true
26+
head -c 3000 launch.json
27+
- name: where the call came from
3128
shell: bash
3229
continue-on-error: true
3330
run: |
34-
export MCPP_VENDORED_XLINGS=$(cygpath -w "$USERPROFILE/.xlings/subos/default/bin/xlings.exe")
35-
for d in "$USERPROFILE/.mcpp/registry/data/xpkgs/xim-x-llvm/"*/lib/clang/*/lib/*-w64-windows-gnu; do
36-
echo "removing $d"; rm -rf "$d"
31+
exe=$(find target -name unit.exe | head -1)
32+
echo "exe=$exe"; ls -la "$(dirname "$exe")" | head -20
33+
cdb=""
34+
for c in "/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/cdb.exe" "/c/Program Files/Windows Kits/10/Debuggers/x64/cdb.exe"; do
35+
[ -f "$c" ] && cdb="$c"
3736
done
38-
rm -rf target "$USERPROFILE/.mcpp/build-cache" "$USERPROFILE/.mcpp/bmi-cache" 2>/dev/null || true
39-
mcpp test test_pack_distribution 2>&1 | tail -25
40-
echo "B exit: ${PIPESTATUS[0]}"
37+
echo "cdb=$cdb"
38+
python - "$exe" <<'PY' > run.txt
39+
import json, sys
40+
text = open("launch.json", encoding="utf-8", errors="replace").read()
41+
start = text.find("{")
42+
argv = []
43+
try:
44+
d = json.JSONDecoder().raw_decode(text[start:])[0]
45+
def walk(o):
46+
if isinstance(o, dict):
47+
for k, v in o.items():
48+
if k in ("argv", "args", "command") and isinstance(v, list) and all(isinstance(x, str) for x in v):
49+
argv.append((k, v))
50+
walk(v)
51+
elif isinstance(o, list):
52+
for v in o: walk(v)
53+
walk(d)
54+
except Exception as e:
55+
print("#", e)
56+
for k, v in argv: print(k, json.dumps(v))
57+
PY
58+
cat run.txt
59+
cat > cdb.txt <<'CDB'
60+
sxe -c ".echo ==AV==; r; .echo ==STACK==; kn 40; .echo ==CALLER==; ub poi(@rsp) L12; .echo ==AFTER==; u poi(@rsp) L3; .echo ==MODULES==; lm; q" av
61+
g
62+
q
63+
CDB
64+
sed -i 's/^ //' cdb.txt
65+
args=$(python - <<'PY'
66+
import json
67+
for line in open("run.txt"):
68+
if line.startswith(("argv ", "args ")):
69+
v = json.loads(line.split(" ", 1)[1])
70+
print(" ".join(a for a in v if not a.lower().endswith("unit.exe")))
71+
break
72+
PY
73+
)
74+
echo "args=$args"
75+
if [ -n "$cdb" ]; then
76+
"$cdb" -cf cdb.txt "$(cygpath -w "$exe")" $args 2>&1 | tail -120
77+
else
78+
echo "no cdb on this image"
79+
fi
80+
- name: the bytes around the caller, and what the objects leave undefined
81+
shell: bash
82+
continue-on-error: true
83+
run: |
84+
llvm="$USERPROFILE/.mcpp/registry/data/xpkgs/xim-x-llvm/23.1.3/bin"
85+
exe=$(find target -name unit.exe | head -1)
86+
"$llvm/llvm-readobj.exe" --file-headers "$exe" | grep -i -E 'ImageBase|AddressOfEntryPoint|Characteristics' | head
87+
# Symbols the xz objects reference and no object of the build defines.
88+
find target -name '*.o' -o -name '*.obj' | grep -i -E 'xz|lzma' | head -3
89+
xz=$(find target "$USERPROFILE/.mcpp" -type f \( -name '*.o' -o -name '*.obj' -o -name '*.a' -o -name '*.lib' \) 2>/dev/null | grep -i -E 'compat.xz|compat_xz|liblzma' | head -200)
90+
echo "$xz" | head -5; echo "$xz" | wc -l
91+
[ -z "$xz" ] || "$llvm/llvm-nm.exe" --undefined-only $xz 2>/dev/null | awk '{print $NF}' | sort -u > undef.txt
92+
[ -z "$xz" ] || "$llvm/llvm-nm.exe" --defined-only $xz 2>/dev/null | awk '{print $NF}' | sort -u > def.txt
93+
comm -23 undef.txt def.txt | head -80

0 commit comments

Comments
 (0)