* device/include/pic16/pic18f*.h: add bit aliases in INTCONbits_t
[fw/sdcc] / src / SDCCdwarf2.c
index 46c2f6b86718bec836f8983e7589b65ea5ac5b1d..0e1d1c325a698d79d6851b9ae5b38fb96af92892 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);
@@ -1575,7 +1575,7 @@ dwFindFileIndex (char * filename)
       if (!strncmp (includeDir, filename, strlen (includeDir))
           && strlen (filename) > strlen (includeDir))
         {
-         if (*(filename+strlen (includeDir)) == DIR_SEPARATOR_CHAR)
+         if (IS_DIR_SEPARATOR(filename[strlen (includeDir)]))
            break;
        }
     }
@@ -2384,6 +2384,16 @@ dwTagFromType (sym_link * type, dwtag * parent)
                                                    getSize (type)));
                  dwAddTagChild (dwRootTag, tp);
                  break;
+
+               case V_FIXED16X16:
+                 tp = dwNewTag (DW_TAG_base_type);
+                 dwAddTagAttr (tp, dwNewAttrConst (DW_AT_encoding,
+                                                   DW_ATE_float));
+                 dwAddTagAttr (tp, dwNewAttrString (DW_AT_name, "fixed16x16"));
+                 dwAddTagAttr (tp, dwNewAttrConst (DW_AT_byte_size,
+                                                   getSize (type)));
+                 dwAddTagChild (dwRootTag, tp);
+                 break;
                
                case V_CHAR:
                  tp = dwNewTag (DW_TAG_base_type);
@@ -2432,29 +2442,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 +2684,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));
@@ -2738,7 +2739,7 @@ int dwWriteFunction(symbol *sym, iCode *ic)
 /*-----------------------------------------------------------------------*/
 int dwWriteEndFunction(symbol *sym, iCode *ic, int offset)
 {
-  char debugSym[SDCC_NAME_MAX];
+  char debugSym[SDCC_NAME_MAX + 1];
   
   if (ic)
     {
@@ -2776,7 +2777,7 @@ int dwWriteEndFunction(symbol *sym, iCode *ic, int offset)
 /*-----------------------------------------------------------------------*/
 int dwWriteLabel(symbol *sym, iCode *ic)
 {
-  char debugSym[SDCC_NAME_MAX];
+  char debugSym[SDCC_NAME_MAX + 1];
   dwtag * tp;
   
   /* ignore the compiler generated labels */
@@ -2875,18 +2876,15 @@ int dwWriteType(structdef *sdef, int block, int inStruct, char *tag)
 int dwWriteModule(char *name)
 {
   dwtag * tp;
-  char * s;
-  
-  if(!dwarf2FilePtr) return 0;
+  char verid[125];
   
   dwModuleName = Safe_strdup (name);
-  for (s = dwModuleName; *s; s++)
-    if (ispunct (*s) || isspace (*s))
-      *s = '_';
+  
+  sprintf(verid, "SDCC version %s #%s", SDCC_VERSION_STR, getBuildNumber());
     
   tp = dwNewTag (DW_TAG_compile_unit);
-  dwAddTagAttr (tp, dwNewAttrString (DW_AT_producer, "SDCC version "
-                                            SDCC_VERSION_STR));
+  dwAddTagAttr (tp, dwNewAttrString (DW_AT_producer, verid));
+
   dwAddTagAttr (tp, dwNewAttrConst (DW_AT_language, DW_LANG_C89));
 
   dwAddTagAttr (tp, dwNewAttrString (DW_AT_name, fullSrcFileName));
@@ -2909,8 +2907,6 @@ int dwWriteCLine(iCode *ic)
   dwline * lp;
   char * debugSym;
   
-  if(!dwarf2FilePtr) return 0;
-
   lp = Safe_alloc (sizeof (dwline));
 
   lp->line = ic->lineno;
@@ -2947,8 +2943,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 +3018,6 @@ dwWriteFrameAddress(char *variable, struct regs *reg, int offset)
 /*-----------------------------------------------------------------------*/
 int dwWriteALine(char *module, int Line)
 {
-  if(!dwarf2FilePtr) return 0;
-  
   return 1;
 }
 
@@ -3037,14 +3029,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 ();