]> Shamusworld >> Repos - rln/commitdiff
Enable debug symbol propagation
authorJames Jones <atari@theinnocuous.com>
Wed, 13 Jul 2022 22:22:46 +0000 (15:22 -0700)
committerShamus Hammons <jlhamm@acm.org>
Tue, 16 Aug 2022 02:31:52 +0000 (21:31 -0500)
The existing code was sufficient to pass through
and relocate most debug symbols as necessary. It
was just disabled for some reason. The only bugs
were in the handling of non-text line numbers,
which aren't ever used as far as I can tell, and
include files, which should be relocated like
line numbers to match ALN's behavior.

rln.c

diff --git a/rln.c b/rln.c
index 4ae8d4435f75b6799ff9b9d59a2d609818735f22..212a05cf8a48c04736e5921133946f061552f37a 100644 (file)
--- a/rln.c
+++ b/rln.c
@@ -33,7 +33,6 @@ unsigned dataoffset = 0;                      // COF DATA segment offset
 unsigned bssoffset = 0;                                // COF BSS segment offset
 unsigned displaybanner = 1;                    // Display version banner
 unsigned symoffset = 0;                                // Symbol table offset in output file
-unsigned dbgsymbase = 0;                       // Debug symbol base address
 int noheaderflag = 0;                          // No header flag for ABS files
 int hflags;                                                    // Value of the arg to -h option
 int ttype, dtype, btype;                       // Type flag: 0, -1, -2, -3, -4
@@ -245,26 +244,21 @@ int DoSymbols(struct OFILE * ofile)
                if (type & 0xF0000000)
                {
                        // DEBUG SYMBOL
-                       // Set the correct debug symbol base address (TEXT segment)
-#if 0
-                       dbgsymbase = 0;
-
-                       for(j=0; (unsigned)j<dosymi; j++)
-                               dbgsymbase += obj_segsize[j][0];
-#else
-                       dbgsymbase = ofile->segBase[TEXT];
-#endif
-
                        switch (type & 0xFF000000)
                        {
-                       case 0x64000000:
-                               value = tval + dbgsymbase;
+                       case 0x64000000: // Primary source file path and/or name
+                       case 0x84000000: // Included source file path and/or name
+                       case 0x44000000: // Text line number
+                               value = tbase + tsegoffset + value;
+                               break;
+                       case 0x46000000: // Data line number (Not used by GCC/rmac)
+                               value = dbase + dsegoffset + value;
                                break;
-                       case 0x44000000:
-                       case 0x46000000:
-                       case 0x48000000:
-                               value = tval + dbgsymbase + value;
+                       case 0x48000000: // BSS line number (Not used by GCC/rmac)
+                               value = bbase + bsegoffset + value;
                        default:
+                               // All other debug symbols don't need to be relocated
+                               // XXX Not true, but matches ALN behavior.
                                break;
                        }
 
@@ -3133,12 +3127,8 @@ int doargs(int argc, char * argv[])
                                break;
                        case 'g':
                        case 'G':                                       // Output source level debugging
-                               printf("\'g\' flag not currently implemented\n");
-                               gflag = 0;
-                               /*
                                if (gflag) warn('g', 1);
                                gflag = 1;
-                               */
                                break;
                        case 'i':
                        case 'I':                                       // Include binary file