diff --git a/asm/assemble.c b/asm/assemble.c index 632641e0b..29ac92291 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -872,6 +872,17 @@ static void out_eops(struct out_data *data, const extop *e) /* This is totally just a wild guess what is reasonable... */ #define INCBIN_MAX_BUF (ZERO_BUF_SIZE * 16) +static void +list_add_template_info(const insn *ins, const struct itemplate *temp) +{ + char *buf; + (void)ins; + + buf = nasm_asprintf(" ;;; matched insns.xda:%u", temp->xdaline); + lfmt->line(LIST_INFO, -1, buf); + nasm_free(buf); +} + static int64_t assemble(insn *instruction) { struct out_data data; @@ -1012,6 +1023,9 @@ static int64_t assemble(insn *instruction) if (m >= MOK_GOOD) { /* Matches! */ + if (list_option('X')) + list_add_template_info(instruction, temp); + if (unlikely(itemp_has(temp, IF_OBSOLETE))) { errflags warning; const char *whathappened; diff --git a/asm/listing.h b/asm/listing.h index 44b40fb58..6fa09db15 100644 --- a/asm/listing.h +++ b/asm/listing.h @@ -136,10 +136,15 @@ static inline const_func uint64_t list_option_mask_val(unsigned char x) static inline const_func uint64_t list_option_mask(unsigned char x) { - if (x == '+') - return ~(list_option_mask_val('w') | 3); - else + if (x == '+') { + const char *p = "bdefFmps"; + uint64_t v = 0; + while (*p) + v |= list_option_mask_val(*p++); + return v; + } else { return list_option_mask_val(x); + } } /* Return true if the listing engine is active and a certain option is set. */ diff --git a/asm/nasm.c b/asm/nasm.c index 128e5b721..1daea49d9 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1932,6 +1932,7 @@ static void help(FILE *out, const char *what) } if (help_is(with, 'L')) { fputs( + " -L flags for general usage:\n" " -Lb show builtin macro packages (standard and %use)\n" " -Ld show byte and repeat counts in decimal, not hex\n" " -Le show the preprocessed output\n" @@ -1940,8 +1941,10 @@ static void help(FILE *out, const char *what) " -Lm show multi-line macro calls with expanded parameters\n" " -Lp output a list file every pass, in case of errors\n" " -Ls show all single-line macro definitions\n" + " -L+ enable all of the above listing options (very verbose!)\n" + " -L flags intended for debugging NASM:\n" " -Lw flush the output after every line (very slow!)\n" - " -L+ enable all listing options except -Lw (very verbose!)\n" + " -LX list instruction pattern line numbers from insns.xda\n" , out); } if (help_optor(with, 'O')) { diff --git a/include/nasm.h b/include/nasm.h index 1e8aee026..7ea54b7f9 100644 --- a/include/nasm.h +++ b/include/nasm.h @@ -526,6 +526,7 @@ static inline char *nasm_skip_identifier(const char *str) enum { LIST_READ, LIST_MACRO, + LIST_INFO, LIST_INCLUDE, LIST_INCBIN, LIST_TIMES