[nasm:debug-macros] preproc: pass macro debug information in invocation order

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Thu Jul 9 17:51:09 PDT 2020


Commit-ID:  7501601dbd026e6fdc1434bdd4dc983f30139c18
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=7501601dbd026e6fdc1434bdd4dc983f30139c18
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Wed, 8 Jul 2020 10:13:46 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Wed, 8 Jul 2020 10:13:46 -0700

preproc: pass macro debug information in invocation order

Reverse the invocation lists once each list is complete, so that the
lists passed to the macro backend are in true invocation order.

Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/preproc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index 9d95e67e..e1112fbe 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -6207,6 +6207,8 @@ static void debug_macro_end(MMacro *m)
 
     nasm_assert(inv == debug_current_macro);
 
+    list_reverse(inv->down.l);
+
     m->dbg.inv = NULL;
     inv = inv->up;
 
@@ -6265,6 +6267,13 @@ static void free_debug_macro_info(void)
     nasm_zero(dmi);
 }
 
+static void debug_macro_output(void)
+{
+    list_reverse(dmi.inv.l);
+    dfmt->debug_macros(&dmi);
+    free_debug_macro_info();
+}
+
 /*
  * Expand the multi-line macro call made by the given line, if
  * there is one to be expanded. If there is, push the expansion on
@@ -7011,10 +7020,8 @@ static void pp_cleanup_pass(void)
         ctx_pop();
     src_set_fname(NULL);
 
-    if (ppdbg & PDBG_MACROS) {
-        dfmt->debug_macros(&dmi);
-        free_debug_macro_info();
-    }
+    if (ppdbg & PDBG_MACROS)
+        debug_macro_output();
 }
 
 static void pp_cleanup_session(void)


More information about the Nasm-commits mailing list