]> git.gag.com Git - fw/sdcc/commitdiff
When generating aomf51 file, corrected bug in static functions, and a bug
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 11 Dec 2002 12:04:59 +0000 (12:04 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 11 Dec 2002 12:04:59 +0000 (12:04 +0000)
when including debug information from the libraries.

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

as/mcs51/lkaomf51.c
as/mcs51/lklibr.c
as/mcs51/lkmain.c

index 7082e675bd8942f51a566c5fbcaac8a56ef6b998..d100081a4f7037992d4381f752ae4b5bc99dfa9d 100644 (file)
@@ -25,6 +25,7 @@
 
 #define EQ(A,B) !strcmp((A),(B))
 #define MEMSIZE 0x10000
+//#define DODUMP 1
 
 typedef struct
 {
@@ -122,7 +123,7 @@ void GetName(char * filepath, char * name)
 void SaveLinkedFilePath(char * filepath) 
 {
        int j;
-       
+
        if(dflag)
        {
                infn=realloc(infn, sizeof(_infn)*(numin+1));
@@ -143,7 +144,12 @@ void SaveLinkedFilePath(char * filepath)
                GetName(infn[numin].PathName, infn[numin].ModuleName);
                //printf("%s, %s\n", infn[numin].PathName, infn[numin].ModuleName);
                
-               numin++;
+               /*Check if this filename is already in*/
+               for(j=0; j<numin; j++)
+               {
+                       if(EQ(infn[numin].PathName, infn[j].PathName)) break;
+               }
+               if(j==numin) numin++;
        }
 }
 
@@ -210,6 +216,7 @@ void OutputChkSum(void)
        GlobalChkSum=0;
 }
 
+#ifdef DODUMP
 void DumpForDebug (void)
 {
        char DumpFileName[PATH_MAX];
@@ -260,6 +267,7 @@ void DumpForDebug (void)
 
        fclose(DumpFile);
 }
+#endif
 
 void OutputAOEMF51(void)
 {
@@ -536,6 +544,7 @@ void CollectInfoFromCDB(void)
        if(CDBin==NULL)
        {
                printf("Couldn't open file '%s'\n", SourceName);
+               lkexit(1);
        }
 
        CurrentModule=0; /*Set the active module as the first one*/
@@ -725,6 +734,17 @@ void CollectInfoFromCDB(void)
                                                                break;
                                                        }
                                                }
+                                               
+                                               /*It could be also a static function*/
+                                               for(j=0; j<numproc; j++)
+                                               {
+                                                       if(EQ(procedure[j].name, name))
+                                                       {
+                                                               if( (procedure[j].BeginAdd==-1) ) procedure[j].BeginAdd=Address;
+                                                               break;
+                                                       }
+                                               }
+
                                        break;
                                        
                                        case 'L': /*Example L:Lmain$j$1$1:29*/
@@ -925,7 +945,9 @@ void CreateAOMF51(void)
        if(dflag)
        {
                CollectInfoFromCDB();
-               //DumpForDebug();
+               #ifdef DODUMP
+               DumpForDebug();
+               #endif
                HexSize=ReadHexFile(&HexBegin)+1;
                OutputAOEMF51();
                FreeAll();
index 26d4a8811e1a436963423b4b2a6dacfcb98bc9e4..555adb1756ac9d689f3bfa05fb1bb001439da212 100644 (file)
@@ -462,6 +462,7 @@ char *name;
                        if (dflag && dfp) {
                            FILE *xfp = afile(str,"adb",0); //JCF: Nov 30, 2002
                            if (xfp) {
+                               SaveLinkedFilePath(str);
                                copyfile(dfp,xfp);
                                fclose(xfp);
                            }
index 1d8df7cf6c9d69ecab8d6dc4733dcfc3d23ee4a3..e0f6a924b766339c787000e6257383752272767d 100644 (file)
@@ -245,6 +245,7 @@ char *argv[];
        
        if (dflag){
            //dfp = afile("temp", "cdb", 1);
+               SaveLinkedFilePath(linkp->f_idp); //Must be the first one... 
                dfp = afile(linkp->f_idp,"cdb",1); //JCF: Nov 30, 2002
            if (dfp == NULL) 
                lkexit(1);