/* */
/* */
/* */
-/* (C) 1998-2000 Ullrich von Bassewitz */
+/* (C) 1998-2001 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
#include "fileio.h"
#include "fragment.h"
#include "global.h"
+#include "lineinfo.h"
#include "segments.h"
Type = Read8 (F);
/* Print some data */
- Print (stdout, 1, "Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
+ Print (stdout, 2, "Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
GetObjFileName (O), Name, Size, Align, Type);
/* Get the segment for this section */
while (Size) {
Fragment* Frag;
+ unsigned LineInfoIndex;
/* Read the fragment type */
unsigned char Type = Read8 (F);
case FRAG_SEXPR:
/* An expression */
Frag->Expr = ReadExpr (F, O);
- break;
+ break;
}
/* Read the file position of the fragment */
ReadFilePos (F, &Frag->Pos);
+ /* Read the additional line info and resolve it */
+ LineInfoIndex = ReadVar (F);
+ if (LineInfoIndex) {
+ --LineInfoIndex;
+ if (LineInfoIndex >= O->LineInfoCount) {
+ Internal ("In module `%s', file `%s', line %lu: Invalid line "
+ "info with index %u (max count %u)",
+ GetObjFileName (O),
+ GetSourceFileName (O, Frag->Pos.Name),
+ Frag->Pos.Line, LineInfoIndex, O->LineInfoCount);
+ }
+ /* Point from the fragment to the line info... */
+ Frag->LI = O->LineInfos[LineInfoIndex];
+ /* ...and back from the line info to the fragment */
+ CollAppend (&Frag->LI->Fragments, Frag);
+ }
+
/* Remember the module we had this fragment from */
Frag->Obj = O;
/* If we have fill bytes, write them now */
WriteMult (Tgt, S->FillVal, Sec->Fill);
+ Offs += Sec->Fill;
/* Loop over all fragments in this section */
Frag = Sec->FragRoot;