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:
cuz
2001-05-23 08:51:48 +00:00
parent d390c51e57
commit ea2cf602b0
8 changed files with 87 additions and 28 deletions

View File

@@ -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;
}