X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fxa51%2Fgen.c;h=ecd1867ca027f20796cd0b5f98707af236b2902d;hb=a32b8b2cccc6220dad34b0d7c963fe87f5b98a04;hp=8a5a2b16bc54c24d1758e5d1423cc188c305f803;hpb=51da61d71d46c2b96789bb6f536c48b83964e138;p=fw%2Fsdcc diff --git a/src/xa51/gen.c b/src/xa51/gen.c index 8a5a2b16..ecd1867c 100755 --- a/src/xa51/gen.c +++ b/src/xa51/gen.c @@ -97,7 +97,7 @@ void bailOut (char *mesg) { static void emitcode (char *inst, char *fmt,...) { va_list ap; char lb[INITIAL_INLINEASM]; - char *lbp = lb; + unsigned char *lbp = lb; va_start (ap, fmt); @@ -112,7 +112,7 @@ static void emitcode (char *inst, char *fmt,...) { else vsprintf (lb, fmt, ap); - while (isspace ((int)*lbp)) + while (isspace (*lbp)) lbp++; if (lbp && *lbp) @@ -124,6 +124,19 @@ static void emitcode (char *inst, char *fmt,...) { va_end (ap); } +/*-----------------------------------------------------------------*/ +/* xa51_emitDebuggerSymbol - associate the current code location */ +/* with a debugger symbol */ +/*-----------------------------------------------------------------*/ +void +xa51_emitDebuggerSymbol (char * debugSym) +{ + _G.debugLine = 1; + emitcode ("", "%s ==.", debugSym); + _G.debugLine = 0; +} + + char *getStackOffset(int stack) { static char gsoBuf[1024]; sprintf (gsoBuf, "r7+(%d%+d%+d)", stack, @@ -829,6 +842,8 @@ genEndFunction (iCode * ic) if (IFFUNC_ISNAKED(sym->type)) { emitcode(";", "naked function: no epilogue."); + if (options.debug && currFunc) + debugFile->writeEndFunction (currFunc, ic, 0); return; } @@ -837,6 +852,10 @@ genEndFunction (iCode * ic) emitcode ("add", "r7,#%d\t; release stack space for locals", sym->stack); } + if (options.debug && currFunc) { + debugFile->writeEndFunction (currFunc, ic, 1); + } + if (IFFUNC_ISISR(sym->type)) { emitcode ("reti", ""); } else { @@ -1188,7 +1207,7 @@ static iCode *hasInc (operand *op, iCode *ic, int osize) { } } /* if the operand used or deffed */ - if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) { + if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) { return NULL; } /* if GOTO or IFX */ @@ -1912,23 +1931,13 @@ void genXA51Code (iCode * lic) { /* if debug information required */ if (options.debug && currFunc) { - debugFile->writeFunction(currFunc); - _G.debugLine = 1; - if (IS_STATIC (currFunc->etype)) - emitcode ("", "F%s$%s$0$0 ==.", moduleName, currFunc->name); - else - emitcode ("", "G$%s$0$0 ==.", currFunc->name); - _G.debugLine = 0; + debugFile->writeFunction (currFunc, lic); } for (ic = lic; ic; ic = ic->next) { if (ic->lineno && 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); } if (!options.noCcodeInAsm) { emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,