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 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* 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 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -44,18 +44,29 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Forwards */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct LineInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* struct Fragment */
|
/* struct Fragment */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct Fragment_ Fragment;
|
typedef struct Fragment Fragment;
|
||||||
struct Fragment_ {
|
struct Fragment {
|
||||||
Fragment* List; /* List of all fragments */
|
Fragment* List; /* List of all fragments */
|
||||||
Fragment* Next; /* Fragment list in one segment */
|
Fragment* Next; /* Fragment list in one segment */
|
||||||
Fragment* LineList; /* List of fragments for one src line */
|
Fragment* LineList; /* List of fragments for one src line */
|
||||||
FilePos Pos; /* File position for this fragment */
|
FilePos Pos; /* File position for this fragment */
|
||||||
|
struct LineInfo* LI; /* Extra line info */
|
||||||
unsigned short Len; /* Length for this fragment */
|
unsigned short Len; /* Length for this fragment */
|
||||||
unsigned char Type; /* Fragment type */
|
unsigned char Type; /* Fragment type */
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -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 */
|
/* common */
|
||||||
#include "coll.h"
|
#include "coll.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
@ -74,9 +84,10 @@ static LineInfo* NewLineInfo (unsigned FileIndex, unsigned long LineNum)
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
LI->Next = 0;
|
LI->Next = 0;
|
||||||
LI->Usage = 0;
|
LI->Usage = 0;
|
||||||
LI->LineNum = LineNum;
|
|
||||||
LI->FileIndex = FileIndex;
|
|
||||||
LI->Index = 0; /* Currently invalid */
|
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 */
|
/* Insert this structure into the line info list */
|
||||||
if (LineInfoLast == 0) {
|
if (LineInfoLast == 0) {
|
||||||
|
@ -100,8 +111,9 @@ LineInfo* UseLineInfo (LineInfo* LI)
|
||||||
* function will gracefully accept NULL pointers and do nothing in this case.
|
* function will gracefully accept NULL pointers and do nothing in this case.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
CHECK (LI != 0);
|
if (LI) {
|
||||||
++LI->Usage;
|
++LI->Usage;
|
||||||
|
}
|
||||||
return LI;
|
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
|
#ifndef LINEINFO_H
|
||||||
#define LINEINFO_H
|
#define LINEINFO_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* common */
|
||||||
|
#include "filepos.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Data */
|
/* Data */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -51,9 +66,8 @@ typedef struct LineInfo LineInfo;
|
||||||
struct LineInfo {
|
struct LineInfo {
|
||||||
LineInfo* Next; /* Pointer to next info in list */
|
LineInfo* Next; /* Pointer to next info in list */
|
||||||
unsigned Usage; /* Usage counter */
|
unsigned Usage; /* Usage counter */
|
||||||
unsigned long LineNum; /* Line number */
|
|
||||||
unsigned FileIndex; /* Index of input file */
|
|
||||||
unsigned Index; /* Index */
|
unsigned Index; /* Index */
|
||||||
|
FilePos Pos; /* File position */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Linked list of all line infos */
|
/* Linked list of all line infos */
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "fragment.h"
|
#include "fragment.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "lineinfo.h"
|
||||||
#include "listing.h"
|
#include "listing.h"
|
||||||
#include "objfile.h"
|
#include "objfile.h"
|
||||||
#include "scanner.h"
|
#include "scanner.h"
|
||||||
|
@ -598,6 +599,7 @@ static Fragment* NewFragment (unsigned char Type, unsigned short Len)
|
||||||
F->Next = 0;
|
F->Next = 0;
|
||||||
F->LineList = 0;
|
F->LineList = 0;
|
||||||
F->Pos = CurPos;
|
F->Pos = CurPos;
|
||||||
|
F->LI = UseLineInfo (CurLineInfo);
|
||||||
F->Len = Len;
|
F->Len = Len;
|
||||||
F->Type = Type;
|
F->Type = Type;
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* 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 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -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 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -115,6 +115,12 @@ void ObjStartDbgSyms (void);
|
||||||
void ObjEndDbgSyms (void);
|
void ObjEndDbgSyms (void);
|
||||||
/* Mark the end of the debug symbol section */
|
/* 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 */
|
/* End of objfile.h */
|
||||||
|
|
Loading…
Add table
Reference in a new issue