aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2023-12-19 20:13:22 -0500
committerMike Frysinger <vapier@gentoo.org>2023-12-21 20:16:26 -0500
commit6003fe166df2cd80030ae4a228ac105ae13f477e (patch)
tree9d50df58ef62f89ed1f1ad1b9326f10a8c07c333
parentc0e97c852595b9516d54688643c08918a446f36c (diff)
downloadgdb-6003fe166df2cd80030ae4a228ac105ae13f477e.zip
gdb-6003fe166df2cd80030ae4a228ac105ae13f477e.tar.gz
gdb-6003fe166df2cd80030ae4a228ac105ae13f477e.tar.bz2
sim: mloop: add #line pragmas everywhere
This will make compiler diagnostics much better with generated code so people can understand the original source file.
-rwxr-xr-xsim/common/genmloop.sh32
-rw-r--r--sim/cris/mloop.in5
-rw-r--r--sim/frv/mloop.in4
-rw-r--r--sim/iq2000/mloop.in4
-rw-r--r--sim/lm32/mloop.in4
-rw-r--r--sim/m32r/mloop.in4
-rw-r--r--sim/m32r/mloop2.in3
-rw-r--r--sim/m32r/mloopx.in3
-rw-r--r--sim/or1k/mloop.in4
9 files changed, 63 insertions, 0 deletions
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index 007582e..765cce8 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -314,6 +314,7 @@ exec 1>${outprefix}tmp-mloop-$$.cin
# here.
cat << EOF
+#line $LINENO "$0"
/* This file is generated by the genmloop script. DO NOT EDIT! */
/* This must come before any other includes. */
@@ -410,6 +411,7 @@ load_infile_section support
if [ x$scache != xyes -a x$pbb != xyes ] ; then
cat << EOF
+#line $LINENO "$0"
#define FAST_P 0
@@ -429,6 +431,7 @@ EOF
case x$parallel in
xread | xwrite)
cat << EOF
+#line $LINENO "$0"
PAREXEC pbufs[MAX_PARALLEL_INSNS];
PAREXEC *par_exec;
@@ -442,6 +445,7 @@ load_infile_section init
if [ x$parallel = xread ] ; then
cat << EOF
+#line $LINENO "$0"
#if defined (__GNUC__)
{
@@ -459,6 +463,7 @@ EOF
fi
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -482,6 +487,7 @@ EOF
load_infile_section full-exec-simple
cat << EOF
+#line $LINENO "$0"
/* end full-exec-simple */
++ CPU_INSN_COUNT (current_cpu);
@@ -501,6 +507,7 @@ EOF
if [ x$fast = xyes ] ; then
cat << EOF
+#line $LINENO "$0"
#define FAST_P 1
@@ -522,6 +529,7 @@ fi # simple engine
if [ x$scache = xyes -a x$parallel = xno ] ; then
cat << EOF
+#line $LINENO "$0"
static INLINE SCACHE *
@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
@@ -543,6 +551,7 @@ EOF
load_infile_section extract-scache
cat << EOF
+#line $LINENO "$0"
/* end extract-scache */
}
else if (! FAST_P)
@@ -573,6 +582,7 @@ EOF
load_infile_section init
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -596,6 +606,7 @@ EOF
load_infile_section full-exec-scache
cat << EOF
+#line $LINENO "$0"
/* end full-exec-scache */
SET_H_PC (vpc);
@@ -616,6 +627,7 @@ EOF
if [ x$fast = xyes ] ; then
cat << EOF
+#line $LINENO "$0"
#define FAST_P 1
@@ -634,6 +646,7 @@ EOF
load_infile_section init
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -663,6 +676,7 @@ EOF
load_infile_section fast-exec-scache
cat << EOF
+#line $LINENO "$0"
/* end fast-exec-scache */
SET_H_PC (vpc);
@@ -689,6 +703,7 @@ fi # -scache && ! parallel
if [ x$scache = xyes -a x$parallel != xno ] ; then
cat << EOF
+#line $LINENO "$0"
static INLINE SCACHE *
@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
@@ -711,6 +726,7 @@ EOF
load_infile_section extract-scache
cat << EOF
+#line $LINENO "$0"
/* end extract-scache */
#undef SET_LAST_INSN_P
}
@@ -743,6 +759,7 @@ load_infile_section init
if [ x$parallel = xread ] ; then
cat << EOF
+#line $LINENO "$0"
#if defined (__GNUC__)
{
if (! CPU_IDESC_READ_INIT_P (current_cpu))
@@ -759,6 +776,7 @@ EOF
fi
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -778,6 +796,7 @@ EOF
load_infile_section full-exec-scache
cat << EOF
+#line $LINENO "$0"
/* end full-exec-scache */
}
while (0 /*CPU_RUNNING_P (current_cpu)*/);
@@ -794,6 +813,7 @@ EOF
if [ x$fast = xyes ] ; then
cat << EOF
+#line $LINENO "$0"
#define FAST_P 1
@@ -815,6 +835,7 @@ load_infile_section init
if [ x$parallel = xread ] ; then
cat << EOF
+#line $LINENO "$0"
#if defined (__GNUC__)
{
@@ -832,6 +853,7 @@ EOF
fi
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -857,6 +879,7 @@ EOF
load_infile_section fast-exec-scache
cat << EOF
+#line $LINENO "$0"
/* end fast-exec-scache */
}
while (0 /*CPU_RUNNING_P (current_cpu)*/);
@@ -881,6 +904,7 @@ fi # -scache && parallel
if [ x$pbb = xyes ] ; then
cat << EOF
+#line $LINENO "$0"
/* Record address of cti terminating a pbb. */
#define SET_CTI_VPC(sc) do { _cti_sc = (sc); } while (0)
@@ -964,6 +988,7 @@ EOF
load_infile_section extract-pbb
cat << EOF
+#line $LINENO "$0"
/* end extract-pbb */
/* The last one is a pseudo-insn to link to the next chain.
@@ -1185,6 +1210,7 @@ EOF
case x$parallel in
xread | xwrite)
cat << EOF
+#line $LINENO "$0"
PAREXEC pbufs[MAX_PARALLEL_INSNS];
PAREXEC *par_exec = &pbufs[0];
@@ -1197,6 +1223,7 @@ esac
load_infile_section init
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -1240,6 +1267,7 @@ EOF
load_infile_section full-exec-pbb
cat << EOF
+#line $LINENO "$0"
/* end full-exec-pbb */
}
while (CPU_RUNNING_P (current_cpu));
@@ -1256,6 +1284,7 @@ EOF
if [ x$fast = xyes ] ; then
cat << EOF
+#line $LINENO "$0"
#define FAST_P 1
@@ -1275,6 +1304,7 @@ EOF
case x$parallel in
xread | xwrite)
cat << EOF
+#line $LINENO "$0"
PAREXEC pbufs[MAX_PARALLEL_INSNS];
PAREXEC *par_exec = &pbufs[0];
@@ -1287,6 +1317,7 @@ esac
load_infile_section init
cat << EOF
+#line $LINENO "$0"
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
{
@@ -1330,6 +1361,7 @@ EOF
load_infile_section fast-exec-pbb
cat << EOF
+#line $LINENO "$0"
/* end fast-exec-pbb */
}
while (CPU_RUNNING_P (current_cpu));
diff --git a/sim/cris/mloop.in b/sim/cris/mloop.in
index 21cbb69..d0f3ee5 100644
--- a/sim/cris/mloop.in
+++ b/sim/cris/mloop.in
@@ -42,6 +42,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
#include <stdlib.h>
/* It seems we don't have a templated header file corresponding to
@@ -142,6 +143,7 @@ EOF
xinit)
cat <<EOF
+#line $LINENO "$0"
/* This seemed the only sane location to emit a call to a
model-specific init function. It may not work for all simulator
types. FIXME: Introduce a model-init hook. */
@@ -160,6 +162,7 @@ xextract-simple | xextract-scache)
# Outputs: sc filled in
cat <<EOF
+#line $LINENO "$0"
{
CGEN_INSN_INT insn = GETIMEMUHI (current_cpu, vpc);
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
@@ -179,6 +182,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -276,6 +280,7 @@ xfull-exec-* | xfast-exec-*)
# vpc contains the address of the next insn to execute
cat <<EOF
+#line $LINENO "$0"
{
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
#define DEFINE_SWITCH
diff --git a/sim/frv/mloop.in b/sim/frv/mloop.in
index dc77f06..9429bf0 100644
--- a/sim/frv/mloop.in
+++ b/sim/frv/mloop.in
@@ -39,6 +39,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
static INLINE const IDESC *
extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn, ARGBUF *abuf,
@@ -411,6 +412,7 @@ EOF
xinit)
cat <<EOF
+#line $LINENO "$0"
/*xxxinit*/
/* If the timer is enabled, then we will enable model profiling during
execution. This is because the timer needs accurate cycles counts to
@@ -428,6 +430,7 @@ xextract-simple | xextract-scache)
# SET_LAST_INSN_P(last_p) called to indicate whether insn is last one
cat <<EOF
+#line $LINENO "$0"
{
CGEN_INSN_INT insn = frvbf_read_imem_USI (current_cpu, vpc);
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
@@ -449,6 +452,7 @@ xfull-exec-* | xfast-exec-*)
# scache lookup.
cat <<EOF
+#line $LINENO "$0"
{
FRV_VLIW *vliw;
int first_insn_p = 1;
diff --git a/sim/iq2000/mloop.in b/sim/iq2000/mloop.in
index e0ec847..1d3df32 100644
--- a/sim/iq2000/mloop.in
+++ b/sim/iq2000/mloop.in
@@ -40,6 +40,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
#include <stdlib.h>
static INLINE const IDESC *
@@ -139,6 +140,7 @@ xextract-simple | xextract-scache)
# Outputs: sc filled in
cat <<EOF
+#line $LINENO "$0"
{
CGEN_INSN_INT insn = GETIMEMUSI (current_cpu, CPU2INSN(vpc));
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
@@ -159,6 +161,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -224,6 +227,7 @@ xfull-exec-* | xfast-exec-*)
# vpc contains the address of the next insn to execute
cat <<EOF
+#line $LINENO "$0"
{
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
#define DEFINE_SWITCH
diff --git a/sim/lm32/mloop.in b/sim/lm32/mloop.in
index 574f00a..d5dc1ed 100644
--- a/sim/lm32/mloop.in
+++ b/sim/lm32/mloop.in
@@ -32,6 +32,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
#include <stdlib.h>
static INLINE const IDESC *
@@ -130,6 +131,7 @@ xinit)
xextract-simple | xextract-scache)
cat <<EOF
+#line $LINENO "$0"
{
CGEN_INSN_INT insn = GETIMEMUSI (current_cpu, vpc);
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
@@ -149,6 +151,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -183,6 +186,7 @@ xfull-exec-* | xfast-exec-*)
# Outputs: vpc
cat <<EOF
+#line $LINENO "$0"
/* Update cycle counter */
SET_H_CSR (LM32_CSR_CC, GET_H_CSR (LM32_CSR_CC) + 1);
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
diff --git a/sim/m32r/mloop.in b/sim/m32r/mloop.in
index 1d4d51b..cec2190 100644
--- a/sim/m32r/mloop.in
+++ b/sim/m32r/mloop.in
@@ -42,6 +42,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
#include <stdlib.h>
static INLINE const IDESC *
@@ -157,6 +158,7 @@ xinit)
xextract-simple | xextract-scache)
cat <<EOF
+#line $LINENO "$0"
{
if ((pc & 3) != 0)
{
@@ -199,6 +201,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -302,6 +305,7 @@ xfull-exec-* | xfast-exec-*)
# vpc is the virtual program counter.
cat <<EOF
+#line $LINENO "$0"
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
#define DEFINE_SWITCH
#include "sem-switch.c"
diff --git a/sim/m32r/mloop2.in b/sim/m32r/mloop2.in
index e7982fc..462c8be 100644
--- a/sim/m32r/mloop2.in
+++ b/sim/m32r/mloop2.in
@@ -41,6 +41,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
/* Emit insns to write back the results of insns executed in parallel.
SC points to a sufficient number of scache entries for the writeback
@@ -206,6 +207,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -517,6 +519,7 @@ xfull-exec-pbb)
# vpc is the virtual program counter.
cat <<EOF
+#line $LINENO "$0"
#define DEFINE_SWITCH
#include "sem2-switch.c"
EOF
diff --git a/sim/m32r/mloopx.in b/sim/m32r/mloopx.in
index e601dca..a7371ed 100644
--- a/sim/m32r/mloopx.in
+++ b/sim/m32r/mloopx.in
@@ -41,6 +41,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
/* Emit insns to write back the results of insns executed in parallel.
SC points to a sufficient number of scache entries for the writeback
@@ -206,6 +207,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -517,6 +519,7 @@ xfull-exec-pbb)
# vpc is the virtual program counter.
cat <<EOF
+#line $LINENO "$0"
#define DEFINE_SWITCH
#include "semx-switch.c"
EOF
diff --git a/sim/or1k/mloop.in b/sim/or1k/mloop.in
index a1cb117..0b707ea 100644
--- a/sim/or1k/mloop.in
+++ b/sim/or1k/mloop.in
@@ -42,6 +42,7 @@ case "x$1" in
xsupport)
cat <<EOF
+#line $LINENO "$0"
#include <stdlib.h>
static INLINE const IDESC *
@@ -144,6 +145,7 @@ xinit)
xextract-simple | xextract-scache)
cat <<EOF
+#line $LINENO "$0"
{
USI insn = GETIMEMUSI (current_cpu, pc);
extract (current_cpu, pc, insn, sc, FAST_P);
@@ -164,6 +166,7 @@ xextract-pbb)
# SET_INSN_COUNT(n) must be called to record number of real insns.
cat <<EOF
+#line $LINENO "$0"
{
const IDESC *idesc;
int icount = 0;
@@ -222,6 +225,7 @@ xfull-exec-* | xfast-exec-*)
# vpc is the virtual program counter.
cat <<EOF
+#line $LINENO "$0"
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
#define DEFINE_SWITCH
#ifdef WANT_CPU_OR1K32BF