}
#endif /* REGVARS */
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
+
mes(type) word type ; {
int argt, a1, a2 ;
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer (bp).
+ */
+ argval += 8;
+ }
+ }
+#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(end_ptyp);
break;
argt = getarg(cst_ptyp);
}
swtxt();
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
fputs("call ___u_LiB\n", codefile);
cleanregs(); /* debugger might change variables */
}
#define fmt_id(fr,to) sprintf(to, "_%s", fr)
#define BSS_INIT 0
+#define MACH_OPTIONS
nlocals = n;
}
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
mes(type) word type ; {
int argt, a1, a2 ;
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
-#ifdef DBX
- if (a1 == N_PSYM) {
- argval += 8;
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer.
+ */
+ argval += 8;
+ }
}
#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(cst_ptyp);
}
swtxt();
-#ifndef DBX
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
#ifdef TBL68020
fputs("jsr (___u_LiB)\n", codefile);
#else
#endif
cleanregs(); /* debugger might change variables */
}
-#endif
fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval);
argt = getarg(cst_ptyp);
fprintf(codefile, "%d\n", (int) argval);
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
+#define MACH_OPTIONS
nlocals = n;
}
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
mes(type) word type ; {
int argt, a1, a2 ;
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
-#ifdef DBX
- if (a1 == N_PSYM) {
- argval += 8;
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer.
+ */
+ argval += 8;
+ }
}
#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(cst_ptyp);
}
swtxt();
-#ifndef DBX
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
#ifdef TBL68020
fputs("jsr (___u_LiB)\n", codefile);
#else
#endif
cleanregs(); /* debugger might change variables */
}
-#endif
fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval);
argt = getarg(cst_ptyp);
fprintf(codefile, "%d\n", (int) argval);
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
+#define MACH_OPTIONS
nlocals = n;
}
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
mes(type) word type ; {
int argt, a1, a2 ;
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
-#ifdef DBX
- if (a1 == N_PSYM) {
- argval += 8;
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer.
+ */
+ argval += 8;
+ }
}
#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(cst_ptyp);
}
swtxt();
-#ifndef DBX
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
#ifdef TBL68020
fputs("jsr (___u_LiB)\n", codefile);
#else
#endif
cleanregs(); /* debugger might change variables */
}
-#endif
fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval);
argt = getarg(cst_ptyp);
fprintf(codefile, "%d\n", (int) argval);
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
+#define MACH_OPTIONS
nlocals = n;
}
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
mes(type) word type ; {
int argt, a1, a2 ;
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
-#ifdef DBX
- if (a1 == N_PSYM) {
- argval += 8;
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer.
+ */
+ argval += 8;
+ }
}
#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(cst_ptyp);
}
swtxt();
-#ifndef DBX
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
#ifdef TBL68020
fputs("jsr (___u_LiB)\n", codefile);
#else
#endif
cleanregs(); /* debugger might change variables */
}
-#endif
fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval);
argt = getarg(cst_ptyp);
fprintf(codefile, "%d\n", (int) argval);
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
+#define MACH_OPTIONS
}
}
+extern int __gdb_flag;
+
C_cst( l)
arith l;
{
+ static int correct_offset;
+
if (db_mes) {
if (! db_str) {
switchseg( SEGTXT);
- if (l == N_SLINE) {
+ if (l == N_SLINE && ! __gdb_flag) {
flush_cache();
fprintf(codefile, "call ___uX_LiB\nnop\n");
}
db_str = 1;
db_nul = 1;
}
- else fprint(codefile, ",0x%lx", (long) l);
+ else {
+ if (correct_offset++ == -1) {
+ l += EM_BSIZE;
+ }
+ fprint(codefile, ",0x%lx", (long) l);
+ }
if (! db_nul) {
+ correct_offset = 0;
+ if (l == N_PSYM && __gdb_flag) {
+ correct_offset = -2;
+ }
fprint(codefile, ",0");
db_nul = 1;
}
char *out_file; /* Name of output file */
int errors; /* Number of errors */
int debug;
+int __gdb_flag;
extern char *C_error;
main(argc,argv)
debug= 1;
continue;
}
+ if (! strcmp(av[0], "-gdb")) {
+ __gdb_flag = 1;
+ continue;
+ }
if (!filename)
{
if (strcmp(*av, "-"))
fprintf(codefile,".data4\t%s\n",str);
}
+#ifdef MACH_OPTIONS
+static int gdb_flag = 0;
+
+mach_option(s)
+ char *s;
+{
+ if (! strcmp(s, "-gdb")) {
+ gdb_flag = 1;
+ }
+ else {
+ error("Unknown flag %s", s);
+ }
+}
+#endif /* MACH_OPTIONS */
+
mes(mesno)
word mesno;
{
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
-#ifdef DBX
- if (a1 == N_PSYM) {
- argval += 4;
+#ifdef MACH_OPTIONS
+ if (gdb_flag) {
+ if (a1 == N_PSYM) {
+ /* Change offset from AB into offset from
+ the frame pointer (ab).
+ */
+ argval += 4;
+ }
}
#endif
fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2);
argt = getarg(cst_ptyp);
}
swtxt();
-#ifndef DBX
- if (argval == N_SLINE) {
+ if (argval == N_SLINE
+#ifdef MACH_OPTIONS
+ && ! gdb_flag
+#endif
+ ) {
fputs("calls $0,___u_LiB\n", codefile);
cleanregs(); /* debugger might change variables */
}
-#endif
fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval);
argt = getarg(cst_ptyp);
fprintf(codefile, "%d\n", (int) argval);
#define con_dlb(x) fprintf(codefile,".data4\t%s\n",x)
#define BSS_INIT 0
+#define MACH_OPTIONS
#define modhead ".sect .text\n.sect .rom\n.sect .data\n.sect .bss\n"