mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 00:44:27 +00:00
-g: debug info, in the compiler written in Finch
DWARF as LLVM metadata: a compile unit, a subprogram per function, a location on every call, a variable for each local and parameter with types a debugger can open (structs with their fields, arrays and text as ptr/len/cap, maps, enums with their variants, pointers, fixed arrays). Methods show self. Use it with -O0, as the docs say: the optimizer inlines the program into main, which has no debug info. boot.sh builds ten programs with -g -O0 and checks they still behave. 51 passed.
This commit is contained in:
parent
dd9cbe7611
commit
8c3b5b15b9
3 changed files with 341 additions and 10 deletions
|
|
@ -60,6 +60,20 @@ for f in tests/new/fail/*.fch; do
|
|||
echo "$got" | head -3
|
||||
fi
|
||||
done
|
||||
# the same programs with debug info (-g -O0): the metadata has to be valid for every kind of thing a program has
|
||||
for f in tests/new/enums.fch tests/new/generics.fch tests/new/std_json.fch tests/run/basics.fch tests/run/methods_basic.fch \
|
||||
tests/run/maps.fch tests/run/errors.fch tests/run/defer.fch tests/run/c_structs.fch tests/run/memory.fch; do
|
||||
input="${f%.fch}.in"
|
||||
[ -f "$input" ] || input=/dev/null
|
||||
if "$boot" build "$f" -g -O0 -o "$tmp/progg" > "$tmp/err" 2>&1 && [ "$("$tmp/progg" < "$input" 2>&1)" == "$(cat "${f%.fch}.out")" ]; then
|
||||
pass=$((pass + 1))
|
||||
else
|
||||
failed=$((failed + 1))
|
||||
echo "FAIL (-g) $f"
|
||||
head -3 "$tmp/err"
|
||||
fi
|
||||
done
|
||||
|
||||
# a library a C program loads (finch build --shared), with the compiler under test
|
||||
if FINCH_RT="$PWD/runtime/finch_rt.c" FINCH="$boot" tests/shared.sh > "$tmp/shared.out" 2>&1; then
|
||||
pass=$((pass + 1))
|
||||
|
|
|
|||
Loading…
Reference in a new issue