/* vms.c -- Write out a VAX/VMS object file
- Copyright 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002
+ Copyright 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001,
+ 2002, 2003
Free Software Foundation, Inc.
-This file is part of GAS, the GNU Assembler.
+ This file is part of GAS, the GNU Assembler.
-GAS is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ GAS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
-GAS is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ GAS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GAS; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with GAS; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
/* Written by David L. Kashtan */
/* Modified by Eric Youngdale to write VMS debug records for program
#define error as_fatal
#ifdef VMS /* These are of no use if we are cross assembling. */
-#include <fab.h> /* Define File Access Block */
-#include <nam.h> /* Define NAM Block */
-#include <xab.h> /* Define XAB - all different types*/
+#include <fab.h> /* Define File Access Block. */
+#include <nam.h> /* Define NAM Block. */
+#include <xab.h> /* Define XAB - all different types. */
extern int sys$open(), sys$close(), sys$asctim();
#endif
-/*
- * Version string of the compiler that produced the code we are
- * assembling. (And this assembler, if we do not have compiler info.)
- */
+/* Version string of the compiler that produced the code we are
+ assembling. (And this assembler, if we do not have compiler info). */
char *compiler_version_string;
extern int flag_hash_long_names; /* -+ */
extern int flag_no_hash_mixed_case; /* -h NUM */
/* Flag that determines how we map names. This takes several values, and
- * is set with the -h switch. A value of zero implies names should be
- * upper case, and the presence of the -h switch inhibits the case hack.
- * No -h switch at all sets vms_name_mapping to 0, and allows case hacking.
- * A value of 2 (set with -h2) implies names should be
- * all lower case, with no case hack. A value of 3 (set with -h3) implies
- * that case should be preserved. */
+ is set with the -h switch. A value of zero implies names should be
+ upper case, and the presence of the -h switch inhibits the case hack.
+ No -h switch at all sets vms_name_mapping to 0, and allows case hacking.
+ A value of 2 (set with -h2) implies names should be
+ all lower case, with no case hack. A value of 3 (set with -h3) implies
+ that case should be preserved. */
/* If the -+ switch is given, then the hash is appended to any name that is
- * longer than 31 characters, regardless of the setting of the -h switch.
- */
+ longer than 31 characters, regardless of the setting of the -h switch. */
char vms_name_mapping = 0;
static symbolS *Entry_Point_Symbol = 0; /* Pointer to "_main" */
-/*
- * We augment the "gas" symbol structure with this
- */
+/* We augment the "gas" symbol structure with this. */
+
struct VMS_Symbol
{
struct VMS_Symbol *Next;
struct VMS_Symbol *Dtors_Symbols = 0;
/* We need this to keep track of the various input files, so that we can
- * give the debugger the correct source line.
- */
+ give the debugger the correct source line. */
struct input_file
{
static struct input_file *file_root = (struct input_file *) NULL;
-/*
- * Styles of PSECTS (program sections) that we generate; just shorthand
- * to avoid lists of section attributes. Used by VMS_Psect_Spec().
- */
+/* Styles of PSECTS (program sections) that we generate; just shorthand
+ to avoid lists of section attributes. Used by VMS_Psect_Spec(). */
enum ps_type
{
ps_TEXT, ps_DATA, ps_COMMON, ps_CONST, ps_CTORS, ps_DTORS
};
-/*
- * This enum is used to keep track of the various types of variables that
- * may be present.
- */
+/* This enum is used to keep track of the various types of variables that
+ may be present. */
enum advanced_type
{
BASIC, POINTER, ARRAY, ENUM, STRUCT, UNION, FUNCTION, VOID, ALIAS, UNKNOWN
};
-/*
- * This structure contains the information from the stabs directives, and the
- * information is filled in by VMS_typedef_parse. Everything that is needed
- * to generate the debugging record for a given symbol is present here.
- * This could be done more efficiently, using nested struct/unions, but for now
- * I am happy that it works.
- */
+/* This structure contains the information from the stabs directives, and the
+ information is filled in by VMS_typedef_parse. Everything that is needed
+ to generate the debugging record for a given symbol is present here.
+ This could be done more efficiently, using nested struct/unions, but for
+ now I am happy that it works. */
+
struct VMS_DBG_Symbol
{
struct VMS_DBG_Symbol *next;
- /* description of what this is */
+ /* Description of what this is. */
enum advanced_type advanced;
- /* this record is for this type */
+ /* This record is for this type. */
int dbx_type;
/* For advanced types this is the type referred to. I.e., the type
a pointer points to, or the type of object that makes up an
array. */
int type2;
- /* Use this type when generating a variable def */
+ /* Use this type when generating a variable def. */
int VMS_type;
- /* used for arrays - this will be present for all */
+ /* Used for arrays - this will be present for all. */
int index_min;
- /* entries, but will be meaningless for non-arrays */
+ /* Entries, but will be meaningless for non-arrays. */
int index_max;
/* Size in bytes of the data type. For an array, this is the size
- of one element in the array */
+ of one element in the array. */
int data_size;
- /* Number of the structure/union/enum - used for ref */
+ /* Number of the structure/union/enum - used for ref. */
int struc_numb;
};
-#define SYMTYPLST_SIZE (1<<4) /* 16; must be power of two */
-#define SYMTYP_HASH(x) ((unsigned) (x) & (SYMTYPLST_SIZE-1))
+#define SYMTYPLST_SIZE (1<<4) /* 16; Must be power of two. */
+#define SYMTYP_HASH(x) ((unsigned) (x) & (SYMTYPLST_SIZE - 1))
+
struct VMS_DBG_Symbol *VMS_Symbol_type_list[SYMTYPLST_SIZE];
-/*
- * We need this structure to keep track of forward references to
- * struct/union/enum that have not been defined yet. When they are ultimately
- * defined, then we can go back and generate the TIR commands to make a back
- * reference.
- */
+/* We need this structure to keep track of forward references to
+ struct/union/enum that have not been defined yet. When they are
+ ultimately defined, then we can go back and generate the TIR
+ commands to make a back reference. */
struct forward_ref
{
struct forward_ref *f_ref_root = (struct forward_ref *) NULL;
-/*
- * This routine is used to compare the names of certain types to various
- * fixed types that are known by the debugger.
- */
+/* This routine is used to compare the names of certain types to various
+ fixed types that are known by the debugger. */
+
#define type_check(X) !strcmp (symbol_name, X)
-/*
- * This variable is used to keep track of the name of the symbol we are
- * working on while we are parsing the stabs directives.
- */
+/* This variable is used to keep track of the name of the symbol we are
+ working on while we are parsing the stabs directives. */
+
static const char *symbol_name;
/* We use this counter to assign numbers to all of the structures, unions
- * and enums that we define. When we actually declare a variable to the
- * debugger, we can simply do it by number, rather than describing the
- * whole thing each time.
- */
+ and enums that we define. When we actually declare a variable to the
+ debugger, we can simply do it by number, rather than describing the
+ whole thing each time. */
static int structure_count = 0;
/* This variable is used to indicate that we are making the last attempt to
parse the stabs, and that we should define as much as we can, and ignore
- the rest */
+ the rest. */
static int final_pass;
/* This variable is used to keep track of the current structure number
- * for a given variable. If this is < 0, that means that the structure
- * has not yet been defined to the debugger. This is still cool, since
- * the VMS object language has ways of fixing things up after the fact,
- * so we just make a note of this, and generate fixups at the end.
- */
+ for a given variable. If this is < 0, that means that the structure
+ has not yet been defined to the debugger. This is still cool, since
+ the VMS object language has ways of fixing things up after the fact,
+ so we just make a note of this, and generate fixups at the end. */
+
static int struct_number;
/* This is used to distinguish between D_float and G_float for telling
static char Module_Name[255+1];
-/*
- * Variable descriptors are used tell the debugger the data types of certain
- * more complicated variables (basically anything involving a structure,
- * union, enum, array or pointer). Some non-pointer variables of the
- * basic types that the debugger knows about do not require a variable
- * descriptor.
- *
- * Since it is impossible to have a variable descriptor longer than 128
- * bytes by virtue of the way that the VMS object language is set up,
- * it makes not sense to make the arrays any longer than this, or worrying
- * about dynamic sizing of the array.
- *
- * These are the arrays and counters that we use to build a variable
- * descriptor.
- */
+/* Variable descriptors are used tell the debugger the data types of certain
+ more complicated variables (basically anything involving a structure,
+ union, enum, array or pointer). Some non-pointer variables of the
+ basic types that the debugger knows about do not require a variable
+ descriptor.
+
+ Since it is impossible to have a variable descriptor longer than 128
+ bytes by virtue of the way that the VMS object language is set up,
+ it makes not sense to make the arrays any longer than this, or worrying
+ about dynamic sizing of the array.
+
+ These are the arrays and counters that we use to build a variable
+ descriptor. */
#define MAX_DEBUG_RECORD 128
-static char Local[MAX_DEBUG_RECORD]; /* buffer for variable descriptor */
-static char Asuffix[MAX_DEBUG_RECORD]; /* buffer for array descriptor */
-static int Lpnt; /* index into Local */
-static int Apoint; /* index into Asuffix */
-static char overflow; /* flag to indicate we have written too much*/
-static int total_len; /* used to calculate the total length of variable
- descriptor plus array descriptor - used for len byte*/
+static char Local[MAX_DEBUG_RECORD]; /* Buffer for variable descriptor. */
+static char Asuffix[MAX_DEBUG_RECORD]; /* Buffer for array descriptor. */
+static int Lpnt; /* Index into Local. */
+static int Apoint; /* Index into Asuffix. */
+static char overflow; /* Flag to indicate we have written too much. */
+static int total_len; /* Used to calculate the total length of
+ variable descriptor plus array descriptor
+ - used for len byte. */
/* Flag if we have told user about finding global constants in the text
section. */
static int gave_compiler_message = 0;
-/*
- * Global data (Object records limited to 512 bytes by VAX-11 "C" runtime)
- */
-static int VMS_Object_File_FD; /* File Descriptor for object file */
-static char Object_Record_Buffer[512]; /* Buffer for object file records */
-static size_t Object_Record_Offset; /* Offset to end of data */
-static int Current_Object_Record_Type; /* Type of record in above */
-
-/*
- * Macros for moving data around. Must work on big-endian systems.
- */
-#ifdef VMS /* These are more efficient for VMS->VMS systems */
+/* Global data (Object records limited to 512 bytes by VAX-11 "C" runtime). */
+
+static int VMS_Object_File_FD; /* File Descriptor for object file. */
+static char Object_Record_Buffer[512]; /* Buffer for object file records. */
+static size_t Object_Record_Offset; /* Offset to end of data. */
+static int Current_Object_Record_Type; /* Type of record in above. */
+
+/* Macros for moving data around. Must work on big-endian systems. */
+
+#ifdef VMS /* These are more efficient for VMS->VMS systems. */
#define COPY_LONG(dest,val) ( *(long *) (dest) = (val) )
#define COPY_SHORT(dest,val) ( *(short *) (dest) = (val) )
#else
#define COPY_LONG(dest,val) md_number_to_chars ((dest), (val), 4)
#define COPY_SHORT(dest,val) md_number_to_chars ((dest), (val), 2)
#endif
-/*
- * Macros for placing data into the object record buffer.
- */
+
+/* Macros for placing data into the object record buffer. */
+
#define PUT_LONG(val) \
( COPY_LONG (&Object_Record_Buffer[Object_Record_Offset], (val)), \
Object_Record_Offset += 4 )
( COPY_SHORT (&Object_Record_Buffer[Object_Record_Offset], (val)), \
Object_Record_Offset += 2 )
-#define PUT_CHAR(val) ( Object_Record_Buffer[Object_Record_Offset++] = (val) )
+#define PUT_CHAR(val) (Object_Record_Buffer[Object_Record_Offset++] = (val))
+
+#define PUT_COUNTED_STRING(cp) \
+ do \
+ { \
+ const char *p = (cp); \
+ \
+ PUT_CHAR ((char) strlen (p)); \
+ while (*p) \
+ PUT_CHAR (*p++); \
+ } \
+ while (0)
-#define PUT_COUNTED_STRING(cp) do { \
- register const char *p = (cp); \
- PUT_CHAR ((char) strlen (p)); \
- while (*p) PUT_CHAR (*p++); } while (0)
+/* Macro for determining if a Name has psect attributes attached
+ to it. */
-/*
- * Macro for determining if a Name has psect attributes attached
- * to it.
- */
#define PSECT_ATTRIBUTES_STRING "$$PsectAttributes_"
#define PSECT_ATTRIBUTES_STRING_LENGTH 18
};
\f
-/* Local support routines which return a value. */
-
-static struct input_file *find_file
- PARAMS ((symbolS *));
-static struct VMS_DBG_Symbol *find_symbol
- PARAMS ((int));
-static symbolS *Define_Routine
- PARAMS ((symbolS *, int, symbolS *, int));
-
-static char *cvt_integer
- PARAMS ((char *, int *));
-static char *fix_name
- PARAMS ((char *));
-static char *get_struct_name
- PARAMS ((char *));
-
-static offsetT VMS_Initialized_Data_Size
- PARAMS ((symbolS *, unsigned));
-
-static int VMS_TBT_Source_File
- PARAMS ((char *, int));
-static int gen1
- PARAMS ((struct VMS_DBG_Symbol *, int));
-static int forward_reference
- PARAMS ((char *));
-static int final_forward_reference
- PARAMS ((struct VMS_DBG_Symbol *));
-static int VMS_typedef_parse
- PARAMS ((char *));
-static int hash_string
- PARAMS ((const char *));
-static int VMS_Psect_Spec
- PARAMS ((const char *, int, enum ps_type, struct VMS_Symbol *));
-
-/* Local support routines which don't directly return any value. */
-
-static void s_const
- PARAMS ((int));
-static void Create_VMS_Object_File
- PARAMS ((void));
-static void Flush_VMS_Object_Record_Buffer
- PARAMS ((void));
-static void Set_VMS_Object_File_Record
- PARAMS ((int));
-static void Close_VMS_Object_File
- PARAMS ((void));
-static void vms_tir_stack_psect
- PARAMS ((int, int, int));
-static void VMS_Store_Immediate_Data
- PARAMS ((const char *, int, int));
-static void VMS_Set_Data
- PARAMS ((int, int, int, int));
-static void VMS_Store_Struct
- PARAMS ((int));
-static void VMS_Def_Struct
- PARAMS ((int));
-static void VMS_Set_Struct
- PARAMS ((int));
-static void VMS_TBT_Module_Begin
- PARAMS ((void));
-static void VMS_TBT_Module_End
- PARAMS ((void));
-static void VMS_TBT_Routine_Begin
- PARAMS ((symbolS *, int));
-static void VMS_TBT_Routine_End
- PARAMS ((int, symbolS *));
-static void VMS_TBT_Block_Begin
- PARAMS ((symbolS *, int, char *));
-static void VMS_TBT_Block_End
- PARAMS ((valueT));
-static void VMS_TBT_Line_PC_Correlation
- PARAMS ((int, int, int, int));
-static void VMS_TBT_Source_Lines
- PARAMS ((int, int, int));
-static void fpush
- PARAMS ((int, int));
-static void rpush
- PARAMS ((int, int));
-static void array_suffix
- PARAMS ((struct VMS_DBG_Symbol *));
-static void new_forward_ref
- PARAMS ((int));
-static void generate_suffix
- PARAMS ((struct VMS_DBG_Symbol *, int));
-static void bitfield_suffix
- PARAMS ((struct VMS_DBG_Symbol *, int));
-static void setup_basic_type
- PARAMS ((struct VMS_DBG_Symbol *));
-static void VMS_DBG_record
- PARAMS ((struct VMS_DBG_Symbol *, int, int, char *));
-static void VMS_local_stab_Parse
- PARAMS ((symbolS *));
-static void VMS_stab_parse
- PARAMS ((symbolS *, int, int, int, int));
-static void VMS_GSYM_Parse
- PARAMS ((symbolS *, int));
-static void VMS_LCSYM_Parse
- PARAMS ((symbolS *, int));
-static void VMS_STSYM_Parse
- PARAMS ((symbolS *, int));
-static void VMS_RSYM_Parse
- PARAMS ((symbolS *, symbolS *, int));
-static void VMS_LSYM_Parse
- PARAMS ((void));
-static void Define_Local_Symbols
- PARAMS ((symbolS *, symbolS *, symbolS *, int));
-static void Write_VMS_MHD_Records
- PARAMS ((void));
-static void Write_VMS_EOM_Record
- PARAMS ((int, valueT));
-static void VMS_Case_Hack_Symbol
- PARAMS ((const char *, char *));
-static void VMS_Modify_Psect_Attributes
- PARAMS ((const char *, int *));
-static void VMS_Global_Symbol_Spec
- PARAMS ((const char *, int, int, int));
-static void VMS_Local_Environment_Setup
- PARAMS ((const char *));
-static void VMS_Emit_Globalvalues
- PARAMS ((unsigned, unsigned, char *));
-static void VMS_Procedure_Entry_Pt
- PARAMS ((char *, int, int, int));
-static void VMS_Set_Psect
- PARAMS ((int, int, int));
-static void VMS_Store_Repeated_Data
- PARAMS ((int, char *, int, int));
-static void VMS_Store_PIC_Symbol_Reference
- PARAMS ((symbolS *, int, int, int, int, int));
-static void VMS_Fix_Indirect_Reference
- PARAMS ((int, addressT, fragS *, fragS *));
-
-/* Support code which used to be inline within vms_write_object_file. */
-static void vms_fixup_text_section
- PARAMS ((unsigned, struct frag *, struct frag *));
-static void synthesize_data_segment
- PARAMS ((unsigned, unsigned, struct frag *));
-static void vms_fixup_data_section
- PARAMS ((unsigned, unsigned));
-static void global_symbol_directory
- PARAMS ((unsigned, unsigned));
-static void local_symbols_DST
- PARAMS ((symbolS *, symbolS *));
-static void vms_build_DST
- PARAMS ((unsigned));
-static void vms_fixup_xtors_section
- PARAMS ((struct VMS_Symbol *, int));
-\f
-
/* The following code defines the special types of pseudo-ops that we
use with VMS. */
unsigned char const_flag = IN_DEFAULT_SECTION;
static void
-s_const (arg)
- int arg; /* 3rd field from obj_pseudo_table[]; not needed here */
+s_const (int arg)
{
/* Since we don't need `arg', use it as our scratch variable so that
we won't get any "not used" warnings about it. */
/* Routine to perform RESOLVE_SYMBOL_REDEFINITION(). */
int
-vms_resolve_symbol_redef (sym)
- symbolS *sym;
+vms_resolve_symbol_redef (symbolS *sym)
{
- /*
- * If the new symbol is .comm AND it has a size of zero,
- * we ignore it (i.e. the old symbol overrides it)
- */
+ /* If the new symbol is .comm AND it has a size of zero,
+ we ignore it (i.e. the old symbol overrides it). */
if (SEGMENT_TO_SYMBOL_TYPE ((int) now_seg) == (N_UNDF | N_EXT)
&& frag_now_fix () == 0)
{
S_GET_NAME (sym));
return 1;
}
- /*
- * If the old symbol is .comm and it has a size of zero,
- * we override it with the new symbol value.
- */
+ /* If the old symbol is .comm and it has a size of zero,
+ we override it with the new symbol value. */
if (S_IS_EXTERNAL (sym) && S_IS_DEFINED (sym) && S_GET_VALUE (sym) == 0)
{
as_warn (_("compiler redefined zero-size common symbol `%s'"),
and "__gnu_language_<name>" and possibly "__vax_<type>_doubles". */
void
-vms_check_for_special_label (symbolP)
-symbolS *symbolP;
+vms_check_for_special_label (symbolS *symbolP)
{
/* Special labels only occur prior to explicit section directives. */
if ((const_flag & IN_DEFAULT_SECTION) != 0)
else if (!strcmp (sym_name, "__vax_d_doubles"))
vax_g_doubles = 0;
#endif
-#if 0 /* these are potential alternatives to tc-vax.c's md_parse_options() */
+#if 0 /* These are potential alternatives to tc-vax.c's md_parse_options(). */
else if (!strcmp (sym_name, "gcc_compiled."))
flag_one = 1;
else if (!strcmp (sym_name, "__gnu_language_cplusplus"))
}
void
-obj_read_begin_hook ()
+obj_read_begin_hook (void)
{
return;
}
void
-obj_crawl_symbol_chain (headers)
- object_headers *headers;
+obj_crawl_symbol_chain (object_headers *headers)
{
symbolS *symbolP;
symbolS **symbolPP;
else
{
if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
- {
- as_bad (_("Local symbol %s never defined"), S_GET_NAME (symbolP));
- } /* oops. */
+ as_bad (_("Local symbol %s never defined"),
+ S_GET_NAME (symbolP));
/* Unhook it from the chain. */
*symbolPP = symbol_next (symbolP);
- } /* if this symbol should be in the output */
-
- } /* for each symbol */
+ }
+ }
H_SET_STRING_SIZE (headers, string_byte_count);
H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number);
-} /* obj_crawl_symbol_chain() */
+}
\f
- /****** VMS OBJECT FILE HACKING ROUTINES *******/
+/* VMS OBJECT FILE HACKING ROUTINES. */
/* Create the VMS object file. */
static void
-Create_VMS_Object_File ()
+Create_VMS_Object_File (void)
{
#ifdef eunice
VMS_Object_File_FD = creat (out_file_name, 0777, "var");
/* Flush the object record buffer to the object file. */
static void
-Flush_VMS_Object_Record_Buffer ()
+Flush_VMS_Object_Record_Buffer (void)
{
/* If the buffer is empty, there's nothing to do. */
if (Object_Record_Offset == 0)
/* Declare a particular type of object file record. */
static void
-Set_VMS_Object_File_Record (Type)
- int Type;
+Set_VMS_Object_File_Record (int Type)
{
/* If the type matches, we are done. */
if (Type == Current_Object_Record_Type)
/* Close the VMS Object file. */
static void
-Close_VMS_Object_File ()
+Close_VMS_Object_File (void)
{
/* Flush (should never be necessary) and reset saved record-type context. */
Set_VMS_Object_File_Record (-1);
close (VMS_Object_File_FD);
}
\f
-
- /****** Text Information and Relocation routines ******/
+/* Text Information and Relocation routines. */
/* Stack Psect base followed by signed, varying-sized offset.
Common to several object records. */
static void
-vms_tir_stack_psect (Psect_Index, Offset, Force)
- int Psect_Index;
- int Offset;
- int Force;
+vms_tir_stack_psect (int Psect_Index, int Offset, int Force)
{
int psect_width, offset_width;
offset_width = (Force || Offset > 32767 || Offset < -32768) ? 4
: (Offset > 127 || Offset < -128) ? 2 : 1;
#define Sta_P(p,o) (((o)<<1) | ((p)-1))
- /* byte or word psect; byte, word, or longword offset */
+ /* Byte or word psect; byte, word, or longword offset. */
switch (Sta_P(psect_width,offset_width))
{
case Sta_P(1,1): PUT_CHAR (TIR_S_C_STA_PB);
/* Store immediate data in current Psect. */
static void
-VMS_Store_Immediate_Data (Pointer, Size, Record_Type)
- const char *Pointer;
- int Size;
- int Record_Type;
+VMS_Store_Immediate_Data (const char *Pointer, int Size, int Record_Type)
{
- register int i;
+ int i;
Set_VMS_Object_File_Record (Record_Type);
/* We can only store as most 128 bytes at a time due to the way that
/* Make a data reference. */
static void
-VMS_Set_Data (Psect_Index, Offset, Record_Type, Force)
- int Psect_Index;
- int Offset;
- int Record_Type;
- int Force;
+VMS_Set_Data (int Psect_Index, int Offset, int Record_Type, int Force)
{
Set_VMS_Object_File_Record (Record_Type);
/* If the buffer is empty we must insert the record type. */
/* Make a debugger reference to a struct, union or enum. */
static void
-VMS_Store_Struct (Struct_Index)
- int Struct_Index;
+VMS_Store_Struct (int Struct_Index)
{
/* We are writing a debug record. */
Set_VMS_Object_File_Record (OBJ_S_C_DBG);
/* Make a debugger reference to partially define a struct, union or enum. */
static void
-VMS_Def_Struct (Struct_Index)
- int Struct_Index;
+VMS_Def_Struct (int Struct_Index)
{
/* We are writing a debug record. */
Set_VMS_Object_File_Record (OBJ_S_C_DBG);
}
static void
-VMS_Set_Struct (Struct_Index)
- int Struct_Index;
-{ /* see previous functions for comments */
+VMS_Set_Struct (int Struct_Index)
+{
Set_VMS_Object_File_Record (OBJ_S_C_DBG);
if (Object_Record_Offset == 0)
PUT_CHAR (OBJ_S_C_DBG);
Flush_VMS_Object_Record_Buffer ();
}
\f
-
- /****** Traceback Information routines ******/
+/* Traceback Information routines. */
/* Write the Traceback Module Begin record. */
static void
-VMS_TBT_Module_Begin ()
+VMS_TBT_Module_Begin (void)
{
- register char *cp, *cp1;
+ char *cp, *cp1;
int Size;
char Local[256];
/* Begin module. */
*cp++ = DST_S_C_MODBEG;
*cp++ = 0; /* flags; not used */
- /*
- * Language type == "C"
- *
- * (FIXME: this should be based on the input...)
- */
+ /* Language type == "C"
+ (FIXME: this should be based on the input...) */
COPY_LONG (cp, DST_S_C_C);
cp += 4;
/* Store the module name. */
/* Write the Traceback Module End record. */
static void
-VMS_TBT_Module_End ()
+VMS_TBT_Module_End (void)
{
char Local[2];
/* Write a Traceback Routine Begin record. */
static void
-VMS_TBT_Routine_Begin (symbolP, Psect)
- symbolS *symbolP;
- int Psect;
+VMS_TBT_Routine_Begin (symbolS *symbolP, int Psect)
{
- register char *cp, *cp1;
+ char *cp, *cp1;
char *Name;
int Offset;
int Size;
routine. */
static void
-VMS_TBT_Routine_End (Max_Size, sp)
- int Max_Size;
- symbolS *sp;
+VMS_TBT_Routine_End (int Max_Size, symbolS *sp)
{
symbolS *symbolP;
unsigned long Size = 0x7fffffff;
if (sym_value > sp_value && sym_value < Size)
Size = sym_value;
- /*
- * Dummy labels like "gcc_compiled." should no longer reach here.
- */
+ /* Dummy labels like "gcc_compiled." should no longer reach here. */
#if 0
else
- /* check if gcc_compiled. has size of zero */
- if (sym_value == sp_value &&
- sp != symbolP &&
- (!strcmp (S_GET_NAME (sp), "gcc_compiled.") ||
- !strcmp (S_GET_NAME (sp), "gcc2_compiled.")))
- Size = sym_value;
+ /* Check if gcc_compiled. has size of zero. */
+ if (sym_value == sp_value &&
+ sp != symbolP &&
+ (!strcmp (S_GET_NAME (sp), "gcc_compiled.") ||
+ !strcmp (S_GET_NAME (sp), "gcc2_compiled.")))
+ Size = sym_value;
#endif
}
}
/* Write a Traceback Block Begin record. */
static void
-VMS_TBT_Block_Begin (symbolP, Psect, Name)
- symbolS *symbolP;
- int Psect;
- char *Name;
+VMS_TBT_Block_Begin (symbolS *symbolP, int Psect, char *Name)
{
- register char *cp, *cp1;
+ char *cp, *cp1;
int Offset;
int Size;
char Local[512];
/* Write a Traceback Block End record. */
static void
-VMS_TBT_Block_End (Size)
- valueT Size;
+VMS_TBT_Block_End (valueT Size)
{
char Local[16];
/* Write a Line number <-> Program Counter correlation record. */
static void
-VMS_TBT_Line_PC_Correlation (Line_Number, Offset, Psect, Do_Delta)
- int Line_Number;
- int Offset;
- int Psect;
- int Do_Delta;
+VMS_TBT_Line_PC_Correlation (int Line_Number, int Offset,
+ int Psect, int Do_Delta)
{
- register char *cp;
+ char *cp;
char Local[64];
if (Do_Delta == 0)
{
- /*
- * If not delta, set our PC/Line number correlation.
- */
+ /* If not delta, set our PC/Line number correlation. */
cp = &Local[1]; /* Put size in Local[0] later. */
/* DST type is "Line Number/PC correlation". */
*cp++ = DST_S_C_LINE_NUM;
{
if (Do_Delta < 0)
{
- /*
- * When delta is negative, terminate the line numbers.
- */
+ /* When delta is negative, terminate the line numbers. */
Local[0] = 1 + 1 + 4;
Local[1] = DST_S_C_LINE_NUM;
Local[2] = DST_S_C_TERM_L;
VMS_Store_Immediate_Data (Local, 7, OBJ_S_C_TBT);
return;
}
- /*
- * Do a PC/Line delta.
- */
+ /* Do a PC/Line delta. */
cp = &Local[1];
*cp++ = DST_S_C_LINE_NUM;
if (Line_Number > 1)
COPY_LONG (cp, Line_Number - 1), cp += 4;
}
}
- /*
- * Increment the PC
- */
+ /* Increment the PC. */
if (Offset <= 128)
{
/* Small offsets are encoded as negative numbers, rather than the
/* Describe a source file to the debugger. */
static int
-VMS_TBT_Source_File (Filename, ID_Number)
- char *Filename;
- int ID_Number;
+VMS_TBT_Source_File (char *Filename, int ID_Number)
{
- register char *cp;
+ char *cp;
int len, rfo, ffb, ebk;
char cdt[8];
char Local[512];
#ifdef VMS /* Used for native assembly */
unsigned Status;
- struct FAB fab; /* RMS file access block */
- struct NAM nam; /* file name information */
- struct XABDAT xabdat; /* date+time fields */
- struct XABFHC xabfhc; /* file header characteristics */
+ struct FAB fab; /* RMS file access block */
+ struct NAM nam; /* file name information */
+ struct XABDAT xabdat; /* date+time fields */
+ struct XABFHC xabfhc; /* file header characteristics */
char resultant_string_buffer[255 + 1];
- /*
- * Set up RMS structures:
- */
+ /* Set up RMS structures: */
/* FAB -- file access block */
memset ((char *) &fab, 0, sizeof fab);
fab.fab$b_bid = FAB$C_BID;
fab.fab$b_fns = (unsigned char) strlen (Filename);
fab.fab$l_nam = (char *) &nam;
fab.fab$l_xab = (char *) &xabdat;
- /* NAM -- file name block */
+ /* NAM -- file name block. */
memset ((char *) &nam, 0, sizeof nam);
nam.nam$b_bid = NAM$C_BID;
nam.nam$b_bln = (unsigned char) sizeof nam;
nam.nam$l_rsa = resultant_string_buffer;
nam.nam$b_rss = (unsigned char) (sizeof resultant_string_buffer - 1);
- /* XABs -- extended attributes blocks */
+ /* XABs -- extended attributes blocks. */
memset ((char *) &xabdat, 0, sizeof xabdat);
xabdat.xab$b_cod = XAB$C_DAT;
xabdat.xab$b_bln = (unsigned char) sizeof xabdat;
xabfhc.xab$b_cod = XAB$C_FHC;
xabfhc.xab$b_bln = (unsigned char) sizeof xabfhc;
xabfhc.xab$l_nxt = 0;
- /*
- * Get the file information
- */
+
+ /* Get the file information. */
Status = sys$open (&fab);
if (!(Status & 1))
{
need to describe a one-to-one correspondence. */
static void
-VMS_TBT_Source_Lines (ID_Number, Starting_Line_Number, Number_Of_Lines)
- int ID_Number;
- int Starting_Line_Number;
- int Number_Of_Lines;
+VMS_TBT_Source_Lines (int ID_Number, int Starting_Line_Number,
+ int Number_Of_Lines)
{
char *cp;
int chunk_limit;
}
\f
- /****** Debugger Information support routines ******/
+/* Debugger Information support routines. */
/* This routine locates a file in the list of files. If an entry does
not exist, one is created. For include files, a new entry is always
created such that inline functions can be properly debugged. */
static struct input_file *
-find_file (sp)
- symbolS *sp;
+find_file (symbolS *sp)
{
struct input_file *same_file = 0;
struct input_file *fpnt, *last = 0;
break;
}
}
- fpnt = (struct input_file *) xmalloc (sizeof (struct input_file));
+ fpnt = xmalloc (sizeof (struct input_file));
if (!file_root)
file_root = fpnt;
else
character just past the last character read. No error is generated. */
static char *
-cvt_integer (str, rtn)
- char *str;
- int *rtn;
+cvt_integer (char *str, int *rtn)
{
int ival = 0, sgn = 1;
}
\f
-/*
- * The following functions and definitions are used to generate object
- * records that will describe program variables to the VMS debugger.
- *
- * This file contains many of the routines needed to output debugging info
- * into the object file that the VMS debugger needs to understand symbols.
- * These routines are called very late in the assembly process, and thus
- * we can be fairly lax about changing things, since the GSD and the TIR
- * sections have already been output.
- */
+/* The following functions and definitions are used to generate object
+ records that will describe program variables to the VMS debugger.
+
+ This file contains many of the routines needed to output debugging info
+ into the object file that the VMS debugger needs to understand symbols.
+ These routines are called very late in the assembly process, and thus
+ we can be fairly lax about changing things, since the GSD and the TIR
+ sections have already been output. */
/* This routine fixes the names that are generated by C++, ".this" is a good
example. The period does not work for the debugger, since it looks like
write a debugger record. */
static char *
-fix_name (pnt)
- char *pnt;
+fix_name (char *pnt)
{
char *pnt1;
outermost level, and thus symbol_name points to the symbol name. */
static char *
-get_struct_name (str)
- char *str;
+get_struct_name (char *str)
{
char *pnt;
pnt = str;
Return a pointer to struct. */
static struct VMS_DBG_Symbol *
-find_symbol (dbx_type)
- int dbx_type;
+find_symbol (int dbx_type)
{
struct VMS_DBG_Symbol *spnt;
}
#if 0 /* obsolete */
-/* this routine puts info into either Local or Asuffix, depending on the sign
- * of size. The reason is that it is easier to build the variable descriptor
- * backwards, while the array descriptor is best built forwards. In the end
- * they get put together, if there is not a struct/union/enum along the way
- */
+/* This routine puts info into either Local or Asuffix, depending on the sign
+ of size. The reason is that it is easier to build the variable descriptor
+ backwards, while the array descriptor is best built forwards. In the end
+ they get put together, if there is not a struct/union/enum along the way. */
+
static void
-push (value, size1)
- int value, size1;
+push (int value, int size1)
{
if (size1 < 0)
{
#endif
static void
-fpush (value, size)
- int value, size;
+fpush (int value, int size)
{
if (Apoint + size >= MAX_DEBUG_RECORD)
{
}
static void
-rpush (value, size)
- int value, size;
+rpush (int value, int size)
{
if (Lpnt < size)
{
/* This routine generates the array descriptor for a given array. */
static void
-array_suffix (spnt2)
- struct VMS_DBG_Symbol *spnt2;
+array_suffix (struct VMS_DBG_Symbol *spnt2)
{
struct VMS_DBG_Symbol *spnt;
struct VMS_DBG_Symbol *spnt1;
finally defined, then we can go back and plug in the correct address. */
static void
-new_forward_ref (dbx_type)
- int dbx_type;
+new_forward_ref (int dbx_type)
{
struct forward_ref *fpnt;
- fpnt = (struct forward_ref *) xmalloc (sizeof (struct forward_ref));
+
+ fpnt = xmalloc (sizeof (struct forward_ref));
fpnt->next = f_ref_root;
f_ref_root = fpnt;
fpnt->dbx_type = dbx_type;
if we know the value when it is time to write it. */
static int
-gen1 (spnt, array_suffix_len)
- struct VMS_DBG_Symbol *spnt;
- int array_suffix_len;
+gen1 (struct VMS_DBG_Symbol *spnt, int array_suffix_len)
{
struct VMS_DBG_Symbol *spnt1;
int i;
}
rpush (0, 4);
rpush (DST_K_VFLAGS_DSC, 1);
- rpush (DST_K_TS_DSC, 1); /* descriptor type specification */
+ rpush (DST_K_TS_DSC, 1); /* Descriptor type specification. */
total_len = -2;
return 1;
case STRUCT:
else
i = gen1 (spnt1, 0);
if (i)
- { /* (*void) is a special case, do not put pointer suffix */
+ {
+ /* (*void) is a special case, do not put pointer suffix. */
rpush (DBG_S_C_POINTER, 1);
total_len += 3;
rpush (total_len, 2);
return 0;
}
}
-/* It is too late to generate forward references, so the user gets a message.
- * This should only happen on a compiler error */
+ /* It is too late to generate forward references, so the user
+ gets a message. This should only happen on a compiler error. */
(void) gen1 (spnt1, 1);
i = Apoint;
array_suffix (spnt);
total_len += 2;
rpush (total_len, 2);
rpush (DST_K_VFLAGS_DSC, 1);
- rpush (1, 1); /* flags: element value spec included */
- rpush (1, 1); /* one dimension */
+ rpush (1, 1); /* Flags: element value spec included. */
+ rpush (1, 1); /* One dimension. */
rpush (DBG_S_C_COMPLEX_ARRAY, 1);
}
total_len += array_suffix_len + 8;
rpush (total_len, 2);
break;
- default: /* lint suppression */
+ default:
break;
}
return 0;
to get a complete descriptor (i.e. struct reference, array suffix). */
static void
-generate_suffix (spnt, dbx_type)
- struct VMS_DBG_Symbol *spnt;
- int dbx_type;
+generate_suffix (struct VMS_DBG_Symbol *spnt, int dbx_type)
{
- static const char pvoid[6] = {
- 5, /* record.length == 5 */
- DST_K_TYPSPEC, /* record.type == 1 (type specification) */
- 0, /* name.length == 0, no name follows */
- 1, 0, /* type.length == 1 {2 bytes, little endian} */
- DBG_S_C_VOID /* type.type == 5 (pointer to unspecified) */
- };
+ static const char pvoid[6] =
+ {
+ 5, /* record.length == 5 */
+ DST_K_TYPSPEC, /* record.type == 1 (type specification) */
+ 0, /* name.length == 0, no name follows */
+ 1, 0, /* type.length == 1 {2 bytes, little endian} */
+ DBG_S_C_VOID /* type.type == 5 (pointer to unspecified) */
+ };
int i;
Apoint = 0;
while (Lpnt < MAX_DEBUG_RECORD - 1)
Local[i++] = Local[++Lpnt];
Lpnt = i;
- /* we use this for reference to structure that has already been defined */
+ /* We use this for reference to structure that has already been defined. */
if (struct_number > 0)
{
VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG);
Lpnt = 0;
}
- /* "novel length" type doesn't work for simple atomic types */
+/* "novel length" type doesn't work for simple atomic types. */
#define USE_BITSTRING_DESCRIPTOR(t) ((t)->advanced == BASIC)
#undef SETUP_BASIC_TYPES
/* This routine generates a type description for a bitfield. */
static void
-bitfield_suffix (spnt, width)
- struct VMS_DBG_Symbol *spnt;
- int width;
+bitfield_suffix (struct VMS_DBG_Symbol *spnt, int width)
{
Local[Lpnt++] = 13; /* rec.len==13 */
Local[Lpnt++] = DST_K_TYPSPEC; /* a type specification record */
type used in a bitfield. */
static void
-setup_basic_type (spnt)
- struct VMS_DBG_Symbol *spnt ATTRIBUTE_UNUSED;
+setup_basic_type (struct VMS_DBG_Symbol *spnt ATTRIBUTE_UNUSED)
{
#ifdef SETUP_BASIC_TYPES
/* This would be very useful if "novel length" fields actually worked
ought to have distinct type records rather than sharing one. */
struct VMS_DBG_Symbol *spnt2;
- /* first check whether this type has already been seen by another name */
+ /* First check whether this type has already been seen by another name. */
for (spnt2 = VMS_Symbol_type_list[SYMTYP_HASH (spnt->VMS_type)];
spnt2;
spnt2 = spnt2->next)
return;
}
-/* This routine generates a symbol definition for a C symbol for the debugger.
- It takes a psect and offset for global symbols; if psect < 0, then this is
- a local variable and the offset is relative to FP. In this case it can
- be either a variable (Offset < 0) or a parameter (Offset > 0). */
+/* This routine generates a symbol definition for a C symbol for the
+ debugger. It takes a psect and offset for global symbols; if psect < 0,
+ then this is a local variable and the offset is relative to FP. In this
+ case it can be either a variable (Offset < 0) or a parameter (Offset > 0). */
static void
-VMS_DBG_record (spnt, Psect, Offset, Name)
- struct VMS_DBG_Symbol *spnt;
- int Psect;
- int Offset;
- char *Name;
+VMS_DBG_record (struct VMS_DBG_Symbol *spnt, int Psect,
+ int Offset, char *Name)
{
char *Name_pnt;
int len;
int i = 0;
- /* if there are bad characters in name, convert them */
+ /* If there are bad characters in name, convert them. */
Name_pnt = fix_name (Name);
len = strlen (Name_pnt);
if (Psect < 0)
- { /* this is a local variable, referenced to SP */
+ {
+ /* This is a local variable, referenced to SP. */
Local[i++] = 7 + len;
Local[i++] = spnt->VMS_type;
Local[i++] = (Offset > 0) ? DBG_C_FUNCTION_PARAM : DBG_C_LOCAL_SYM;
for the debugger of local symbols and function parameters. */
static void
-VMS_local_stab_Parse (sp)
- symbolS *sp;
+VMS_local_stab_Parse (symbolS *sp)
{
struct VMS_DBG_Symbol *spnt;
char *pnt;
str = S_GET_NAME (sp);
pnt = (char *) strchr (str, ':');
if (!pnt)
- return; /* no colon present */
- pnt1 = pnt++; /* save this for later, and skip colon */
+ return;
+
+ /* Save this for later, and skip colon. */
+ pnt1 = pnt++;
+
+ /* Ignore static constants. */
if (*pnt == 'c')
- return; /* ignore static constants */
-
-/* there is one little catch that we must be aware of. Sometimes function
- * parameters are optimized into registers, and the compiler, in its infiite
- * wisdom outputs stabs records for *both*. In general we want to use the
- * register if it is present, so we must search the rest of the symbols for
- * this function to see if this parameter is assigned to a register.
- */
+ return;
+
+ /* There is one little catch that we must be aware of. Sometimes function
+ parameters are optimized into registers, and the compiler, in its
+ infiite wisdom outputs stabs records for *both*. In general we want to
+ use the register if it is present, so we must search the rest of the
+ symbols for this function to see if this parameter is assigned to a
+ register. */
{
symbolS *sp1;
char *str1;
}
if (*str1 == ':' && *pnt2 == ':')
return; /* They are the same! Let's skip this one. */
- } /* for */
- pnt++; /* skip p in case no register */
- } /* if */
- } /* p block */
+ }
+
+ /* Skip p in case no register. */
+ pnt++;
+ }
+ }
pnt = cvt_integer (pnt, &dbx_type);
+
spnt = find_symbol (dbx_type);
if (!spnt)
- return; /*Dunno what this is*/
+ /* Dunno what this is. */
+ return;
+
*pnt1 = '\0';
VMS_DBG_record (spnt, -1, S_GET_VALUE (sp), str);
- *pnt1 = ':'; /* and restore the string */
- return;
+
+ /* ...and restore the string. */
+ *pnt1 = ':';
}
/* This routine parses a stabs entry to find the information required
to do with it. */
static void
-VMS_stab_parse (sp, expected_type, type1, type2, Text_Psect)
- symbolS *sp;
- int expected_type; /* char */
- int type1, type2, Text_Psect;
+VMS_stab_parse (symbolS *sp, int expected_type,
+ int type1, int type2, int Text_Psect)
{
char *pnt;
char *pnt1;
dbx_type = 0;
str = S_GET_NAME (sp);
+
pnt = (char *) strchr (str, ':');
if (!pnt)
- return; /* no colon present */
- pnt1 = pnt; /* save this for later*/
+ /* No colon present. */
+ return;
+
+ /* Save this for later. */
+ pnt1 = pnt;
pnt++;
if (*pnt == expected_type)
{
spnt = find_symbol (dbx_type);
if (!spnt)
return; /*Dunno what this is*/
- /*
- * Now we need to search the symbol table to find the psect and
- * offset for this variable.
- */
+ /* Now we need to search the symbol table to find the psect and
+ offset for this variable. */
*pnt1 = '\0';
vsp = VMS_Symbols;
while (vsp)
"entry point" if it was a constant. */
for (sp1 = symbol_rootP; sp1; sp1 = symbol_next (sp1))
{
- /*
- * Dispatch on STAB type
- */
+ /* Dispatch on STAB type. */
if (S_IS_DEBUG (sp1) || (S_GET_TYPE (sp1) != N_TEXT))
continue;
pnt = S_GET_NAME (sp1);
S_GET_VALUE (sp1),
str);
*pnt1 = ':';
- /* fool assembler to not output this as a routine in the TBT */
+ /* Fool assembler to not output this as a routine in the TBT. */
pnt1 = S_GET_NAME (sp1);
*pnt1 = 'L';
S_SET_NAME (sp1, pnt1);
}
}
}
- *pnt1 = ':'; /* and restore the string */
+
+ /* ...and restore the string. */
+ *pnt1 = ':';
return;
}
/* Simpler interfaces into VMS_stab_parse(). */
static void
-VMS_GSYM_Parse (sp, Text_Psect)
- symbolS *sp;
- int Text_Psect;
+VMS_GSYM_Parse (symbolS *sp, int Text_Psect)
{ /* Global variables */
VMS_stab_parse (sp, 'G', (N_UNDF | N_EXT), (N_DATA | N_EXT), Text_Psect);
}
static void
-VMS_LCSYM_Parse (sp, Text_Psect)
- symbolS *sp;
- int Text_Psect;
-{ /* Static symbols - uninitialized */
+VMS_LCSYM_Parse (symbolS *sp, int Text_Psect)
+{
VMS_stab_parse (sp, 'S', N_BSS, -1, Text_Psect);
}
static void
-VMS_STSYM_Parse (sp, Text_Psect)
- symbolS *sp;
- int Text_Psect;
-{ /* Static symbols - initialized */
+VMS_STSYM_Parse (symbolS *sp, int Text_Psect)
+{
VMS_stab_parse (sp, 'S', N_DATA, -1, Text_Psect);
}
Caveat Emptor. */
static void
-VMS_RSYM_Parse (sp, Current_Routine, Text_Psect)
- symbolS *sp;
- symbolS *Current_Routine ATTRIBUTE_UNUSED;
- int Text_Psect;
+VMS_RSYM_Parse (symbolS *sp, symbolS *Current_Routine ATTRIBUTE_UNUSED,
+ int Text_Psect)
{
symbolS *symbolP;
struct VMS_DBG_Symbol *spnt;
for (symbolP = sp; symbolP; symbolP = symbol_next (symbolP))
{
- /*
- * Dispatch on STAB type
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (symbolP))
{
case N_LBRAC:
they are. All others we can handle with a normal forward reference. */
static int
-forward_reference (pnt)
- char *pnt;
+forward_reference (char *pnt)
{
struct VMS_DBG_Symbol *spnt, *spnt1;
int i;
/* Used to check a single element of a structure on the final pass. */
static int
-final_forward_reference (spnt)
- struct VMS_DBG_Symbol *spnt;
+final_forward_reference (struct VMS_DBG_Symbol *spnt)
{
struct VMS_DBG_Symbol *spnt1;
definition, and only the first one has the definition. */
static int
-VMS_typedef_parse (str)
- char *str;
+VMS_typedef_parse (char *str)
{
char *pnt;
char *pnt1;
pnt++; /* and get back to the number */
cvt_integer (pnt, &i1);
spnt = find_symbol (i1);
- /* first see if this has been defined already, due to forward reference */
+ /* First see if this has been defined already, due to forward reference. */
if (!spnt)
{
i2 = SYMTYP_HASH (i1);
- spnt = (struct VMS_DBG_Symbol *) xmalloc (sizeof (struct VMS_DBG_Symbol));
+ spnt = xmalloc (sizeof (struct VMS_DBG_Symbol));
spnt->next = VMS_Symbol_type_list[i2];
VMS_Symbol_type_list[i2] = spnt;
spnt->dbx_type = i1; /* and save the type */
spnt->type2 = spnt->VMS_type = spnt->data_size = 0;
spnt->index_min = spnt->index_max = spnt->struc_numb = 0;
}
- /*
- * For structs and unions, do a partial parse, otherwise we sometimes get
- * circular definitions that are impossible to resolve. We read enough
- * info so that any reference to this type has enough info to be resolved.
- */
- pnt = str + 1; /* point to character past equal sign */
+
+ /* For structs and unions, do a partial parse, otherwise we sometimes get
+ circular definitions that are impossible to resolve. We read enough
+ info so that any reference to this type has enough info to be resolved. */
+
+ /* Point to character past equal sign. */
+ pnt = str + 1;
+
if (*pnt >= '0' && *pnt <= '9')
{
if (type_check ("void"))
return 1; /* do not know what this is */
}
- pnt = str + 1; /* point to character past equal sign */
+ /* Point to character past equal sign. */
+ pnt = str + 1;
+
switch (*pnt)
{
case 'r':
}
else
{
- /* [pr]
- * Shouldn't get here, but if we do, something
- * more substantial ought to be done...
- */
+ /* Shouldn't get here, but if we do, something
+ more substantial ought to be done... */
spnt->VMS_type = 0;
spnt->data_size = 0;
}
if (pnt != symbol_name)
{
pnt += strlen (pnt);
+ /* Replace colon for later. */
*pnt = ':';
- } /* replace colon for later */
+ }
+
while (*++pnt1 != ';')
{
pnt = (char *) strchr (pnt1, ':');
|| spnt1->VMS_type == DBG_S_C_USINT
|| spnt1->VMS_type == DBG_S_C_UCHAR
|| spnt1->VMS_type == DBG_S_C_UQUAD
- || spnt1->advanced == ENUM); /* (approximate) */
+ || spnt1->advanced == ENUM);
Apoint = 0;
fpush (19 + len, 1);
fpush (unsigned_type ? DBG_S_C_UBITU : DBG_S_C_SBITU, 1);
bitfield_suffix (spnt1, i3);
}
}
- else
- { /* not a bitfield */
- /* check if this is a forward reference */
+ else /* Not a bitfield. */
+ {
+ /* Check if this is a forward reference. */
if (final_pass && final_forward_reference (spnt1))
{
as_tsktsk (_("debugger output: structure element `%s' has undefined type"),
VMS_typedef_parse. */
static void
-VMS_LSYM_Parse ()
+VMS_LSYM_Parse (void)
{
char *pnt;
char *pnt1;
incomplete = 0;
for (sp = symbol_rootP; sp; sp = symbol_next (sp))
{
- /*
- * Deal with STAB symbols
- */
+ /* Deal with STAB symbols. */
if (S_IS_DEBUG (sp))
{
- /*
- * Dispatch on STAB type
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (sp))
{
case N_GSYM:
case N_PSYM:
case N_RSYM:
case N_LSYM:
- case N_FUN: /*sometimes these contain typedefs*/
+ case N_FUN: /* Sometimes these contain typedefs. */
str = S_GET_NAME (sp);
symbol_name = str;
pnt = str + strlen (str) - 1;
int tlen = 0;
spnext = sp;
- do {
- tlen += strlen (str) - 1;
- spnext = symbol_next (spnext);
- str = S_GET_NAME (spnext);
- pnt = str + strlen (str) - 1;
- } while (*pnt == '?');
+ do
+ {
+ tlen += strlen (str) - 1;
+ spnext = symbol_next (spnext);
+ str = S_GET_NAME (spnext);
+ pnt = str + strlen (str) - 1;
+ }
+ while (*pnt == '?');
+
tlen += strlen (str);
- parse_buffer = (char *) xmalloc (tlen + 1);
+ parse_buffer = xmalloc (tlen + 1);
strcpy (parse_buffer, S_GET_NAME (sp));
pnt2 = parse_buffer + strlen (parse_buffer) - 1;
*pnt2 = '\0';
spnext = sp;
- do {
- spnext = symbol_next (spnext);
- str = S_GET_NAME (spnext);
- strcat (pnt2, str);
- pnt2 += strlen (str) - 1;
- *str = '\0'; /* Erase this string */
- /* S_SET_NAME (spnext, str); */
- if (*pnt2 != '?') break;
- *pnt2 = '\0';
- } while (1);
+
+ do
+ {
+ spnext = symbol_next (spnext);
+ str = S_GET_NAME (spnext);
+ strcat (pnt2, str);
+ pnt2 += strlen (str) - 1;
+ *str = '\0'; /* Erase this string */
+ /* S_SET_NAME (spnext, str); */
+ if (*pnt2 != '?') break;
+ *pnt2 = '\0';
+ }
+ while (1);
+
str = parse_buffer;
symbol_name = str;
}
+
if ((pnt = (char *) strchr (str, ':')) != 0)
{
*pnt = '\0';
shorter than the original line. */
pnt2 = S_GET_NAME (sp);
strcpy (pnt2, parse_buffer);
- /* S_SET_NAME (sp, pnt2); */
+ /* S_SET_NAME (sp, pnt2); */
free (parse_buffer), parse_buffer = 0;
}
- *pnt = ':'; /* put back colon to restore dbx_type */
+ /* Put back colon to restore dbx_type. */
+ *pnt = ':';
}
break;
- } /*switch*/
- } /* if */
- } /*for*/
+ }
+ }
+ }
pass++;
- /*
- * Make one last pass, if needed, and define whatever we can
- * that is left.
- */
+
+ /* Make one last pass, if needed, and define whatever we can
+ that is left. */
if (final_pass == 0 && incomplete == incom1)
{
final_pass = 1;
- incom1++; /* Force one last pass through */
+ incom1++; /* Force one last pass through. */
}
- } while (incomplete != 0 && incomplete != incom1);
- /* repeat until all refs resolved if possible */
-/* if (pass > 1) printf (" Required %d passes\n", pass); */
- if (incomplete != 0)
- {
- as_tsktsk (_("debugger output: Unable to resolve %d circular references."),
- incomplete);
}
+ while (incomplete != 0 && incomplete != incom1);
+
+ if (incomplete != 0)
+ as_tsktsk (_("debugger output: Unable to resolve %d circular references."),
+ incomplete);
+
fpnt = f_ref_root;
symbol_name = "\0";
while (fpnt)
}
static void
-Define_Local_Symbols (s0P, s2P, Current_Routine, Text_Psect)
- symbolS *s0P, *s2P;
- symbolS *Current_Routine;
- int Text_Psect;
+Define_Local_Symbols (symbolS *s0P, symbolS *s2P, symbolS *Current_Routine,
+ int Text_Psect)
{
- symbolS *s1P; /* each symbol from s0P .. s2P (exclusive) */
+ symbolS *s1P; /* Each symbol from s0P .. s2P (exclusive). */
for (s1P = symbol_next (s0P); s1P != s2P; s1P = symbol_next (s1P))
{
}
if (!S_IS_DEBUG (s1P))
continue;
- /*
- * Dispatch on STAB type
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (s1P))
{
default:
- continue; /* not left or right brace */
+ /* Not left or right brace. */
+ continue;
case N_LSYM:
case N_PSYM:
case N_RSYM:
VMS_RSYM_Parse (s1P, Current_Routine, Text_Psect);
break;
- } /*switch*/
- } /* for */
+ }
+ }
}
/* This function crawls the symbol chain searching for local symbols that
of which scope we are currently in. */
static symbolS *
-Define_Routine (s0P, Level, Current_Routine, Text_Psect)
- symbolS *s0P;
- int Level;
- symbolS *Current_Routine;
- int Text_Psect;
+Define_Routine (symbolS *s0P, int Level, symbolS *Current_Routine,
+ int Text_Psect)
{
symbolS *s1P;
valueT Offset;
}
if (!S_IS_DEBUG (s1P))
continue;
- /*
- * Dispatch on STAB type
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (s1P))
{
default:
- continue; /* not left or right brace */
+ continue;
case N_LBRAC:
if (Level != 0)
sprintf (str, "$%d", rcount++);
VMS_TBT_Block_Begin (s1P, Text_Psect, str);
}
- Offset = S_GET_VALUE (s1P); /* side-effect: fully resolve symbol */
+ /* Side-effect: fully resolve symbol. */
+ Offset = S_GET_VALUE (s1P);
Define_Local_Symbols (s0P, s1P, Current_Routine, Text_Psect);
s1P = Define_Routine (s1P, Level + 1, Current_Routine, Text_Psect);
if (Level != 0)
case N_RBRAC:
return s1P;
- } /*switch*/
- } /* for */
+ }
+ }
/* We end up here if there were no brackets in this function.
Define everything. */
#ifndef VMS
#include <sys/types.h>
#include <time.h>
-static void get_VMS_time_on_unix PARAMS ((char *));
+static void get_VMS_time_on_unix (char *);
/* Manufacture a VMS-like time string on a Unix based system. */
static void
-get_VMS_time_on_unix (Now)
- char *Now;
+get_VMS_time_on_unix (char *Now)
{
char *pnt;
time_t timeb;
/* Write the MHD (Module Header) records. */
static void
-Write_VMS_MHD_Records ()
+Write_VMS_MHD_Records (void)
{
- register const char *cp;
- register char *cp1;
- register int i;
+ const char *cp;
+ char *cp1;
+ int i;
#ifdef VMS
struct { unsigned short len, mbz; char *ptr; } Descriptor;
#endif
/* We are writing a module header record. */
Set_VMS_Object_File_Record (OBJ_S_C_HDR);
- /*
- * ***************************
- * *MAIN MODULE HEADER RECORD*
- * ***************************
- */
+ /* MAIN MODULE HEADER RECORD. */
/* Store record type and header type. */
PUT_CHAR (OBJ_S_C_HDR);
PUT_CHAR (MHD_S_C_MHD);
/* Maximum record size is size of the object record buffer. */
PUT_SHORT (sizeof (Object_Record_Buffer));
- /*
- * FIXME: module name and version should be user
- * specifiable via `.ident' and/or `#pragma ident'.
- */
+ /* FIXME: module name and version should be user
+ specifiable via `.ident' and/or `#pragma ident'. */
/* Get module name (the FILENAME part of the object file). */
cp = out_file_name;
/* Force this to be a separate output record. */
Flush_VMS_Object_Record_Buffer ();
- /*
- * *************************
- * *LANGUAGE PROCESSOR NAME*
- * *************************
- */
+ /* LANGUAGE PROCESSOR NAME. */
+
/* Store record type and header type. */
PUT_CHAR (OBJ_S_C_HDR);
PUT_CHAR (MHD_S_C_LNM);
- /*
- * Store language processor name and version (not a counted string!).
- *
- * This is normally supplied by the gcc driver for the command line
- * which invokes gas. If absent, we fall back to gas's version.
- */
+
+ /* Store language processor name and version (not a counted string!).
+ This is normally supplied by the gcc driver for the command line
+ which invokes gas. If absent, we fall back to gas's version. */
+
cp = compiler_version_string;
if (cp == 0)
{
/* Write the EOM (End Of Module) record. */
static void
-Write_VMS_EOM_Record (Psect, Offset)
- int Psect;
- valueT Offset;
+Write_VMS_EOM_Record (int Psect, valueT Offset)
{
- /*
- * We are writing an end-of-module record
- * (this assumes that the entry point will always be in a psect
- * represented by a single byte, which is the case for code in
- * Text_Psect==0)
- */
+ /* We are writing an end-of-module record
+ (this assumes that the entry point will always be in a psect
+ represented by a single byte, which is the case for code in
+ Text_Psect==0). */
+
Set_VMS_Object_File_Record (OBJ_S_C_EOM);
PUT_CHAR (OBJ_S_C_EOM); /* Record type. */
PUT_CHAR (0); /* Error severity level (we ignore it). */
- /*
- * Store the entry point, if it exists
- */
+ /* Store the entry point, if it exists. */
if (Psect >= 0)
{
PUT_CHAR (Psect);
}
\f
-/* this hash routine borrowed from GNU-EMACS, and strengthened slightly ERY*/
+/* This hash routine borrowed from GNU-EMACS, and strengthened slightly
+ ERY. */
static int
-hash_string (ptr)
- const char *ptr;
+hash_string (const char *ptr)
{
- register const unsigned char *p = (unsigned char *) ptr;
- register const unsigned char *end = p + strlen (ptr);
- register unsigned char c;
- register int hash = 0;
+ const unsigned char *p = (unsigned char *) ptr;
+ const unsigned char *end = p + strlen (ptr);
+ unsigned char c;
+ int hash = 0;
while (p != end)
{
return hash;
}
-/*
- * Generate a Case-Hacked VMS symbol name (limited to 31 chars)
- */
+/* Generate a Case-Hacked VMS symbol name (limited to 31 chars). */
+
static void
-VMS_Case_Hack_Symbol (In, Out)
- register const char *In;
- register char *Out;
+VMS_Case_Hack_Symbol (const char *In, char *Out)
{
long int init;
long int result;
char *pnt = 0;
char *new_name;
const char *old_name;
- register int i;
- int destructor = 0; /*hack to allow for case sens in a destructor*/
+ int i;
+ int destructor = 0; /* Hack to allow for case sens in a destructor. */
int truncate = 0;
int Case_Hack_Bits = 0;
int Saw_Dollar = 0;
static char Hex_Table[16] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
- /*
- * Kill any leading "_"
- */
+ /* Kill any leading "_". */
if ((In[0] == '_') && ((In[1] > '9') || (In[1] < '0')))
In++;
- new_name = Out; /* save this for later*/
+ new_name = Out; /* Save this for later. */
-#if barfoo /* Dead code */
+#if 0
if ((In[0] == '_') && (In[1] == '$') && (In[2] == '_'))
destructor = 1;
#endif
- /* We may need to truncate the symbol, save the hash for later*/
+ /* We may need to truncate the symbol, save the hash for later. */
result = (strlen (In) > 23) ? hash_string (In) : 0;
- /*
- * Is there a Psect Attribute to skip??
- */
+ /* Is there a Psect Attribute to skip? */
if (HAS_PSECT_ATTRIBUTES (In))
{
- /*
- * Yes: Skip it
- */
+ /* Yes: Skip it. */
In += PSECT_ATTRIBUTES_STRING_LENGTH;
while (*In)
{
}
old_name = In;
-/* if (strlen (In) > 31 && flag_hash_long_names)
- as_tsktsk ("Symbol name truncated: %s\n", In); */
- /*
- * Do the case conversion
- */
- i = 23; /* Maximum of 23 chars */
+#if 0
+ if (strlen (In) > 31 && flag_hash_long_names)
+ as_tsktsk ("Symbol name truncated: %s\n", In);
+#endif
+ /* Do the case conversion. */
+ /* Maximum of 23 chars */
+ i = 23;
while (*In && (--i >= 0))
{
Case_Hack_Bits <<= 1;
Saw_Dollar = 1;
if ((destructor == 1) && (i == 21))
Saw_Dollar = 0;
+
switch (vms_name_mapping)
{
case 0:
- if (ISUPPER (*In)) {
- *Out++ = *In++;
- Case_Hack_Bits |= 1;
- } else {
+ if (ISUPPER (*In))
+ {
+ *Out++ = *In++;
+ Case_Hack_Bits |= 1;
+ }
+ else
*Out++ = TOUPPER (*In++);
- }
break;
- case 3: *Out++ = *In++;
+
+ case 3:
+ *Out++ = *In++;
break;
+
case 2:
- if (ISLOWER (*In)) {
+ if (ISLOWER (*In))
*Out++ = *In++;
- } else {
+ else
*Out++ = TOLOWER (*In++);
- }
break;
}
}
- /*
- * If we saw a dollar sign, we don't do case hacking
- */
+ /* If we saw a dollar sign, we don't do case hacking. */
if (flag_no_hash_mixed_case || Saw_Dollar)
Case_Hack_Bits = 0;
- /*
- * If we have more than 23 characters and everything is lowercase
- * we can insert the full 31 characters
- */
+ /* If we have more than 23 characters and everything is lowercase
+ we can insert the full 31 characters. */
if (*In)
{
- /*
- * We have more than 23 characters
- * If we must add the case hack, then we have truncated the str
- */
+ /* We have more than 23 characters
+ If we must add the case hack, then we have truncated the str. */
pnt = Out;
truncate = 1;
if (Case_Hack_Bits == 0)
{
- /*
- * And so far they are all lower case:
- * Check up to 8 more characters
- * and ensure that they are lowercase
- */
+ /* And so far they are all lower case:
+ Check up to 8 more characters
+ and ensure that they are lowercase. */
for (i = 0; (In[i] != 0) && (i < 8); i++)
if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case)
break;
if ((i == 8) || (In[i] == 0))
{
- /*
- * They are: Copy up to 31 characters
- * to the output string
- */
+ /* They are: Copy up to 31 characters
+ to the output string. */
i = 8;
while ((--i >= 0) && (*In))
switch (vms_name_mapping){
}
}
}
- /*
- * If there were any uppercase characters in the name we
- * take on the case hacking string
- */
+ /* If there were any uppercase characters in the name we
+ take on the case hacking string. */
- /* Old behavior for regular GNU-C compiler */
+ /* Old behavior for regular GNU-C compiler. */
if (!flag_hash_long_names)
truncate = 0;
if ((Case_Hack_Bits != 0) || (truncate == 1))
}
else
{
- Out = pnt; /*Cut back to 23 characters maximum */
+ Out = pnt; /* Cut back to 23 characters maximum. */
*Out++ = '_';
for (i = 0; i < 7; i++)
{
result = result >> 5;
}
}
- } /*Case Hack */
- /*
- * Done
- */
+ }
+ /* Done. */
*Out = 0;
if (truncate == 1 && flag_hash_long_names && flag_show_after_trunc)
as_tsktsk (_("Symbol %s replaced by %s\n"), old_name, new_name);
}
\f
-/*
- * Scan a symbol name for a psect attribute specification
- */
+/* Scan a symbol name for a psect attribute specification. */
+
#define GLOBALSYMBOL_BIT 0x10000
#define GLOBALVALUE_BIT 0x20000
static void
-VMS_Modify_Psect_Attributes (Name, Attribute_Pointer)
- const char *Name;
- int *Attribute_Pointer;
+VMS_Modify_Psect_Attributes (const char *Name, int *Attribute_Pointer)
{
- register int i;
- register const char *cp;
+ int i;
+ const char *cp;
int Negate;
static const struct
{
{0, 0}
};
- /*
- * Kill leading "_"
- */
+ /* Kill leading "_". */
if (*Name == '_')
Name++;
- /*
- * Check for a PSECT attribute list
- */
+ /* Check for a PSECT attribute list. */
if (!HAS_PSECT_ATTRIBUTES (Name))
- return; /* If not, return */
- /*
- * Skip the attribute list indicator
- */
+ return;
+ /* Skip the attribute list indicator. */
Name += PSECT_ATTRIBUTES_STRING_LENGTH;
- /*
- * Process the attributes ("_" separated, "$" terminated)
- */
+ /* Process the attributes ("_" separated, "$" terminated). */
while (*Name != '$')
{
- /*
- * Assume not negating
- */
+ /* Assume not negating. */
Negate = 0;
- /*
- * Check for "NO"
- */
+ /* Check for "NO". */
if ((Name[0] == 'N') && (Name[1] == 'O'))
{
- /*
- * We are negating (and skip the NO)
- */
+ /* We are negating (and skip the NO). */
Negate = 1;
Name += 2;
}
- /*
- * Find the token delimiter
- */
+ /* Find the token delimiter. */
cp = Name;
while (*cp && (*cp != '_') && (*cp != '$'))
cp++;
- /*
- * Look for the token in the attribute list
- */
+ /* Look for the token in the attribute list. */
for (i = 0; Attributes[i].Name; i++)
{
- /*
- * If the strings match, set/clear the attr.
- */
+ /* If the strings match, set/clear the attr. */
if (strncmp (Name, Attributes[i].Name, cp - Name) == 0)
{
- /*
- * Set or clear
- */
+ /* Set or clear. */
if (Negate)
*Attribute_Pointer &=
~Attributes[i].Value;
else
*Attribute_Pointer |=
Attributes[i].Value;
- /*
- * Done
- */
+ /* Done. */
break;
}
}
- /*
- * Now skip the attribute
- */
+ /* Now skip the attribute. */
Name = cp;
if (*Name == '_')
Name++;
#define GBLSYM_LCL 4 /* not GBL after all... */
#define GBLSYM_WEAK 8
-/*
- * Define a global symbol (or possibly a local one).
- */
+/* Define a global symbol (or possibly a local one). */
+
static void
-VMS_Global_Symbol_Spec (Name, Psect_Number, Psect_Offset, Flags)
- const char *Name;
- int Psect_Number;
- int Psect_Offset;
- int Flags;
+VMS_Global_Symbol_Spec (const char *Name, int Psect_Number, int Psect_Offset, int Flags)
{
char Local[32];
- /*
- * We are writing a GSD record
- */
+ /* We are writing a GSD record. */
Set_VMS_Object_File_Record (OBJ_S_C_GSD);
- /*
- * If the buffer is empty we must insert the GSD record type
- */
+
+ /* If the buffer is empty we must insert the GSD record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (OBJ_S_C_GSD);
- /*
- * We are writing a Global (or local) symbol definition subrecord.
- */
+
+ /* We are writing a Global (or local) symbol definition subrecord. */
PUT_CHAR ((Flags & GBLSYM_LCL) != 0 ? GSD_S_C_LSY :
((unsigned) Psect_Number <= 255) ? GSD_S_C_SYM : GSD_S_C_SYMW);
- /*
- * Data type is undefined
- */
+
+ /* Data type is undefined. */
PUT_CHAR (0);
- /*
- * Switch on Definition/Reference
- */
+
+ /* Switch on Definition/Reference. */
if ((Flags & GBLSYM_DEF) == 0)
{
- /*
- * Reference
- */
+ /* Reference. */
PUT_SHORT (((Flags & GBLSYM_VAL) == 0) ? GSY_S_M_REL : 0);
if ((Flags & GBLSYM_LCL) != 0) /* local symbols have extra field */
PUT_SHORT (Current_Environment);
{
int sym_flags;
- /*
- * Definition
- *[ assert (LSY_S_M_DEF == GSY_S_M_DEF && LSY_S_M_REL == GSY_S_M_REL); ]
- */
+ /* Definition
+ [ assert (LSY_S_M_DEF == GSY_S_M_DEF && LSY_S_M_REL == GSY_S_M_REL); ]. */
sym_flags = GSY_S_M_DEF;
if (Flags & GBLSYM_WEAK)
sym_flags |= GSY_S_M_WEAK;
PUT_SHORT (sym_flags);
if ((Flags & GBLSYM_LCL) != 0) /* local symbols have extra field */
PUT_SHORT (Current_Environment);
- /*
- * Psect Number
- */
+
+ /* Psect Number. */
if ((Flags & GBLSYM_LCL) == 0 && (unsigned) Psect_Number <= 255)
PUT_CHAR (Psect_Number);
else
PUT_SHORT (Psect_Number);
- /*
- * Offset
- */
+
+ /* Offset. */
PUT_LONG (Psect_Offset);
}
- /*
- * Finally, the global symbol name
- */
+
+ /* Finally, the global symbol name. */
VMS_Case_Hack_Symbol (Name, Local);
PUT_COUNTED_STRING (Local);
- /*
- * Flush the buffer if it is more than 75% full
- */
+
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
}
-/*
- * Define an environment to support local symbol references.
- * This is just to mollify the linker; we don't actually do
- * anything useful with it.
- */
+/* Define an environment to support local symbol references.
+ This is just to mollify the linker; we don't actually do
+ anything useful with it. */
+
static void
-VMS_Local_Environment_Setup (Env_Name)
- const char *Env_Name;
+VMS_Local_Environment_Setup (const char *Env_Name)
{
/* We are writing a GSD record. */
Set_VMS_Object_File_Record (OBJ_S_C_GSD);
}
\f
-/*
- * Define a psect
- */
+/* Define a psect. */
+
static int
-VMS_Psect_Spec (Name, Size, Type, vsp)
- const char *Name;
- int Size;
- enum ps_type Type;
- struct VMS_Symbol *vsp;
+VMS_Psect_Spec (const char *Name, int Size, enum ps_type Type, struct VMS_Symbol *vsp)
{
char Local[32];
int Psect_Attributes;
- /*
- * Generate the appropriate PSECT flags given the PSECT type
- */
+ /* Generate the appropriate PSECT flags given the PSECT type. */
switch (Type)
{
case ps_TEXT:
error (_("Unknown VMS psect type (%ld)"), (long) Type);
break;
}
- /*
- * Modify the psect attributes according to any attribute string
- */
+ /* Modify the psect attributes according to any attribute string. */
if (vsp && S_GET_TYPE (vsp->Symbol) == N_ABS)
Psect_Attributes |= GLOBALVALUE_BIT;
else if (HAS_PSECT_ATTRIBUTES (Name))
VMS_Modify_Psect_Attributes (Name, &Psect_Attributes);
- /*
- * Check for globalref/def/val.
- */
+ /* Check for globalref/def/val. */
if ((Psect_Attributes & GLOBALVALUE_BIT) != 0)
{
- /*
- * globalvalue symbols were generated before. This code
- * prevents unsightly psect buildup, and makes sure that
- * fixup references are emitted correctly.
- */
+ /* globalvalue symbols were generated before. This code
+ prevents unsightly psect buildup, and makes sure that
+ fixup references are emitted correctly. */
vsp->Psect_Index = -1; /* to catch errors */
S_SET_TYPE (vsp->Symbol, N_UNDF); /* make refs work */
return 1; /* decrement psect counter */
vsp->Psect_Offset, GBLSYM_REF);
vsp->Psect_Index = -1;
S_SET_TYPE (vsp->Symbol, N_UNDF);
- return 1; /* return and indicate no psect */
+ /* Return and indicate no psect. */
+ return 1;
+
case N_DATA | N_EXT:
VMS_Global_Symbol_Spec (Name, vsp->Psect_Index,
vsp->Psect_Offset, GBLSYM_DEF);
- /* In this case we still generate the psect */
+ /* In this case we still generate the psect. */
break;
+
default:
as_fatal (_("Globalsymbol attribute for symbol %s was unexpected."),
Name);
break;
- } /* switch */
+ }
}
- Psect_Attributes &= 0xffff; /* clear out the globalref/def stuff */
- /*
- * We are writing a GSD record
- */
+ /* Clear out the globalref/def stuff. */
+ Psect_Attributes &= 0xffff;
+ /* We are writing a GSD record. */
Set_VMS_Object_File_Record (OBJ_S_C_GSD);
- /*
- * If the buffer is empty we must insert the GSD record type
- */
+ /* If the buffer is empty we must insert the GSD record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (OBJ_S_C_GSD);
- /*
- * We are writing a PSECT definition subrecord
- */
+ /* We are writing a PSECT definition subrecord. */
PUT_CHAR (GSD_S_C_PSC);
- /*
- * Psects are always LONGWORD aligned
- */
+ /* Psects are always LONGWORD aligned. */
PUT_CHAR (2);
- /*
- * Specify the psect attributes
- */
+ /* Specify the psect attributes. */
PUT_SHORT (Psect_Attributes);
- /*
- * Specify the allocation
- */
+ /* Specify the allocation. */
PUT_LONG (Size);
- /*
- * Finally, the psect name
- */
+ /* Finally, the psect name. */
VMS_Case_Hack_Symbol (Name, Local);
PUT_COUNTED_STRING (Local);
- /*
- * Flush the buffer if it is more than 75% full
- */
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
return 0;
which will indicate the start of another datum. */
static offsetT
-VMS_Initialized_Data_Size (s0P, End_Of_Data)
- register symbolS *s0P;
- unsigned End_Of_Data;
+VMS_Initialized_Data_Size (symbolS *s0P, unsigned End_Of_Data)
{
symbolS *s1P;
valueT s0P_val = S_GET_VALUE (s0P), s1P_val,
generate globalvalues for those that have it. */
static void
-VMS_Emit_Globalvalues (text_siz, data_siz, Data_Segment)
- unsigned text_siz;
- unsigned data_siz;
- char *Data_Segment;
+VMS_Emit_Globalvalues (unsigned text_siz, unsigned data_siz,
+ char *Data_Segment)
{
- register symbolS *sp;
+ symbolS *sp;
char *stripped_name, *Name;
int Size;
int Psect_Attributes;
int globalvalue;
int typ, abstyp;
- /*
- * Scan the symbol table for globalvalues, and emit def/ref when
- * required. These will be caught again later and converted to
- * N_UNDF
- */
+ /* Scan the symbol table for globalvalues, and emit def/ref when
+ required. These will be caught again later and converted to
+ N_UNDF. */
for (sp = symbol_rootP; sp; sp = sp->sy_next)
{
typ = S_GET_RAW_TYPE (sp);
abstyp = ((typ & ~N_EXT) == N_ABS);
- /*
- * See if this is something we want to look at.
- */
+ /* See if this is something we want to look at. */
if (!abstyp &&
typ != (N_DATA | N_EXT) &&
typ != (N_UNDF | N_EXT))
continue;
- /*
- * See if this has globalvalue specification.
- */
+ /* See if this has globalvalue specification. */
Name = S_GET_NAME (sp);
if (abstyp)
}
else if (HAS_PSECT_ATTRIBUTES (Name))
{
- stripped_name = (char *) xmalloc (strlen (Name) + 1);
+ stripped_name = xmalloc (strlen (Name) + 1);
strcpy (stripped_name, Name);
Psect_Attributes = 0;
VMS_Modify_Psect_Attributes (stripped_name, &Psect_Attributes);
default:
as_warn (_("Invalid globalvalue of %s"), stripped_name);
break;
- } /* switch */
- } /* if */
- if (stripped_name) free (stripped_name); /* clean up */
- } /* for */
+ }
+ }
+
+ if (stripped_name)
+ free (stripped_name);
+ }
}
\f
-/*
- * Define a procedure entry pt/mask
- */
+/* Define a procedure entry pt/mask. */
+
static void
-VMS_Procedure_Entry_Pt (Name, Psect_Number, Psect_Offset, Entry_Mask)
- char *Name;
- int Psect_Number;
- int Psect_Offset;
- int Entry_Mask;
+VMS_Procedure_Entry_Pt (char *Name, int Psect_Number, int Psect_Offset,
+ int Entry_Mask)
{
char Local[32];
- /*
- * We are writing a GSD record
- */
+ /* We are writing a GSD record. */
Set_VMS_Object_File_Record (OBJ_S_C_GSD);
- /*
- * If the buffer is empty we must insert the GSD record type
- */
+ /* If the buffer is empty we must insert the GSD record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (OBJ_S_C_GSD);
- /*
- * We are writing a Procedure Entry Pt/Mask subrecord
- */
+ /* We are writing a Procedure Entry Pt/Mask subrecord. */
PUT_CHAR (((unsigned) Psect_Number <= 255) ? GSD_S_C_EPM : GSD_S_C_EPMW);
- /*
- * Data type is undefined
- */
+ /* Data type is undefined. */
PUT_CHAR (0);
- /*
- * Flags = "RELOCATABLE" and "DEFINED"
- */
+ /* Flags = "RELOCATABLE" and "DEFINED". */
PUT_SHORT (GSY_S_M_DEF | GSY_S_M_REL);
- /*
- * Psect Number
- */
+ /* Psect Number. */
if ((unsigned) Psect_Number <= 255)
PUT_CHAR (Psect_Number);
else
PUT_SHORT (Psect_Number);
- /*
- * Offset
- */
+ /* Offset. */
PUT_LONG (Psect_Offset);
- /*
- * Entry mask
- */
+ /* Entry mask. */
PUT_SHORT (Entry_Mask);
- /*
- * Finally, the global symbol name
- */
+ /* Finally, the global symbol name. */
VMS_Case_Hack_Symbol (Name, Local);
PUT_COUNTED_STRING (Local);
- /*
- * Flush the buffer if it is more than 75% full
- */
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
}
\f
-/*
- * Set the current location counter to a particular Psect and Offset
- */
+/* Set the current location counter to a particular Psect and Offset. */
+
static void
-VMS_Set_Psect (Psect_Index, Offset, Record_Type)
- int Psect_Index;
- int Offset;
- int Record_Type;
+VMS_Set_Psect (int Psect_Index, int Offset, int Record_Type)
{
- /*
- * We are writing a "Record_Type" record
- */
+ /* We are writing a "Record_Type" record. */
Set_VMS_Object_File_Record (Record_Type);
- /*
- * If the buffer is empty we must insert the record type
- */
+ /* If the buffer is empty we must insert the record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (Record_Type);
- /*
- * Stack the Psect base + Offset
- */
+ /* Stack the Psect base + Offset. */
vms_tir_stack_psect (Psect_Index, Offset, 0);
- /*
- * Set relocation base
- */
+ /* Set relocation base. */
PUT_CHAR (TIR_S_C_CTL_SETRB);
- /*
- * Flush the buffer if it is more than 75% full
- */
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
}
\f
-/*
- * Store repeated immediate data in current Psect
- */
+/* Store repeated immediate data in current Psect. */
+
static void
-VMS_Store_Repeated_Data (Repeat_Count, Pointer, Size, Record_Type)
- int Repeat_Count;
- register char *Pointer;
- int Size;
- int Record_Type;
+VMS_Store_Repeated_Data (int Repeat_Count, char *Pointer, int Size,
+ int Record_Type)
{
-
- /*
- * Ignore zero bytes/words/longwords
- */
+ /* Ignore zero bytes/words/longwords. */
switch (Size)
{
case 4:
default:
break;
}
- /*
- * If the data is too big for a TIR_S_C_STO_RIVB sub-record
- * then we do it manually
- */
+ /* If the data is too big for a TIR_S_C_STO_RIVB sub-record
+ then we do it manually. */
if (Size > 255)
{
while (--Repeat_Count >= 0)
VMS_Store_Immediate_Data (Pointer, Size, Record_Type);
return;
}
- /*
- * We are writing a "Record_Type" record
- */
+ /* We are writing a "Record_Type" record. */
Set_VMS_Object_File_Record (Record_Type);
- /*
- * If the buffer is empty we must insert record type
- */
+ /* If the buffer is empty we must insert record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (Record_Type);
- /*
- * Stack the repeat count
- */
+ /* Stack the repeat count. */
PUT_CHAR (TIR_S_C_STA_LW);
PUT_LONG (Repeat_Count);
- /*
- * And now the command and its data
- */
+ /* And now the command and its data. */
PUT_CHAR (TIR_S_C_STO_RIVB);
PUT_CHAR (Size);
while (--Size >= 0)
PUT_CHAR (*Pointer++);
- /*
- * Flush the buffer if it is more than 75% full
- */
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
}
\f
-/*
- * Store a Position Independent Reference
- */
+/* Store a Position Independent Reference. */
+
static void
-VMS_Store_PIC_Symbol_Reference (Symbol, Offset, PC_Relative,
- Psect, Psect_Offset, Record_Type)
- symbolS *Symbol;
- int Offset;
- int PC_Relative;
- int Psect;
- int Psect_Offset;
- int Record_Type;
+VMS_Store_PIC_Symbol_Reference (symbolS *Symbol, int Offset, int PC_Relative,
+ int Psect, int Psect_Offset, int Record_Type)
{
- register struct VMS_Symbol *vsp = Symbol->sy_obj;
+ struct VMS_Symbol *vsp = Symbol->sy_obj;
char Local[32];
int local_sym = 0;
- /*
- * We are writing a "Record_Type" record
- */
+ /* We are writing a "Record_Type" record. */
Set_VMS_Object_File_Record (Record_Type);
- /*
- * If the buffer is empty we must insert record type
- */
+ /* If the buffer is empty we must insert record type. */
if (Object_Record_Offset == 0)
PUT_CHAR (Record_Type);
- /*
- * Set to the appropriate offset in the Psect.
- * For a Code reference we need to fix the operand
- * specifier as well, so back up 1 byte;
- * for a Data reference we just store HERE.
- */
+ /* Set to the appropriate offset in the Psect.
+ For a Code reference we need to fix the operand
+ specifier as well, so back up 1 byte;
+ for a Data reference we just store HERE. */
VMS_Set_Psect (Psect,
PC_Relative ? Psect_Offset - 1 : Psect_Offset,
Record_Type);
- /*
- * Make sure we are still generating a "Record Type" record
- */
+ /* Make sure we are still generating a "Record Type" record. */
if (Object_Record_Offset == 0)
PUT_CHAR (Record_Type);
- /*
- * Dispatch on symbol type (so we can stack its value)
- */
+ /* Dispatch on symbol type (so we can stack its value). */
switch (S_GET_RAW_TYPE (Symbol))
{
- /*
- * Global symbol
- */
+ /* Global symbol. */
case N_ABS:
local_sym = 1;
/*FALLTHRU*/
#endif /* NOT_VAX_11_C_COMPATIBLE */
case N_UNDF:
case N_TEXT | N_EXT:
- /*
- * Get the symbol name (case hacked)
- */
+ /* Get the symbol name (case hacked). */
VMS_Case_Hack_Symbol (S_GET_NAME (Symbol), Local);
- /*
- * Stack the global symbol value
- */
+ /* Stack the global symbol value. */
if (!local_sym)
{
PUT_CHAR (TIR_S_C_STA_GBL);
PUT_COUNTED_STRING (Local);
if (Offset)
{
- /*
- * Stack the longword offset
- */
+ /* Stack the longword offset. */
PUT_CHAR (TIR_S_C_STA_LW);
PUT_LONG (Offset);
- /*
- * Add the two, leaving the result on the stack
- */
+ /* Add the two, leaving the result on the stack. */
PUT_CHAR (TIR_S_C_OPR_ADD);
}
break;
- /*
- * Uninitialized local data
- */
+ /* Uninitialized local data. */
case N_BSS:
- /*
- * Stack the Psect (+offset)
- */
+ /* Stack the Psect (+offset). */
vms_tir_stack_psect (vsp->Psect_Index,
vsp->Psect_Offset + Offset,
0);
break;
- /*
- * Local text
- */
+ /* Local text. */
case N_TEXT:
- /*
- * Stack the Psect (+offset)
- */
+ /* Stack the Psect (+offset). */
vms_tir_stack_psect (vsp->Psect_Index,
S_GET_VALUE (Symbol) + Offset,
0);
break;
- /*
- * Initialized local or global data
- */
+ /* Initialized local or global data. */
case N_DATA:
#ifndef NOT_VAX_11_C_COMPATIBLE
case N_UNDF | N_EXT:
case N_DATA | N_EXT:
#endif /* NOT_VAX_11_C_COMPATIBLE */
- /*
- * Stack the Psect (+offset)
- */
+ /* Stack the Psect (+offset). */
vms_tir_stack_psect (vsp->Psect_Index,
vsp->Psect_Offset + Offset,
0);
break;
}
- /*
- * Store either a code or data reference
- */
+ /* Store either a code or data reference. */
PUT_CHAR (PC_Relative ? TIR_S_C_STO_PICR : TIR_S_C_STO_PIDR);
- /*
- * Flush the buffer if it is more than 75% full
- */
+ /* Flush the buffer if it is more than 75% full. */
if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4))
Flush_VMS_Object_Record_Buffer ();
}
\f
-/*
- * Check in the text area for an indirect pc-relative reference
- * and fix it up with addressing mode 0xff [PC indirect]
- *
- * THIS SHOULD BE REPLACED BY THE USE OF TIR_S_C_STO_PIRR IN THE
- * PIC CODE GENERATING FIXUP ROUTINE.
- */
+/* Check in the text area for an indirect pc-relative reference
+ and fix it up with addressing mode 0xff [PC indirect]
+
+ THIS SHOULD BE REPLACED BY THE USE OF TIR_S_C_STO_PIRR IN THE
+ PIC CODE GENERATING FIXUP ROUTINE. */
+
static void
-VMS_Fix_Indirect_Reference (Text_Psect, Offset, fragP, text_frag_root)
- int Text_Psect;
- addressT Offset;
- register fragS *fragP;
- fragS *text_frag_root;
+VMS_Fix_Indirect_Reference (int Text_Psect, addressT Offset,
+ fragS *fragP, fragS *text_frag_root)
{
- /*
- * The addressing mode byte is 1 byte before the address
- */
+ /* The addressing mode byte is 1 byte before the address. */
Offset--;
- /*
- * Is it in THIS frag??
- */
+ /* Is it in THIS frag? */
if ((Offset < fragP->fr_address) ||
(Offset >= (fragP->fr_address + fragP->fr_fix)))
{
- /*
- * We need to search for the fragment containing this
- * Offset
- */
+ /* We need to search for the fragment containing this
+ Offset. */
for (fragP = text_frag_root; fragP; fragP = fragP->fr_next)
{
if ((Offset >= fragP->fr_address) &&
(Offset < (fragP->fr_address + fragP->fr_fix)))
break;
}
- /*
- * If we couldn't find the frag, things are BAD!!
- */
+ /* If we couldn't find the frag, things are BAD! */
if (fragP == 0)
error (_("Couldn't find fixup fragment when checking for indirect reference"));
}
- /*
- * Check for indirect PC relative addressing mode
- */
+ /* Check for indirect PC relative addressing mode. */
if (fragP->fr_literal[Offset - fragP->fr_address] == (char) 0xff)
{
static char Address_Mode = (char) 0xff;
- /*
- * Yes: Store the indirect mode back into the image
- * to fix up the damage done by STO_PICR
- */
+ /* Yes: Store the indirect mode back into the image
+ to fix up the damage done by STO_PICR. */
VMS_Set_Psect (Text_Psect, Offset, OBJ_S_C_TIR);
VMS_Store_Immediate_Data (&Address_Mode, 1, OBJ_S_C_TIR);
}
}
\f
-/*
- * If the procedure "main()" exists we have to add the instruction
- * "jsb c$main_args" at the beginning to be compatible with VAX-11 "C".
- *
- * FIXME: the macro name `HACK_DEC_C_STARTUP' should be renamed
- * to `HACK_VAXCRTL_STARTUP' because Digital's compiler
- * named "DEC C" uses run-time library "DECC$SHR", but this
- * startup code is for "VAXCRTL", the library for Digital's
- * older "VAX C". Also, this extra code isn't needed for
- * supporting gcc because it already generates the VAXCRTL
- * startup call when compiling main(). The reference to
- * `flag_hash_long_names' looks very suspicious too;
- * probably an old-style command line option was inadvertently
- * overloaded here, then blindly converted into the new one.
- */
+/* If the procedure "main()" exists we have to add the instruction
+ "jsb c$main_args" at the beginning to be compatible with VAX-11 "C".
+
+ FIXME: the macro name `HACK_DEC_C_STARTUP' should be renamed
+ to `HACK_VAXCRTL_STARTUP' because Digital's compiler
+ named "DEC C" uses run-time library "DECC$SHR", but this
+ startup code is for "VAXCRTL", the library for Digital's
+ older "VAX C". Also, this extra code isn't needed for
+ supporting gcc because it already generates the VAXCRTL
+ startup call when compiling main(). The reference to
+ `flag_hash_long_names' looks very suspicious too;
+ probably an old-style command line option was inadvertently
+ overloaded here, then blindly converted into the new one. */
void
-vms_check_for_main ()
+vms_check_for_main (void)
{
- register symbolS *symbolP;
+ symbolS *symbolP;
#ifdef HACK_DEC_C_STARTUP /* JF */
- register struct frchain *frchainP;
- register fragS *fragP;
- register fragS **prev_fragPP;
- register struct fix *fixP;
- register fragS *New_Frag;
+ struct frchain *frchainP;
+ fragS *fragP;
+ fragS **prev_fragPP;
+ struct fix *fixP;
+ fragS *New_Frag;
int i;
#endif /* HACK_DEC_C_STARTUP */
if (!flag_hash_long_names)
{
#endif
- /*
- * Remember the entry point symbol
- */
+ /* Remember the entry point symbol. */
Entry_Point_Symbol = symbolP;
#ifdef HACK_DEC_C_STARTUP
}
else
{
- /*
- * Scan all the fragment chains for the one with "_main"
- * (Actually we know the fragment from the symbol, but we need
- * the previous fragment so we can change its pointer)
- */
+ /* Scan all the fragment chains for the one with "_main"
+ (Actually we know the fragment from the symbol, but we need
+ the previous fragment so we can change its pointer). */
frchainP = frchain_root;
while (frchainP)
{
- /*
- * Scan all the fragments in this chain, remembering
- * the "previous fragment"
- */
+ /* Scan all the fragments in this chain, remembering
+ the "previous fragment". */
prev_fragPP = &frchainP->frch_root;
fragP = frchainP->frch_root;
while (fragP && (fragP != frchainP->frch_last))
{
- /*
- * Is this the fragment?
- */
+ /* Is this the fragment ? */
if (fragP == symbolP->sy_frag)
{
- /*
- * Yes: Modify the fragment by replacing
- * it with a new fragment.
- */
- New_Frag = (fragS *)
+ /* Yes: Modify the fragment by replacing
+ it with a new fragment. */
+ New_Frag =
xmalloc (sizeof (*New_Frag) +
fragP->fr_fix +
fragP->fr_var +
5);
- /*
- * The fragments are the same except
- * that the "fixed" area is larger
- */
+ /* The fragments are the same except
+ that the "fixed" area is larger. */
*New_Frag = *fragP;
New_Frag->fr_fix += 6;
- /*
- * Copy the literal data opening a hole
- * 2 bytes after "_main" (i.e. just after
- * the entry mask). Into which we place
- * the JSB instruction.
- */
+ /* Copy the literal data opening a hole
+ 2 bytes after "_main" (i.e. just after
+ the entry mask). Into which we place
+ the JSB instruction. */
New_Frag->fr_literal[0] = fragP->fr_literal[0];
New_Frag->fr_literal[1] = fragP->fr_literal[1];
New_Frag->fr_literal[2] = 0x16; /* Jsb */
for (i = 2; i < fragP->fr_fix + fragP->fr_var; i++)
New_Frag->fr_literal[i + 6] =
fragP->fr_literal[i];
- /*
- * Now replace the old fragment with the
- * newly generated one.
- */
+ /* Now replace the old fragment with the
+ newly generated one. */
*prev_fragPP = New_Frag;
- /*
- * Remember the entry point symbol
- */
+ /* Remember the entry point symbol. */
Entry_Point_Symbol = symbolP;
- /*
- * Scan the text area fixup structures
- * as offsets in the fragment may have
- * changed
- */
+ /* Scan the text area fixup structures
+ as offsets in the fragment may have changed. */
for (fixP = text_fix_root; fixP; fixP = fixP->fx_next)
{
- /*
- * Look for references to this
- * fragment.
- */
+ /* Look for references to this fragment. */
if (fixP->fx_frag == fragP)
{
- /*
- * Change the fragment
- * pointer
- */
+ /* Change the fragment pointer. */
fixP->fx_frag = New_Frag;
- /*
- * If the offset is after
- * the entry mask we need
- * to account for the JSB
- * instruction we just
- * inserted.
- */
+ /* If the offset is after the entry mask we need
+ to account for the JSB instruction we just
+ inserted. */
if (fixP->fx_where >= 2)
fixP->fx_where += 6;
}
}
- /*
- * Scan the symbols as offsets in the
- * fragment may have changed
- */
+ /* Scan the symbols as offsets in the
+ fragment may have changed. */
for (symbolP = symbol_rootP;
symbolP;
symbolP = symbol_next (symbolP))
{
- /*
- * Look for references to this
- * fragment.
- */
+ /* Look for references to this fragment. */
if (symbolP->sy_frag == fragP)
{
- /*
- * Change the fragment
- * pointer
- */
+ /* Change the fragment pointer. */
symbolP->sy_frag = New_Frag;
- /*
- * If the offset is after
- * the entry mask we need
- * to account for the JSB
- * instruction we just
- * inserted.
- */
+ /* If the offset is after the entry mask we need
+ to account for the JSB instruction we just
+ inserted. */
if (S_GET_VALUE (symbolP) >= 2)
S_SET_VALUE (symbolP,
S_GET_VALUE (symbolP) + 6);
}
}
- /*
- * Make a symbol reference to
- * "_c$main_args" so we can get
- * its address inserted into the
- * JSB instruction.
- */
- symbolP = (symbolS *) xmalloc (sizeof (*symbolP));
+ /* Make a symbol reference to "_c$main_args" so we
+ can get its address inserted into the JSB
+ instruction. */
+ symbolP = xmalloc (sizeof (*symbolP));
S_SET_NAME (symbolP, "_C$MAIN_ARGS");
S_SET_TYPE (symbolP, N_UNDF);
S_SET_OTHER (symbolP, 0);
symbolP->sy_frag = New_Frag;
symbolP->sy_resolved = 0;
symbolP->sy_resolving = 0;
- /* this actually inserts at the beginning of the list */
+ /* This actually inserts at the beginning of the list. */
symbol_append (symbol_rootP, symbolP,
&symbol_rootP, &symbol_lastP);
symbol_rootP = symbolP;
- /*
- * Generate a text fixup structure
- * to get "_c$main_args" stored into the
- * JSB instruction.
- */
- fixP = (struct fix *) xmalloc (sizeof (*fixP));
+ /* Generate a text fixup structure
+ to get "_c$main_args" stored into the
+ JSB instruction. */
+ fixP = xmalloc (sizeof (*fixP));
fixP->fx_frag = New_Frag;
fixP->fx_where = 4;
fixP->fx_addsy = symbolP;
fixP->fx_pcrel = 1;
fixP->fx_next = text_fix_root;
text_fix_root = fixP;
- /*
- * Now make sure we exit from the loop
- */
+ /* Now make sure we exit from the loop. */
frchainP = 0;
break;
}
- /*
- * Try the next fragment
- */
+ /* Try the next fragment. */
prev_fragPP = &fragP->fr_next;
fragP = fragP->fr_next;
}
- /*
- * Try the next fragment chain
- */
+ /* Try the next fragment chain. */
if (frchainP)
frchainP = frchainP->frch_next;
}
}
\f
-/*
- * Beginning of vms_write_object_file().
- */
+/* Beginning of vms_write_object_file(). */
static
-struct vms_obj_state {
-
+struct vms_obj_state
+{
/* Next program section index to use. */
int psect_number;
/* Perform text segment fixups. */
static void
-vms_fixup_text_section (text_siz, text_frag_root, data_frag_root)
- unsigned text_siz ATTRIBUTE_UNUSED;
- struct frag *text_frag_root;
- struct frag *data_frag_root;
+vms_fixup_text_section (unsigned text_siz ATTRIBUTE_UNUSED,
+ struct frag *text_frag_root,
+ struct frag *data_frag_root)
{
- register fragS *fragP;
- register struct fix *fixP;
+ fragS *fragP;
+ struct fix *fixP;
offsetT dif;
/* Scan the text fragments. */
/* Ignore fragments with no data. */
if ((fragP->fr_fix == 0) && (fragP->fr_var == 0))
continue;
- /* Go the the appropriate offset in the Text Psect. */
+ /* Go to the appropriate offset in the Text Psect. */
VMS_Set_Psect (Text_Psect, fragP->fr_address, OBJ_S_C_TIR);
/* Store the "fixed" part. */
if (fragP->fr_fix)
fragP->fr_literal + fragP->fr_fix,
fragP->fr_var,
OBJ_S_C_TIR);
- } /* text frag loop */
+ }
- /*
- * Now we go through the text segment fixups and generate
- * TIR records to fix up addresses within the Text Psect.
- */
+ /* Now we go through the text segment fixups and generate
+ TIR records to fix up addresses within the Text Psect. */
for (fixP = text_fix_root; fixP; fixP = fixP->fx_next)
{
/* We DO handle the case of "Symbol - Symbol" as
VMS_Store_Immediate_Data (Local,
fixP->fx_size,
OBJ_S_C_TIR);
- continue; /* done with this fixup */
- } /* if fx_subsy && fx_addsy */
+ continue;
+ }
/* Size will HAVE to be "long". */
if (fixP->fx_size != 4)
error (_("Fixup datum is not a longword"));
Text_Psect,
fixP->fx_where + fixP->fx_frag->fr_address,
OBJ_S_C_TIR);
- /*
- * Check for indirect address reference, which has to be fixed up
- * (as the linker will screw it up with TIR_S_C_STO_PICR)...
- */
+ /* Check for indirect address reference, which has to be fixed up
+ (as the linker will screw it up with TIR_S_C_STO_PICR). */
if (fixP->fx_pcrel)
VMS_Fix_Indirect_Reference (Text_Psect,
fixP->fx_where + fixP->fx_frag->fr_address,
fixP->fx_frag,
text_frag_root);
- } /* text fix loop */
+ }
}
\f
/* Create a buffer holding the data segment. */
static void
-synthesize_data_segment (data_siz, text_siz, data_frag_root)
- unsigned data_siz;
- unsigned text_siz;
- struct frag *data_frag_root;
+synthesize_data_segment (unsigned data_siz, unsigned text_siz,
+ struct frag *data_frag_root)
{
- register fragS *fragP;
+ fragS *fragP;
char *fill_literal;
long fill_size, count, i;
/* Allocate the data segment. */
- Data_Segment = (char *) xmalloc (data_siz);
+ Data_Segment = xmalloc (data_siz);
+
/* Run through the data fragments, filling in the segment. */
for (fragP = data_frag_root; fragP; fragP = fragP->fr_next)
{
i += fill_size;
}
}
- } /* data frag loop */
+ }
return;
}
/* Perform data segment fixups. */
static void
-vms_fixup_data_section (data_siz, text_siz)
- unsigned int data_siz ATTRIBUTE_UNUSED;
- unsigned int text_siz;
+vms_fixup_data_section (unsigned int data_siz ATTRIBUTE_UNUSED,
+ unsigned int text_siz)
{
- register struct VMS_Symbol *vsp;
- register struct fix *fixP;
- register symbolS *sp;
+ struct VMS_Symbol *vsp;
+ struct fix *fixP;
+ symbolS *sp;
addressT fr_address;
offsetT dif;
valueT val;
OBJ_S_C_TIR);
} /* N_DATA symbol loop */
- /*
- * Now we go through the data segment fixups and generate
- * TIR records to fix up addresses within the Data Psects.
- */
+ /* Now we go through the data segment fixups and generate
+ TIR records to fix up addresses within the Data Psects. */
for (fixP = data_fix_root; fixP; fixP = fixP->fx_next)
{
/* Find the symbol for the containing datum. */
/* Subtract their values to get the difference. */
dif = S_GET_VALUE (fixP->fx_addsy) - S_GET_VALUE (fixP->fx_subsy);
md_number_to_chars (Local, (valueT)dif, fixP->fx_size);
- /*
- * Now generate the fixup object records;
- * set the psect and store the data.
- */
+ /* Now generate the fixup object records;
+ set the psect and store the data. */
VMS_Set_Psect (vsp->Psect_Index,
fr_address + fixP->fx_where
- val + vsp->Psect_Offset,
OBJ_S_C_TIR);
/* Done with this fixup. */
break;
- } /* vms_symbol loop */
-
- } /* data fix loop */
+ }
+ }
}
/* Perform ctors/dtors segment fixups. */
static void
-vms_fixup_xtors_section (symbols, sect_no)
- struct VMS_Symbol *symbols;
- int sect_no ATTRIBUTE_UNUSED;
+vms_fixup_xtors_section (struct VMS_Symbol *symbols,
+ int sect_no ATTRIBUTE_UNUSED)
{
- register struct VMS_Symbol *vsp;
+ struct VMS_Symbol *vsp;
/* Run through all the symbols and store the data. */
for (vsp = symbols; vsp; vsp = vsp->Next)
{
- register symbolS *sp;
+ symbolS *sp;
/* Set relocation base. */
VMS_Set_Psect (vsp->Psect_Index, vsp->Psect_Offset, OBJ_S_C_TIR);
/* Define symbols for the linker. */
static void
-global_symbol_directory (text_siz, data_siz)
- unsigned text_siz, data_siz;
+global_symbol_directory (unsigned text_siz, unsigned data_siz)
{
- register fragS *fragP;
- register symbolS *sp;
- register struct VMS_Symbol *vsp;
+ fragS *fragP;
+ symbolS *sp;
+ struct VMS_Symbol *vsp;
int Globalref, define_as_global_symbol;
#if 0
}
#endif
- /*
- * Now scan the symbols and emit the appropriate GSD records
- */
+ /* Now scan the symbols and emit the appropriate GSD records. */
for (sp = symbol_rootP; sp; sp = symbol_next (sp))
{
define_as_global_symbol = 0;
/* Global uninitialized data. */
case N_UNDF | N_EXT:
/* Make a VMS data symbol entry. */
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = S_GET_VALUE (sp);
vsp->Psect_Index = Psect_Number++;
/* Local uninitialized data. */
case N_BSS:
/* Make a VMS data symbol entry. */
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = 0;
vsp->Psect_Index = Bss_Psect;
/* Global initialized data. */
case N_DATA | N_EXT:
/* Make a VMS data symbol entry. */
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = VMS_Initialized_Data_Size (sp, text_siz + data_siz);
vsp->Psect_Index = Psect_Number++;
break;
/* Make a VMS data symbol entry. */
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = VMS_Initialized_Data_Size (sp, text_siz + data_siz);
vsp->Psect_Index = Data_Psect;
if (IS_GXX_XTOR (sp))
{
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = XTOR_SIZE;
sp->sy_obj = vsp;
/* Make a VMS data symbol entry. */
if (Text_Psect != -1)
{
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = 0;
vsp->Psect_Index = Text_Psect;
case N_ABS | N_EXT:
/* gcc doesn't generate these;
VMS_Emit_Globalvalue handles them though. */
- vsp = (struct VMS_Symbol *) xmalloc (sizeof *vsp);
+ vsp = xmalloc (sizeof *vsp);
vsp->Symbol = sp;
vsp->Size = 4; /* always assume 32 bits */
vsp->Psect_Index = 0;
are local to a specific routine. */
static void
-local_symbols_DST (s0P, Current_Routine)
- symbolS *s0P, *Current_Routine;
+local_symbols_DST (symbolS *s0P, symbolS *Current_Routine)
{
symbolS *s1P;
char *s0P_name, *pnt0, *pnt1;
/* Construct and output the debug symbol table. */
static void
-vms_build_DST (text_siz)
- unsigned text_siz;
+vms_build_DST (unsigned text_siz)
{
- register symbolS *symbolP;
+ symbolS *symbolP;
symbolS *Current_Routine = 0;
struct input_file *Cur_File = 0;
offsetT Cur_Offset = -1;
/* Write the Traceback Begin Module record. */
VMS_TBT_Module_Begin ();
- /*
- * Output debugging info for global variables and static variables
- * that are not specific to one routine. We also need to examine
- * all stabs directives, to find the definitions to all of the
- * advanced data types, and this is done by VMS_LSYM_Parse. This
- * needs to be done before any definitions are output to the object
- * file, since there can be forward references in the stabs
- * directives. When through with parsing, the text of the stabs
- * directive is altered, with the definitions removed, so that later
- * passes will see directives as they would be written if the type
- * were already defined.
- *
- * We also look for files and include files, and make a list of
- * them. We examine the source file numbers to establish the actual
- * lines that code was generated from, and then generate offsets.
- */
+ /* Output debugging info for global variables and static variables
+ that are not specific to one routine. We also need to examine
+ all stabs directives, to find the definitions to all of the
+ advanced data types, and this is done by VMS_LSYM_Parse. This
+ needs to be done before any definitions are output to the object
+ file, since there can be forward references in the stabs
+ directives. When through with parsing, the text of the stabs
+ directive is altered, with the definitions removed, so that later
+ passes will see directives as they would be written if the type
+ were already defined.
+
+ We also look for files and include files, and make a list of
+ them. We examine the source file numbers to establish the actual
+ lines that code was generated from, and then generate offsets. */
VMS_LSYM_Parse ();
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
/* Only deal with STAB symbols here. */
if (!S_IS_DEBUG (symbolP))
continue;
- /*
- * Dispatch on STAB type.
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (symbolP))
{
case N_SLINE:
break;
default:
break;
- } /* switch */
- } /* for */
-
- /*
- * Now we take a quick sweep through the files and assign offsets
- * to each one. This will essentially be the starting line number to
- * the debugger for each file. Output the info for the debugger to
- * specify the files, and then tell it how many lines to use.
- */
+ }
+ }
+
+ /* Now we take a quick sweep through the files and assign offsets
+ to each one. This will essentially be the starting line number to
+ the debugger for each file. Output the info for the debugger to
+ specify the files, and then tell it how many lines to use. */
for (Cur_File = file_root; Cur_File; Cur_File = Cur_File->next)
{
if (Cur_File->max_line == 0)
} /* for */
Cur_File = (struct input_file *) NULL;
- /*
- * Scan the symbols and write out the routines
- * (this makes the assumption that symbols are in
- * order of ascending text segment offset)
- */
+ /* Scan the symbols and write out the routines
+ (this makes the assumption that symbols are in
+ order of ascending text segment offset). */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
- /*
- * Deal with text symbols.
- */
+ /* Deal with text symbols. */
if (!S_IS_DEBUG (symbolP) && S_GET_TYPE (symbolP) == N_TEXT)
{
- /*
- * Ignore symbols starting with "L", as they are local symbols.
- */
+ /* Ignore symbols starting with "L", as they are local symbols. */
if (*S_GET_NAME (symbolP) == 'L')
continue;
- /*
- * If there is a routine start defined, terminate it.
- */
+ /* If there is a routine start defined, terminate it. */
if (Current_Routine)
VMS_TBT_Routine_End (text_siz, Current_Routine);
- /*
- * Check for & skip dummy labels like "gcc_compiled.".
- * They're identified by the IN_DEFAULT_SECTION flag.
- */
+ /* Check for & skip dummy labels like "gcc_compiled.".
+ * They're identified by the IN_DEFAULT_SECTION flag. */
if ((S_GET_OTHER (symbolP) & IN_DEFAULT_SECTION) != 0 &&
S_GET_VALUE (symbolP) == 0)
continue;
- /*
- * Store the routine begin traceback info.
- */
+ /* Store the routine begin traceback info. */
VMS_TBT_Routine_Begin (symbolP, Text_Psect);
Current_Routine = symbolP;
- /*
- * Define symbols local to this routine.
- */
+ /* Define symbols local to this routine. */
local_symbols_DST (symbolP, Current_Routine);
- /*
- * Done
- */
+ /* Done. */
continue;
}
- /*
- * Deal with STAB symbols.
- */
+ /* Deal with STAB symbols. */
else if (S_IS_DEBUG (symbolP))
{
- /*
- * Dispatch on STAB type.
- */
+ /* Dispatch on STAB type. */
switch (S_GET_RAW_TYPE (symbolP))
{
- /*
- * Line number
- */
+ /* Line number. */
case N_SLINE:
/* Offset the line into the correct portion of the file. */
if (Cur_File->file_number == 0)
if (val == Cur_Offset && Cur_File->file_number != 1)
break;
- /* calculate actual debugger source line */
+ /* Calculate actual debugger source line. */
dsc = S_GET_DESC (symbolP) + Cur_File->offset;
S_SET_DESC (symbolP, dsc);
- /*
- * Define PC/Line correlation.
- */
+ /* Define PC/Line correlation. */
if (Cur_Offset == -1)
{
- /*
- * First N_SLINE; set up initial correlation.
- */
+ /* First N_SLINE; set up initial correlation. */
VMS_TBT_Line_PC_Correlation (dsc,
val,
Text_Psect,
}
else if ((dsc - Cur_Line_Number) <= 0)
{
- /*
- * Line delta is not +ve, we need to close the line and
- * start a new PC/Line correlation.
- */
+ /* Line delta is not +ve, we need to close the line and
+ start a new PC/Line correlation. */
VMS_TBT_Line_PC_Correlation (0,
val - Cur_Offset,
0,
}
else
{
- /*
- * Line delta is +ve, all is well.
- */
+ /* Line delta is +ve, all is well. */
VMS_TBT_Line_PC_Correlation (dsc - Cur_Line_Number,
val - Cur_Offset,
0,
Cur_Offset = val;
break;
- /*
- * Source file
- */
+ /* Source file. */
case N_SO:
/* Remember that we had a source file and emit
the source file debugger record. */
default:
break;
- } /* switch */
- } /* if (IS_DEBUG) */
- } /* for */
-
- /*
- * If there is a routine start defined, terminate it
- * (and the line numbers).
- */
+ }
+ }
+ }
+
+ /* If there is a routine start defined, terminate it
+ (and the line numbers). */
if (Current_Routine)
{
/* Terminate the line numbers. */
/* Write a VAX/VMS object file (everything else has been done!). */
void
-vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
- data_frag_root)
- unsigned text_siz;
- unsigned data_siz;
- unsigned bss_siz;
- fragS *text_frag_root;
- fragS *data_frag_root;
+vms_write_object_file (unsigned text_siz, unsigned data_siz, unsigned bss_siz,
+ fragS *text_frag_root, fragS *data_frag_root)
{
- register struct VMS_Symbol *vsp;
+ struct VMS_Symbol *vsp;
- /*
- * Initialize program section indices; values get updated later.
- */
+ /* Initialize program section indices; values get updated later. */
Psect_Number = 0; /* next Psect Index to use */
Text_Psect = -1; /* Text Psect Index */
Data_Psect = -2; /* Data Psect Index JF: Was -1 */
Data_Segment = 0;
Local_Initd_Data_Size = 0;
- /*
- * Create the actual output file and populate it with required
- * "module header" information.
- */
+ /* Create the actual output file and populate it with required
+ "module header" information. */
Create_VMS_Object_File ();
Write_VMS_MHD_Records ();
- /*
- * Create the Data segment:
- *
- * Since this is REALLY hard to do any other way,
- * we actually manufacture the data segment and
- * then store the appropriate values out of it.
- * We need to generate this early, so that globalvalues
- * can be properly emitted.
- */
+ /* Create the Data segment:
+
+ Since this is REALLY hard to do any other way,
+ we actually manufacture the data segment and
+ then store the appropriate values out of it.
+ We need to generate this early, so that globalvalues
+ can be properly emitted. */
if (data_siz > 0)
synthesize_data_segment (data_siz, text_siz, data_frag_root);
- /******* Global Symbol Directory *******/
+ /* Global Symbol Directory. */
- /*
- * Emit globalvalues now. We must do this before the text psect is
- * defined, or we will get linker warnings about multiply defined
- * symbols. All of the globalvalues "reference" psect 0, although
- * it really does not have anything to do with it.
- */
+ /* Emit globalvalues now. We must do this before the text psect is
+ defined, or we will get linker warnings about multiply defined
+ symbols. All of the globalvalues "reference" psect 0, although
+ it really does not have anything to do with it. */
VMS_Emit_Globalvalues (text_siz, data_siz, Data_Segment);
- /*
- * Define the Text Psect
- */
+ /* Define the Text Psect. */
Text_Psect = Psect_Number++;
VMS_Psect_Spec ("$code", text_siz, ps_TEXT, 0);
- /*
- * Define the BSS Psect
- */
+ /* Define the BSS Psect. */
if (bss_siz > 0)
{
Bss_Psect = Psect_Number++;
VMS_Psect_Spec ("$uninitialized_data", bss_siz, ps_DATA, 0);
}
- /*
- * Define symbols to the linker.
- */
+ /* Define symbols to the linker. */
global_symbol_directory (text_siz, data_siz);
- /*
- * Define the Data Psect
- */
+ /* Define the Data Psect. */
if (data_siz > 0 && Local_Initd_Data_Size > 0)
{
Data_Psect = Psect_Number++;
VMS_Psect_Spec ("$data", Local_Initd_Data_Size, ps_DATA, 0);
- /*
- * Local initialized data (N_DATA) symbols need to be updated to the
- * proper value of Data_Psect now that it's actually been defined.
- * (A dummy value was used in global_symbol_directory() above.)
- */
+ /* Local initialized data (N_DATA) symbols need to be updated to the
+ proper value of Data_Psect now that it's actually been defined.
+ (A dummy value was used in global_symbol_directory() above.) */
for (vsp = VMS_Symbols; vsp; vsp = vsp->Next)
if (vsp->Psect_Index < 0 && S_GET_RAW_TYPE (vsp->Symbol) == N_DATA)
vsp->Psect_Index = Data_Psect;
vsp->Psect_Index = Dtors_Psect;
}
- /******* Text Information and Relocation Records *******/
+ /* Text Information and Relocation Records. */
- /*
- * Write the text segment data
- */
+ /* Write the text segment data. */
if (text_siz > 0)
vms_fixup_text_section (text_siz, text_frag_root, data_frag_root);
- /*
- * Write the data segment data, then discard it.
- */
+ /* Write the data segment data, then discard it. */
if (data_siz > 0)
{
vms_fixup_data_section (data_siz, text_siz);
}
if (Ctors_Symbols != 0)
- {
- vms_fixup_xtors_section (Ctors_Symbols, Ctors_Psect);
- }
+ vms_fixup_xtors_section (Ctors_Symbols, Ctors_Psect);
if (Dtors_Symbols != 0)
- {
- vms_fixup_xtors_section (Dtors_Symbols, Dtors_Psect);
- }
+ vms_fixup_xtors_section (Dtors_Symbols, Dtors_Psect);
- /******* Debugger Symbol Table Records *******/
+ /* Debugger Symbol Table Records. */
vms_build_DST (text_siz);
- /******* Wrap things up *******/
+ /* Wrap things up. */
- /*
- * Write the End Of Module record
- */
+ /* Write the End Of Module record. */
if (Entry_Point_Symbol)
Write_VMS_EOM_Record (Text_Psect, S_GET_VALUE (Entry_Point_Symbol));
else
Write_VMS_EOM_Record (-1, (valueT) 0);
- /*
- * All done, close the object file
- */
+ /* All done, close the object file. */
Close_VMS_Object_File ();
}
Written by the Center for Software Science at the University of Utah
and by Cygnus Support.
- Copyright 1994, 1995, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1998, 1999, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define SLTNIL (-1)
typedef int sltpointer;
-/* Index into DOC (= "Debugging Optimized Code") line table */
+/* Index into DOC (= "Debugging Optimized Code") line table. */
#define LTNIL (-1)
typedef int ltpointer;
-/* Index into context table */
+/* Index into context table. */
#define CTXTNIL (-1)
typedef int ctxtpointer;
ADDRESS points to an SLT entry from which line number and code locations
may be determined.
- ENTRYADDR is the memory address corresponding the the function's entry point
+ ENTRYADDR is the memory address corresponding the function's entry point
RETVAL points to a LNTT entry describing the function's return value.
{
unsigned int extension: 1;
unsigned int kind: 10; /* DNTT_TYPE_TYPEDEF or
- DNTT_TYPE_TAGDEF
- */
+ DNTT_TYPE_TAGDEF. */
unsigned int global: 1;
unsigned int typeinfo: 1;
unsigned int unused: 19;
vtpointer name;
dnttpointer type; /* Underlying type, which for TAGDEF's may be
- * DNTT_TYPE_STRUCT, DNTT_TYPE_UNION,
- * DNTT_TYPE_ENUM, or DNTT_TYPE_CLASS.
- * For TYPEDEF's other underlying types
- * are also possible.
- */
+ DNTT_TYPE_STRUCT, DNTT_TYPE_UNION,
+ DNTT_TYPE_ENUM, or DNTT_TYPE_CLASS.
+ For TYPEDEF's other underlying types
+ are also possible. */
};
/* DNTT_TYPE_POINTER:
00 for a constant lower bound (found in LOWBOUND).
- 01 for a dynamic lower bound with the lower bound found in the the
+ 01 for a dynamic lower bound with the lower bound found in the
memory address pointed to by LOWBOUND.
10 for a dynamic lower bound described by an variable found in the
infers the "with" semantics when it sees a "this" argument to the member
function. So GDB can safely ignore the DNTT_TYPE_WITH record.
- A DNTT_TYPE_WITH has a matching DNTT_TYPE_END symbol
- */
+ A DNTT_TYPE_WITH has a matching DNTT_TYPE_END symbol. */
-struct dntt_type_with {
+struct dntt_type_with
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_WITH */
unsigned int addrtype: 2; /* 0 => STATTYPE */
CLASS_SCOPE is what is used to indicate it is really a method.
- A DNTT_TYPE_CLASS_SCOPE symbol must have a matching DNTT_TYPE_END symbol
-*/
+ A DNTT_TYPE_CLASS_SCOPE symbol must have a matching DNTT_TYPE_END symbol. */
-struct dntt_type_class_scope {
- unsigned int extension: 1; /* always zero */
- unsigned int kind: 10; /* always DNTT_TYPE_CLASS_SCOPE */
+struct dntt_type_class_scope
+{
+ unsigned int extension: 1; /* Always zero. */
+ unsigned int kind: 10; /* Always DNTT_TYPE_CLASS_SCOPE. */
unsigned int unused: 21;
- sltpointer address ; /* pointer to SLT entry */
- dnttpointer type ; /* pointer to class type DNTT */
+ sltpointer address ; /* Pointer to SLT entry. */
+ dnttpointer type ; /* Pointer to class type DNTT. */
};
/* C++ reference parameter.
The structure of this record is the same as DNTT_TYPE_POINTER -
- refer to struct dntt_type_pointer.
- */
+ refer to struct dntt_type_pointer. */
/* The next two describe C++ pointer-to-data-member type, and
pointer-to-member-function type, respectively.
- DNTT_TYPE_PTRMEM and DNTT_TYPE_PTRMEMFUNC have the same structure
- */
+ DNTT_TYPE_PTRMEM and DNTT_TYPE_PTRMEMFUNC have the same structure. */
-struct dntt_type_ptrmem {
- unsigned int extension: 1; /* always zero */
- unsigned int kind: 10; /* always DNTT_TYPE_PTRMEM */
+struct dntt_type_ptrmem
+{
+ unsigned int extension: 1; /* Always zero. */
+ unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEM. */
unsigned int unused: 21;
- dnttpointer pointsto ; /* pointer to class DNTT */
- dnttpointer memtype ; /* type of member */
+ dnttpointer pointsto ; /* Pointer to class DNTT. */
+ dnttpointer memtype ; /* Type of member. */
};
-struct dntt_type_ptrmemfunc {
- unsigned int extension: 1; /* always zero */
- unsigned int kind: 10; /* always DNTT_TYPE_PTRMEMFUNC */
+struct dntt_type_ptrmemfunc
+{
+ unsigned int extension: 1; /* Always zero. */
+ unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEMFUNC. */
unsigned int unused: 21;
- dnttpointer pointsto ; /* pointer to class DNTT */
- dnttpointer memtype ; /* type of member */
+ dnttpointer pointsto ; /* Pointer to class DNTT. */
+ dnttpointer memtype ; /* Type of member. */
};
/* The DNTT_TYPE_CLASS symbol is emitted to describe a class type.
- * "memberlist" points to a chained list of FIELD or GENFIELD records
- * indicating the class members. "parentlist" points to a chained list
- * of INHERITANCE records indicating classes from which we inherit
- * fields.
- */
+ "memberlist" points to a chained list of FIELD or GENFIELD records
+ indicating the class members. "parentlist" points to a chained list
+ of INHERITANCE records indicating classes from which we inherit
+ fields. */
struct dntt_type_class
{
- unsigned int extension: 1; /* always 0 */
- unsigned int kind: 10; /* always DNTT_TYPE_CLASS */
- unsigned int abstract: 1; /* is this an abstract class? */
- unsigned int class_decl: 2; /* 0=class,1=union,2=struct */
- unsigned int expansion: 1; /* 1=template expansion */
+ unsigned int extension: 1; /* Always zero. */
+ unsigned int kind: 10; /* Always DNTT_TYPE_CLASS. */
+ unsigned int abstract: 1; /* Is this an abstract class? */
+ unsigned int class_decl: 2; /* 0=class,1=union,2=struct. */
+ unsigned int expansion: 1; /* 1=template expansion. */
unsigned int unused: 17;
- dnttpointer memberlist ; /* ptr to chain of [GEN]FIELDs */
- unsigned long vtbl_loc ; /* offset in obj of ptr to vtbl */
- dnttpointer parentlist ; /* ptr to K_INHERITANCE list */
- unsigned long bitlength ; /* total at this level */
- dnttpointer identlist ; /* ptr to chain of class ident's */
- dnttpointer friendlist ; /* ptr to K_FRIEND list */
- dnttpointer templateptr ; /* ptr to template */
- dnttpointer nextexp ; /* ptr to next expansion */
+ dnttpointer memberlist ; /* Ptr to chain of [GEN]FIELDs. */
+ unsigned long vtbl_loc ; /* Offset in obj of ptr to vtbl. */
+ dnttpointer parentlist ; /* Ptr to K_INHERITANCE list. */
+ unsigned long bitlength ; /* Total at this level. */
+ dnttpointer identlist ; /* Ptr to chain of class ident's. */
+ dnttpointer friendlist ; /* Ptr to K_FRIEND list. */
+ dnttpointer templateptr ; /* Ptr to template. */
+ dnttpointer nextexp ; /* Ptr to next expansion. */
};
/* Class members are indicated via either the FIELD record (for
data members, same as for C struct fields), or by the GENFIELD record
- (for member functions).
- */
+ (for member functions). */
-struct dntt_type_genfield {
- unsigned int extension: 1; /* always zero */
- unsigned int kind: 10; /* always DNTT_TYPE_GENFIELD */
- unsigned int visibility: 2; /* pub = 0, prot = 1, priv = 2 */
- unsigned int a_union: 1; /* 1 => anonymous union member */
+struct dntt_type_genfield
+{
+ unsigned int extension: 1; /* Always zero. */
+ unsigned int kind: 10; /* Always DNTT_TYPE_GENFIELD. */
+ unsigned int visibility: 2; /* Pub = 0, prot = 1, priv = 2. */
+ unsigned int a_union: 1; /* 1 => anonymous union member. */
unsigned int unused: 18;
- dnttpointer field ; /* pointer to field or qualifier */
- dnttpointer nextfield ; /* pointer to next field */
+ dnttpointer field ; /* Pointer to field or qualifier. */
+ dnttpointer nextfield ; /* Pointer to next field. */
};
-/* C++ virtual functions */
+/* C++ virtual functions. */
-struct dntt_type_vfunc {
+struct dntt_type_vfunc
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_VFUNC */
unsigned int pure: 1; /* pure virtual function ? */
unsigned long vtbl_offset ; /* offset into vtbl for virtual */
};
-/* Not precisely sure what this is intended for - DDE ignores it */
+/* Not precisely sure what this is intended for - DDE ignores it. */
-struct dntt_type_memaccess {
+struct dntt_type_memaccess
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_MEMACCESS */
unsigned int unused: 21;
};
/* The DNTT_TYPE_INHERITANCE record describes derived classes.
- * In particular, the "parentlist" field of the CLASS record points
- * to a list of INHERITANCE records for classes from which we
- * inherit members.
- */
+ In particular, the "parentlist" field of the CLASS record points
+ to a list of INHERITANCE records for classes from which we
+ inherit members. */
-struct dntt_type_inheritance {
+struct dntt_type_inheritance
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_INHERITANCE */
unsigned int Virtual: 1; /* virtual base class ? */
/* C++ "friend" classes ... */
-struct dntt_type_friend_class {
+struct dntt_type_friend_class
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_CLASS */
unsigned int unused: 21;
dnttpointer next ; /* next DNTT_FRIEND */
};
-struct dntt_type_friend_func {
+struct dntt_type_friend_func
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_FUNC */
unsigned int unused: 21;
};
/* DDE appears to ignore the DNTT_TYPE_MODIFIER record.
- * It could perhaps be used to give better "ptype" output in GDB;
- * otherwise it is probably safe for GDB to ignore it also.
- */
+ It could perhaps be used to give better "ptype" output in GDB;
+ otherwise it is probably safe for GDB to ignore it also. */
-struct dntt_type_modifier {
+struct dntt_type_modifier
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_MODIFIER */
unsigned int m_const: 1; /* const */
unsigned long future ; /* padding to 3-word block end */
};
-/* I'm not sure what this was intended for - DDE ignores it */
+/* I'm not sure what this was intended for - DDE ignores it. */
-struct dntt_type_object_id {
+struct dntt_type_object_id
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_OBJECT_ID */
unsigned int indirect: 1; /* Is object_ident addr of addr? */
/* No separate dntt_type_memfunc; same as dntt_type_func */
/* Symbol records to support templates. These only get used
- * in DDE's "describe" output (like GDB's "ptype").
- */
+ in DDE's "describe" output (like GDB's "ptype"). */
/* The TEMPLATE record is the header for a template-class.
- * Like the CLASS record, a TEMPLATE record has a memberlist that
- * points to a list of template members. It also has an arglist
- * pointing to a list of TEMPLATE_ARG records.
- */
+ Like the CLASS record, a TEMPLATE record has a memberlist that
+ points to a list of template members. It also has an arglist
+ pointing to a list of TEMPLATE_ARG records. */
-struct dntt_type_template {
+struct dntt_type_template
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_TEMPLATE */
unsigned int abstract: 1; /* is this an abstract class? */
};
/* Template-class arguments are a list of TEMPL_ARG records
- * chained together. The "name" field is the name of the formal.
- * E.g.:
- * template <class T> class q { ... };
- * Then "T" is the name of the formal argument.
- */
-struct dntt_type_templ_arg {
+ chained together. The "name" field is the name of the formal.
+ E.g.:
+
+ template <class T> class q { ... };
+
+ Then "T" is the name of the formal argument. */
+
+struct dntt_type_templ_arg
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_TEMPL_ARG */
unsigned int usagetype: 1; /* 0 type-name 1 expression */
};
/* FUNC_TEMPLATE records are sort of like FUNCTION, but are emitted
- * for template member functions. E.g.,
- * template <class T> class q {
- ...
- void f();
- ...
- };
- * Within the list of FIELDs/GENFIELDs defining the member list
- * of the template "q", "f" would appear as a FUNC_TEMPLATE.
- * We'll also see instances of FUNCTION "f" records for each
- * instantiation of the template.
- */
-
-struct dntt_type_func_template {
+ for template member functions. E.g.,
+
+ template <class T> class q
+ {
+ ...
+ void f();
+ ...
+ };
+
+ Within the list of FIELDs/GENFIELDs defining the member list
+ of the template "q", "f" would appear as a FUNC_TEMPLATE.
+ We'll also see instances of FUNCTION "f" records for each
+ instantiation of the template. */
+
+struct dntt_type_func_template
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_FUNC_TEMPLATE */
unsigned int public: 1; /* 1 => globally visible */
};
/* LINK is apparently intended to link together function template
- * definitions with their instantiations. However, it is not clear
- * why this would be needed, except to provide the information on
- * a "ptype" command. And as far as I can tell, aCC does not
- * generate this record.
- */
+ definitions with their instantiations. However, it is not clear
+ why this would be needed, except to provide the information on
+ a "ptype" command. And as far as I can tell, aCC does not
+ generate this record. */
-struct dntt_type_link {
+struct dntt_type_link
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* always DNTT_TYPE_LINK */
unsigned int linkKind: 4; /* always LINK_UNKNOWN */
long future[2] ; /* padding to 3-word block end */
};
-/* end of C++ specific SOM's */
+/* end of C++ specific SOM's. */
/* DNTT_TYPE_DYN_ARRAY_DESC is unused by GDB */
/* DNTT_TYPE_DESC_SUBRANGE is unused by GDB */
/* DNTT_TYPE_INLN_LIST is unused by GDB */
/* DNTT_TYPE_ALIAS is unused by GDB */
-struct dntt_type_doc_function {
+struct dntt_type_doc_function
+{
unsigned int extension: 1; /* always zero */
unsigned int kind: 10; /* K_DOC_FUNCTION or */
/* K_DOC_MEMFUNC */
};
/* One entry in a DNTT (either the LNTT or GNTT).
- * This is a union of the above 60 or so structure definitions.
- */
+ This is a union of the above 60 or so structure definitions. */
+
union dnttentry
{
struct dntt_type_srcfile dsfile;
struct slt_generic sgeneric;
};
-/* $LINES$ declarations
- * This is the line table used for optimized code, which is only present
- * in the new $PROGRAM_INFO$ debug space.
- */
+/* $LINES$ declarations
+ This is the line table used for optimized code, which is only present
+ in the new $PROGRAM_INFO$ debug space. */
#define DST_LN_ESCAPE_FLAG1 15
#define DST_LN_ESCAPE_FLAG2 14
#define DST_LN_CTX_SPEC1 13
#define DST_LN_CTX_SPEC2 12
-/*
- Escape function codes:
-*/
+/* Escape function codes: */
+
typedef enum
- {
- dst_ln_pad, /* pad byte */
- dst_ln_escape_1, /* reserved */
- dst_ln_dpc1_dln1, /* 1 byte line delta, 1 byte pc delta */
- dst_ln_dpc2_dln2, /* 2 bytes line delta, 2 bytes pc delta */
- dst_ln_pc4_ln4, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
- dst_ln_dpc0_dln1, /* 1 byte line delta, pc delta = 0 */
- dst_ln_ln_off_1, /* statement escape, stmt # = 1 (2nd stmt on line) */
- dst_ln_ln_off, /* statement escape, stmt # = next byte */
- dst_ln_entry, /* entry escape, next byte is entry number */
- dst_ln_exit, /* exit escape */
- dst_ln_stmt_end, /* gap escape, 4 bytes pc delta */
- dst_ln_stmt_cp, /* current stmt is a critical point */
- dst_ln_escape_12, /* reserved */
- dst_ln_escape_13, /* this is an exception site record */
- dst_ln_nxt_byte, /* next byte contains the real escape code */
- dst_ln_end, /* end escape, final entry follows */
- dst_ln_escape1_END_OF_ENUM
- }
- dst_ln_escape1_t;
+{
+ dst_ln_pad, /* pad byte */
+ dst_ln_escape_1, /* reserved */
+ dst_ln_dpc1_dln1, /* 1 byte line delta, 1 byte pc delta */
+ dst_ln_dpc2_dln2, /* 2 bytes line delta, 2 bytes pc delta */
+ dst_ln_pc4_ln4, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
+ dst_ln_dpc0_dln1, /* 1 byte line delta, pc delta = 0 */
+ dst_ln_ln_off_1, /* statement escape, stmt # = 1 (2nd stmt on line) */
+ dst_ln_ln_off, /* statement escape, stmt # = next byte */
+ dst_ln_entry, /* entry escape, next byte is entry number */
+ dst_ln_exit, /* exit escape */
+ dst_ln_stmt_end, /* gap escape, 4 bytes pc delta */
+ dst_ln_stmt_cp, /* current stmt is a critical point */
+ dst_ln_escape_12, /* reserved */
+ dst_ln_escape_13, /* this is an exception site record */
+ dst_ln_nxt_byte, /* next byte contains the real escape code */
+ dst_ln_end, /* end escape, final entry follows */
+ dst_ln_escape1_END_OF_ENUM
+}
+dst_ln_escape1_t;
typedef enum
- {
- dst_ln_ctx_1, /* next byte describes context switch with 5-bit */
- /* index into the image table and 3-bit run length. */
- /* If run length is 0, end with another cxt specifier or ctx_end */
- dst_ln_ctx_2, /* next 2 bytes switch context: 13 bit index, 3 bit run length */
- dst_ln_ctx_4, /* next 4 bytes switch context: 29 bit index, 3 bit run length */
- dst_ln_ctx_end, /* end current context */
- dst_ln_col_run_1, /* next byte is column position of start of next statement, */
- /* following byte is length of statement */
- dst_ln_col_run_2, /* next 2 bytes is column position of start of next statement, */
- /* following 2 bytes is length of statement */
- dst_ln_init_base1, /* next 4 bytes are absolute PC, followed by 1 byte of line number */
- dst_ln_init_base2, /* next 4 bytes are absolute PC, followed by 2 bytes of line number */
- dst_ln_init_base3, /* next 4 bytes are absolute PC, followed by 3 bytes of line number */
- dst_ln_escape2_END_OF_ENUM
- }
- dst_ln_escape2_t;
+{
+ dst_ln_ctx_1, /* next byte describes context switch with 5-bit */
+ /* index into the image table and 3-bit run length. */
+ /* If run length is 0, end with another cxt specifier or ctx_end */
+ dst_ln_ctx_2, /* next 2 bytes switch context: 13 bit index, 3 bit run length */
+ dst_ln_ctx_4, /* next 4 bytes switch context: 29 bit index, 3 bit run length */
+ dst_ln_ctx_end, /* end current context */
+ dst_ln_col_run_1, /* next byte is column position of start of next statement, */
+ /* following byte is length of statement */
+ dst_ln_col_run_2, /* next 2 bytes is column position of start of next statement, */
+ /* following 2 bytes is length of statement */
+ dst_ln_init_base1, /* next 4 bytes are absolute PC, followed by 1 byte of line number */
+ dst_ln_init_base2, /* next 4 bytes are absolute PC, followed by 2 bytes of line number */
+ dst_ln_init_base3, /* next 4 bytes are absolute PC, followed by 3 bytes of line number */
+ dst_ln_escape2_END_OF_ENUM
+}
+dst_ln_escape2_t;
typedef union
- {
- struct
- {
- unsigned int pc_delta : 4; /* 4 bit pc delta */
- int ln_delta : 4; /* 4 bit line number delta */
- }
- delta;
-
- struct
- {
- unsigned int esc_flag : 4; /* alias for pc_delta */
- unsigned int esc_code : 4; /* escape function code (dst_ln_escape1_t, or ...2_t */
- }
- esc;
-
- struct
- {
- unsigned int esc_flag : 4; /* dst_ln_ctx_spec1, or dst_ln_ctx_spec2 */
- unsigned int run_length : 2;
- unsigned int ctx_index : 2; /* ...spec2 contains index; ...spec1, index - 4 */
- }
- ctx_spec;
-
- char sdata; /* signed data byte */
- unsigned char udata; /* unsigned data byte */
- }
- dst_ln_entry_t,
- *dst_ln_entry_ptr_t;
+{
+ struct
+ {
+ unsigned int pc_delta : 4; /* 4 bit pc delta */
+ int ln_delta : 4; /* 4 bit line number delta */
+ }
+ delta;
+
+ struct
+ {
+ unsigned int esc_flag : 4; /* alias for pc_delta */
+ unsigned int esc_code : 4; /* escape function code (dst_ln_escape1_t, or ...2_t */
+ }
+ esc;
+
+ struct
+ {
+ unsigned int esc_flag : 4; /* dst_ln_ctx_spec1, or dst_ln_ctx_spec2 */
+ unsigned int run_length : 2;
+ unsigned int ctx_index : 2; /* ...spec2 contains index; ...spec1, index - 4 */
+ }
+ ctx_spec;
+
+ char sdata; /* signed data byte */
+ unsigned char udata; /* unsigned data byte */
+}
+dst_ln_entry_t,
+ * dst_ln_entry_ptr_t;
/* Warning: although the above union occupies only 1 byte the compiler treats
- * it as having size 2 (the minimum size of a struct). Therefore a sequence of
- * dst_ln_entry_t's cannot be described as an array, and walking through such a
- * sequence requires convoluted code such as
- * ln_ptr = (dst_ln_entry_ptr_t) (char*) ln_ptr + 1
- * We regret the inconvenience. */
-
-/* Structure for interpreting the byte following a dst_ln_ctx1 entry */
-typedef struct {
- unsigned int ctx1_index : 5; /* 5 bit index into context table */
- unsigned int ctx1_run_length : 3; /* 3 bit run length */
+ it as having size 2 (the minimum size of a struct). Therefore a sequence of
+ dst_ln_entry_t's cannot be described as an array, and walking through such a
+ sequence requires convoluted code such as
+ ln_ptr = (dst_ln_entry_ptr_t) (char*) ln_ptr + 1
+ We regret the inconvenience. */
+
+/* Structure for interpreting the byte following a dst_ln_ctx1 entry. */
+typedef struct
+{
+ unsigned int ctx1_index : 5; /* 5 bit index into context table */
+ unsigned int ctx1_run_length : 3; /* 3 bit run length */
} dst_ln_ctx1_t,
*dst_ln_ctx1_ptr_t;
-/* Structure for interpreting the bytes following a dst_ln_ctx2 entry */
-typedef struct {
- unsigned int ctx2_index : 13; /* 13 bit index into context table */
- unsigned int ctx2_run_length : 3; /* 3 bit run length */
+/* Structure for interpreting the bytes following a dst_ln_ctx2 entry. */
+typedef struct
+{
+ unsigned int ctx2_index : 13; /* 13 bit index into context table */
+ unsigned int ctx2_run_length : 3; /* 3 bit run length */
} dst_ln_ctx2_t,
*dst_ln_ctx2_ptr_t;
-/* Structure for interpreting the bytes following a dst_ln_ctx4 entry */
-typedef struct {
- unsigned int ctx4_index : 29; /* 29 bit index into context table */
- unsigned int ctx4_run_length : 3; /* 3 bit run length */
+/* Structure for interpreting the bytes following a dst_ln_ctx4 entry. */
+typedef struct
+{
+ unsigned int ctx4_index : 29; /* 29 bit index into context table */
+ unsigned int ctx4_run_length : 3; /* 3 bit run length */
} dst_ln_ctx4_t,
*dst_ln_ctx4_ptr_t;
/* PXDB definitions.
- *
- * PXDB is a post-processor which takes the executable file
- * and massages the debug information so that the debugger may
- * start up and run more efficiently. Some of the tasks
- * performed by PXDB are:
- *
- * o Remove duplicate global type and variable information
- * from the GNTT,
- *
- * o Append the GNTT onto the end of the LNTT and place both
- * back in the LNTT section,
- *
- * o Build quick look-up tables (description follows) for
- * files, procedures, modules, and paragraphs (for Cobol),
- * placing these in the GNTT section,
- *
- * o Reconstruct the header appearing in the header section
- * to access this information.
- *
- * The "quick look-up" tables are in the $GNTT$ sub-space, in
- * the following order:
- *
- * Procedures -sorted by address
- * Source files -sorted by address (of the
- * generated code from routines)
- * Modules -sorted by address
- * Classes -<unsorted?>
- * Address Alias -sorted by index <?>
- * Object IDs -sorted by object identifier
- *
- * Most quick entries have (0-based) indices into the LNTT tables to
- * the full entries for the item it describes.
- *
- * The post-PXDB header is in the $HEADER$ sub-space. Alas, it
- * occurs in different forms, depending on the optimization level
- * in the compilation step and whether PXDB was run or not. The
- * worst part is the forms aren't self-describing, so we'll have
- * to grovel in the bits to figure out what kind we're looking at
- * (see hp_get_header in hp-psymtab-read.c).
- */
-
-/* PXDB versions
- */
+
+ PXDB is a post-processor which takes the executable file
+ and massages the debug information so that the debugger may
+ start up and run more efficiently. Some of the tasks
+ performed by PXDB are:
+
+ o Remove duplicate global type and variable information
+ from the GNTT,
+
+ o Append the GNTT onto the end of the LNTT and place both
+ back in the LNTT section,
+
+ o Build quick look-up tables (description follows) for
+ files, procedures, modules, and paragraphs (for Cobol),
+ placing these in the GNTT section,
+
+ o Reconstruct the header appearing in the header section
+ to access this information.
+
+ The "quick look-up" tables are in the $GNTT$ sub-space, in
+ the following order:
+
+ Procedures -sorted by address
+ Source files -sorted by address (of the
+ generated code from routines)
+ Modules -sorted by address
+ Classes -<unsorted?>
+ Address Alias -sorted by index <?>
+ Object IDs -sorted by object identifier
+
+ Most quick entries have (0-based) indices into the LNTT tables to
+ the full entries for the item it describes.
+
+ The post-PXDB header is in the $HEADER$ sub-space. Alas, it
+ occurs in different forms, depending on the optimization level
+ in the compilation step and whether PXDB was run or not. The
+ worst part is the forms aren't self-describing, so we'll have
+ to grovel in the bits to figure out what kind we're looking at
+ (see hp_get_header in hp-psymtab-read.c). */
+
+/* PXDB versions. */
+
#define PXDB_VERSION_CPLUSPLUS 1
#define PXDB_VERSION_7_4 2
#define PXDB_VERSION_CPP_30 3
#define PXDB_VERSION_2_1 1
/* Header version for the case that there is no DOC info
- * but the executable has been processed by pxdb (the easy
- * case, from "cc -g").
- */
-typedef struct PXDB_struct {
- int pd_entries; /* # of entries in function look-up table */
- int fd_entries; /* # of entries in file look-up table */
- int md_entries; /* # of entries in module look-up table */
- unsigned int pxdbed : 1; /* 1 => file has been preprocessed */
- unsigned int bighdr : 1; /* 1 => this header contains 'time' word */
- unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */
+ but the executable has been processed by pxdb (the easy
+ case, from "cc -g"). */
+
+typedef struct PXDB_struct
+{
+ int pd_entries; /* # of entries in function look-up table */
+ int fd_entries; /* # of entries in file look-up table */
+ int md_entries; /* # of entries in module look-up table */
+ unsigned int pxdbed : 1; /* 1 => file has been preprocessed */
+ unsigned int bighdr : 1; /* 1 => this header contains 'time' word */
+ unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */
/* used for version check in xdb */
- unsigned int inlined: 1; /* one or more functions have been inlined */
- unsigned int spare:12;
- short version; /* pxdb header version */
- int globals; /* index into the DNTT where GNTT begins */
- unsigned int time; /* modify time of file before being pxdbed */
- int pg_entries; /* # of entries in label look-up table */
- int functions; /* actual number of functions */
- int files; /* actual number of files */
- int cd_entries; /* # of entries in class look-up table */
- int aa_entries; /* # of entries in addr alias look-up table */
- int oi_entries; /* # of entries in object id look-up table */
+ unsigned int inlined: 1; /* one or more functions have been inlined */
+ unsigned int spare:12;
+ short version; /* pxdb header version */
+ int globals; /* index into the DNTT where GNTT begins */
+ unsigned int time; /* modify time of file before being pxdbed */
+ int pg_entries; /* # of entries in label look-up table */
+ int functions; /* actual number of functions */
+ int files; /* actual number of files */
+ int cd_entries; /* # of entries in class look-up table */
+ int aa_entries; /* # of entries in addr alias look-up table */
+ int oi_entries; /* # of entries in object id look-up table */
} PXDB_header, *PXDB_header_ptr;
/* Header version for the case that there is no DOC info and the
- * executable has NOT been processed by pxdb.
- */
-typedef struct XDB_header_struct {
- long gntt_length;
- long lntt_length;
- long slt_length;
- long vt_length;
- long xt_length;
+ executable has NOT been processed by pxdb. */
+
+typedef struct XDB_header_struct
+{
+ long gntt_length;
+ long lntt_length;
+ long slt_length;
+ long vt_length;
+ long xt_length;
} XDB_header;
/* Header version for the case that there is DOC info and the
- * executable has been processed by pxdb.
- */
-typedef struct DOC_info_PXDB_header_struct {
- unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */
- unsigned int doc_header: 1; /* bit set if this is doc-style header*/
- unsigned int version: 8; /* version of pxdb see defines
- * PXDB_VERSION_* in this file */
- unsigned int reserved_for_flags: 16;/* for future use; -- must be
- * set to zero
- */
- unsigned int has_aux_pd_table: 1; /* $GNTT$ has aux PD table */
- unsigned int has_expr_table: 1; /* space has $EXPR$ */
- unsigned int has_range_table: 1; /* space has $RANGE$ */
- unsigned int has_context_table: 1; /* space has $SRC_CTXT$ */
- unsigned int has_lines_table: 1; /* space contains a $LINES$
- * subspace for line tables.
- */
- unsigned int has_lt_offset_map: 1; /* space contains an lt_offset
- * subspace for line table mapping
- */
- /* the following fields are the same as those in the PXDB_header in $DEBUG$ */
- int pd_entries; /* # of entries in function look-up table */
- int fd_entries; /* # of entries in file look-up table */
- int md_entries; /* # of entries in module look-up table */
- unsigned int pxdbed : 1; /* 1 => file has been preprocessed */
- unsigned int bighdr : 1; /* 1 => this header contains 'time' word */
- unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */
- /* used for version check in xdb */
- unsigned int inlined: 1; /* one or more functions have been inlined */
- unsigned int spare : 28;
- int globals; /* index into the DNTT where GNTT begins */
- unsigned int time; /* modify time of file before being pxdbed */
- int pg_entries; /* # of entries in label look-up table */
- int functions; /* actual number of functions */
- int files; /* actual number of files */
- int cd_entries; /* # of entries in class look-up table */
- int aa_entries; /* # of entries in addr alias look-up table */
- int oi_entries; /* # of entries in object id look-up table */
+ executable has been processed by pxdb. */
+
+typedef struct DOC_info_PXDB_header_struct
+{
+ unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */
+ unsigned int doc_header: 1; /* bit set if this is doc-style header */
+ unsigned int version: 8; /* version of pxdb see defines
+ PXDB_VERSION_* in this file. */
+ unsigned int reserved_for_flags: 16;/* for future use; -- must be
+ set to zero. */
+ unsigned int has_aux_pd_table: 1; /* $GNTT$ has aux PD table */
+ unsigned int has_expr_table: 1; /* space has $EXPR$ */
+ unsigned int has_range_table: 1; /* space has $RANGE$ */
+ unsigned int has_context_table: 1; /* space has $SRC_CTXT$ */
+ unsigned int has_lines_table: 1; /* space contains a $LINES$
+ subspace for line tables. */
+ unsigned int has_lt_offset_map: 1; /* space contains an lt_offset
+ subspace for line table mapping. */
+ /* The following fields are the same as those in the PXDB_header in $DEBUG$ */
+ int pd_entries; /* # of entries in function look-up table */
+ int fd_entries; /* # of entries in file look-up table */
+ int md_entries; /* # of entries in module look-up table */
+ unsigned int pxdbed : 1; /* 1 => file has been preprocessed */
+ unsigned int bighdr : 1; /* 1 => this header contains 'time' word */
+ unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */
+ /* used for version check in xdb */
+ unsigned int inlined: 1; /* one or more functions have been inlined */
+ unsigned int spare : 28;
+ int globals; /* index into the DNTT where GNTT begins */
+ unsigned int time; /* modify time of file before being pxdbed */
+ int pg_entries; /* # of entries in label look-up table */
+ int functions; /* actual number of functions */
+ int files; /* actual number of files */
+ int cd_entries; /* # of entries in class look-up table */
+ int aa_entries; /* # of entries in addr alias look-up table */
+ int oi_entries; /* # of entries in object id look-up table */
} DOC_info_PXDB_header;
/* Header version for the case that there is DOC info and the
- * executable has NOT been processed by pxdb.
- */
-typedef struct DOC_info_header_struct {
- unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */
- unsigned int doc_header: 1; /* bit set if this is doc-style header*/
- unsigned int version: 8; /* version of debug/header
- format. For 10.0 the value
- will be 1. For "Davis" the
- value is 2.
- */
- unsigned int reserved_for_flags: 18; /* for future use; -- must be
- set to zero
- */
- unsigned int has_range_table: 1; /* space contains a $RANGE$
- subspace for variable ranges.
- */
- unsigned int has_context_table: 1; /* space contains a $CTXT$
- subspace for context/inline
- table.
- */
- unsigned int has_lines_table: 1; /* space contains a $LINES$
- subspace for line tables.
- */
- unsigned int has_lt_offset_map: 1; /* space contains an lt_offset
- subspace for line table mapping
- */
-
- long gntt_length; /* same as old header */
- long lntt_length; /* same as old header */
- long slt_length; /* same as old header */
- long vt_length; /* same as old header */
- long xt_length; /* same as old header */
- long ctxt_length; /* present only if version >= 2 */
- long range_length; /* present only if version >= 2 */
- long expr_length; /* present only if version >= 2 */
+ executable has NOT been processed by pxdb. */
+
+typedef struct DOC_info_header_struct
+{
+ unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */
+ unsigned int doc_header: 1; /* bit set if this is doc-style header*/
+ unsigned int version: 8; /* version of debug/header
+ format. For 10.0 the value
+ will be 1. For "Davis" the value is 2. */
+ unsigned int reserved_for_flags: 18; /* for future use; -- must be set to zero. */
+ unsigned int has_range_table: 1; /* space contains a $RANGE$ subspace for variable ranges. */
+ unsigned int has_context_table: 1; /* space contains a $CTXT$ subspace for context/inline table. */
+ unsigned int has_lines_table: 1; /* space contains a $LINES$ subspace for line tables. */
+ unsigned int has_lt_offset_map: 1; /* space contains an lt_offset subspace for line table mapping. */
+
+ long gntt_length; /* same as old header */
+ long lntt_length; /* same as old header */
+ long slt_length; /* same as old header */
+ long vt_length; /* same as old header */
+ long xt_length; /* same as old header */
+ long ctxt_length; /* present only if version >= 2 */
+ long range_length; /* present only if version >= 2 */
+ long expr_length; /* present only if version >= 2 */
} DOC_info_header;
/* Procedure Descriptor:
- *
- * An element of the procedure quick look-up table
- */
-typedef struct quick_procedure {
- long isym; /* 0-based index of first symbol*/
- /* for procedure in $LNTT$, */
- /* i.e. the procedure itself */
- CORE_ADDR adrStart; /* memory adr of start of proc */
- CORE_ADDR adrEnd; /* memory adr of end of proc */
- char *sbAlias; /* alias name of procedure */
- char *sbProc; /* real name of procedure */
- CORE_ADDR adrBp; /* address of entry breakpoint */
- CORE_ADDR adrExitBp; /* address of exit breakpoint */
- int icd; /* member of this class (index) */
- unsigned int ipd; /* index of template for this */
- /* function (index) */
- unsigned int unused: 5;
- unsigned int no_lt_offset: 1;/* no entry in lt_offset table */
- unsigned int fTemplate: 1; /* function template */
- unsigned int fExpansion: 1; /* function expansion */
- unsigned int linked : 1; /* linked with other expansions */
- unsigned int duplicate: 1; /* clone of another procedure */
- unsigned int overloaded:1; /* overloaded function */
- unsigned int member: 1; /* class member function */
- unsigned int constructor:1; /* constructor function */
- unsigned int destructor:1; /* destructor function */
- unsigned int Static: 1; /* static function */
- unsigned int Virtual: 1; /* virtual function */
- unsigned int constant: 1; /* constant function */
- unsigned int pure: 1; /* pure (virtual) function */
- unsigned int language: 4; /* procedure's language */
- unsigned int inlined: 1; /* function has been inlined */
- unsigned int Operator: 1; /* operator function */
- unsigned int stub: 1; /* bodyless function */
- unsigned int optimize: 2; /* optimization level */
- unsigned int level: 5; /* nesting level (top=0) */
+ An element of the procedure quick look-up table. */
+
+typedef struct quick_procedure
+{
+ long isym; /* 0-based index of first symbol
+ for procedure in $LNTT$,
+ i.e. the procedure itself. */
+ CORE_ADDR adrStart; /* memory adr of start of proc */
+ CORE_ADDR adrEnd; /* memory adr of end of proc */
+ char *sbAlias; /* alias name of procedure */
+ char *sbProc; /* real name of procedure */
+ CORE_ADDR adrBp; /* address of entry breakpoint */
+ CORE_ADDR adrExitBp; /* address of exit breakpoint */
+ int icd; /* member of this class (index) */
+ unsigned int ipd; /* index of template for this */
+ /* function (index) */
+ unsigned int unused: 5;
+ unsigned int no_lt_offset: 1;/* no entry in lt_offset table */
+ unsigned int fTemplate: 1; /* function template */
+ unsigned int fExpansion: 1; /* function expansion */
+ unsigned int linked : 1; /* linked with other expansions */
+ unsigned int duplicate: 1; /* clone of another procedure */
+ unsigned int overloaded:1; /* overloaded function */
+ unsigned int member: 1; /* class member function */
+ unsigned int constructor:1; /* constructor function */
+ unsigned int destructor:1; /* destructor function */
+ unsigned int Static: 1; /* static function */
+ unsigned int Virtual: 1; /* virtual function */
+ unsigned int constant: 1; /* constant function */
+ unsigned int pure: 1; /* pure (virtual) function */
+ unsigned int language: 4; /* procedure's language */
+ unsigned int inlined: 1; /* function has been inlined */
+ unsigned int Operator: 1; /* operator function */
+ unsigned int stub: 1; /* bodyless function */
+ unsigned int optimize: 2; /* optimization level */
+ unsigned int level: 5; /* nesting level (top=0) */
} quick_procedure_entry, *quick_procedure_entry_ptr;
/* Source File Descriptor:
- *
- * An element of the source file quick look-up table
- */
-typedef struct quick_source {
- long isym; /* 0-based index in $LNTT$ of */
- /* first symbol for this file */
- CORE_ADDR adrStart; /* mem adr of start of file's code */
- CORE_ADDR adrEnd; /* mem adr of end of file's code */
- char *sbFile; /* name of source file */
- unsigned int fHasDecl: 1; /* do we have a .d file? */
- unsigned int fWarned: 1; /* have warned about age problems? */
- unsigned int fSrcfile: 1; /* 0 => include 1=> source */
- unsigned short ilnMac; /* lines in file (0 if don't know) */
- int ipd; /* 0-based index of first procedure*/
- /* in this file, in the quick */
- /* look-up table of procedures */
- unsigned int *rgLn; /* line pointer array, if any */
+ An element of the source file quick look-up table. */
+
+typedef struct quick_source
+{
+ long isym; /* 0-based index in $LNTT$ of
+ first symbol for this file. */
+ CORE_ADDR adrStart; /* mem adr of start of file's code */
+ CORE_ADDR adrEnd; /* mem adr of end of file's code */
+ char *sbFile; /* name of source file */
+ unsigned int fHasDecl: 1; /* do we have a .d file? */
+ unsigned int fWarned: 1; /* have warned about age problems? */
+ unsigned int fSrcfile: 1; /* 0 => include 1=> source */
+ unsigned short ilnMac; /* lines in file (0 if don't know) */
+ int ipd; /* 0-based index of first procedure
+ in this file, in the quick
+ look-up table of procedures. */
+ unsigned int *rgLn; /* line pointer array, if any */
} quick_file_entry, *quick_file_entry_ptr;
/* Module Descriptor:
- *
- * An element of the module quick reference table
- */
-typedef struct quick_module {
- long isym; /* 0-based index of first */
- /* symbol for module */
- CORE_ADDR adrStart; /* adr of start of mod. */
- CORE_ADDR adrEnd; /* adr of end of mod. */
- char *sbAlias; /* alias name of module */
- char *sbMod; /* real name of module */
- unsigned int imports: 1; /* module have any imports? */
- unsigned int vars_in_front: 1; /* module globals in front? */
- unsigned int vars_in_gaps: 1; /* module globals in gaps? */
- unsigned int language: 4; /* type of language */
- unsigned int unused : 25;
- unsigned int unused2; /* space for future stuff */
+ An element of the module quick reference table. */
+
+typedef struct quick_module
+{
+ long isym; /* 0-based index of first
+ symbol for module. */
+ CORE_ADDR adrStart; /* adr of start of mod. */
+ CORE_ADDR adrEnd; /* adr of end of mod. */
+ char *sbAlias; /* alias name of module */
+ char *sbMod; /* real name of module */
+ unsigned int imports: 1; /* module have any imports? */
+ unsigned int vars_in_front: 1; /* module globals in front? */
+ unsigned int vars_in_gaps: 1; /* module globals in gaps? */
+ unsigned int language: 4; /* type of language */
+ unsigned int unused : 25;
+ unsigned int unused2; /* space for future stuff */
} quick_module_entry, *quick_module_entry_ptr;
/* Auxiliary Procedure Descriptor:
- *
- * An element of the auxiliary procedure quick look-up table
- */
-typedef struct quick_aux_procedure {
- long isym_inln; /* start on inline list for proc */
- long spare;
+ An element of the auxiliary procedure quick look-up table. */
+
+typedef struct quick_aux_procedure
+{
+ long isym_inln; /* start on inline list for proc */
+ long spare;
} quick_aux_procedure_entry, *quick_aux_procedure_entry_ptr;
/* Paragraph Descriptor:
- *
- * An element of the paragraph quick look-up table
- */
-typedef struct quick_paragraph {
- long isym; /* first symbol for label (index) */
- CORE_ADDR adrStart; /* memory adr of start of label */
- CORE_ADDR adrEnd; /* memory adr of end of label */
- char *sbLab; /* name of label */
- unsigned int inst; /* Used in xdb to store inst @ bp */
- unsigned int sect: 1; /* true = section, false = parag. */
- unsigned int unused: 31; /* future use */
+ An element of the paragraph quick look-up table. */
+
+typedef struct quick_paragraph
+{
+ long isym; /* first symbol for label (index) */
+ CORE_ADDR adrStart; /* memory adr of start of label */
+ CORE_ADDR adrEnd; /* memory adr of end of label */
+ char *sbLab; /* name of label */
+ unsigned int inst; /* Used in xdb to store inst @ bp */
+ unsigned int sect: 1; /* true = section, false = parag. */
+ unsigned int unused: 31; /* future use */
} quick_paragraph_entry, *quick_paragraph_entry_ptr;
-/*
- * Class Descriptor:
- *
- * An element of the class quick look-up table
- */
-typedef struct quick_class {
- char *sbClass; /* name of class */
- long isym; /* class symbol (tag) */
- unsigned int type : 2; /* 0=class, 1=union, 2=struct */
- unsigned int fTemplate : 1;/* class template */
- unsigned int expansion : 1;/* template expansion */
- unsigned int unused :28;
- sltpointer lowscope; /* beginning of defined scope */
- sltpointer hiscope; /* end of defined scope */
+/* Class Descriptor:
+ An element of the class quick look-up table. */
+
+typedef struct quick_class
+{
+ char *sbClass; /* name of class */
+ long isym; /* class symbol (tag) */
+ unsigned int type : 2; /* 0=class, 1=union, 2=struct */
+ unsigned int fTemplate : 1;/* class template */
+ unsigned int expansion : 1;/* template expansion */
+ unsigned int unused :28;
+ sltpointer lowscope; /* beginning of defined scope */
+ sltpointer hiscope; /* end of defined scope */
} quick_class_entry, *quick_class_entry_ptr;
-/* Address Alias Entry
- *
- * An element of the address alias quick look-up table
- */
-typedef struct quick_alias {
- CORE_ADDR low;
- CORE_ADDR high;
- int index;
- unsigned int unused : 31;
- unsigned int alternate : 1; /* alternate unnamed aliases? */
+/* Address Alias Entry
+ An element of the address alias quick look-up table. */
+
+typedef struct quick_alias
+{
+ CORE_ADDR low;
+ CORE_ADDR high;
+ int index;
+ unsigned int unused : 31;
+ unsigned int alternate : 1; /* alternate unnamed aliases? */
} quick_alias_entry, *quick_alias_entry_ptr;
-/* Object Identification Entry
- *
- * An element of the object identification quick look-up table
- */
+/* Object Identification Entry
+ An element of the object identification quick look-up table. */
-typedef struct quick_obj_ID {
- CORE_ADDR obj_ident; /* class identifier */
- long isym; /* class symbol */
- long offset; /* offset to object start */
+typedef struct quick_obj_ID
+{
+ CORE_ADDR obj_ident; /* class identifier */
+ long isym; /* class symbol */
+ long offset; /* offset to object start */
} quick_obj_ID_entry, *quick_obj_ID_entry_ptr;
-
#endif /* HP_SYMTAB_INCLUDED */
-