raz / commit 3895d175

commit
3895d175803bb0f2e0d858c44895ebd814052198
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
26da1860
The places, and the line table in them, are made whatever Rt declares: a kernel keeps its lines for gdb

patch · log

4 files changed, +15 -11

doc/compiler.md (history) modified +3 -2

@@ -2340,8 +2340,9 @@
23402340 one of them alone stops the compiler with "Rt has calls but no teller",
23412341 naming the other. `-s` leaves all of them out, and the ELF's symbols and
23422342 line numbers with them. Without `-s`, an `Rt` that declares none still
2343-has its symbols in the ELF (what a debugger reads), but no line table, which
2344-lives in the places table. A failed check in such a program is told by
2343+has its symbols and line numbers in the ELF, what a debugger reads: the
2344+places table, which holds the line table, is made whatever `Rt` declares,
2345+and only its address is left out. A failed check in such a program is told by
23452346 its address: `fail` is given `at`, an address inside the code, and it is
23462347 for `Rt` to print it, or look it up in the symbols. A hosted program's
23472348 `Rt` is raz's, which declares them all, so its output is as before.

src/Link.raz (history) modified +3 -0

@@ -77,6 +77,9 @@
7777 end;
7878 end;
7979 end;
80+ (* the places hold the line table a debugger reads, so they are made
81+ even when Rt takes no address of them, a kernel's Rt with no places *)
82+ if (placesChunk >= 0) and not Chunk.chunks[placesChunk].live then Chunk.setLive(placesChunk); end;
8083 end;
8184
8285 (* Gives the live chunks of one section their places, from start;

src/Raz.raz (history) modified +8 -8

@@ -193,19 +193,19 @@
193193 end;
194194
195195 (* What Rt is given for telling where a failed check was, as far as it
196- declares it. The places table (and the line table in it) is made only
197- if Rt has `places`, a variable for its address; Rt's calls, place and
196+ declares it. The places table, which holds the line table a debugger
197+ reads, is always made (Link.markLive keeps it); Rt is given its
198+ address only if it has `places`, a variable for it. Rt's calls, place and
198199 startProfile are linked to the variables teller, placer and profiler
199200 (profiled: unless -noprofile or -bare). An Rt that declares none of
200201 these, a kernel's, gets a failed check with only the raw address of
201- the failing call, as with -s, and still has the ELF's symbols. *)
202+ the failing call, as with -s, and still has the ELF's symbols and
203+ lines. *)
202204 proc giveRtPlaces(rt: ^Sym.Module; profiled: BOOL);
203205 begin
204- if declares(rt, "places") then
205- Link.setPlaces(Chunk.newChunk(Chunk.secRodata, -1, -1));
206- Chunk.setData(Link.placesChunk, nil, 0, 8);
207- addLink(Link.placesChunk, objIn(rt, "places"));
208- end;
206+ Link.setPlaces(Chunk.newChunk(Chunk.secRodata, -1, -1));
207+ Chunk.setData(Link.placesChunk, nil, 0, 8);
208+ if declares(rt, "places") then addLink(Link.placesChunk, objIn(rt, "places")); end;
209209 addPair(rt, "calls", "teller");
210210 addPair(rt, "place", "placer");
211211 if profiled then addPair(rt, "startProfile", "profiler"); end;

test/check.sh (history) modified +1 -1

@@ -165,7 +165,7 @@
165165 statusFail=$( { ( exec $out/own/OwnFail ) > $out/own/OwnFail.out 2>&1; echo $?; } 2>/dev/null )
166166 if [ $status = 3 ] && [ $statusFail = 2 ] && [ "$(cat $out/own/Own.out)" = hello ] \
167167 && [ "$(cat $out/own/OwnFail.out)" = 'check failed: 0' ] \
168- && readelf -s $out/own/Own | grep -q ' Own.main$'; then pass=$((pass + 1))
168+ && readelf -s $out/own/Own | grep -q ' Own.main$' && readelf --debug-dump=decodedline $out/own/Own | grep -q 'Own.raz'; then pass=$((pass + 1))
169169 else echo "FAIL own Rt: status $status, $statusFail"; cat $out/own/Own.out $out/own/OwnFail.out; fail=$((fail + 1)); fi
170170
171171 # what src/ asks of lib/ is what doc/compiler.md lists (test/asks.sh)