/* Copyright (c) 1980 Regents of the University of California */
static char sccsid
[] = "@(#)stab.c 1.3 9/4/80";
* procedures to put out sdb symbol table information.
* and stabs for separate compilation type checking.
* these use the new .stabs, .stabn, and .stabd directives
/* and the rest of the file */
* additional symbol definition for <stab.h>
* that is used by the separate compilation facility --
* eventually, <stab.h> should be updated to include this
* absolute value: line numbers are negative if error recovery.
#define ABS( x ) ( x < 0 ? -x : x )
stabvar( name
, type
, level
, offset
, length
, line
)
* for separate compilation
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, name
, N_PC
, N_PGVAR
, ABS( line
) );
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0x%x,0" , 0 , N_GSYM
, type
);
putprintf( "\",0x%x,0,0x%x,0x%x" , 0 , N_LSYM
, type
, offset
);
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0,0x%x" , 0 , N_LENG
, length
);
stabparam( name
, type
, offset
, length
)
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0x%x,0x%x" , 0 , N_PSYM
, type
, offset
);
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0,0x%x" , 0 , N_LENG
, length
);
stabfield( name
, type
, offset
, length
)
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0x%x,0x%x" , 0 , N_SSYM
, type
, offset
);
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0,0x%x" , 0 , N_LENG
, length
);
putprintf( " .stabd 0x%x,0,0x%x" , 0 , N_LBRAC
, level
);
putprintf( " .stabd 0x%x,0,0x%x" , 0 , N_RBRAC
, level
);
stabfunc( name
, class , line
, level
)
* for separate compilation
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, name
, N_PC
, N_PGFUNC
, ABS( line
) );
} else if ( class == PROC
) {
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, name
, N_PC
, N_PGPROC
, ABS( line
) );
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , name
);
putprintf( "\",0x%x,0,0x%x," , 1 , N_FUN
, line
);
for ( i
= 1 ; i
< level
; i
++ ) {
putprintf( EXTFORMAT
, 1 , enclosing
[ i
] );
putprintf( EXTFORMAT
, 0 , name
);
putprintf( " .stabd 0x%x,0,0x%x" , 0 , N_SLINE
, ABS( line
) );
* for separate compilation
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0" , 0
, filename
, N_PC
, N_PSO
);
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , filename
);
putprintf( "\",0x%x,0,0," , 1 , N_SO
);
putprintf( PREFIXFORMAT
, 0 , LLABELPREFIX
, label
);
putprintf( PREFIXFORMAT
, 1 , LLABELPREFIX
, label
);
* included files get one or more of these:
* one as they are entered by a #include,
* and one every time they are returned to by nested #includes
* for separate compilation
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0" , 0
, filename
, N_PC
, N_PSOL
);
putprintf( " .stabs \"" , 1 );
putprintf( NAMEFORMAT
, 1 , filename
);
putprintf( "\",0x%x,0,0," , 1 , N_SOL
);
putprintf( PREFIXFORMAT
, 0 , LLABELPREFIX
, label
);
putprintf( PREFIXFORMAT
, 1 , LLABELPREFIX
, label
);
* global Pascal symbols :
* labels, types, constants, and external procedure and function names:
* These are used by the separate compilation facility
* to be able to check for disjoint header files.
stabglabel( label
, line
)
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, label
, N_PC
, N_PGLABEL
, ABS( line
) );
stabgconst( const , line
)
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, const , N_PC
, N_PGCONST
, ABS( line
) );
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, type
, N_PC
, N_PGTYPE
, ABS( line
) );
* external functions and procedures
stabefunc( name
, class , line
)
} else if ( class == PROC
) {
putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0
, name
, N_PC
, type
, ABS( line
) );