aboutsummaryrefslogtreecommitdiff
path: root/sim/common/local.mk
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2023-12-19 20:04:34 -0500
committerMike Frysinger <vapier@gentoo.org>2023-12-21 20:16:26 -0500
commitc0e97c852595b9516d54688643c08918a446f36c (patch)
tree3cca7534f3ba674f35d97439f6543c7647cc6571 /sim/common/local.mk
parent10df3b929c72245bf363c11d6236637b4dc43cbc (diff)
downloadgdb-c0e97c852595b9516d54688643c08918a446f36c.zip
gdb-c0e97c852595b9516d54688643c08918a446f36c.tar.gz
gdb-c0e97c852595b9516d54688643c08918a446f36c.tar.bz2
sim: common: add $LINENO rewriting support to genmloop scripts
The generated mloop files can trigger compile time warnings. It can be difficult to see/understand where the original code is coming from as all the diagnostics point to the generated output. Using #line pragmas, we can point people to the original source files. Unfortunately, this code is written in POSIX shell, and that lacks support for line number tracking. The $LINENO variable, even when available, can just be plain wrong. For example, when using dash and subshells, $LINENO can end up having negative values. Add a wrapper script that will uses awk to rewrite the $LINENO variable to the right value to avoid all that. Basically lineno.sh takes an input script, rewrites all uses of $LINENO into the actual line number (and $0 into the original file name), and then executes the temporary script. This commit doesn't actually add #line pragmas to any files. That comes next.
Diffstat (limited to 'sim/common/local.mk')
-rw-r--r--sim/common/local.mk6
1 files changed, 4 insertions, 2 deletions
diff --git a/sim/common/local.mk b/sim/common/local.mk
index 8124910..6414ad1 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -234,6 +234,8 @@ CGEN_GEN_CPU_DESC = \
$(CGEN_ARCHFILE) ignored $$opcfile
CGEN_GEN_MLOOP = \
- $(SHELL) $(srccom)/genmloop.sh \
- -shell $(SHELL) \
+ $(SHELL) $(srccom)/lineno.sh \
+ $(srccom)/genmloop.sh \
+ $@.lineno.sh \
+ -shell $(SHELL) -awk $(AWK) -lineno $(srccom)/lineno.sh \
-infile $< -outfile-prefix $(@D)/