Generate stabs entries for any executable section
authorCharles Crayne <chuck@thor.crayne.org>
Thu, 18 Oct 2007 00:55:45 +0000 (17:55 -0700)
committerCharles Crayne <chuck@thor.crayne.org>
Thu, 18 Oct 2007 00:55:45 +0000 (17:55 -0700)
output/outelf32.c
output/outelf64.c

index 6466b1e..e021ba7 100644 (file)
@@ -1394,7 +1394,7 @@ void stabs32_output(int type, void *param)
     if (type == TY_STABSSYMLIN) {
         if (stabs_immcall) {
             s = (struct symlininfo *)param;
-            if (strcmp(s->name, ".text"))
+            if (!(sects[s->section]->flags & SHF_EXECINSTR))
                 return;         /* we are only interested in the text stuff */
             numlinestabs++;
             el = (struct linelist *)nasm_malloc(sizeof(struct linelist));
@@ -1492,16 +1492,16 @@ void stabs32_generate(void)
     stabstrlen = strsize;       /* set global variable for length of stab strings */
 
     sptr = sbuf;
-    /* this is the first stab, its strx points to the filename of the
-       the source-file, the n_desc field should be set to the number
-       of remaining stabs
-     */
-    WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12));
-
     ptr = stabslines;
     numstabs = 0;
 
     if (ptr) {
+        /* this is the first stab, its strx points to the filename of the
+        the source-file, the n_desc field should be set to the number
+        of remaining stabs
+        */
+        WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12));
+
         /* this is the stab for the main source file */
         WRITE_STAB(sptr, fileidx[mainfileindex], N_SO, 0, 0, 0);
 
index a72a6bf..3ef19a2 100644 (file)
@@ -1409,7 +1409,7 @@ void stabs64_output(int type, void *param)
     if (type == TY_STABSSYMLIN) {
         if (stabs_immcall) {
             s = (struct symlininfo *)param;
-            if (strcmp(s->name, ".text"))
+            if (!(sects[s->section]->flags & SHF_EXECINSTR))
                 return;         /* we are only interested in the text stuff */
             numlinestabs++;
             el = (struct linelist *)nasm_malloc(sizeof(struct linelist));
@@ -1507,16 +1507,16 @@ void stabs64_generate(void)
     stabstrlen = strsize;       /* set global variable for length of stab strings */
 
     sptr = sbuf;
-    /* this is the first stab, its strx points to the filename of the
-       the source-file, the n_desc field should be set to the number
-       of remaining stabs
-     */
-    WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12));
-
     ptr = stabslines;
     numstabs = 0;
 
     if (ptr) {
+        /* this is the first stab, its strx points to the filename of the
+        the source-file, the n_desc field should be set to the number
+        of remaining stabs
+        */
+        WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12));
+
         /* this is the stab for the main source file */
         WRITE_STAB(sptr, fileidx[mainfileindex], N_SO, 0, 0, 0);