* src/hc08/gen.c (hc08_emitDebuggerSymbol),
[fw/sdcc] / src / avr / gen.c
index 68eca463be1d66aa408c97230b59cff87579db25..5993a46c7f2aaa02915370ac52bd9b4d7799a293 100644 (file)
@@ -261,6 +261,18 @@ emitcode (char *inst, char *fmt, ...)
        va_end (ap);
 }
 
+/*-----------------------------------------------------------------*/
+/* avr_emitDebuggerSymbol - associate the current code location  */
+/*   with a debugger symbol                                        */
+/*-----------------------------------------------------------------*/
+void
+avr_emitDebuggerSymbol (char * debugSym)
+{
+  _G.debugLine = 1;
+  emitcode ("", "%s ==.", debugSym);
+  _G.debugLine = 0;
+}
+
 /*-----------------------------------------------------------------*/
 /* hasInc - operand is incremented before any other use            */
 /*-----------------------------------------------------------------*/
@@ -1815,6 +1827,10 @@ genEndFunction (iCode * ic)
        if (IFFUNC_ISCRITICAL (sym->type))
                emitcode ("sti", "");
 
+       if (options.debug && currFunc) {
+               debugFile->writeEndFunction (currFunc, ic, 1);
+       }
+
        if (IFFUNC_ISISR (sym->type)) {
                emitcode ("rti", "");
        }
@@ -5113,12 +5129,8 @@ genAVRCode (iCode * lic)
        if (allocInfo)
                printAllocInfo (currFunc, codeOutFile);
        /* if debug information required */
-       /*     if (options.debug && currFunc) { */
-       if (currFunc) {
-               debugFile->writeFunction(currFunc);
-               _G.debugLine = 1;
-/*             emitcode ("", ".type %s,@function", currFunc->name); */
-               _G.debugLine = 0;
+       if (options.debug && currFunc) {
+               debugFile->writeFunction (currFunc, lic);
        }
        /* stack pointer name */
        spname = "sp";
@@ -5128,11 +5140,7 @@ genAVRCode (iCode * lic)
 
                if (cln != ic->lineno) {
                        if (options.debug) {
-                               _G.debugLine = 1;
-                               emitcode ("", "C$%s$%d$%d$%d ==.",
-                                         FileBaseName (ic->filename),
-                                         ic->lineno, ic->level, ic->block);
-                               _G.debugLine = 0;
+                               debugFile->writeCLine (ic);
                        }
                        emitcode (";", "%s %d", ic->filename, ic->lineno);
                        cln = ic->lineno;