]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeseg.c
Added .dbg statement generation for the assembler
[cc65] / src / cc65 / codeseg.c
index 9371593d7bbc39a12aba40bde9ae3084c65c99bf..116b67b3027efd3032253490057b62c964fbf0c0 100644 (file)
@@ -944,13 +944,23 @@ void OutputCodeSeg (const CodeSeg* S, FILE* F)
        /* Get the next entry */
        const CodeEntry* E = CollConstAt (&S->Entries, I);
        /* Check if the line info has changed. If so, output the source line
-        * if the option is enabled.
+        * if the option is enabled and output debug line info if the debug
+        * option is enabled.
         */
        if (E->LI != LI) {
+           /* Line info has changed, remember the new line info */
            LI = E->LI;
+
+           /* Add the source line as a comment */
            if (AddSource) {
                fprintf (F, ";\n; %s\n;\n", LI->Line);
            }
+
+           /* Add line debug info */
+           if (DebugInfo) {
+               fprintf (F, "\t.dbg\tline, \"%s\", %u\n",
+                        GetInputName (LI), GetInputLine (LI));
+           }
        }
        /* Output the code */
        OutputCodeEntry (E, F);