From 1e0ab407cd4964ba78a4de3e284088fdfa3f02f3 Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 22 Aug 2011 21:52:40 +0000 Subject: [PATCH] Added the LineInfo count to the info line of the debug info file. This allows the debug info module to reduce memory usage. git-svn-id: svn://svn.cc65.org/cc65/trunk@5265 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/dbgfile.c | 27 ++++++++++++++------------- src/ld65/lineinfo.c | 20 ++++++++++++++++++++ src/ld65/lineinfo.h | 3 +++ 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/ld65/dbgfile.c b/src/ld65/dbgfile.c index 358849100..e171866e6 100644 --- a/src/ld65/dbgfile.c +++ b/src/ld65/dbgfile.c @@ -47,7 +47,7 @@ #include "lineinfo.h" #include "scopes.h" #include "segments.h" -#include "span.h" +#include "span.h" #include "tpool.h" @@ -115,9 +115,10 @@ void CreateDbgFile (void) */ fprintf ( F, - "info\tfile=%u,lib=%u,mod=%u,scope=%u,seg=%u,span=%u,type=%u\n", + "info\tfile=%u,lib=%u,line=%u,mod=%u,scope=%u,seg=%u,span=%u,type=%u\n", FileInfoCount (), LibraryCount (), + LineInfoCount (), ObjDataCount (), ScopeCount (), SegmentCount (), @@ -128,32 +129,32 @@ void CreateDbgFile (void) /* Assign the ids to the items */ AssignIds (); + /* Output files */ + PrintDbgFileInfo (F); + /* Output libraries */ PrintDbgLibraries (F); + /* Output line info */ + PrintDbgLineInfo (F); + /* Output modules */ PrintDbgModules (F); /* Output the segment info */ PrintDbgSegments (F); - /* Output files */ - PrintDbgFileInfo (F); - - /* Output line info */ - PrintDbgLineInfo (F); - /* Output spans */ PrintDbgSpans (F); - - /* Output types */ - PrintDbgTypes (F); + + /* Output scopes */ + PrintDbgScopes (F); /* Output symbols */ PrintDbgSyms (F); - /* Output scopes */ - PrintDbgScopes (F); + /* Output types */ + PrintDbgTypes (F); /* Close the file */ if (fclose (F) != 0) { diff --git a/src/ld65/lineinfo.c b/src/ld65/lineinfo.c index 0e0368541..c7af64996 100644 --- a/src/ld65/lineinfo.c +++ b/src/ld65/lineinfo.c @@ -177,6 +177,26 @@ const LineInfo* GetAsmLineInfo (const Collection* LineInfos) +unsigned LineInfoCount (void) +/* Return the total number of line infos */ +{ + /* Walk over all object files */ + unsigned I; + unsigned Count = 0; + for (I = 0; I < CollCount (&ObjDataList); ++I) { + + /* Get this object file */ + const ObjData* O = CollAtUnchecked (&ObjDataList, I); + + /* Count spans */ + Count += CollCount (&O->LineInfos); + } + + return Count; +} + + + void AssignLineInfoIds (void) /* Assign the ids to the line infos */ { diff --git a/src/ld65/lineinfo.h b/src/ld65/lineinfo.h index 9e32803ee..db4f84f4a 100644 --- a/src/ld65/lineinfo.h +++ b/src/ld65/lineinfo.h @@ -171,6 +171,9 @@ INLINE unsigned GetSourceLineFromList (const Collection* LineInfos) GetSourceLine ((const LineInfo*) CollConstAt ((LineInfos), 0)) #endif +unsigned LineInfoCount (void); +/* Return the total number of line infos */ + void AssignLineInfoIds (void); /* Assign the ids to the line infos */ -- 2.39.5