implement line number info tracking

Support "file" and "loc" directives. "file" takes a string (a file name)
assigns it a number, sets the current file to that number and records
the string for later. "loc" takes a single number and outputs location
information with a reference to the current file.
This commit is contained in:
Thomas Bracht Laumann Jespersen 2023-01-26 12:09:44 +01:00 committed by Quentin Carbonneaux
parent e493a7f233
commit 0d929287d7
10 changed files with 75 additions and 7 deletions

4
all.h
View file

@ -502,7 +502,7 @@ bshas(BSet *bs, uint elt)
/* parse.c */
extern Op optab[NOp];
void parse(FILE *, char *, void (Dat *), void (Fn *));
void parse(FILE *, char *, void (char *), void (Dat *), void (Fn *));
void printfn(Fn *, FILE *);
void printref(Ref, Fn *, FILE *);
void err(char *, ...) __attribute__((noreturn));
@ -568,6 +568,8 @@ void rega(Fn *);
/* emit.c */
void emitfnlnk(char *, Lnk *, FILE *);
void emitdat(Dat *, FILE *);
void emitdbgfile(char *, FILE *);
void emitdbgloc(uint, FILE *);
int stashbits(void *, int);
void elf_emitfnfin(char *, FILE *);
void elf_emitfin(FILE *);