/* */
/* */
/* */
-/* (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) 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 */
/*****************************************************************************/
-/* struct Fragment */
+/* Forwards */
/*****************************************************************************/
-typedef struct Fragment_ Fragment;
-struct Fragment_ {
+struct LineInfo;
+
+
+
+/*****************************************************************************/
+/* struct Fragment */
+/*****************************************************************************/
+
+
+
+typedef struct Fragment Fragment;
+struct Fragment {
Fragment* List; /* List of all fragments */
Fragment* Next; /* Fragment list in one segment */
Fragment* LineList; /* List of fragments for one src line */
FilePos Pos; /* File position for this fragment */
+ struct LineInfo* LI; /* Extra line info */
unsigned short Len; /* Length for this fragment */
unsigned char Type; /* Fragment type */
union {
-
+
+/* Note: The line infos kept here are additional line infos supplied by the
+ * ".dbg line" command. The native line infos are always kept in the fragments
+ * itself (because one fragment always originates from one line). The
+ * additional line infos (which may not exist if none are supplied in the
+ * source) may have several fragments attached (as is the case with sources
+ * generated by the C compiler).
+ */
+
+
+
/* common */
#include "coll.h"
#include "xmalloc.h"
LineInfo* LI = xmalloc (sizeof (LineInfo));
/* Initialize the fields */
- LI->Next = 0;
- LI->Usage = 0;
- LI->LineNum = LineNum;
- LI->FileIndex = FileIndex;
- LI->Index = 0; /* Currently invalid */
+ LI->Next = 0;
+ LI->Usage = 0;
+ LI->Index = 0; /* Currently invalid */
+ LI->Pos.Line = LineNum;
+ LI->Pos.Col = 0;
+ LI->Pos.Name = FileIndex;
/* Insert this structure into the line info list */
if (LineInfoLast == 0) {
* function will gracefully accept NULL pointers and do nothing in this case.
*/
{
- CHECK (LI != 0);
- ++LI->Usage;
+ if (LI) {
+ ++LI->Usage;
+ }
return LI;
}
+/* Note: The line infos kept here are additional line infos supplied by the
+ * ".dbg line" command. The native line infos are always kept in the fragments
+ * itself (because one fragment always originates from one line). The
+ * additional line infos (which may not exist if none are supplied in the
+ * source) may have several fragments attached (as is the case with sources
+ * generated by the C compiler).
+ */
+
+
+
#ifndef LINEINFO_H
#define LINEINFO_H
+/* common */
+#include "filepos.h"
+
+
+
/*****************************************************************************/
/* Data */
/*****************************************************************************/
struct LineInfo {
LineInfo* Next; /* Pointer to next info in list */
unsigned Usage; /* Usage counter */
- unsigned long LineNum; /* Line number */
- unsigned FileIndex; /* Index of input file */
unsigned Index; /* Index */
+ FilePos Pos; /* File position */
};
/* Linked list of all line infos */
extern LineInfo* LineInfoRoot;
extern LineInfo* LineInfoLast;
-extern unsigned LineInfoCount;
+extern unsigned LineInfoCount;
extern unsigned LineInfoValid; /* Valid, that is, used entries */
/* Global pointer to last line info or NULL if not active */
/* */
/* */
/* */
-/* (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 "error.h"
#include "fragment.h"
#include "global.h"
+#include "lineinfo.h"
#include "listing.h"
#include "objfile.h"
#include "scanner.h"
F->Next = 0;
F->LineList = 0;
F->Pos = CurPos;
+ F->LI = UseLineInfo (CurLineInfo);
F->Len = Len;
F->Type = Type;
/* */
/* */
/* */
-/* (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) 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 */
ObjWriteVar (0);
} else {
ObjWriteVar (Pos->Name - 1);
- }
+ }
}
+void ObjStartLineInfos (void)
+/* Mark the start of the line info section */
+{
+}
+
+
+
+void ObjEndLineInfos (void)
+/* Mark the end of the line info 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 */
void ObjWrite32 (unsigned long V);
/* Write a 32 bit value to the file */
-
+
void ObjWriteVar (unsigned long V);
/* Write a variable sized value to the file in special encoding */
void ObjEndDbgSyms (void);
/* Mark the end of the debug symbol section */
+void ObjStartLineInfos (void);
+/* Mark the start of the line info section */
+
+void ObjEndLineInfos (void);
+/* Mark the end of the line info section */
+
/* End of objfile.h */