PDR *proc_desc; /* procedure tables */
/* Forward reference for functions. */
-static void *read_seek PARAMS ((void *, size_t, off_t, const char *));
-static void read_tfile PARAMS ((void));
-static void print_global_hdr PARAMS ((struct filehdr *));
-static void print_sym_hdr PARAMS ((HDRR *));
-static void print_file_desc PARAMS ((FDR *, int));
-static void print_symbol PARAMS ((SYMR *, int, const char *, AUXU *, int, FDR *));
-static void print_aux PARAMS ((AUXU, int, int));
-static void emit_aggregate PARAMS ((char *, AUXU, AUXU, const char *, FDR *));
-static const char *st_to_string PARAMS ((st_t));
-static const char *sc_to_string PARAMS ((sc_t));
-static const char *glevel_to_string PARAMS ((glevel_t));
-static const char *lang_to_string PARAMS ((lang_t));
-static const char *type_to_string PARAMS ((AUXU *, int, FDR *));
+static void *read_seek (void *, size_t, off_t, const char *);
+static void read_tfile (void);
+static void print_global_hdr (struct filehdr *);
+static void print_sym_hdr (HDRR *);
+static void print_file_desc (FDR *, int);
+static void print_symbol (SYMR *, int, const char *, AUXU *, int, FDR *);
+static void print_aux (AUXU, int, int);
+static void emit_aggregate (char *, AUXU, AUXU, const char *, FDR *);
+static const char *st_to_string (st_t);
+static const char *sc_to_string (sc_t);
+static const char *glevel_to_string (glevel_t);
+static const char *lang_to_string (lang_t);
+static const char *type_to_string (AUXU *, int, FDR *);
extern char *optarg;
extern int optind;
{ 0, 0, 0, 0 }
};
\f
-/* Read some bytes at a specified location, and return a pointer. */
+/* Read some bytes at a specified location, and return a pointer.
+ Read_seek takes a pointer PTR to a buffer or NULL and reads SIZE
+ bytes from offset OFFSET. In case of errors CONTEXT is used as
+ error message. */
static void *
-read_seek (ptr, size, offset, context)
- void *ptr; /* pointer to buffer or NULL */
- size_t size; /* # bytes to read */
- off_t offset; /* offset to read at */
- const char *context; /* context for error message */
+read_seek (void *ptr, size_t size, off_t offset, const char *context)
{
long read_size = 0;
/* Convert language code to string format. */
static const char *
-lang_to_string (lang)
- lang_t lang;
+lang_to_string (lang_t lang)
{
switch (lang)
{
/* Convert storage class to string. */
static const char *
-sc_to_string(storage_class)
- sc_t storage_class;
+sc_to_string (sc_t storage_class)
{
switch(storage_class)
{
/* Convert symbol type to string. */
static const char *
-st_to_string(symbol_type)
- st_t symbol_type;
+st_to_string (st_t symbol_type)
{
switch(symbol_type)
{
/* Convert debug level to string. */
static const char *
-glevel_to_string (g_level)
- glevel_t g_level;
+glevel_to_string (glevel_t g_level)
{
switch(g_level)
{
return "??";
}
-
+
\f
/* Convert the type information to string format. */
static const char *
-type_to_string (aux_ptr, index, fdp)
- AUXU *aux_ptr;
- int index;
- FDR *fdp;
+type_to_string (AUXU *aux_ptr, int index, FDR *fdp)
{
AUXU u;
struct qual {
/* Print out the global file header for object files. */
static void
-print_global_hdr (ptr)
- struct filehdr *ptr;
+print_global_hdr (struct filehdr *ptr)
{
char *time = ctime ((time_t *)&ptr->f_timdat);
ushort flags = ptr->f_flags;
/* Print out the symbolic header. */
static void
-print_sym_hdr (sym_ptr)
- HDRR *sym_ptr;
+print_sym_hdr (HDRR *sym_ptr)
{
int width = 20;
/* Print out a symbol. */
static void
-print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
- SYMR *sym_ptr;
- int number;
- const char *strbase;
- AUXU *aux_base;
- int ifd;
- FDR *fdp;
+print_symbol (SYMR *sym_ptr, int number, const char *strbase, AUXU *aux_base,
+ int ifd, FDR *fdp)
{
sc_t storage_class = (sc_t) sym_ptr->sc;
st_t symbol_type = (st_t) sym_ptr->st;
if (want_scope)
{
if (free_scope == (scope_t *) 0)
- scope_ptr = (scope_t *) xmalloc (sizeof (scope_t));
+ scope_ptr = xmalloc (sizeof (scope_t));
else
{
scope_ptr = free_scope;
if (want_scope)
{
if (free_scope == (scope_t *) 0)
- scope_ptr = (scope_t *) xmalloc (sizeof (scope_t));
+ scope_ptr = xmalloc (sizeof (scope_t));
else
{
scope_ptr = free_scope;
/* Print out a word from the aux. table in various formats. */
static void
-print_aux (u, auxi, used)
- AUXU u;
- int auxi;
- int used;
+print_aux (AUXU u, int auxi, int used)
{
printf ("\t%s#%-5d %11ld, [%4ld/%7ld], [%2d %1d:%1d %1x:%1x:%1x:%1x:%1x:%1x]\n",
(used) ? " " : "* ",
/* Write aggregate information to a string. */
static void
-emit_aggregate (string, u, u2, which, fdp)
- char *string;
- AUXU u;
- AUXU u2;
- const char *which;
- FDR *fdp;
+emit_aggregate (char *string, AUXU u, AUXU u2, const char *which, FDR *fdp)
{
unsigned int ifd = u.rndx.rfd;
unsigned int index = u.rndx.index;
const char *name;
-
+
if (ifd == ST_RFDESCAPE)
ifd = u2.isym;
-
+
/* An ifd of -1 is an opaque type. An escaped index of 0 is a
struct return type of a procedure compiled without -g. */
if (ifd == 0xffffffff
fdp = &file_desc[rfile_desc[fdp->rfdBase + ifd]];
name = &l_strings[fdp->issBase + l_symbols[index + fdp->isymBase].iss];
}
-
+
sprintf (string,
"%s %s { ifd = %u, index = %u }",
which, name, ifd, index);
procedures, and line numbers within it. */
static void
-print_file_desc (fdp, number)
- FDR *fdp;
- int number;
+print_file_desc (FDR *fdp, int number)
{
char *str_base;
AUXU *aux_base;
int symi, pdi;
int width = 20;
char *used_base;
-
- str_base = l_strings + fdp->issBase;
+
+ str_base = l_strings + fdp->issBase;
aux_base = aux_symbols + fdp->iauxBase;
used_base = aux_used + (aux_base - aux_symbols);
printf ("\nFile #%d, \"%s\"\n\n",
number,
fdp->rss != issNil ? str_base + fdp->rss : "<unknown>");
-
+
printf (" Name index = %-10ld Readin = %s\n",
(long) fdp->rss, (fdp->fReadin) ? "Yes" : "No");
if (want_scope && cur_scope != (scope_t *) 0)
printf ("\n Warning scope does not start at 0!\n");
- /*
+ /*
* print the info about the symbol table.
*/
printf ("\n There are %lu local symbols, starting at %lu\n",
}
}
- /*
+ /*
* do the procedure descriptors.
*/
printf ("\n There are %lu procedure descriptor entries, ", (ulong) fdp->cpd);
/* Read in the portions of the .T file that we will print out. */
static void
-read_tfile ()
+read_tfile (void)
{
short magic;
off_t sym_hdr_offset = 0;
- (void) read_seek (&magic, sizeof (magic), (off_t) 0, "Magic number");
+ read_seek (&magic, sizeof (magic), 0, "Magic number");
if (!tfile)
{
/* Print out the global header, since this is not a T-file. */
- (void) read_seek (&global_hdr, sizeof (global_hdr), (off_t) 0,
- "Global file header");
+ read_seek (&global_hdr, sizeof (global_hdr), 0, "Global file header");
print_global_hdr (&global_hdr);
sym_hdr_offset = global_hdr.f_symptr;
}
- (void) read_seek (&sym_hdr,
- sizeof (sym_hdr),
- sym_hdr_offset,
- "Symbolic header");
+ read_seek (&sym_hdr, sizeof (sym_hdr), sym_hdr_offset, "Symbolic header");
print_sym_hdr (&sym_hdr);
- lines = (LINER *) read_seek (NULL,
- sym_hdr.cbLine,
- sym_hdr.cbLineOffset,
- "Line numbers");
+ lines = read_seek (NULL, sym_hdr.cbLine, sym_hdr.cbLineOffset,
+ "Line numbers");
- dense_nums = (DNR *) read_seek (NULL,
- sym_hdr.idnMax * sizeof (DNR),
- sym_hdr.cbDnOffset,
- "Dense numbers");
+ dense_nums = read_seek (NULL, sym_hdr.idnMax * sizeof (DNR),
+ sym_hdr.cbDnOffset, "Dense numbers");
- proc_desc = (PDR *) read_seek (NULL,
- sym_hdr.ipdMax * sizeof (PDR),
- sym_hdr.cbPdOffset,
- "Procedure tables");
+ proc_desc = read_seek (NULL, sym_hdr.ipdMax * sizeof (PDR),
+ sym_hdr.cbPdOffset, "Procedure tables");
- l_symbols = (SYMR *) read_seek (NULL,
- sym_hdr.isymMax * sizeof (SYMR),
- sym_hdr.cbSymOffset,
- "Local symbols");
+ l_symbols = read_seek (NULL, sym_hdr.isymMax * sizeof (SYMR),
+ sym_hdr.cbSymOffset, "Local symbols");
- opt_symbols = (OPTR *) read_seek (NULL,
- sym_hdr.ioptMax * sizeof (OPTR),
- sym_hdr.cbOptOffset,
- "Optimization symbols");
+ opt_symbols = read_seek (NULL, sym_hdr.ioptMax * sizeof (OPTR),
+ sym_hdr.cbOptOffset, "Optimization symbols");
- aux_symbols = (AUXU *) read_seek (NULL,
- sym_hdr.iauxMax * sizeof (AUXU),
- sym_hdr.cbAuxOffset,
- "Auxiliary symbols");
+ aux_symbols = read_seek (NULL, sym_hdr.iauxMax * sizeof (AUXU),
+ sym_hdr.cbAuxOffset, "Auxiliary symbols");
if (sym_hdr.iauxMax > 0)
aux_used = xcalloc (sym_hdr.iauxMax, 1);
- l_strings = (char *) read_seek (NULL,
- sym_hdr.issMax,
- sym_hdr.cbSsOffset,
- "Local string table");
-
- e_strings = (char *) read_seek (NULL,
- sym_hdr.issExtMax,
- sym_hdr.cbSsExtOffset,
- "External string table");
-
- file_desc = (FDR *) read_seek (NULL,
- sym_hdr.ifdMax * sizeof (FDR),
- sym_hdr.cbFdOffset,
- "File tables");
-
- rfile_desc = (ulong *) read_seek (NULL,
- sym_hdr.crfd * sizeof (ulong),
- sym_hdr.cbRfdOffset,
- "Relative file tables");
-
- e_symbols = (EXTR *) read_seek (NULL,
- sym_hdr.iextMax * sizeof (EXTR),
- sym_hdr.cbExtOffset,
- "External symbols");
+ l_strings = read_seek (NULL, sym_hdr.issMax,
+ sym_hdr.cbSsOffset, "Local string table");
+
+ e_strings = read_seek (NULL, sym_hdr.issExtMax,
+ sym_hdr.cbSsExtOffset, "External string table");
+
+ file_desc = read_seek (NULL, sym_hdr.ifdMax * sizeof (FDR),
+ sym_hdr.cbFdOffset, "File tables");
+
+ rfile_desc = read_seek (NULL, sym_hdr.crfd * sizeof (ulong),
+ sym_hdr.cbRfdOffset, "Relative file tables");
+
+ e_symbols = read_seek (NULL, sym_hdr.iextMax * sizeof (EXTR),
+ sym_hdr.cbExtOffset, "External symbols");
}
\f
-extern int main PARAMS ((int, char **));
+extern int main (int, char **);
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int i, opt;
for (i = 0; i < sym_hdr.ifdMax; i++)
print_file_desc (&file_desc[i], i);
- /*
+ /*
* Print the external symbols.
*/
want_scope = 0; /* scope info is meaning for extern symbols */