From 88b3489d898983eb13ff9a70ca49283da25958fe Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 27 Jan 2011 16:47:45 +0000 Subject: [PATCH] Adapt to changed object file format. git-svn-id: svn://svn.cc65.org/cc65/trunk@4930 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/od65/dump.c | 42 +++++++++++++++++++++++++++++------------- src/od65/main.c | 4 ++-- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/od65/dump.c b/src/od65/dump.c index 26b0c38e9..d812358c4 100644 --- a/src/od65/dump.c +++ b/src/od65/dump.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2002-2010, Ullrich von Bassewitz */ +/* (C) 2002-2011, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -111,7 +111,7 @@ static char* TimeToStr (unsigned long Time) /* Remove the trailing newline */ unsigned Len = strlen (S); if (Len > 0 && S[Len-1] == '\n') { - S[Len-1 ] = '\0'; + S[Len-1 ] = '\0'; } /* Return the time string */ @@ -120,6 +120,20 @@ static char* TimeToStr (unsigned long Time) +static void SkipLineInfoList (FILE* F) +/* Skip a line info 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 */ { @@ -145,7 +159,7 @@ static void SkipExpr (FILE* F) case EXPR_SECTION: /* Read the segment number */ (void) Read8 (F); - break; + break; default: Error ("Invalid expression op: %02X", Op); @@ -180,7 +194,7 @@ static const char* GetExportFlags (unsigned Flags, const unsigned char* ConDes) } /* Symbol usage */ - switch (Flags & SYM_MASK_LABEL) { + switch (Flags & SYM_MASK_LABEL) { case SYM_EQUATE: strcat (TypeDesc, ",SYM_EQUATE"); break; case SYM_LABEL: strcat (TypeDesc, ",SYM_LABEL"); break; } @@ -388,7 +402,7 @@ void DumpObjFiles (FILE* F, unsigned long Offset) /* Read the data for one file */ const char* Name = GetString (&StrPool, ReadVar (F)); unsigned long MTime = Read32 (F); - unsigned long Size = Read32 (F); + unsigned long Size = ReadVar (F); unsigned Len = strlen (Name); /* Print the header */ @@ -473,7 +487,6 @@ void DumpObjImports (FILE* F, unsigned long Offset) Collection StrPool = AUTO_COLLECTION_INITIALIZER; unsigned Count; unsigned I; - FilePos Pos; /* Seek to the header position and read the header */ FileSetPos (F, Offset); @@ -500,7 +513,9 @@ void DumpObjImports (FILE* F, unsigned long Offset) unsigned char AddrSize = Read8 (F); const char* Name = GetString (&StrPool, ReadVar (F)); unsigned Len = strlen (Name); - ReadFilePos (F, &Pos); + + /* Skip the line infos */ + SkipLineInfoList (F); /* Print the header */ printf (" Index:%27u\n", I); @@ -524,7 +539,6 @@ void DumpObjExports (FILE* F, unsigned long Offset) Collection StrPool = AUTO_COLLECTION_INITIALIZER; unsigned Count; unsigned I; - FilePos Pos; /* Seek to the header position and read the header */ FileSetPos (F, Offset); @@ -567,7 +581,9 @@ void DumpObjExports (FILE* F, unsigned long Offset) Value = Read32 (F); HaveValue = 1; } - ReadFilePos (F, &Pos); + + /* Skip the line infos */ + SkipLineInfoList (F); /* Print the header */ printf (" Index:%27u\n", I); @@ -595,7 +611,6 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset) Collection StrPool = AUTO_COLLECTION_INITIALIZER; unsigned Count; unsigned I; - FilePos Pos; /* Seek to the header position and read the header */ FileSetPos (F, Offset); @@ -640,7 +655,9 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset) Value = Read32 (F); HaveValue = 1; } - ReadFilePos (F, &Pos); + + /* Skip the line infos */ + SkipLineInfoList (F); /* Print the header */ printf (" Index:%27u\n", I); @@ -697,9 +714,8 @@ void DumpObjLineInfo (FILE* F, unsigned long Offset) /* Read and print all line infos */ for (I = 0; I < Count; ++I) { - FilePos Pos; - /* Read one line info */ + FilePos Pos; ReadFilePos (F, &Pos); /* Print the header */ diff --git a/src/od65/main.c b/src/od65/main.c index e8bea3cba..aa046634f 100644 --- a/src/od65/main.c +++ b/src/od65/main.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2009, Ullrich von Bassewitz */ +/* (C) 2000-2011, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -201,7 +201,7 @@ static void OptVersion (const char* Opt attribute ((unused)), /* Print the assembler version */ { fprintf (stderr, - "%s V%s - (C) Copyright 2000-2009, Ullrich von Bassewitz\n", + "%s V%s - (C) Copyright 2000-2011, Ullrich von Bassewitz\n", ProgName, GetVersionAsString ()); }