Working on source line information
git-svn-id: svn://svn.cc65.org/cc65/trunk@747 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
d390c51e57
commit
ea2cf602b0
8 changed files with 87 additions and 28 deletions
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
@ -45,17 +45,28 @@
|
|||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* 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 {
|
||||
|
@ -77,4 +88,4 @@ extern Fragment* FragLast;
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,16 @@
|
|||
|
||||
|
||||
|
||||
/* 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"
|
||||
|
@ -72,11 +82,12 @@ static LineInfo* NewLineInfo (unsigned FileIndex, unsigned long LineNum)
|
|||
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) {
|
||||
|
@ -100,8 +111,9 @@ LineInfo* UseLineInfo (LineInfo* LI)
|
|||
* function will gracefully accept NULL pointers and do nothing in this case.
|
||||
*/
|
||||
{
|
||||
CHECK (LI != 0);
|
||||
++LI->Usage;
|
||||
if (LI) {
|
||||
++LI->Usage;
|
||||
}
|
||||
return LI;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,26 @@
|
|||
|
||||
|
||||
|
||||
/* 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 */
|
||||
/*****************************************************************************/
|
||||
|
@ -51,15 +66,14 @@ typedef struct LineInfo LineInfo;
|
|||
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 */
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
@ -46,6 +46,7 @@
|
|||
#include "error.h"
|
||||
#include "fragment.h"
|
||||
#include "global.h"
|
||||
#include "lineinfo.h"
|
||||
#include "listing.h"
|
||||
#include "objfile.h"
|
||||
#include "scanner.h"
|
||||
|
@ -598,6 +599,7 @@ static Fragment* NewFragment (unsigned char Type, unsigned short Len)
|
|||
F->Next = 0;
|
||||
F->LineList = 0;
|
||||
F->Pos = CurPos;
|
||||
F->LI = UseLineInfo (CurLineInfo);
|
||||
F->Len = Len;
|
||||
F->Type = Type;
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
@ -266,7 +266,7 @@ void ObjWritePos (const FilePos* Pos)
|
|||
ObjWriteVar (0);
|
||||
} else {
|
||||
ObjWriteVar (Pos->Name - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,3 +367,17 @@ void ObjEndDbgSyms (void)
|
|||
|
||||
|
||||
|
||||
void ObjStartLineInfos (void)
|
||||
/* Mark the start of the line info section */
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ObjEndLineInfos (void)
|
||||
/* Mark the end of the line info section */
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (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 */
|
||||
|
@ -66,7 +66,7 @@ void ObjWrite24 (unsigned long V);
|
|||
|
||||
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 */
|
||||
|
||||
|
@ -115,6 +115,12 @@ void ObjStartDbgSyms (void);
|
|||
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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue