dbgloc: add column argument
dbgloc line [col] This is implemented in a backwards-compatible manner.
This commit is contained in:
parent
24d68e841f
commit
85287081c4
7 changed files with 18 additions and 7 deletions
2
all.h
2
all.h
|
@ -569,7 +569,7 @@ void rega(Fn *);
|
||||||
void emitfnlnk(char *, Lnk *, FILE *);
|
void emitfnlnk(char *, Lnk *, FILE *);
|
||||||
void emitdat(Dat *, FILE *);
|
void emitdat(Dat *, FILE *);
|
||||||
void emitdbgfile(char *, FILE *);
|
void emitdbgfile(char *, FILE *);
|
||||||
void emitdbgloc(uint, FILE *);
|
void emitdbgloc(uint, uint, FILE *);
|
||||||
int stashbits(void *, int);
|
int stashbits(void *, int);
|
||||||
void elf_emitfnfin(char *, FILE *);
|
void elf_emitfnfin(char *, FILE *);
|
||||||
void elf_emitfin(FILE *);
|
void elf_emitfin(FILE *);
|
||||||
|
|
|
@ -548,7 +548,7 @@ emitins(Ins i, Fn *fn, FILE *f)
|
||||||
emitcopy(i.arg[1], TMP(XMM0+15), i.cls, fn, f);
|
emitcopy(i.arg[1], TMP(XMM0+15), i.cls, fn, f);
|
||||||
break;
|
break;
|
||||||
case Odbgloc:
|
case Odbgloc:
|
||||||
emitdbgloc(i.arg[0].val, f);
|
emitdbgloc(i.arg[0].val, i.arg[1].val, f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,7 @@ emitins(Ins *i, E *e)
|
||||||
emitf("mov %=, sp", i, e);
|
emitf("mov %=, sp", i, e);
|
||||||
break;
|
break;
|
||||||
case Odbgloc:
|
case Odbgloc:
|
||||||
emitdbgloc(i->arg[0].val, e->f);
|
emitdbgloc(i->arg[0].val, i->arg[1].val, e->f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
emit.c
7
emit.c
|
@ -235,7 +235,10 @@ emitdbgfile(char *fn, FILE *f)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emitdbgloc(uint loc, FILE *f)
|
emitdbgloc(uint line, uint col, FILE *f)
|
||||||
{
|
{
|
||||||
fprintf(f, "\t.loc %u %u\n", curfile, loc);
|
if (col != 0)
|
||||||
|
fprintf(f, "\t.loc %u %u %u\n", curfile, line, col);
|
||||||
|
else
|
||||||
|
fprintf(f, "\t.loc %u %u\n", curfile, line);
|
||||||
}
|
}
|
||||||
|
|
2
ops.h
2
ops.h
|
@ -122,7 +122,7 @@ O(vastart, T(m,e,e,e, x,e,e,e), 0) X(0, 0, 0) V(0)
|
||||||
O(copy, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0)
|
O(copy, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0)
|
||||||
|
|
||||||
/* Debug */
|
/* Debug */
|
||||||
O(dbgloc, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0)
|
O(dbgloc, T(w,e,e,e, w,e,e,e), 0) X(0, 0, 1) V(0)
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* INTERNAL OPERATIONS (keep nop first) */
|
/* INTERNAL OPERATIONS (keep nop first) */
|
||||||
|
|
8
parse.c
8
parse.c
|
@ -669,6 +669,14 @@ parseline(PState ps)
|
||||||
arg[0] = INT(tokval.num);
|
arg[0] = INT(tokval.num);
|
||||||
if (arg[0].val != tokval.num)
|
if (arg[0].val != tokval.num)
|
||||||
err("line number too big");
|
err("line number too big");
|
||||||
|
if (peek() == Tcomma) {
|
||||||
|
next();
|
||||||
|
expect(Tint);
|
||||||
|
arg[1] = INT(tokval.num);
|
||||||
|
if (arg[1].val != tokval.num)
|
||||||
|
err("column number too big");
|
||||||
|
} else
|
||||||
|
arg[1] = INT(0);
|
||||||
goto Ins;
|
goto Ins;
|
||||||
}
|
}
|
||||||
if (op == Tcall) {
|
if (op == Tcall) {
|
||||||
|
|
|
@ -406,7 +406,7 @@ emitins(Ins *i, Fn *fn, FILE *f)
|
||||||
emitf("mv %=, sp", i, fn, f);
|
emitf("mv %=, sp", i, fn, f);
|
||||||
break;
|
break;
|
||||||
case Odbgloc:
|
case Odbgloc:
|
||||||
emitdbgloc(i->arg[0].val, f);
|
emitdbgloc(i->arg[0].val, i->arg[1].val, f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue