mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Output information about the item counts in the debug info file.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5136 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
57e39e0e04
commit
07cd427110
@ -102,6 +102,19 @@ void CreateDbgFile (void)
|
||||
/* Output version information */
|
||||
fprintf (F, "version\tmajor=2,minor=0\n");
|
||||
|
||||
/* Output a line with the item numbers so the debug info module is able
|
||||
* to preallocate the required memory.
|
||||
*/
|
||||
fprintf (
|
||||
F,
|
||||
"info\tlib=%u,mod=%u,seg=%u,file=%u,scope=%u\n",
|
||||
LibraryCount (),
|
||||
ObjDataCount (),
|
||||
SegmentCount (),
|
||||
FileInfoCount (),
|
||||
ScopeCount ()
|
||||
);
|
||||
|
||||
/* Assign the ids to the items */
|
||||
AssignIds ();
|
||||
|
||||
|
@ -193,6 +193,14 @@ FileInfo* ReadFileInfo (FILE* F, ObjData* O)
|
||||
|
||||
|
||||
|
||||
unsigned FileInfoCount (void)
|
||||
/* Return the total number of file infos */
|
||||
{
|
||||
return CollCount (&FileInfos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AssignFileInfoIds (void)
|
||||
/* Remove unused file infos and assign the ids to the remaining ones */
|
||||
{
|
||||
|
@ -75,6 +75,9 @@ struct FileInfo {
|
||||
FileInfo* ReadFileInfo (FILE* F, ObjData* O);
|
||||
/* Read a file info from a file and return it */
|
||||
|
||||
unsigned FileInfoCount (void);
|
||||
/* Return the total number of file infos */
|
||||
|
||||
void AssignFileInfoIds (void);
|
||||
/* Assign the ids to the file infos */
|
||||
|
||||
|
@ -76,7 +76,7 @@ struct Library {
|
||||
static Collection OpenLibs = STATIC_COLLECTION_INITIALIZER;
|
||||
|
||||
/* List of used libraries */
|
||||
static Collection Libraries = STATIC_COLLECTION_INITIALIZER;
|
||||
static Collection LibraryList = STATIC_COLLECTION_INITIALIZER;
|
||||
|
||||
/* Flag for library grouping */
|
||||
static int Grouping = 0;
|
||||
@ -431,8 +431,8 @@ static void LibResolve (void)
|
||||
*/
|
||||
if (CollCount (&L->Modules) > 0) {
|
||||
CloseLibrary (L);
|
||||
L->Id = CollCount (&Libraries);
|
||||
CollAppend (&Libraries, L);
|
||||
L->Id = CollCount (&LibraryList);
|
||||
CollAppend (&LibraryList, L);
|
||||
} else {
|
||||
/* Delete the library */
|
||||
FreeLibrary (L);
|
||||
@ -526,15 +526,23 @@ unsigned GetLibId (const Library* L)
|
||||
|
||||
|
||||
|
||||
unsigned LibraryCount (void)
|
||||
/* Return the total number of libraries */
|
||||
{
|
||||
return CollCount (&LibraryList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintDbgLibraries (FILE* F)
|
||||
/* Output the libraries to a debug info file */
|
||||
{
|
||||
unsigned I;
|
||||
|
||||
/* Output information about all libraries */
|
||||
for (I = 0; I < CollCount (&Libraries); ++I) {
|
||||
for (I = 0; I < CollCount (&LibraryList); ++I) {
|
||||
/* Get the library */
|
||||
const Library* L = CollAtUnchecked (&Libraries, I);
|
||||
const Library* L = CollAtUnchecked (&LibraryList, I);
|
||||
|
||||
/* Output the info */
|
||||
fprintf (F, "library\tid=%u,name=\"%s\"\n", L->Id, GetString (L->Name));
|
||||
|
@ -81,6 +81,9 @@ const char* GetLibFileName (const struct Library* L);
|
||||
unsigned GetLibId (const struct Library* L);
|
||||
/* Get the id of a library file. */
|
||||
|
||||
unsigned LibraryCount (void);
|
||||
/* Return the total number of libraries */
|
||||
|
||||
void PrintDbgLibraries (FILE* F);
|
||||
/* Output the libraries to a debug info file */
|
||||
|
||||
|
@ -216,6 +216,14 @@ struct Scope* GetObjScope (ObjData* O, unsigned Id)
|
||||
|
||||
|
||||
|
||||
unsigned ObjDataCount (void)
|
||||
/* Return the total number of modules */
|
||||
{
|
||||
return CollCount (&ObjDataList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintDbgModules (FILE* F)
|
||||
/* Output the modules to a debug info file */
|
||||
{
|
||||
|
@ -145,6 +145,9 @@ struct Section* GetObjSection (ObjData* Obj, unsigned Id);
|
||||
struct Scope* GetObjScope (ObjData* Obj, unsigned Id);
|
||||
/* Get a scope from an object file checking for a valid index */
|
||||
|
||||
unsigned ObjDataCount (void);
|
||||
/* Return the total number of modules */
|
||||
|
||||
void PrintDbgModules (FILE* F);
|
||||
/* Output the modules to a debug info file */
|
||||
|
||||
|
@ -98,6 +98,25 @@ Scope* ReadScope (FILE* F, ObjData* Obj, unsigned Id)
|
||||
|
||||
|
||||
|
||||
unsigned ScopeCount (void)
|
||||
/* Return the total number of scopes */
|
||||
{
|
||||
|
||||
/* Count scopes from all modules we have linked into the output file */
|
||||
unsigned I;
|
||||
unsigned Count = 0;
|
||||
for (I = 0; I < CollCount (&ObjDataList); ++I) {
|
||||
/* Get the object file */
|
||||
const ObjData* O = CollAtUnchecked (&ObjDataList, I);
|
||||
|
||||
/* Account for the scopes in this file */
|
||||
Count += CollCount (&O->Scopes);
|
||||
}
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintDbgScopes (FILE* F)
|
||||
/* Output the scopes to a debug info file */
|
||||
{
|
||||
@ -132,7 +151,7 @@ void PrintDbgScopes (FILE* F)
|
||||
if (SCOPE_HAS_LABEL (S->Flags)) {
|
||||
fprintf (F, ",sym=%u", O->SymBaseId + S->LabelId);
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the output line */
|
||||
fputc ('\n', F);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ struct Scope {
|
||||
ObjData* Obj; /* Object file that contains the scope */
|
||||
unsigned ParentId; /* Id of parent scope */
|
||||
unsigned LabelId; /* Id of the scope label if any */
|
||||
unsigned LexicalLevel; /* Lexical level */
|
||||
unsigned LexicalLevel; /* Lexical level */
|
||||
unsigned Flags;
|
||||
unsigned Type; /* Type of scope */
|
||||
unsigned Name; /* Name of scope */
|
||||
@ -81,6 +81,9 @@ struct Scope {
|
||||
Scope* ReadScope (FILE* F, ObjData* Obj, unsigned Id);
|
||||
/* Read a scope from a file, insert and return it */
|
||||
|
||||
unsigned ScopeCount (void);
|
||||
/* Return the total number of scopes */
|
||||
|
||||
void PrintDbgScopes (FILE* F);
|
||||
/* Output the scopes to a debug info file */
|
||||
|
||||
|
@ -347,7 +347,7 @@ void SegDump (void)
|
||||
unsigned I;
|
||||
unsigned long Count;
|
||||
unsigned char* Data;
|
||||
|
||||
|
||||
for (I = 0; I < CollCount (&SegmentList); ++I) {
|
||||
const Segment* Seg = CollConstAt (&SegmentList, I);
|
||||
Section* S = Seg->SecRoot;
|
||||
@ -546,6 +546,14 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
|
||||
|
||||
|
||||
|
||||
unsigned SegmentCount (void)
|
||||
/* Return the total number of segments */
|
||||
{
|
||||
return CollCount (&SegmentList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int CmpSegStart (const void* K1, const void* K2)
|
||||
/* Compare function for qsort */
|
||||
{
|
||||
@ -613,7 +621,7 @@ void PrintSegmentMap (FILE* F)
|
||||
|
||||
void PrintDbgSegments (FILE* F)
|
||||
/* Output the segments to the debug file */
|
||||
{
|
||||
{
|
||||
/* Walk over all segments */
|
||||
unsigned I;
|
||||
for (I = 0; I < CollCount (&SegmentList); ++I) {
|
||||
|
@ -147,6 +147,9 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
|
||||
* called (see description of SegWriteFunc above).
|
||||
*/
|
||||
|
||||
unsigned SegmentCount (void);
|
||||
/* Return the total number of segments */
|
||||
|
||||
void PrintSegmentMap (FILE* F);
|
||||
/* Print a segment map to the given file */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user