Write spans out in a separate object file section. This allows to merge

duplicate spans in an object file and more extensions to come.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5250 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-21 19:08:23 +00:00
parent 37ac033370
commit 358ccf236e
18 changed files with 396 additions and 111 deletions

View File

@@ -136,6 +136,20 @@ static void SkipLineInfoList (FILE* F)
static void SkipSpanList (FILE* F)
/* Skip a span list from the given file */
{
/* Count preceeds the list */
unsigned long Count = ReadVar (F);
/* Skip indices */
while (Count--) {
(void) ReadVar (F);
}
}
static void SkipExpr (FILE* F)
/* Skip an expression from the given file */
{
@@ -772,13 +786,17 @@ void DumpObjLineInfo (FILE* F, unsigned long Offset)
for (I = 0; I < Count; ++I) {
FilePos Pos;
/* Type of line info */
unsigned Type = ReadVar (F);
unsigned Type;
/* File position of line info */
ReadFilePos (F, &Pos);
/* Type of line info */
Type = ReadVar (F);
/* Skip the spans */
SkipSpanList (F);
/* Print the header */
printf (" Index:%27u\n", I);
@@ -834,8 +852,6 @@ void DumpObjScopes (FILE* F, unsigned long Offset)
const char* Name;
unsigned Len;
unsigned SpanCount;
unsigned J;
/* Read the data */
unsigned ParentId = ReadVar (F);
@@ -869,17 +885,8 @@ void DumpObjScopes (FILE* F, unsigned long Offset)
printf (" Label id:%22u\n", LabelId);
}
/* Spans */
SpanCount = ReadVar (F);
printf (" Segment spans:\n");
printf (" Count:%23u\n", SpanCount);
for (J = 0; J < SpanCount; ++J) {
printf (" Index:%23u\n", J);
printf (" Segment:%19lu\n", ReadVar (F));
printf (" Start:%13s0x%06lX\n", "", ReadVar (F));
printf (" Size:%14s0x%06lX\n", "", ReadVar (F));
}
/* Skip the spans */
SkipSpanList (F);
}
/* Destroy the string pool */

View File

@@ -6,10 +6,10 @@
/* */
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* (C) 1998-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -53,7 +53,7 @@
void FileSetPos (FILE* F, unsigned long Pos)
/* Seek to the given absolute position, fail on errors */
{
{
if (fseek (F, Pos, SEEK_SET) != 0) {
Error ("Cannot seek: %s", strerror (errno));
}
@@ -229,6 +229,8 @@ void ReadObjHeader (FILE* F, ObjHeader* H)
H->AssertSize = Read32 (F);
H->ScopeOffs = Read32 (F);
H->ScopeSize = Read32 (F);
H->SpanOffs = Read32 (F);
H->SpanSize = Read32 (F);
}