* src/hc08/main.c (_hc08_genAssemblerEnd),
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 18 May 2004 06:03:07 +0000 (06:03 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 18 May 2004 06:03:07 +0000 (06:03 +0000)
* src/SDCCdwarf2.c (dwOpenFile, dwCloseFile, dwWriteFunction,
dwWriteModule, dwWriteCLine, dwWriteALine, dwarf2FinalizeFile):
completely eliminated the use of a temporary file
* src/SDCCdwarf2.c (dwWriteAttr): fixed bug with location list offset
when more than one file linked
* src/SDCCloop.c (pointerAssigned): fixed bug #954163

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3318 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCdwarf2.c
src/SDCCloop.c
src/hc08/main.c

index 78e9989c36d3bca94c1104da20ac249e1730b6d2..d7d1a63cdc94554317fb79497c3f922ddf7c9b83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
+2004-05-18 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+       * src/hc08/main.c (_hc08_genAssemblerEnd),
+       * src/SDCCdwarf2.c (dwOpenFile, dwCloseFile, dwWriteFunction,
+       dwWriteModule, dwWriteCLine, dwWriteALine, dwarf2FinalizeFile):
+       completely eliminated the use of a temporary file
+       * src/SDCCdwarf2.c (dwWriteAttr): fixed bug with location list offset
+       when more than one file linked
+       * src/SDCCloop.c (pointerAssigned): fixed bug #954163
+
 2004-05-17 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
-       * src/SDCCval.c (valForArray): applied Maarteen Brock's patch #947682
+       * src/SDCCval.c (valForArray): applied Maarten Brock's patch #947682
        which fixes bug #543481
        * support/regression/tests/bug-751703.c: fixed comments left from a
        cut and paste error
index 46c2f6b86718bec836f8983e7589b65ea5ac5b1d..a84afe26d32be3b23669e9d9ac4aca91048e3b3b 100644 (file)
@@ -990,7 +990,7 @@ dwWriteAttr (dwattr * ap)
            break;
          case DW_AT_location:
          case DW_AT_frame_base:
-           dwWriteWord (NULL, ap->val.loclist->baseOffset, NULL);
+           dwWriteWord ("Ldebug_loc_start", ap->val.loclist->baseOffset, NULL);
            break;
          default:
            dwWriteWord (NULL, ap->val.data, NULL);
@@ -2432,29 +2432,22 @@ dwTagFromType (sym_link * type, dwtag * parent)
 
 
 /*-----------------------------------------------------------------------*/
-/* dwOpenFile - opens a temporary file for debugging information         */
+/* dwOpenFile - open the debugging file (just initialize, since all      */
+/*              DWARF data goes into the assembly output file)           */
 /*-----------------------------------------------------------------------*/
 int dwOpenFile(char *file)
 {
-  dwarf2FilePtr = tempfile();
-  if(!dwarf2FilePtr) return 0;
-  
   dwTypeTagTable = newHashTable (128);
   
   return 1;
 }
 
 /*-----------------------------------------------------------------------*/
-/* dwCloseFile - close (and deletes) the temporary file for debugging    */
-/*               information                                             */
+/* dwCloseFile - close the debugging file (do nothing, since all DWARF   */
+/*               data goes into the assembly output file)                */
 /*-----------------------------------------------------------------------*/
 int dwCloseFile(void)
 {
-  if(!dwarf2FilePtr) return 0;
-  
-  /* Don't explicitly close the file; this will be done automatically */
-  dwarf2FilePtr = NULL;
-  
   return 1;
 }
   
@@ -2681,8 +2674,6 @@ int dwWriteFunction(symbol *sym, iCode *ic)
   dwtag * tp;
   value * args;
     
-  if(!dwarf2FilePtr) return 0;
-  
   dwFuncTag = tp = dwNewTag (DW_TAG_subprogram);
   
   dwAddTagAttr (dwFuncTag, dwNewAttrString (DW_AT_name, sym->name));
@@ -2875,14 +2866,8 @@ int dwWriteType(structdef *sdef, int block, int inStruct, char *tag)
 int dwWriteModule(char *name)
 {
   dwtag * tp;
-  char * s;
-  
-  if(!dwarf2FilePtr) return 0;
   
   dwModuleName = Safe_strdup (name);
-  for (s = dwModuleName; *s; s++)
-    if (ispunct (*s) || isspace (*s))
-      *s = '_';
     
   tp = dwNewTag (DW_TAG_compile_unit);
   dwAddTagAttr (tp, dwNewAttrString (DW_AT_producer, "SDCC version "
@@ -2909,8 +2894,6 @@ int dwWriteCLine(iCode *ic)
   dwline * lp;
   char * debugSym;
   
-  if(!dwarf2FilePtr) return 0;
-
   lp = Safe_alloc (sizeof (dwline));
 
   lp->line = ic->lineno;
@@ -2947,8 +2930,6 @@ dwWriteFrameAddress(char *variable, struct regs *reg, int offset)
   dwloc * lp;
   int regNum;
     
-  if(!dwarf2FilePtr) return 0;
-
   /* If there was a region open, close it */
   if (dwFrameLastLoc)
     {
@@ -3024,8 +3005,6 @@ dwWriteFrameAddress(char *variable, struct regs *reg, int offset)
 /*-----------------------------------------------------------------------*/
 int dwWriteALine(char *module, int Line)
 {
-  if(!dwarf2FilePtr) return 0;
-  
   return 1;
 }
 
@@ -3037,14 +3016,14 @@ int dwWriteALine(char *module, int Line)
 /*                      debug file                                       */
 /*-----------------------------------------------------------------------*/
 int
-dwarf2FinalizeFile(void)
+dwarf2FinalizeFile(FILE *of)
 {
   int tagAddress = 11;
   int abbrevNum = 0;
   int attr;
-  
-  if(!dwarf2FilePtr) return 1;
 
+  dwarf2FilePtr = of;
+  
   /* Write the .debug_line section */
   dwWriteLineNumbers ();
  
index f23b41f06fe063f8f93fa9fdf2420e75d16287df..52cc19affc7c0ef5a1e9c124a9ae442710bd6f04 100644 (file)
@@ -379,7 +379,22 @@ DEFSETFUNC (pointerAssigned)
   eBBlock *ebp = item;
   V_ARG (operand *, op);
 
-  return ebp->hasFcall || bitVectBitValue (ebp->ptrsSet, op->key);
+  if (ebp->hasFcall)
+    return 1;
+
+  if (bitVectBitValue (ebp->ptrsSet, op->key))
+    return 1;
+
+  /* Unfortunately, one of the other pointer set operations  */
+  /* may be using an alias of this operand, and the above    */
+  /* test would miss it. To be thorough, some aliasing       */
+  /* analysis should be done here. In the meantime, be       */
+  /* conservative and assume any other pointer set operation */
+  /* is dangerous                                            */
+  if (!bitVectIsZero (ebp->ptrsSet))
+    return 1;
+  
+  return 0;
 }
 
 /*-----------------------------------------------------------------*/
index aa2cbb0cf7cb1b65ed2cddeebba8899812ebba5a..d28b72a51158447c20c45cd813fa9ca9c0676710 100644 (file)
@@ -12,9 +12,8 @@
 
 void copyFile(FILE *dest, FILE *src);
 extern char * iComments2;
-extern FILE * dwarf2FilePtr;
 extern DEBUGFILE dwarf2DebugFile;
-extern int dwarf2FinalizeFile(void);
+extern int dwarf2FinalizeFile(FILE *);
 
 static char _defaultRules[] =
 {
@@ -240,8 +239,7 @@ _hc08_genAssemblerEnd (FILE * of)
 {
   if (options.out_fmt == 2 && options.debug)
     {
-      dwarf2FinalizeFile();
-      copyFile(of, dwarf2FilePtr);
+      dwarf2FinalizeFile (of);
     }
 }