Pass type of line info through the object files.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4957 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-01-29 22:16:03 +00:00
parent 0e32325ca6
commit 299a0ed4cd
7 changed files with 48 additions and 26 deletions

View File

@@ -33,6 +33,9 @@
/* common */
#include "lidefs.h"
/* ld65 */
#include "dbginfo.h"
#include "fileinfo.h"
@@ -67,6 +70,10 @@ void PrintDbgInfo (ObjData* O, FILE* F)
/* Get this line info */
const LineInfo* LI = CollConstAt (&O->LineInfos, I);
/* Get the line info type and count */
unsigned Type = LI_GET_TYPE (LI->Type);
unsigned Count = LI_GET_COUNT (LI->Type);
/* Get a pointer to the code ranges */
const Collection* CodeRanges = &LI->CodeRanges;
@@ -78,9 +85,21 @@ void PrintDbgInfo (ObjData* O, FILE* F)
/* Print it */
fprintf (F,
"line\tfile=%u,line=%lu,segment=%u,range=0x%06lX-0x%06lX\n",
"line\tfile=%u,line=%lu,segment=%u,range=0x%06lX-0x%06lX",
LI->File->Id, GetSourceLine (LI), R->Seg->Id,
R->Offs, R->Offs + R->Size - 1);
/* Print type if not LI_TYPE_ASM and count if not zero */
if (Type != LI_TYPE_ASM) {
fprintf (F, ",type=%u", Type);
}
if (Count != 0) {
fprintf (F, ",count=%u", Count);
}
/* Terminate line */
fputc ('\n', F);
}
}
}

View File

@@ -35,6 +35,7 @@
/* common */
#include "check.h"
#include "lidefs.h"
#include "xmalloc.h"
/* ld65 */
@@ -78,10 +79,11 @@ static LineInfo* NewLineInfo (void)
LineInfo* LI = xmalloc (sizeof (LineInfo));
/* Initialize the fields */
LI->File = 0;
LI->Type = LI_TYPE_ASM;
LI->Pos.Name = INVALID_STRING_ID;
LI->Pos.Line = 0;
LI->Pos.Col = 0;
LI->File = 0;
LI->Fragments = EmptyCollection;
LI->CodeRanges = EmptyCollection;
@@ -92,7 +94,7 @@ static LineInfo* NewLineInfo (void)
LineInfo* GenLineInfo (const FilePos* Pos)
/* Generate a new (internally used) line info with the given information */
/* Generate a new (internally used) line info with the given information */
{
/* Create a new LineInfo struct */
LineInfo* LI = NewLineInfo ();
@@ -113,6 +115,7 @@ LineInfo* ReadLineInfo (FILE* F, ObjData* O)
LineInfo* LI = NewLineInfo ();
/* Read/fill the fields in the new LineInfo */
LI->Type = ReadVar (F);
LI->Pos.Line = ReadVar (F);
LI->Pos.Col = ReadVar (F);
LI->File = CollAt (&O->Files, ReadVar (F));
@@ -242,5 +245,4 @@ void RelocLineInfo (Segment* S)

View File

@@ -82,6 +82,7 @@ struct CodeRange {
typedef struct LineInfo LineInfo;
struct LineInfo {
struct FileInfo* File; /* File struct for this line if any */
unsigned Type; /* Type of line info */
FilePos Pos; /* Position in file */
Collection Fragments; /* Fragments for this line */
Collection CodeRanges; /* Code ranges for this line */