Accept -gdb option

This commit is contained in:
ceriel 1992-03-27 17:36:49 +00:00
parent ea2e95a627
commit b2cca56e16
14 changed files with 188 additions and 33 deletions

View file

@ -158,6 +158,21 @@ regreturn()
}
#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 ;
@ -186,6 +201,16 @@ mes(type) word type ; {
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;
@ -197,7 +222,11 @@ mes(type) word type ; {
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 */
}

View file

@ -31,3 +31,4 @@
#define fmt_id(fr,to) sprintf(to, "_%s", fr)
#define BSS_INIT 0
#define MACH_OPTIONS

View file

@ -178,7 +178,20 @@ prolog(n) full n; {
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 ;
@ -208,10 +221,15 @@ mes(type) word type ; {
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
#ifdef DBX
#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(end_ptyp);
@ -224,8 +242,11 @@ mes(type) word type ; {
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
@ -233,7 +254,6 @@ mes(type) word type ; {
#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);

View file

@ -46,3 +46,4 @@ You must specify the appropriate word size, then REMOVE tables.c
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
#define MACH_OPTIONS

View file

@ -178,7 +178,20 @@ prolog(n) full n; {
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 ;
@ -208,10 +221,15 @@ mes(type) word type ; {
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
#ifdef DBX
#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(end_ptyp);
@ -224,8 +242,11 @@ mes(type) word type ; {
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
@ -233,7 +254,6 @@ mes(type) word type ; {
#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);

View file

@ -46,3 +46,4 @@ You must specify the appropriate word size, then REMOVE tables.c
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
#define MACH_OPTIONS

View file

@ -178,7 +178,20 @@ prolog(n) full n; {
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 ;
@ -208,10 +221,15 @@ mes(type) word type ; {
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
#ifdef DBX
#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(end_ptyp);
@ -224,8 +242,11 @@ mes(type) word type ; {
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
@ -233,7 +254,6 @@ mes(type) word type ; {
#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);

View file

@ -46,3 +46,4 @@ You must specify the appropriate word size, then REMOVE tables.c
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
#define MACH_OPTIONS

View file

@ -178,7 +178,20 @@ prolog(n) full n; {
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 ;
@ -208,10 +221,15 @@ mes(type) word type ; {
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
#ifdef DBX
#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(end_ptyp);
@ -224,8 +242,11 @@ mes(type) word type ; {
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
@ -233,7 +254,6 @@ mes(type) word type ; {
#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);

View file

@ -46,3 +46,4 @@ You must specify the appropriate word size, then REMOVE tables.c
#define fmt_id(sf,st) sprintf(st,"_%s",sf)
#define BSS_INIT 0
#define MACH_OPTIONS

View file

@ -306,13 +306,17 @@ C_mes_end()
}
}
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");
}
@ -323,8 +327,17 @@ arith l;
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;
}

View file

@ -29,6 +29,7 @@ char *filename; /* Name of input file */
char *out_file; /* Name of output file */
int errors; /* Number of errors */
int debug;
int __gdb_flag;
extern char *C_error;
main(argc,argv)
@ -49,6 +50,10 @@ main(argc,argv)
debug= 1;
continue;
}
if (! strcmp(av[0], "-gdb")) {
__gdb_flag = 1;
continue;
}
if (!filename)
{
if (strcmp(*av, "-"))

View file

@ -47,6 +47,21 @@ con_mult(sz)
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;
{
@ -77,10 +92,15 @@ mes(mesno)
argt = getarg(cst_ptyp);
a2 = argval;
argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp);
#ifdef DBX
#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(end_ptyp);
@ -93,12 +113,14 @@ mes(mesno)
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);

View file

@ -27,5 +27,6 @@
#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"