/* */
/* */
/* */
-/* (C) 1998 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 1998-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* common */
#include "xmalloc.h"
-
+
/* ar65 */
#include "error.h"
#include "objdata.h"
if (H->Version != OBJ_VERSION) {
Error ("Object file `%s' has wrong version", Name);
}
- H->Flags = Read16 (Obj);
- H->OptionOffs = Read32 (Obj);
- H->OptionSize = Read32 (Obj);
- H->FileOffs = Read32 (Obj);
- H->FileSize = Read32 (Obj);
- H->SegOffs = Read32 (Obj);
- H->SegSize = Read32 (Obj);
- H->ImportOffs = Read32 (Obj);
- H->ImportSize = Read32 (Obj);
- H->ExportOffs = Read32 (Obj);
- H->ExportSize = Read32 (Obj);
- H->DbgSymOffs = Read32 (Obj);
- H->DbgSymSize = Read32 (Obj);
+ H->Flags = Read16 (Obj);
+ H->OptionOffs = Read32 (Obj);
+ H->OptionSize = Read32 (Obj);
+ H->FileOffs = Read32 (Obj);
+ H->FileSize = Read32 (Obj);
+ H->SegOffs = Read32 (Obj);
+ H->SegSize = Read32 (Obj);
+ H->ImportOffs = Read32 (Obj);
+ H->ImportSize = Read32 (Obj);
+ H->ExportOffs = Read32 (Obj);
+ H->ExportSize = Read32 (Obj);
+ H->DbgSymOffs = Read32 (Obj);
+ H->DbgSymSize = Read32 (Obj);
+ H->LineInfoOffs = Read32 (Obj);
+ H->LineInfoSize = Read32 (Obj);
}
Write32 (Obj, H->ExportSize);
Write32 (Obj, H->DbgSymOffs);
Write32 (Obj, H->DbgSymSize);
+ Write32 (Obj, H->LineInfoOffs);
+ Write32 (Obj, H->LineInfoSize);
}
}
/* Initialize the object module data structure */
- O->Name = xstrdup (Module);
- O->Flags = OBJ_HAVEDATA;
- O->MTime = StatBuf.st_mtime;
+ O->Name = xstrdup (Module);
+ O->Flags = OBJ_HAVEDATA;
+ O->MTime = StatBuf.st_mtime;
O->ImportSize = H.ImportSize;
O->Imports = xmalloc (O->ImportSize);
O->ExportSize = H.ExportSize;
H.SegOffs = LibCopyTo (Obj, H.SegSize) - O->Start;
fseek (Obj, H.FileOffs, SEEK_SET);
H.FileOffs = LibCopyTo (Obj, H.FileSize) - O->Start;
+ fseek (Obj, H.LineInfoOffs, SEEK_SET);
+ H.LineInfoOffs = LibCopyTo (Obj, H.LineInfoSize) - O->Start;
/* Calculate the amount of data written */
O->Size = ftell (NewLib) - O->Start;
unsigned long Size;
unsigned long MTime;
+ /* Parameters are separated by a comma */
+ ConsumeComma ();
+
/* Name */
if (Tok != TOK_STRCON) {
ErrorSkip (ERR_STRCON_EXPECTED);
unsigned Index;
long LineNum;
+ /* If a parameters follow, this is actual line info. If no parameters
+ * follow, the last line info is terminated.
+ */
+ if (Tok == TOK_SEP) {
+ ClearLineInfo ();
+ return;
+ }
+
+ /* Parameters are separated by a comma */
+ ConsumeComma ();
+
/* The name of the file follows */
if (Tok != TOK_STRCON) {
ErrorSkip (ERR_STRCON_EXPECTED);
#include "xmalloc.h"
/* ca65 */
+#include "objfile.h"
#include "lineinfo.h"
+void ClearLineInfo (void)
+/* Clear the current line info */
+{
+ CurLineInfo = 0;
+}
+
+
+
void MakeLineInfoIndex (void)
/* Walk over the line info list and make an index of all entries ignoring
* those with a usage count of zero.
+void WriteLineInfo (void)
+/* Write a list of all line infos to the object file. */
+{
+ LineInfo* LI;
+
+ /* Tell the object file module that we're about to write line infos */
+ ObjStartLineInfos ();
+
+ /* Check if debug info is requested */
+ if (DbgSyms) {
+
+ /* Write the line info count to the list */
+ ObjWriteVar (LineInfoValid);
+
+ /* Walk through list and write all line infos that have references */
+ LI = LineInfoRoot;
+ while (LI) {
+ if (LI->Usage) {
+ /* Write the source file position */
+ ObjWritePos (&LI->Pos);
+ }
+ LI = LI->Next;
+ }
+
+ } else {
+
+ /* No line infos */
+ ObjWriteVar (0);
+
+ }
+}
+
+
+
/* common */
#include "filepos.h"
+/* ca65 */
+#include "global.h"
+
/*****************************************************************************/
void GenLineInfo (unsigned FileIndex, unsigned long LineNum);
/* Generate a new line info */
+void ClearLineInfo (void);
+/* Clear the current line info */
+
+void MakeLineInfoIndex (void);
+/* Walk over the line info list and make an index of all entries ignoring
+ * those with a usage count of zero.
+ */
+
+void WriteLineInfo (void);
+/* Write a list of all line infos to the object file. */
+
/* End of lineinfo.h */
#include "incpath.h"
#include "instr.h"
#include "istack.h"
+#include "lineinfo.h"
#include "listing.h"
#include "macro.h"
#include "nexttok.h"
/* Write debug symbols if requested */
WriteDbgSyms ();
+ /* Write line infos if requested */
+ WriteLineInfo ();
+
/* Write an updated header and close the file */
ObjClose ();
}
SegCheck ();
}
+ /* If we didn't have an errors, index the line infos */
+ MakeLineInfoIndex ();
+
/* Dump the data */
if (Verbosity >= 2) {
SymDump (stdout);
Fragment* Frag;
Fragment* F;
unsigned long Size;
+ unsigned LineInfoIndex;
/* Write the segment name followed by the byte count in this segment */
ObjWriteStr (Seg->Name);
/* Write the file position of this fragment */
ObjWritePos (&Frag->Pos);
+ /* Write extra line info for this fragment. Zero is considered
+ * "no line info", so add one to the value.
+ */
+ LineInfoIndex = Frag->LI? Frag->LI->Index + 1 : 0;
+ ObjWriteVar (LineInfoIndex);
+
/* Next fragment */
Frag = Frag->Next;
}
ObjWrite32 (Header.ExportSize);
ObjWrite32 (Header.DbgSymOffs);
ObjWrite32 (Header.DbgSymSize);
+ ObjWrite32 (Header.LineInfoOffs);
+ ObjWrite32 (Header.LineInfoSize);
}
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
*/
ObjWriteVar (Len);
ObjWriteData (S, Len);
-}
+}
void ObjStartLineInfos (void)
/* Mark the start of the line info section */
{
+ Header.LineInfoOffs = ftell (F);
}
void ObjEndLineInfos (void)
/* Mark the end of the line info section */
{
+ Header.LineInfoSize = ftell (F) - Header.LineInfoOffs;
}
/* Skip the subkey */
NextTok ();
- /* Parameters are separated by a comma */
- ConsumeComma ();
-
/* Check the key and dispatch to a handler */
switch (Key) {
case 0: DbgInfoFile (); break;
OutputCodeEntry (E, F);
}
+ /* If debug info is enabled, terminate the last line number information */
+ if (DebugInfo) {
+ fprintf (F, "\t.dbg\tline\n");
+ }
+
/* If this is a segment for a function, leave the function */
if (S->Func) {
fprintf (F, "\n.endproc\n\n");
/* Defines for magic and version */
#define LIB_MAGIC 0x7A55616E
-#define LIB_VERSION 0x0008
+#define LIB_VERSION 0x0009
/* Size of an library file header */
#define LIB_HDR_SIZE 12
/* Defines for magic and version */
#define OBJ_MAGIC 0x616E7A55
-#define OBJ_VERSION 0x0008
+#define OBJ_VERSION 0x0009
/* Size of an object file header */
-#define OBJ_HDR_SIZE 56
+#define OBJ_HDR_SIZE 64
/* Flag bits */
#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */
unsigned long ExportSize; /* 32: Size of export list */
unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */
unsigned long DbgSymSize; /* 32: Size of debug symbols */
+ unsigned long LineInfoOffs; /* 32: Offset to list of line infos */
+ unsigned long LineInfoSize; /* 32: Size of line infos */
};
/* */
/* */
/* */
-/* (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 */
F->Size = Size;
F->Expr = 0;
InitFilePos (&F->Pos);
+ F->LI = 0;
F->Type = Type;
/* Insert the code fragment into the section */
/* */
/* */
/* */
-/* (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 */
unsigned long Size; /* Size of data/expression */
struct ExprNode* Expr; /* Expression if FRAG_EXPR */
FilePos Pos; /* File position in source */
+ struct LineInfo* LI; /* Additional line info */
unsigned char Type; /* Type of fragment */
unsigned char LitBuf [1]; /* Dynamically alloc'ed literal buffer */
};
--- /dev/null
+/*****************************************************************************/
+/* */
+/* lineinfo.h */
+/* */
+/* Source file line info structure */
+/* */
+/* */
+/* */
+/* (C) 2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
+/* */
+/* */
+/* This software is provided 'as-is', without any expressed or implied */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+/* common */
+#include "xmalloc.h"
+
+/* ld65 */
+#include "fileio.h"
+#include "lineinfo.h"
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+static LineInfo* NewLineInfo (void)
+/* Create and return a new LineInfo struct */
+{
+ /* Allocate memory */
+ LineInfo* LI = xmalloc (sizeof (LineInfo));
+
+ /* Initialize the fields */
+ InitFilePos (&LI->Pos);
+ InitCollection (&LI->Fragments);
+
+ /* Return the new struct */
+ return LI;
+}
+
+
+
+LineInfo* ReadLineInfo (FILE* F, ObjData* O)
+/* Read a line info from a file and return it */
+{
+ /* Allocate a new LineInfo struct and initialize it */
+ LineInfo* LI = NewLineInfo ();
+
+ /* Read the file position */
+ ReadFilePos (F, &LI->Pos);
+
+ /* Return the new LineInfo */
+ return LI;
+}
+
+
+
--- /dev/null
+/*****************************************************************************/
+/* */
+/* lineinfo.h */
+/* */
+/* Source file line info structure */
+/* */
+/* */
+/* */
+/* (C) 2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
+/* */
+/* */
+/* This software is provided 'as-is', without any expressed or implied */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+#ifndef LINEINFO_H
+#define LINEINFO_H
+
+
+
+/* common */
+#include "coll.h"
+#include "filepos.h"
+
+/* ld65 */
+#include "objdata.h"
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+typedef struct LineInfo LineInfo;
+struct LineInfo {
+ FilePos Pos; /* File position */
+ Collection Fragments; /* Fragments for this line */
+};
+
+
+
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+LineInfo* ReadLineInfo (FILE* F, ObjData* O);
+/* Read a line info from a file and return it */
+
+
+
+/* End of lineinfo.h */
+#endif
+
+
+
fragment.o \
global.o \
library.o \
+ lineinfo.o \
main.o \
mapfile.o \
o65.o \
/* */
/* */
/* */
-/* (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 */
O->Imports = 0;
O->DbgSymCount = 0;
O->DbgSyms = 0;
+ O->LineInfoCount = 0;
+ O->LineInfos = 0;
/* Link it into the list */
if (ObjLast) {
xfree (O->Name);
xfree (O->Imports);
xfree (O->Exports);
- xfree (O->DbgSyms);
+ xfree (O->DbgSyms);
+ xfree (O->LineInfos);
xfree (O);
}
/* Return the name */
return O->Files[Index];
- }
+ }
}
/* */
/* */
/* */
-/* (C) 1998 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 1998-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
struct Import** Imports; /* List of all imports */
unsigned DbgSymCount; /* Count of debug symbols */
struct DbgSym** DbgSyms; /* List of debug symbols */
+ unsigned LineInfoCount; /* Count of additional line infos */
+ struct LineInfo** LineInfos; /* List of additional line infos */
};
const char* GetSourceFileName (const ObjData* O, unsigned Index);
/* Get the name of the source file with the given index. If O is NULL, return
- * "[linker generated]" as the file name.
+ * "[linker generated]" as the file name.
*/
+
#include "error.h"
#include "exports.h"
#include "fileio.h"
+#include "lineinfo.h"
#include "objdata.h"
#include "segments.h"
#include "objfile.h"
if (H->Version != OBJ_VERSION) {
Error ("Object file `%s' has wrong version", Name);
}
- H->Flags = Read16 (Obj);
- H->OptionOffs = Read32 (Obj);
- H->OptionSize = Read32 (Obj);
- H->FileOffs = Read32 (Obj);
- H->FileSize = Read32 (Obj);
- H->SegOffs = Read32 (Obj);
- H->SegSize = Read32 (Obj);
- H->ImportOffs = Read32 (Obj);
- H->ImportSize = Read32 (Obj);
- H->ExportOffs = Read32 (Obj);
- H->ExportSize = Read32 (Obj);
- H->DbgSymOffs = Read32 (Obj);
- H->DbgSymSize = Read32 (Obj);
+ H->Flags = Read16 (Obj);
+ H->OptionOffs = Read32 (Obj);
+ H->OptionSize = Read32 (Obj);
+ H->FileOffs = Read32 (Obj);
+ H->FileSize = Read32 (Obj);
+ H->SegOffs = Read32 (Obj);
+ H->SegSize = Read32 (Obj);
+ H->ImportOffs = Read32 (Obj);
+ H->ImportSize = Read32 (Obj);
+ H->ExportOffs = Read32 (Obj);
+ H->ExportSize = Read32 (Obj);
+ H->DbgSymOffs = Read32 (Obj);
+ H->DbgSymSize = Read32 (Obj);
+ H->LineInfoOffs = Read32 (Obj);
+ H->LineInfoSize = Read32 (Obj);
}
/* Read the debug symbols from a file at the current position */
{
unsigned I;
-
+
O->DbgSymCount = ReadVar (F);
O->DbgSyms = xmalloc (O->DbgSymCount * sizeof (DbgSym*));
for (I = 0; I < O->DbgSymCount; ++I) {
+void ObjReadLineInfos (FILE* F, ObjData* O)
+/* Read the line infos from a file at the current position */
+{
+ unsigned I;
+
+ O->LineInfoCount = ReadVar (F);
+ O->LineInfos = xmalloc (O->LineInfoCount * sizeof (LineInfo*));
+ for (I = 0; I < O->LineInfoCount; ++I) {
+ O->LineInfos[I] = ReadLineInfo (F, O);
+ }
+}
+
+
+
void ObjReadSections (FILE* F, ObjData* O)
/* Read the section data from a file at the current position */
{
fseek (Obj, O->Header.DbgSymOffs, SEEK_SET);
ObjReadDbgSyms (Obj, O);
+ /* Read the line infos from the object file */
+ fseek (Obj, O->Header.LineInfoOffs, SEEK_SET);
+ ObjReadLineInfos (Obj, O);
+
/* Read the segment list from the object file. This must be last, since
* the expressions stored in the code may reference segments or imported
* symbols.
/* */
/* */
/* */
-/* (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"
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;
+ CHECK (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;
/* */
/* */
/* */
-/* (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 */
/* */
/* */
/* */
-/* (C) 2000 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 2000-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* Skip the file position of the fragment */
ReadFilePos (F, &Pos);
+ /* Skip the additional line info */
+ (void) ReadVar (F);
+
/* Return the size */
return Size;
}
/* Read the header */
ReadObjHeader (F, &H);
- /* Seek to the start of the options */
+ /* Seek to the start of the source files */
FileSeek (F, Offset + H.FileOffs);
/* Output a header */
/* Read the header */
ReadObjHeader (F, &H);
- /* Seek to the start of the options */
+ /* Seek to the start of the segments */
FileSeek (F, Offset + H.SegOffs);
/* Output a header */
/* Read the header */
ReadObjHeader (F, &H);
- /* Seek to the start of the options */
+ /* Seek to the start of the imports */
FileSeek (F, Offset + H.ImportOffs);
/* Output a header */
/* Read the header */
ReadObjHeader (F, &H);
- /* Seek to the start of the options */
+ /* Seek to the start of the exports */
FileSeek (F, Offset + H.ExportOffs);
/* Output a header */
/* Read the header */
ReadObjHeader (F, &H);
- /* Seek to the start of the options */
+ /* Seek to the start of the debug syms */
FileSeek (F, Offset + H.DbgSymOffs);
/* Output a header */
+void DumpObjLineInfo (FILE* F, unsigned long Offset)
+/* Dump the line info from an object file */
+{
+ ObjHeader H;
+ unsigned Count;
+ unsigned I;
+
+ /* Seek to the header position */
+ FileSeek (F, Offset);
+
+ /* Read the header */
+ ReadObjHeader (F, &H);
+
+ /* Seek to the start of line infos */
+ FileSeek (F, Offset + H.LineInfoOffs);
+
+ /* Output a header */
+ printf (" Line info:\n");
+
+ /* Check if the object file was compiled with debug info */
+ if ((H.Flags & OBJ_FLAGS_DBGINFO) == 0) {
+ /* Print that there no line infos and bail out */
+ printf (" Count:%27u\n", 0);
+ return;
+ }
+
+ /* Read the number of line infos and print it */
+ Count = ReadVar (F);
+ printf (" Count:%27u\n", Count);
+
+ /* Read and print all line infos */
+ for (I = 0; I < Count; ++I) {
+
+ FilePos Pos;
+
+ /* Read one line info */
+ ReadFilePos (F, &Pos);
+
+ /* Print the header */
+ printf (" Index:%27u\n", I);
+
+ /* Print the data */
+ printf (" Line:%26lu\n", Pos.Line);
+ printf (" Col:%27u\n", Pos.Col);
+ printf (" Name:%26u\n", Pos.Name);
+ }
+}
+
+
+
/* */
/* */
/* */
-/* (C) 2000 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 2000-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
void DumpObjDbgSyms (FILE* F, unsigned long Offset);
/* Dump the debug symbols from an object file */
+void DumpObjLineInfo (FILE* F, unsigned long Offset);
+/* Dump the line infos from an object file */
+
/* End of dump.h */
if (Size > 0) {
if (fread (Data, 1, Size, F) != Size) {
Error ("Read error (file corrupt?)");
- }
+ }
}
return Data;
}
H->ExportSize = Read32 (F);
H->DbgSymOffs = Read32 (F);
H->DbgSymSize = Read32 (F);
+ H->LineInfoOffs = Read32 (F);
+ H->LineInfoSize = Read32 (F);
}
#define D_IMPORTS 0x0010U /* Dump imported symbols */
#define D_EXPORTS 0x0020U /* Dump exported symbols */
#define D_DBGSYMS 0x0040U /* Dump debug symbols */
+#define D_LINEINFO 0x0080U /* Dump line infos */
#define D_ALL 0xFFFFU /* Dump anything */
/* */
/* */
/* */
-/* (C) 2000 Ullrich von Bassewitz */
+/* (C) 2000-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 */
" --dump-files\t\tDump the source files\n"
" --dump-header\t\tDump the object file header\n"
" --dump-imports\tDump imported symbols\n"
+ " --dump-lineinfo\tDump line information\n"
" --dump-options\tDump object file options\n"
" --dump-segments\tDump the segments in the file\n"
" --help\t\tHelp (this text)\n"
+static void OptDumpLineInfo (const char* Opt, const char* Arg)
+/* Dump the line infos */
+{
+ What |= D_LINEINFO;
+}
+
+
+
static void OptDumpOptions (const char* Opt, const char* Arg)
/* Dump the object file options */
{
if (What & D_DBGSYMS) {
DumpObjDbgSyms (F, 0);
}
+ if (What & D_LINEINFO) {
+ DumpObjLineInfo (F, 0);
+ }
}
/* Close the file */
{ "--dump-files", 0, OptDumpFiles },
{ "--dump-header", 0, OptDumpHeader },
{ "--dump-imports", 0, OptDumpImports },
+ { "--dump-lineinfo", 0, OptDumpLineInfo },
{ "--dump-options", 0, OptDumpOptions },
{ "--dump-segments", 0, OptDumpSegments },
{ "--help", 0, OptHelp },