/*************************************************************************** * (c) Copyright 1988 - 1993 HEWLETT-PACKARD COMPANY. All rights reserved. * ***************************************************************************/ /*************************************************************************** * 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 * the Free Software Foundation; Version 2, June 1991. * * This program 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 this include file; if not, write to the Free Software Foundation, * Inc, 675 Mass Ave, Cambridge, MA 02139, USA * ***************************************************************************/ /*************************************************************************** * * Hewlett-Packard Company will not respond to external queries regarding * the distribution or content of this include file. The University of * Utah Center for Software Science (CSS) is the contact point for its * distribution. CSS distributes this file under the terms of the GNU * General Public License, as above: WITHOUT ANY WARRANTY. CSS makes NO * WARRANTY as to the file's accuracy or timeliness. This file is NOT * SUPPORTED by CSS. * * The current distributed version of this file is available by * anonymous ftp from jaguar.cs.utah.edu in dist/hpux-symtab.h. * The GNU General Public License is in dist/COPYING. * Email may be directed to pa-gdb-bugs@cs.utah.edu. * ***************************************************************************/ #ifndef _SYMTAB_INCLUDED /* allow multiple inclusions */ #define _SYMTAB_INCLUDED /* * * SYMBOLIC DEBUG FORMAT ACD * $Revision$ * * * * ---- 1. INTRODUCTION * * * This document describes the current format for data tables which * appear in HP-UX / HPE object files (a.out files). These tables * will be generated by the compilers, fixed up by the linker, and * used by various programs (primarily the symbolic debugger(s)) to * reconstruct information about the program. The form of this * document is a C include file annotated with comments. * * On PA-RISC, a major goal was that the linker need not know * anything about the format. To this end, it was decided that the * debug information be composed of several unloadable subspaces * within an unloadable space (named $DEBUG$), and that link time * updates to the debug information be made through the standard * mechanism of a list of fixups. The linker will perform the * required fixups for the debug spaces, and subspaces from * separate compilation units will be concatenated. However, at * exec time, the loader would know that the debug space is not to * be loaded. * * Similarly, on the series 300, several debug tables are present * in the a.out format which are not loaded at exec time. Debug * tables are simply concatenated into larger tables at link time * and all fixups are then performed by pxdb. */ /* * ---- 2. SUMMARY OF STRUCTURES * * * The debug information consists of six tables: a header table * and five special tables. The header table will contain one * header record for each compilation unit. Each header record * identifies the size (in bytes) of the five tables generated by * that compilation unit. Two of the tables are very similar. The * GNTT and LNTT both contain name and type information (NTT for * Name and Type Table). The GNTT contains information about * globals, and is thus limited to variables, types, and constants. * The LNTT is for information about locals. The LNTT must * therefore contain scoping information such as procedure nesting, * begin-end blocks, etc. The GNTT and LNTT are both DNTTs (Debug * Name and Type Tables), so the prefix DNTT is attached to objects * (like a DNTTPOINTER) that are relevant to both the GNTT and * LNTT. The SLT contains information relating source (or listing) * lines to code addresses. The SLT and LNTT contain pointers * between the two tables, so that the scoping information * contained in the LNTT can also be used with the SLT. The VT * contains ascii strings (such as variable names) and the values * of named constants. The five tables are summarized below: * * * Table Abbr Contains Points into * ============= ==== ========================= =============== * Global symbols GNTT global name-and-type info GNTT * Local symbols LNTT local name-and-type info GNTT,LNTT,SLT,VT * source line SLT source/listing line info LNTT,SLT * value VT names and constants - * xref XT File offsets and Attributes XT,VT * * * The pointers needed within the debug tables are in fact indexes * into the tables. The GNTT, LNTT, and SLT each consist of a series * of equal-sized entries. Some DNTT entries begin a data structure * and some are extension entries. Some SLT entries are "special" * (point back to the LNTT), others are "assist" (point forward in * the SLT), but most are "normal" (point to code). * * There can be pointers from the LNTT to the GNTT, as it is common * to have local variables of a global type. However, there are * never pointers from the GNTT to the LNTT, as global variables * are never of a local type. * * The tables are defined to be as machine-independent as possible, * but the debugger may need to "know" some facts about the system * and language it is dealing with. * * The GNTT and LNTT are the only tables that require fixups to be * generated by the compiler and acted upon by the linker. There * are other fixups to be done, but these are all done by the pre- * processor. */ /* * ---- 3. LOW-LEVEL TYPE DECLARATIONS */ /* * Code or data address: * * For the series 300: * * A virtual Address * * For PA-RISC: * * A PA-RISC short pointer. * */ #if __cplusplus #define public global #endif typedef long ADDRESS; typedef unsigned long ADRT, *pADRT; /* * Language types: * * Sizeof (LANGTYPE) = 4 bits, for a maximum of 16 possible * language types. */ typedef unsigned int LANGTYPE; #define LANG_UNKNOWN 0 #define LANG_C 1 #define LANG_HPF77 2 #define LANG_HPPASCAL 3 #define LANG_HPMODCAL 4 #define LANG_HPCOBOL 5 #define LANG_HPBASIC 6 #define LANG_HPADA 7 #ifdef CPLUSPLUS #define LANG_CPLUSPLUS 8 #endif /* * Location types: * * 32-bit, machine-dependent and context-dependent specifiers of * variable storage location. */ typedef unsigned long STATTYPE; /* static-type location */ typedef long DYNTYPE; /* dynamic-type location */ typedef unsigned long REGTYPE; /* register-type location */ #define STATNIL (-1) /* no location for STATTYPE */ /* * Loc type Series 300 PA-RISC * ======== ================ =============== * * STATTYPE Absolute address A PA-RISC * into process short pointer. * space (could be * code or data). * * * DYNTYPE A6-register- SP-register * relative byte relative byte * offset (+/-). offset (+/-) * * REGTYPE Register number Register number * (see below). (see below). * * All location types are always byte (not word) pointers when they * address memory, and they always point to the first byte * containing the object, skipping any padding bytes. For example, * if in Pascal a CHAR is allocated in the last byte of a whole * word, the pointer is to that byte. (In C, four different CHAR * variables might be packed into one word.) */ /* * Meaning of STATTYPE for CONST entries: * * Sizeof (LOCDESCTYPE) = 3 bits, for a maximum of 8 possible * desctypes. */ typedef unsigned int LOCDESCTYPE; #define LOC_IMMED 0 /* immediate constant */ #define LOC_PTR 1 /* standard STATTYPE */ #define LOC_VT 2 /* value table byte offset */ /* * Register numbers for REGTYPE (Series 300 only): */ #define REG_D0 0 #define REG_D1 1 #define REG_D2 2 #define REG_D3 3 #define REG_D4 4 #define REG_D5 5 #define REG_D6 6 #define REG_D7 7 #define REG_A0 8 #define REG_A1 9 #define REG_A2 10 #define REG_A3 11 #define REG_A4 12 #define REG_A5 13 #define REG_A6 14 #define REG_A7 15 #define REG_FP0 16 #define REG_FP1 17 #define REG_FP2 18 #define REG_FP3 19 #define REG_FP4 20 #define REG_FP5 21 #define REG_FP6 22 #define REG_FP7 23 #define REG_FPA0 24 #define REG_FPA1 25 #define REG_FPA2 26 #define REG_FPA3 27 #define REG_FPA4 28 #define REG_FPA5 29 #define REG_FPA6 30 #define REG_FPA7 31 #define REG_FPA8 32 #define REG_FPA9 33 #define REG_FPA10 34 #define REG_FPA11 35 #define REG_FPA12 36 #define REG_FPA13 37 #define REG_FPA14 38 #define REG_FPA15 39 /* * generic floating point registers; * actual register determined at runtime */ #define REG_FGEN0 40 #define REG_FGEN1 41 #define REG_FGEN2 42 #define REG_FGEN3 43 #define REG_FGEN4 44 #define REG_FGEN5 45 #define REG_FGEN6 46 #define REG_FGEN7 47 #define REG_FGEN8 48 #define REG_FGEN9 49 #define REG_FGEN10 50 #define REG_FGEN11 51 #define REG_FGEN12 52 #define REG_FGEN13 53 #define REG_FGEN14 54 #define REG_FGEN15 55 /* * Basetypes: * * Sizeof (BASETYPE) = 5 bits, for a maximum of 32 possible * basetypes. */ typedef unsigned int BASETYPE; #define T_UNDEFINED 0 /* unheard of */ #define T_BOOLEAN 1 /* true/false or LOGICAL */ #define T_CHAR 2 /* ASCII, signed if used as int */ #define T_INT 3 /* signed integer */ #define T_UNS_INT 4 /* unsigned integer */ #define T_REAL 5 /* binary or decimal real */ #define T_COMPLEX 6 /* pair of reals */ #define T_STRING200 7 /* Series 300 string type */ #define T_LONGSTRING200 8 /* Series 300 long string type */ #define T_TEXT 9 /* for Pascal TEXT file */ #define T_FLABEL 10 /* for any program labels */ #define T_FTN_STRING_SPEC 11 /* PA-RISC FORTRAN string type */ #define T_MOD_STRING_SPEC 12 /* PA-RISC Modcal/Pascal string */ #define T_PACKED_DECIMAL 13 /* packed decimal */ #define T_REAL_3000 14 /* HP3000 format real */ #define T_MOD_STRING_3000 15 /* HP3000 Modcal/Pascal string */ #define T_ANYPTR 16 /* Pascal any-pointer */ #define T_GLOBAL_ANYPTR 17 /* Pascal global any-pointer */ #define T_LOCAL_ANYPTR 18 /* Pascal local any-pointer */ #define T_COMPLEXS3000 19 /* HP3000 format complex */ #define T_FTN_STRING_S300_COMPAT 20 /* 9000/s300 compatible fortran string */ #define T_FTN_STRING_VAX_COMPAT 21 /* VAX compatible fortran string */ #define T_BOOLEAN_S300_COMPAT 22 /* 9000/s300 compatible fortran logical */ #define T_BOOLEAN_VAX_COMPAT 23 /* VAX compatible fortran logical */ #define T_WIDE_CHAR 24 /* ANSI/C wchar_t pseudo-type */ #define T_LONG 25 /* signed long */ #define T_UNS_LONG 26 /* unsigned long */ #define T_DOUBLE 27 /* binary or decimal double */ #ifdef TEMPLATES #define T_TEMPLATE_ARG 28 /* template argument immediate type */ #endif /* TEMPLATES */ /* THE HIGHEST BASE_TYPE ALLOWABLE is 31 (see DNTTP_IMMEDIATE) */ /* * The string types are reserved for cases where the language has * an explicit string type separate from "array of char". * * The ANSI/C wchar_t typedef defines a special base-type to * the debugger. The interpretation of wide-characters during * input or display (i.e. their mapping to/from "external" * characters) is defined by the ANSI/C functions mbtowc() and * wctomb(), the "multi-byte" translation functions. * * T_FLABEL is used for CONSTs which are actually FORTRAN labels. * The T_FLABEL is needed for the following: in FORTRAN there is * the ASSIGN statement (ASSIGN