xref: /freebsd/contrib/bmake/unit-tests/opt-debug-parse.mk (revision 148ee84570001f46b7b667c86573d378101c3801)
1*148ee845SSimon J. Gerraty# $NetBSD: opt-debug-parse.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
2956e45f6SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the -dp command line option, which adds debug logging about
4956e45f6SSimon J. Gerraty# makefile parsing.
5956e45f6SSimon J. Gerraty
69f45a3c8SSimon J. Gerraty.MAKEFLAGS: -dp
79f45a3c8SSimon J. Gerraty
8956e45f6SSimon J. Gerraty# TODO: Implementation
9956e45f6SSimon J. Gerraty
109f45a3c8SSimon J. Gerraty# Before parse.c 1.639 from 2022-01-08, PrintStackTrace and other diagnostics
119f45a3c8SSimon J. Gerraty# printed a wrong line number, using the last line before the loop body, while
129f45a3c8SSimon J. Gerraty# it should rather be the line number where the .for loop starts.
139f45a3c8SSimon J. Gerraty#
149f45a3c8SSimon J. Gerraty# Before parse.c 1.643 from 2022-01-08, PrintStackTrace tried to be too clever
159f45a3c8SSimon J. Gerraty# by merging stack trace entries, printing confusing line numbers as a result.
169f45a3c8SSimon J. Gerraty.for \
179f45a3c8SSimon J. Gerraty    var \
189f45a3c8SSimon J. Gerraty    in \
199f45a3c8SSimon J. Gerraty    value
20*148ee845SSimon J. Gerraty# expect+1: trace with multi-line .for loop head
219f45a3c8SSimon J. Gerraty.info trace with multi-line .for loop head
229f45a3c8SSimon J. Gerraty.endfor
239f45a3c8SSimon J. Gerraty
241d3f2ddcSSimon J. Gerraty# Before parse.c 1.641 from 2022-01-08, the debug log said it returned to
259f45a3c8SSimon J. Gerraty# the line of the '.include' instead of the line following it.
269f45a3c8SSimon J. Gerraty.include "/dev/null"
279f45a3c8SSimon J. Gerraty
289f45a3c8SSimon J. Gerraty
299f45a3c8SSimon J. Gerraty# In .for loops with multiple variables, the variable details are included in
309f45a3c8SSimon J. Gerraty# the stack trace, just as with a single variable.
319f45a3c8SSimon J. Gerraty.for a b c in 1 2 3 ${:U4 5 6}
32*148ee845SSimon J. Gerraty# expect+2: trace
33*148ee845SSimon J. Gerraty# expect+1: trace
349f45a3c8SSimon J. Gerraty.info trace
359f45a3c8SSimon J. Gerraty.endfor
369f45a3c8SSimon J. Gerraty
379f45a3c8SSimon J. Gerraty
389f45a3c8SSimon J. Gerraty.MAKEFLAGS: -d0
399f45a3c8SSimon J. Gerraty
409f45a3c8SSimon J. Gerratyall: .PHONY
41