Skip to content

Commit

Permalink
Add LFIDEBUG check
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Nov 28, 2024
1 parent 7d83297 commit cba9d08
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lfi-leg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ main(int argc, char** argv)
input = argopen(args.input, "r", stdin);
output = argopen(args.output, "w", stdout);

char* lfidebug = getenv("LFIDEBUG");
if (lfidebug) {
// write input to a debug location
FILE* debug = argopen("debug-in.s", "w", NULL);
char buf[BUFSIZ];
size_t n;
while ((n = fread(buf, 1, BUFSIZ, input)) != 0)
fwrite(buf, 1, n, debug);
fseek(input, 0, SEEK_SET);
fclose(debug);
}

if (args.arch == NULL) {
args.arch = getarch();
}
Expand Down

0 comments on commit cba9d08

Please sign in to comment.