From 3895d175803bb0f2e0d858c44895ebd814052198 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:25:49 +0000 Subject: [PATCH] The places, and the line table in them, are made whatever Rt declares: a kernel keeps its lines for gdb --- diff --git a/doc/compiler.md b/doc/compiler.md index e27bf09..6a2ca69 100644 --- a/doc/compiler.md +++ b/doc/compiler.md @@ -2340,8 +2340,9 @@ one of them alone stops the compiler with "Rt has calls but no teller", naming the other. `-s` leaves all of them out, and the ELF's symbols and line numbers with them. Without `-s`, an `Rt` that declares none still -has its symbols in the ELF (what a debugger reads), but no line table, which -lives in the places table. A failed check in such a program is told by +has its symbols and line numbers in the ELF, what a debugger reads: the +places table, which holds the line table, is made whatever `Rt` declares, +and only its address is left out. A failed check in such a program is told by its address: `fail` is given `at`, an address inside the code, and it is for `Rt` to print it, or look it up in the symbols. A hosted program's `Rt` is raz's, which declares them all, so its output is as before. diff --git a/src/Link.raz b/src/Link.raz index 5e0630c..38170d7 100644 --- a/src/Link.raz +++ b/src/Link.raz @@ -77,6 +77,9 @@ end; end; end; + (* the places hold the line table a debugger reads, so they are made + even when Rt takes no address of them, a kernel's Rt with no places *) + if (placesChunk >= 0) and not Chunk.chunks[placesChunk].live then Chunk.setLive(placesChunk); end; end; (* Gives the live chunks of one section their places, from start; diff --git a/src/Raz.raz b/src/Raz.raz index 5353653..258aaa6 100644 --- a/src/Raz.raz +++ b/src/Raz.raz @@ -193,19 +193,19 @@ end; (* What Rt is given for telling where a failed check was, as far as it - declares it. The places table (and the line table in it) is made only - if Rt has `places`, a variable for its address; Rt's calls, place and + declares it. The places table, which holds the line table a debugger + reads, is always made (Link.markLive keeps it); Rt is given its + address only if it has `places`, a variable for it. Rt's calls, place and startProfile are linked to the variables teller, placer and profiler (profiled: unless -noprofile or -bare). An Rt that declares none of these, a kernel's, gets a failed check with only the raw address of - the failing call, as with -s, and still has the ELF's symbols. *) + the failing call, as with -s, and still has the ELF's symbols and + lines. *) proc giveRtPlaces(rt: ^Sym.Module; profiled: BOOL); begin - if declares(rt, "places") then - Link.setPlaces(Chunk.newChunk(Chunk.secRodata, -1, -1)); - Chunk.setData(Link.placesChunk, nil, 0, 8); - addLink(Link.placesChunk, objIn(rt, "places")); - end; + Link.setPlaces(Chunk.newChunk(Chunk.secRodata, -1, -1)); + Chunk.setData(Link.placesChunk, nil, 0, 8); + if declares(rt, "places") then addLink(Link.placesChunk, objIn(rt, "places")); end; addPair(rt, "calls", "teller"); addPair(rt, "place", "placer"); if profiled then addPair(rt, "startProfile", "profiler"); end; diff --git a/test/check.sh b/test/check.sh index d418989..26ca377 100755 --- a/test/check.sh +++ b/test/check.sh @@ -165,7 +165,7 @@ statusFail=$( { ( exec $out/own/OwnFail ) > $out/own/OwnFail.out 2>&1; echo $?; } 2>/dev/null ) if [ $status = 3 ] && [ $statusFail = 2 ] && [ "$(cat $out/own/Own.out)" = hello ] \ && [ "$(cat $out/own/OwnFail.out)" = 'check failed: 0' ] \ - && readelf -s $out/own/Own | grep -q ' Own.main$'; then pass=$((pass + 1)) + && readelf -s $out/own/Own | grep -q ' Own.main$' && readelf --debug-dump=decodedline $out/own/Own | grep -q 'Own.raz'; then pass=$((pass + 1)) else echo "FAIL own Rt: status $status, $statusFail"; cat $out/own/Own.out $out/own/OwnFail.out; fail=$((fail + 1)); fi # what src/ asks of lib/ is what doc/compiler.md lists (test/asks.sh)