2007-02-22 09:34:42 +03:00
|
|
|
/* $NetBSD: db_aout.c,v 1.41 2007/02/22 06:41:00 thorpej Exp $ */
|
1994-06-29 10:29:24 +04:00
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
/*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Mach Operating System
|
|
|
|
* Copyright (c) 1991,1990 Carnegie Mellon University
|
|
|
|
* All Rights Reserved.
|
2002-02-15 10:33:48 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
|
|
* documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
2002-02-15 10:33:48 +03:00
|
|
|
*
|
1999-04-13 00:38:17 +04:00
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
1993-03-21 12:45:37 +03:00
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
2002-02-15 10:33:48 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Carnegie Mellon requests users of this software to return to
|
2002-02-15 10:33:48 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
2002-02-15 10:33:48 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
2001-11-13 01:54:03 +03:00
|
|
|
#include <sys/cdefs.h>
|
2007-02-22 09:34:42 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: db_aout.c,v 1.41 2007/02/22 06:41:00 thorpej Exp $");
|
2001-11-13 01:54:03 +03:00
|
|
|
|
1993-12-18 07:46:25 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
#include <machine/db_machdep.h>
|
1993-12-18 07:46:25 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#include <ddb/db_sym.h>
|
1996-02-05 04:56:47 +03:00
|
|
|
#include <ddb/db_output.h>
|
|
|
|
#include <ddb/db_extern.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-06-26 05:11:00 +04:00
|
|
|
#ifdef DB_AOUT_SYMBOLS
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1996-02-27 23:54:43 +03:00
|
|
|
#include <ddb/db_aout.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool db_aout_sym_init(int, void *, void *, const char *);
|
2005-05-30 01:31:05 +04:00
|
|
|
static db_sym_t db_aout_lookup(db_symtab_t *, const char *);
|
2002-02-15 10:33:48 +03:00
|
|
|
static db_sym_t db_aout_search_symbol(db_symtab_t *, db_addr_t, db_strategy_t,
|
|
|
|
db_expr_t *);
|
2005-05-30 01:31:05 +04:00
|
|
|
static void db_aout_symbol_values(db_symtab_t *, db_sym_t, const char **,
|
2002-02-15 10:33:48 +03:00
|
|
|
db_expr_t *);
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool db_aout_line_at_pc(db_symtab_t *, db_sym_t, char **, int *,
|
2002-02-15 10:33:48 +03:00
|
|
|
db_expr_t);
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool db_aout_sym_numargs(db_symtab_t *, db_sym_t, int *, char **);
|
2002-02-15 10:33:48 +03:00
|
|
|
static void db_aout_forall(db_symtab_t *, db_forall_func_t db_forall_func,
|
|
|
|
void *);
|
2003-04-25 00:00:48 +04:00
|
|
|
static int db_add_symbol_table(char *, char *, const char *, char *);
|
|
|
|
|
|
|
|
/* Only one symbol table, please */
|
|
|
|
static db_symtab_t db_symtabs;
|
|
|
|
|
1998-12-04 23:18:05 +03:00
|
|
|
|
2001-01-17 22:50:03 +03:00
|
|
|
const db_symformat_t db_symformat_aout = {
|
1998-12-04 23:18:05 +03:00
|
|
|
"a.out",
|
|
|
|
db_aout_sym_init,
|
|
|
|
db_aout_lookup,
|
|
|
|
db_aout_search_symbol,
|
|
|
|
db_aout_symbol_values,
|
|
|
|
db_aout_line_at_pc,
|
|
|
|
db_aout_sym_numargs,
|
2000-05-22 18:49:10 +04:00
|
|
|
db_aout_forall
|
1998-12-04 23:18:05 +03:00
|
|
|
};
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* An a.out symbol table as loaded into the kernel debugger:
|
|
|
|
*
|
|
|
|
* symtab -> size of symbol entries, in bytes
|
|
|
|
* sp -> first symbol entry
|
|
|
|
* ...
|
|
|
|
* ep -> last symbol entry + 1
|
|
|
|
* strtab == start of string table
|
|
|
|
* size of string table in bytes,
|
|
|
|
* including this word
|
|
|
|
* -> strings
|
|
|
|
*/
|
|
|
|
|
1994-06-03 05:58:32 +04:00
|
|
|
/*
|
|
|
|
* Find the symbol table and strings; tell ddb about them.
|
|
|
|
*/
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool
|
2002-02-15 10:33:48 +03:00
|
|
|
db_aout_sym_init(
|
|
|
|
int symsize, /* size of symbol table */
|
|
|
|
void *vsymtab, /* pointer to start of symbol table */
|
|
|
|
void *vesymtab, /* pointer to end of string table,
|
1993-03-21 12:45:37 +03:00
|
|
|
for checking - rounded up to integer
|
|
|
|
boundary */
|
2002-02-15 10:33:48 +03:00
|
|
|
const char *name
|
|
|
|
)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
struct nlist *sym_start, *sym_end;
|
|
|
|
struct nlist *sp;
|
|
|
|
char *strtab;
|
|
|
|
int slen, bad = 0;
|
1996-02-05 04:56:47 +03:00
|
|
|
char *estrtab;
|
1997-06-26 05:11:00 +04:00
|
|
|
|
1998-12-04 23:18:05 +03:00
|
|
|
if (ALIGNED_POINTER(vsymtab, long) == 0) {
|
|
|
|
printf("[ %s symbol table has bad start address %p ]\n",
|
|
|
|
name, vsymtab);
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
1997-06-26 05:11:00 +04:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-06-03 05:58:32 +04:00
|
|
|
/*
|
|
|
|
* Find pointers to the start and end of the symbol entries,
|
|
|
|
* given a pointer to the start of the symbol table.
|
|
|
|
*/
|
1998-06-09 05:57:41 +04:00
|
|
|
sym_start = (struct nlist *)vsymtab;
|
|
|
|
sym_end = (struct nlist *)((char *)sym_start + symsize);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
strtab = (char *)sym_end;
|
1999-04-29 15:28:42 +04:00
|
|
|
if (ALIGNED_POINTER(strtab, int) == 0) {
|
|
|
|
printf("[ %s symbol table has bad string table address %p ]\n",
|
|
|
|
name, strtab);
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
1999-04-29 15:28:42 +04:00
|
|
|
}
|
1996-02-05 04:56:47 +03:00
|
|
|
slen = *(int *)strtab;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1996-02-05 04:56:47 +03:00
|
|
|
estrtab = strtab + slen;
|
1993-07-22 17:02:15 +04:00
|
|
|
|
|
|
|
#define round_to_size(x) \
|
1998-08-13 06:10:37 +04:00
|
|
|
(((vaddr_t)(x) + sizeof(vsize_t) - 1) & ~(sizeof(vsize_t) - 1))
|
1993-07-22 17:02:15 +04:00
|
|
|
|
1998-06-09 05:57:41 +04:00
|
|
|
if (round_to_size(estrtab) != round_to_size(vesymtab)) {
|
2002-02-15 10:33:48 +03:00
|
|
|
printf("[ %s a.out symbol table not valid ]\n", name);
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
2002-02-15 10:33:48 +03:00
|
|
|
}
|
1993-07-22 17:02:15 +04:00
|
|
|
#undef round_to_size
|
2002-02-15 10:33:48 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
for (sp = sym_start; sp < sym_end; sp++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
int strx;
|
|
|
|
strx = sp->n_un.n_strx;
|
|
|
|
if (strx != 0) {
|
|
|
|
if (strx > slen) {
|
|
|
|
printf("[ %s has bad a.out string table "
|
|
|
|
"index (0x%x) ]\n", name, strx);
|
|
|
|
sp->n_un.n_name = 0;
|
|
|
|
bad = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
sp->n_un.n_name = strtab + strx;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-15 04:23:19 +04:00
|
|
|
if (bad)
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
1999-06-15 04:23:19 +04:00
|
|
|
|
1994-10-09 11:19:29 +03:00
|
|
|
if (db_add_symbol_table((char *)sym_start, (char *)sym_end, name,
|
1998-06-09 05:57:41 +04:00
|
|
|
NULL) != -1) {
|
2002-02-15 10:33:48 +03:00
|
|
|
printf("[ using %ld bytes of %s a.out symbol table ]\n",
|
|
|
|
(long)vesymtab - (long)vsymtab, name);
|
2007-02-22 09:34:42 +03:00
|
|
|
return (true);
|
2002-02-15 10:33:48 +03:00
|
|
|
}
|
|
|
|
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static db_sym_t
|
2005-05-30 01:31:05 +04:00
|
|
|
db_aout_lookup(db_symtab_t *stab, const char *symstr)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
struct nlist *sp, *ep;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2003-04-25 00:00:48 +04:00
|
|
|
stab = &db_symtabs;
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
sp = (struct nlist *)stab->start;
|
|
|
|
ep = (struct nlist *)stab->end;
|
|
|
|
|
|
|
|
for (; sp < ep; sp++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_un.n_name == 0)
|
|
|
|
continue;
|
|
|
|
if ((sp->n_type & N_STAB) == 0 &&
|
|
|
|
sp->n_un.n_name != 0 &&
|
|
|
|
db_eqname(sp->n_un.n_name, symstr, '_'))
|
|
|
|
return ((db_sym_t)sp);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
return ((db_sym_t)0);
|
|
|
|
}
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static db_sym_t
|
|
|
|
db_aout_search_symbol(db_symtab_t *symtab, db_addr_t off,
|
|
|
|
db_strategy_t strategy, db_expr_t *diffp)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
unsigned int diff = *diffp;
|
|
|
|
struct nlist *symp = 0;
|
|
|
|
struct nlist *sp, *ep;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2003-04-25 00:00:48 +04:00
|
|
|
symtab = &db_symtabs;
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
sp = (struct nlist *)symtab->start;
|
|
|
|
ep = (struct nlist *)symtab->end;
|
|
|
|
|
|
|
|
for (; sp < ep; sp++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_un.n_name == 0)
|
|
|
|
continue;
|
|
|
|
if ((sp->n_type & N_STAB) != 0 || (sp->n_type & N_TYPE) == N_FN)
|
|
|
|
continue;
|
|
|
|
if (off >= sp->n_value) {
|
|
|
|
if (off - sp->n_value < diff) {
|
|
|
|
diff = off - sp->n_value;
|
|
|
|
symp = sp;
|
|
|
|
if (diff == 0 &&
|
|
|
|
((strategy == DB_STGY_PROC &&
|
|
|
|
sp->n_type == (N_TEXT|N_EXT)) ||
|
|
|
|
(strategy == DB_STGY_ANY &&
|
|
|
|
(sp->n_type & N_EXT))))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (off - sp->n_value == diff) {
|
|
|
|
if (symp == 0)
|
|
|
|
symp = sp;
|
|
|
|
else if ((symp->n_type & N_EXT) == 0 &&
|
|
|
|
(sp->n_type & N_EXT) != 0)
|
|
|
|
/* pick the external symbol */
|
|
|
|
symp = sp;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
2002-02-15 10:33:48 +03:00
|
|
|
if (symp == 0)
|
|
|
|
*diffp = off;
|
|
|
|
else
|
|
|
|
*diffp = diff;
|
1993-03-21 12:45:37 +03:00
|
|
|
return ((db_sym_t)symp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the name and value for a symbol.
|
|
|
|
*/
|
2002-02-15 10:33:48 +03:00
|
|
|
static void
|
2006-11-16 04:32:37 +03:00
|
|
|
db_aout_symbol_values(db_symtab_t *symtab, db_sym_t sym,
|
2006-10-12 05:30:41 +04:00
|
|
|
const char **namep, db_expr_t *valuep)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
struct nlist *sp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
sp = (struct nlist *)sym;
|
|
|
|
if (namep)
|
2002-02-15 10:33:48 +03:00
|
|
|
*namep = sp->n_un.n_name;
|
1993-03-21 12:45:37 +03:00
|
|
|
if (valuep)
|
2002-02-15 10:33:48 +03:00
|
|
|
*valuep = sp->n_value;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1993-07-10 07:25:02 +04:00
|
|
|
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool
|
2006-11-16 04:32:37 +03:00
|
|
|
db_aout_line_at_pc(db_symtab_t *symtab, db_sym_t cursym,
|
2006-10-12 05:30:41 +04:00
|
|
|
char **filename, int *linenum, db_expr_t off)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
struct nlist *sp, *ep;
|
1993-07-10 07:25:02 +04:00
|
|
|
unsigned long sodiff = -1UL, lndiff = -1UL, ln = 0;
|
|
|
|
char *fname = NULL;
|
|
|
|
|
2003-04-25 00:00:48 +04:00
|
|
|
symtab = &db_symtabs;
|
|
|
|
|
1993-07-10 07:25:02 +04:00
|
|
|
sp = (struct nlist *)symtab->start;
|
|
|
|
ep = (struct nlist *)symtab->end;
|
|
|
|
|
|
|
|
/* XXX - gcc specific */
|
|
|
|
#define NEWSRC(str) ((str) != NULL && \
|
|
|
|
(str)[0] == 'g' && strcmp((str), "gcc_compiled.") == 0)
|
|
|
|
|
|
|
|
for (; sp < ep; sp++) {
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
/*
|
|
|
|
* Prevent bogus linenumbers in case module not compiled
|
|
|
|
* with debugging options
|
|
|
|
*/
|
1993-07-10 07:25:02 +04:00
|
|
|
#if 0
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_value <= off && (off - sp->n_value) <= sodiff &&
|
|
|
|
NEWSRC(sp->n_un.n_name)) {
|
1993-07-10 07:25:02 +04:00
|
|
|
#endif
|
2002-02-15 10:33:48 +03:00
|
|
|
if ((sp->n_type & N_TYPE) == N_FN || NEWSRC(sp->n_un.n_name)) {
|
|
|
|
sodiff = lndiff = -1UL;
|
|
|
|
ln = 0;
|
|
|
|
fname = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sp->n_type == N_SO) {
|
|
|
|
if (sp->n_value <= off && (off - sp->n_value) < sodiff) {
|
|
|
|
sodiff = off - sp->n_value;
|
|
|
|
fname = sp->n_un.n_name;
|
|
|
|
}
|
|
|
|
continue;
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_type != N_SLINE)
|
|
|
|
continue;
|
1993-07-10 07:25:02 +04:00
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_value > off)
|
|
|
|
break;
|
1993-07-10 07:25:02 +04:00
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
if (off - sp->n_value < lndiff) {
|
|
|
|
lndiff = off - sp->n_value;
|
|
|
|
ln = sp->n_desc;
|
|
|
|
}
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fname != NULL && ln != 0) {
|
|
|
|
*filename = fname;
|
|
|
|
*linenum = ln;
|
2007-02-22 09:34:42 +03:00
|
|
|
return true;
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
|
|
|
|
2007-02-22 09:34:42 +03:00
|
|
|
return (false);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
2007-02-22 01:59:35 +03:00
|
|
|
static bool
|
2002-02-15 10:33:48 +03:00
|
|
|
db_aout_sym_numargs(db_symtab_t *symtab, db_sym_t cursym, int *nargp,
|
|
|
|
char **argnamep)
|
1993-07-10 07:25:02 +04:00
|
|
|
{
|
2000-03-30 15:31:26 +04:00
|
|
|
struct nlist *sp, *ep;
|
1993-07-10 07:25:02 +04:00
|
|
|
u_long addr;
|
|
|
|
int maxnarg = *nargp, nargs = 0;
|
2005-05-30 01:31:05 +04:00
|
|
|
static char question[] = "???";
|
1993-07-10 07:25:02 +04:00
|
|
|
|
2003-05-17 04:28:44 +04:00
|
|
|
if ((struct nlist *)cursym == NULL)
|
2007-02-22 09:34:42 +03:00
|
|
|
return false;
|
1993-07-10 07:25:02 +04:00
|
|
|
|
2003-04-25 00:00:48 +04:00
|
|
|
symtab = &db_symtabs;
|
|
|
|
|
1993-07-10 07:25:02 +04:00
|
|
|
addr = ((struct nlist *)cursym)->n_value;
|
|
|
|
sp = (struct nlist *)symtab->start;
|
|
|
|
ep = (struct nlist *)symtab->end;
|
|
|
|
|
|
|
|
for (; sp < ep; sp++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_type == N_FUN && sp->n_value == addr) {
|
|
|
|
while (++sp < ep && sp->n_type == N_PSYM) {
|
|
|
|
if (nargs >= maxnarg)
|
|
|
|
break;
|
|
|
|
nargs++;
|
|
|
|
*argnamep++ = sp->n_un.n_name ?
|
2005-05-30 01:31:05 +04:00
|
|
|
sp->n_un.n_name : question;
|
2002-02-15 10:33:48 +03:00
|
|
|
{
|
|
|
|
/* XXX - remove trailers */
|
|
|
|
char *cp = *(argnamep-1);
|
|
|
|
while (*cp != '\0' && *cp != ':') cp++;
|
|
|
|
if (*cp == ':') *cp = '\0';
|
|
|
|
}
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
2002-02-15 10:33:48 +03:00
|
|
|
*nargp = nargs;
|
2007-02-22 09:34:42 +03:00
|
|
|
return true;
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
|
|
|
}
|
2007-02-22 09:34:42 +03:00
|
|
|
return false;
|
1993-07-10 07:25:02 +04:00
|
|
|
}
|
2000-05-22 18:49:10 +04:00
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static void
|
|
|
|
db_aout_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg)
|
2000-05-22 18:49:10 +04:00
|
|
|
{
|
|
|
|
static char suffix[2];
|
|
|
|
struct nlist *sp, *ep;
|
|
|
|
|
2003-04-25 00:00:48 +04:00
|
|
|
stab = &db_symtabs;
|
|
|
|
|
2000-05-22 18:49:10 +04:00
|
|
|
sp = (struct nlist *)stab->start;
|
|
|
|
ep = (struct nlist *)stab->end;
|
|
|
|
|
|
|
|
for (; sp < ep; sp++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
if (sp->n_un.n_name == 0)
|
|
|
|
continue;
|
|
|
|
if ((sp->n_type & N_STAB) == 0 && sp->n_un.n_name != 0) {
|
|
|
|
suffix[1] = '\0';
|
|
|
|
switch(sp->n_type & N_TYPE) {
|
|
|
|
case N_ABS:
|
|
|
|
suffix[0] = '@';
|
|
|
|
break;
|
|
|
|
case N_TEXT:
|
|
|
|
suffix[0] = '*';
|
|
|
|
break;
|
|
|
|
case N_DATA:
|
|
|
|
suffix[0] = '+';
|
|
|
|
break;
|
|
|
|
case N_BSS:
|
|
|
|
suffix[0] = '-';
|
|
|
|
break;
|
|
|
|
case N_FN:
|
|
|
|
suffix[0] = '/';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
suffix[0] = '\0';
|
|
|
|
}
|
|
|
|
(*db_forall_func)(stab, (db_sym_t)sp, sp->n_un.n_name,
|
|
|
|
suffix, '_', arg);
|
|
|
|
}
|
2000-05-22 18:49:10 +04:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2003-04-25 00:00:48 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add symbol table, with given name, to symbol tables.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
db_add_symbol_table(char *start, char *end, const char *name, char *ref)
|
|
|
|
{
|
|
|
|
|
|
|
|
db_symtabs.start = start;
|
|
|
|
db_symtabs.end = end;
|
|
|
|
db_symtabs.name = name;
|
|
|
|
db_symtabs.private = ref;
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
1997-06-26 05:11:00 +04:00
|
|
|
#endif /* DB_AOUT_SYMBOLS */
|