1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-03 06:29:36 +00:00

Added more debug output.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5041 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-06-08 18:28:21 +00:00
parent 8cb4788e13
commit c17816fafd
2 changed files with 19 additions and 7 deletions

View File

@ -172,6 +172,7 @@ Section* NewSection (Segment* Seg, unsigned char Align, unsigned char AddrSize)
/* Initialize the data */
S->Next = 0;
S->Seg = Seg;
S->Obj = 0;
S->FragRoot = 0;
S->FragLast = 0;
S->Size = 0;
@ -231,6 +232,9 @@ Section* ReadSection (FILE* F, ObjData* O)
/* Allocate the section we will return later */
Sec = NewSection (S, Align, Type);
/* Remember the object file this section was from */
Sec->Obj = O;
/* Set up the minimum segment alignment */
if (Sec->Align > S->Align) {
/* Section needs larger alignment, use this one */
@ -467,7 +471,12 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
while (Sec) {
Fragment* Frag;
/* Output were this section is from */
Print (stdout, 2, " Section from \"%s\"\n", GetObjFileName (Sec->Obj));
/* If we have fill bytes, write them now */
Print (stdout, 2, " Filling 0x%x bytes with 0x%02x\n",
Sec->Fill, S->FillVal);
WriteMult (Tgt, S->FillVal, Sec->Fill);
Offs += Sec->Fill;
@ -480,14 +489,14 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
/* Output fragment data */
switch (Frag->Type) {
switch (Frag->Type) {
case FRAG_LITERAL:
WriteData (Tgt, Frag->LitBuf, Frag->Size);
break;
case FRAG_LITERAL:
WriteData (Tgt, Frag->LitBuf, Frag->Size);
break;
case FRAG_EXPR:
case FRAG_SEXPR:
case FRAG_EXPR:
case FRAG_SEXPR:
Sign = (Frag->Type == FRAG_SEXPR);
/* Call the users function and evaluate the result */
switch (F (Frag->Expr, Sign, Frag->Size, Offs, Data)) {
@ -527,6 +536,8 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void*
}
/* Update the offset */
Print (stdout, 2, " Fragment with 0x%x bytes\n",
Frag->Size);
Offs += Frag->Size;
/* Next fragment */

View File

@ -70,7 +70,7 @@ struct Segment {
unsigned char AddrSize; /* Address size of segment */
unsigned char ReadOnly; /* True for readonly segments (config) */
unsigned char Relocatable; /* True if the segment is relocatable */
unsigned char Placed; /* Did we place this segment already? */
unsigned char Placed; /* Did we place this segment already? */
unsigned char Dumped; /* Did we dump this segment? */
};
@ -81,6 +81,7 @@ typedef struct Section Section;
struct Section {
Section* Next; /* List of sections in a segment */
Segment* Seg; /* Segment that contains the section */
struct ObjData* Obj; /* Object file this section comes from */
struct Fragment* FragRoot; /* Fragment list */
struct Fragment* FragLast; /* Pointer to last fragment */
unsigned long Offs; /* Offset into the segment */