summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-23 12:45:08 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-23 12:45:08 -0700
commit0741eb600481a97c3baddb290e0ab1a33a9e4921 (patch)
treea3bfe8535ad4b6b57fc226719737c6ef103f63f6 /asm
parent4b58ec1b8f7626517077a70049805878b3dcd50b (diff)
downloadnasm-0741eb600481a97c3baddb290e0ab1a33a9e4921.tar.gz
listing: make it possible to flush the listing output after every line
Add the -Lw option to flush the list file after every line output. This is handy for debugging if nasm hangs. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/listing.c7
-rw-r--r--asm/nasm.c1
2 files changed, 7 insertions, 1 deletions
diff --git a/asm/listing.c b/asm/listing.c
index 3101a258..9b101ff4 100644
--- a/asm/listing.c
+++ b/asm/listing.c
@@ -148,6 +148,8 @@ static void list_cleanup(void)
static void list_init(const char *fname)
{
+ enum file_flags flags = NF_TEXT;
+
if (listfp)
list_cleanup();
@@ -156,7 +158,10 @@ static void list_init(const char *fname)
return;
}
- listfp = nasm_open_write(fname, NF_TEXT);
+ if (list_option('w'))
+ flags |= NF_IOLBF;
+
+ listfp = nasm_open_write(fname, flags);
if (!listfp) {
nasm_nonfatal("unable to open listing file `%s'", fname);
return;
diff --git a/asm/nasm.c b/asm/nasm.c
index 07a360b2..a30831dc 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -2067,6 +2067,7 @@ static void help(FILE *out)
" -Lm show multi-line macro calls with expanded parmeters\n"
" -Lp output a list file every pass, in case of errors\n"
" -Ls show all single-line macro definitions\n"
+ " -Lw flush the output after every line\n"
" -L+ enable all listing options (very verbose!)\n"
"\n"
" -Oflags... optimize opcodes, immediates and branch offsets\n"