From: Peter B. Kessler Date: Fri, 5 Sep 1980 14:12:28 +0000 (-0800) Subject: N_PC stabs with subtypes X-Git-Tag: BSD-4^3~732 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/99f6998fe72a5a1a384e1e7810c08750b30050b0?hp=c9957a94c6d9ac3f228791f93fd1dc9af1fe9694 N_PC stabs with subtypes SCCS-vsn: usr.bin/pascal/src/const.c 1.4 SCCS-vsn: usr.bin/pascal/src/lab.c 1.4 SCCS-vsn: usr.bin/pascal/src/stab.c 1.3 SCCS-vsn: usr.bin/pascal/src/type.c 1.4 SCCS-vsn: usr.bin/pascal/pc3/pc3.h 1.3 SCCS-vsn: usr.bin/pascal/pc3/pc3.c 1.5 --- diff --git a/usr/src/usr.bin/pascal/pc3/pc3.c b/usr/src/usr.bin/pascal/pc3/pc3.c index 228fe87681..2992939210 100644 --- a/usr/src/usr.bin/pascal/pc3/pc3.c +++ b/usr/src/usr.bin/pascal/pc3/pc3.c @@ -1,6 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)pc3.c 1.4 %G%"; +static char sccsid[] = "@(#)pc3.c 1.5 %G%"; /* * Pc3 is a pass in the Berkeley Pascal compilation @@ -28,7 +28,7 @@ static char sccsid[] = "@(#)pc3.c 1.4 %G%"; * is: * * - the name of the symbol; - * - a type specifier; + * - a subtype descriptor; * - for file symbols, their last modify time; * - the file which logically contains the declaration of * the symbol (not an include file); @@ -71,7 +71,7 @@ char program[] = "pc"; #include #include #include -#include "/usr/src/new/pc0/p.a.out.h" +#include "/usr/src/new/pc0/pstab.h" #include "pc3.h" int errors = 0; @@ -253,48 +253,36 @@ checksymbol( nlp , ofilep ) fprintf( stderr , "[checksymbol] pfile %s ifile %s\n" , pfilep -> name , ifilep -> name ); } - fprintf( stderr , "[checksymbol] ->name %s ->n_type %x (%s)\n" - , nlp -> n_un.n_name , nlp -> n_type - , classify( nlp -> n_type ) ); + fprintf( stderr , "[checksymbol] ->name %s ->n_desc %x (%s)\n" + , nlp -> n_un.n_name , nlp -> n_desc + , classify( nlp -> n_desc ) ); # endif DEBUG - switch ( nlp -> n_type ) { - case N_PGLAB: - case N_PGCON: - case N_PGTYP: - case N_PGVAR: - case N_PGFUN: - case N_PGPRC: - case N_PEFUN: - case N_PEPRC: - case N_PSO: - case N_PSOL: - symbolp = entersymbol( nlp -> n_un.n_name ); - break; - default: - /* don't care about the others */ - return; + if ( nlp -> n_type != N_PC ) { + /* don't care about the others */ + return; } + symbolp = entersymbol( nlp -> n_un.n_name ); if ( symbolp -> lookup == NEW ) { # ifdef DEBUG fprintf( stderr , "[checksymbol] ->name %s is NEW\n" , symbolp -> name ); # endif DEBUG - symbolp -> type = nlp -> n_type; - switch ( symbolp -> type ) { - case N_PGLAB: - case N_PGCON: - case N_PGTYP: + symbolp -> desc = nlp -> n_desc; + switch ( symbolp -> desc ) { + case N_PGLABEL: + case N_PGCONST: + case N_PGTYPE: case N_PGVAR: - case N_PGFUN: - case N_PGPRC: + case N_PGFUNC: + case N_PGPROC: symbolp -> sym_un.sym_str.rfilep = ifilep; symbolp -> sym_un.sym_str.rline = nlp -> n_value; symbolp -> sym_un.sym_str.fromp = pfilep; symbolp -> sym_un.sym_str.fromi = ifilep; symbolp -> sym_un.sym_str.iline = nlp -> n_value; return; - case N_PEFUN: - case N_PEPRC: + case N_PEFUNC: + case N_PEPROC: symbolp -> sym_un.sym_str.rfilep = NIL; symbolp -> sym_un.sym_str.rline = 0; /* @@ -305,7 +293,7 @@ checksymbol( nlp , ofilep ) error( WARNING , "%s, line %d: %s %s must be declared in included file" , pfilep -> name , nlp -> n_value - , classify( symbolp -> type ) + , classify( symbolp -> desc ) , symbolp -> name ); } symbolp -> sym_un.sym_str.fromp = pfilep; @@ -329,7 +317,7 @@ checksymbol( nlp , ofilep ) fprintf( stderr , "[checksymbol] ->name %s is OLD\n" , symbolp -> name ); # endif DEBUG - switch ( symbolp -> type ) { + switch ( symbolp -> desc ) { case N_PSO: /* * finding a file again means you are back @@ -351,15 +339,15 @@ checksymbol( nlp , ofilep ) , ofilep -> name , symbolp -> name ); } return; - case N_PEFUN: - case N_PEPRC: + case N_PEFUNC: + case N_PEPROC: /* * we may see any number of external declarations, * but they all have to come * from the same include file. */ - if ( nlp -> n_type == N_PEFUN - || nlp -> n_type == N_PEPRC ) { + if ( nlp -> n_desc == N_PEFUNC + || nlp -> n_desc == N_PEPROC ) { goto included; } /* @@ -368,10 +356,10 @@ checksymbol( nlp , ofilep ) * if the resolving file * included the external declaration. */ - if ( ( symbolp -> type == N_PEFUN - && nlp -> n_type != N_PGFUN ) - || ( symbolp -> type == N_PEPRC - && nlp -> n_type != N_PGPRC ) + if ( ( symbolp -> desc == N_PEFUNC + && nlp -> n_desc != N_PGFUNC ) + || ( symbolp -> desc == N_PEPROC + && nlp -> n_desc != N_PGPROC ) || symbolp -> sym_un.sym_str.fromp != pfilep ) { break; } @@ -384,17 +372,17 @@ checksymbol( nlp , ofilep ) symbolp -> sym_un.sym_str.rfilep = ifilep; symbolp -> sym_un.sym_str.rline = nlp -> n_value; return; - case N_PGFUN: - case N_PGPRC: + case N_PGFUNC: + case N_PGPROC: /* * functions may not be seen more than once. * the loader will complain about * `multiply defined', but we can, too. */ break; - case N_PGLAB: - case N_PGCON: - case N_PGTYP: + case N_PGLABEL: + case N_PGCONST: + case N_PGTYPE: case N_PGVAR: /* * labels, constants, types, variables @@ -404,7 +392,7 @@ checksymbol( nlp , ofilep ) * make it look like they come from this .p file. */ included: - if ( nlp -> n_type != symbolp -> type + if ( nlp -> n_desc != symbolp -> desc || symbolp -> sym_un.sym_str.fromi != ifilep ) { break; } @@ -728,21 +716,21 @@ classify( type ) return "source file"; case N_PSOL: return "include file"; - case N_PGLAB: + case N_PGLABEL: return "label"; - case N_PGCON: + case N_PGCONST: return "constant"; - case N_PGTYP: + case N_PGTYPE: return "type"; case N_PGVAR: return "variable"; - case N_PGFUN: + case N_PGFUNC: return "function"; - case N_PGPRC: + case N_PGPROC: return "procedure"; - case N_PEFUN: + case N_PEFUNC: return "external function"; - case N_PEPRC: + case N_PEPROC: return "external procedure"; default: return "unknown symbol"; diff --git a/usr/src/usr.bin/pascal/pc3/pc3.h b/usr/src/usr.bin/pascal/pc3/pc3.h index 007000030f..cd5dc37d4b 100644 --- a/usr/src/usr.bin/pascal/pc3/pc3.h +++ b/usr/src/usr.bin/pascal/pc3/pc3.h @@ -1,13 +1,13 @@ /* Copyright (c) 1980 Regents of the University of California */ - /* static char sccsid[] = "@(#)pc3.h 1.2 %G%"; */ + /* static char sccsid[] = "@(#)pc3.h 1.3 %G%"; */ /* * a symbol table entry. */ struct symbol { char *name; /* pointer to string table */ - unsigned char type; /* symbol type */ + short desc; /* symbol description */ int lookup; /* whether new or old */ union { /* either */ struct { /* for a symbol, */ @@ -16,7 +16,7 @@ struct symbol { long iline; /* the .i file line */ struct symbol *rfilep; /* its resolving file */ long rline; /* resolving file line */ - } sym_str; + } sym_str; time_t modtime; /* for a file, its st_mtime */ } sym_un; }; diff --git a/usr/src/usr.bin/pascal/src/const.c b/usr/src/usr.bin/pascal/src/const.c index f346948a9b..a91b8d5dea 100644 --- a/usr/src/usr.bin/pascal/src/const.c +++ b/usr/src/usr.bin/pascal/src/const.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)const.c 1.3 %G%"; +static char sccsid[] = "@(#)const.c 1.4 %G%"; #include "whoami.h" #include "0.h" @@ -64,7 +64,7 @@ const(cline, cid, cdecl) #ifdef PC if (cbn == 1) { - stabcname( cid , line ); + stabgconst( cid , line ); } #endif PC diff --git a/usr/src/usr.bin/pascal/src/lab.c b/usr/src/usr.bin/pascal/src/lab.c index 58528c8628..4395839ac5 100644 --- a/usr/src/usr.bin/pascal/src/lab.c +++ b/usr/src/usr.bin/pascal/src/lab.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)lab.c 1.3 %G%"; +static char sccsid[] = "@(#)lab.c 1.4 %G%"; #include "whoami.h" #include "0.h" @@ -85,7 +85,7 @@ label(r, l) * stab the label for separate compilation. * make label number = label name. */ - stabglab( p -> symbol , line ); + stabglabel( p -> symbol , line ); p -> value[1] = atol( p -> symbol ); putprintf( " .globl " , 1 ); putprintf( PREFIXFORMAT , 0 , PLABELPREFIX diff --git a/usr/src/usr.bin/pascal/src/stab.c b/usr/src/usr.bin/pascal/src/stab.c index b3d3c84bc0..0a0db00940 100644 --- a/usr/src/usr.bin/pascal/src/stab.c +++ b/usr/src/usr.bin/pascal/src/stab.c @@ -1,6 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)stab.c 1.2 %G%"; +static char sccsid[] = "@(#)stab.c 1.3 %G%"; /* * procedures to put out sdb symbol table information. @@ -14,13 +14,13 @@ static char sccsid[] = "@(#)stab.c 1.2 %G%"; # include "0.h" # include -/* - * the file "p.a.out" has an additional symbol definition for "a.out.h" - * that is used by the separate compilation facility -- - * eventually, "a.out.h" must be updated to include this - */ + /* + * additional symbol definition for + * that is used by the separate compilation facility -- + * eventually, should be updated to include this + */ -# include "p.a.out.h" +# include "pstab.h" # include "pc.h" /* @@ -44,9 +44,8 @@ stabvar( name , type , level , offset , length , line ) * for separate compilation */ if ( level == 1 ) { - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGVAR , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , name , N_PC , N_PGVAR , ABS( line ) ); } /* * for sdb @@ -153,13 +152,11 @@ stabfunc( name , class , line , level ) */ if ( level == 1 ) { if ( class == FUNC ) { - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGFUN , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , name , N_PC , N_PGFUNC , ABS( line ) ); } else if ( class == PROC ) { - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGPRC , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , name , N_PC , N_PGPROC , ABS( line ) ); } } /* @@ -200,9 +197,8 @@ stabsource( filename ) /* * for separate compilation */ - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , filename ); - putprintf( "\",0x%x,0,0,0" , 0 , N_PSO ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0" , 0 + , filename , N_PC , N_PSO ); /* * for sdb */ @@ -228,9 +224,11 @@ stabinclude( filename ) { int label; - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , filename ); - putprintf( "\",0x%x,0,0,0" , 0 , N_PSOL ); + /* + * for separate compilation + */ + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0" , 0 + , filename , N_PC , N_PSOL ); /* * for sdb */ @@ -257,40 +255,37 @@ stabinclude( filename ) /* * global labels */ -stabglab( label , line ) +stabglabel( label , line ) char *label; int line; { - putprintf( " .stabs \"" , 1 ); - putprintf( PREFIXFORMAT , 1 , PLABELPREFIX , label ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGLAB , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , label , N_PC , N_PGLABEL , ABS( line ) ); } /* * global constants */ -stabcname( name , line ) - char *name; +stabgconst( const , line ) + char *const; int line; { - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGCON , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , const , N_PC , N_PGCONST , ABS( line ) ); } /* * global types */ -stabtname( name , line ) - char *name; +stabgtype( type , line ) + char *type; int line; { - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGTYP , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , type , N_PC , N_PGTYPE , ABS( line ) ); } @@ -305,15 +300,14 @@ stabefunc( name , class , line ) int type; if ( class == FUNC ) { - type = N_PEFUN; + type = N_PEFUNC; } else if ( class == PROC ) { - type = N_PEPRC; + type = N_PEPROC; } else { return; } - putprintf( " .stabs \"" , 1 ); - putprintf( NAMEFORMAT , 1 , name ); - putprintf( "\",0x%x,0,0,0x%x" , 0 , type , ABS( line ) ); + putprintf( " .stabs \"%s\",0x%x,0,0x%x,0x%x" , 0 + , name , N_PC , type , ABS( line ) ); } #endif PC diff --git a/usr/src/usr.bin/pascal/src/type.c b/usr/src/usr.bin/pascal/src/type.c index 2094cd1d16..6447577c7b 100644 --- a/usr/src/usr.bin/pascal/src/type.c +++ b/usr/src/usr.bin/pascal/src/type.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)type.c 1.3 %G%"; +static char sccsid[] = "@(#)type.c 1.4 %G%"; #include "whoami.h" #include "0.h" @@ -72,7 +72,7 @@ type(tline, tid, tdecl) #ifdef PC if (cbn == 1) { - stabtname( tid , line ); + stabgtype( tid , line ); } #endif PC