summaryrefslogtreecommitdiff
path: root/sys/src/cmd/dtracy
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-01-09 11:59:44 -0800
committerOri Bernstein <ori@eigenstate.org>2020-01-09 11:59:44 -0800
commit8150f689959f71410f56ab66c0e89698c58459bc (patch)
tree6f345c9c4d138311654de87628d772d842562e5d /sys/src/cmd/dtracy
parent17ebe55031ae6945ad1f671b69267a672328e4b1 (diff)
show line numbers in dtracy type errors
Diffstat (limited to 'sys/src/cmd/dtracy')
-rw-r--r--sys/src/cmd/dtracy/act.c6
-rw-r--r--sys/src/cmd/dtracy/dat.h1
-rw-r--r--sys/src/cmd/dtracy/lex.c1
3 files changed, 6 insertions, 2 deletions
diff --git a/sys/src/cmd/dtracy/act.c b/sys/src/cmd/dtracy/act.c
index dde47ae57..2159ce19e 100644
--- a/sys/src/cmd/dtracy/act.c
+++ b/sys/src/cmd/dtracy/act.c
@@ -192,7 +192,8 @@ prepprintf(Node **arg, int narg, DTActGr *g, int *recoff)
goto again;
case 'x': case 'X': case 'o': case 'b': case 'd':
if(n >= narg) sysfatal("printf() too few arguments");
- if(arg[n]->typ->type != TYPINT) sysfatal("print() %%%c with non-integer", *fmt);
+ if(arg[n]->typ->type != TYPINT)
+ sysfatal("%d: print() %%%c with non-integer", arg[n]->line, *fmt);
arg[n] = tracegen(arg[n], g, recoff);
n++;
fmtrune(&f, 'l');
@@ -201,7 +202,8 @@ prepprintf(Node **arg, int narg, DTActGr *g, int *recoff)
break;
case 's':
if(n >= narg) sysfatal("printf() too few arguments");
- if(arg[n]->typ->type != TYPSTRING) sysfatal("print() %%s with non-string");
+ if(arg[n]->typ->type != TYPSTRING)
+ sysfatal("%d: print() %%s with non-string", arg[n]->line);
arg[n] = tracegen(arg[n], g, recoff);
n++;
fmtrune(&f, *fmt);
diff --git a/sys/src/cmd/dtracy/dat.h b/sys/src/cmd/dtracy/dat.h
index 5087a609e..cffc1968b 100644
--- a/sys/src/cmd/dtracy/dat.h
+++ b/sys/src/cmd/dtracy/dat.h
@@ -75,6 +75,7 @@ struct Node {
Symbol *sym;
char *str;
s64int num;
+ int line;
/* used by elidecasts() */
char databits;
diff --git a/sys/src/cmd/dtracy/lex.c b/sys/src/cmd/dtracy/lex.c
index c820f145c..bd7825542 100644
--- a/sys/src/cmd/dtracy/lex.c
+++ b/sys/src/cmd/dtracy/lex.c
@@ -239,6 +239,7 @@ node(int type, ...)
n = emalloc(sizeof(Node));
n->type = type;
+ n->line = lineno;
va_start(va, type);
switch(type){
case OBIN: