Change ddb_init() for a.out to provision for kernels which are not booted by

the current 'bootblock' method, like the Shark, which preloads and preformats
the symbol table right in the boot code.
This commit is contained in:
tv 1998-06-09 01:57:41 +00:00
parent 5ba723ecf2
commit 00ede2160e
16 changed files with 117 additions and 50 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.113 1998/05/24 19:32:36 is Exp $ */
/* $NetBSD: machdep.c,v 1.114 1998/06/09 01:57:41 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -222,7 +222,12 @@ consinit()
cninit();
#if defined (DDB)
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: rc7500_machdep.c,v 1.5 1998/04/02 02:01:13 mark Exp $ */
/* $NetBSD: rc7500_machdep.c,v 1.6 1998/06/09 01:57:42 tv Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -1014,7 +1014,12 @@ promcngetc();
#ifdef DDB
printf("ddb: ");
db_machine_init();
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_machdep.c,v 1.6 1998/04/19 03:59:19 mark Exp $ */
/* $NetBSD: rpc_machdep.c,v 1.7 1998/06/09 01:57:42 tv Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -1196,7 +1196,12 @@ initarm(bootconf)
#ifdef DDB
printf("ddb: ");
db_machine_init();
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.62 1998/05/11 07:46:17 leo Exp $ */
/* $NetBSD: machdep.c,v 1.63 1998/06/09 01:57:42 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -153,7 +153,12 @@ consinit()
cninit();
#if defined (DDB)
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if(boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.107 1998/04/26 21:24:27 scottr Exp $ */
/* $NetBSD: machdep.c,v 1.108 1998/06/09 01:57:43 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -267,7 +267,12 @@ consinit()
consinit_active = 0;
#ifdef DDB
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.307 1998/06/06 21:27:31 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.308 1998/06/09 01:57:43 tv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -1861,7 +1861,12 @@ init386(first_avail)
#ifdef DDB
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.198 1998/05/24 19:32:43 is Exp $ */
/* $NetBSD: machdep.c,v 1.199 1998/06/09 01:57:44 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -338,7 +338,12 @@ consinit(void)
/*
* Initialize kernel debugger, if compiled in.
*/
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif
if (boothowto & RB_KDB) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.38 1998/05/24 19:32:46 is Exp $ */
/* $NetBSD: machdep.c,v 1.39 1998/06/09 01:57:44 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -345,7 +345,12 @@ consinit()
cninit();
#ifdef DDB
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.76 1998/05/08 16:55:17 kleink Exp $ */
/* $NetBSD: machdep.c,v 1.77 1998/06/09 01:57:44 tv Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -1302,7 +1302,12 @@ consinit()
}
#endif
#if defined (DDB)
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if(boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.91 1998/06/06 05:03:23 mrg Exp $ */
/* $NetBSD: autoconf.c,v 1.92 1998/06/09 01:57:45 tv Exp $ */
/*
* Copyright (c) 1996
@ -228,7 +228,12 @@ bootstrap()
/* Moved zs_kgdb_init() to dev/zs.c:consinit(). */
#ifdef DDB
db_machine_init();
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.h,v 1.9 1997/01/18 19:24:54 gwr Exp $ */
/* $NetBSD: db_machdep.h,v 1.10 1998/06/09 01:57:45 tv Exp $ */
/*
* Mach Operating System
@ -42,7 +42,6 @@
extern label_t *db_recover; /* db_command.c */
extern char *esym; /* end of symbols */
void ddb_init __P((void));
void db_machine_init __P((void));
/* These are in db_memrw.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.113 1998/06/08 20:47:46 gwr Exp $ */
/* $NetBSD: machdep.c,v 1.114 1998/06/09 01:57:45 tv Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -103,6 +103,7 @@
#include <machine/pte.h>
#include <machine/db_machdep.h>
#include <ddb/db_extern.h>
#include <sun3/sun3/machdep.h>
@ -173,7 +174,12 @@ consinit()
#ifdef DDB
db_machine_init();
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif DDB
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.31 1998/03/08 19:12:53 gwr Exp $ */
/* $NetBSD: machdep.c,v 1.32 1998/06/09 01:57:45 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -95,6 +95,7 @@
#include <machine/pte.h>
#include <machine/db_machdep.h>
#include <ddb/db_extern.h>
#include <sun3/sun3/machdep.h>
@ -157,7 +158,12 @@ consinit()
#ifdef DDB
db_machine_init();
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif DDB
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.28 1998/05/24 19:32:49 is Exp $ */
/* $NetBSD: machdep.c,v 1.29 1998/06/09 01:57:46 tv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -182,7 +182,12 @@ consinit()
zs_kgdb_init(); /* XXX */
#endif
#ifdef DDB
ddb_init();
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_aout.c,v 1.18 1997/11/30 15:49:34 drochner Exp $ */
/* $NetBSD: db_aout.c,v 1.19 1998/06/09 01:57:46 tv Exp $ */
/*
* Mach Operating System
@ -63,7 +63,8 @@ int db_symtab[SYMTAB_SPACE/sizeof(int)] = { 0, 1 };
* Find the symbol table and strings; tell ddb about them.
*/
void
X_db_sym_init(vsymtab, vesymtab, name)
X_db_sym_init(symsize, vsymtab, vesymtab, name)
int symsize; /* size of symbol table */
void *vsymtab; /* pointer to start of symbol table */
void *vesymtab; /* pointer to end of string table,
for checking - rounded up to integer
@ -75,16 +76,14 @@ X_db_sym_init(vsymtab, vesymtab, name)
register char *strtab;
register int slen;
char *estrtab;
int *symtab = vsymtab;
char *esymtab = vesymtab;
if (ALIGNED_POINTER(symtab, int) == 0) {
printf("DDB: bad symtol table start address %p\n", symtab);
if (ALIGNED_POINTER(vsymtab, int) == 0) {
printf("DDB: bad symbol table start address %p\n", vsymtab);
return;
}
#ifdef SYMTAB_SPACE
if (*symtab < sizeof(int)) {
if (symsize < sizeof(struct nlist)) {
printf ("DDB: no symbols\n");
return;
}
@ -94,8 +93,8 @@ X_db_sym_init(vsymtab, vesymtab, name)
* Find pointers to the start and end of the symbol entries,
* given a pointer to the start of the symbol table.
*/
sym_start = (struct nlist *)(symtab + 1);
sym_end = (struct nlist *)((char *)sym_start + *symtab);
sym_start = (struct nlist *)vsymtab;
sym_end = (struct nlist *)((char *)sym_start + symsize);
strtab = (char *)sym_end;
slen = *(int *)strtab;
@ -103,7 +102,7 @@ X_db_sym_init(vsymtab, vesymtab, name)
#ifdef SYMTAB_SPACE
printf("DDB: found symbols [%d + %d bytes]\n",
*symtab, slen);
if ((*symtab + slen) > db_symtabsize) {
if ((symsize + slen) > db_symtabsize) {
printf("DDB: symbols larger than SYMTAB_SPACE?\n");
return;
}
@ -113,7 +112,7 @@ X_db_sym_init(vsymtab, vesymtab, name)
#define round_to_size(x) \
(((vm_offset_t)(x) + sizeof(vm_size_t) - 1) & ~(sizeof(vm_size_t) - 1))
if (round_to_size(estrtab) != round_to_size(esymtab)) {
if (round_to_size(estrtab) != round_to_size(vesymtab)) {
printf("[ %s symbol table not valid ]\n", name);
return;
}
@ -135,10 +134,10 @@ X_db_sym_init(vsymtab, vesymtab, name)
}
if (db_add_symbol_table((char *)sym_start, (char *)sym_end, name,
(char *)symtab) != -1) {
NULL) != -1) {
#ifndef SYMTAB_SPACE
printf("[ preserving %d bytes of %s symbol table ]\n",
esymtab - (char *)symtab, name);
(char *)vesymtab - (char *)vsymtab, name);
#endif
}
}
@ -342,15 +341,13 @@ X_db_sym_numargs(symtab, cursym, nargp, argnamep)
* Initialization routine for a.out files.
*/
void
ddb_init()
ddb_init(symsize, vss, vse)
int symsize;
void *vss, *vse;
{
#ifndef SYMTAB_SPACE
extern char *esym;
extern int end;
if (esym > (char *)&end) {
X_db_sym_init((int *)&end, esym, "netbsd");
}
if (symsize)
X_db_sym_init(symsize, vss, vse, "netbsd");
#else
X_db_sym_init (db_symtab, 0, "netbsd");
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_extern.h,v 1.3 1997/11/16 22:46:39 christos Exp $ */
/* $NetBSD: db_extern.h,v 1.4 1998/06/09 01:57:46 tv Exp $ */
/*
* Copyright (c) 1995 Christos Zoulas. All rights reserved.
@ -32,7 +32,11 @@
#define _DDB_DB_EXTERN_H_
/* db_aout.c and db_elf.c */
#ifdef DB_ELF_SYMBOLS /* XXX */
void X_db_sym_init __P((void *, void *, char *));
#else
void X_db_sym_init __P((int, void *, void *, char *));
#endif
db_sym_t X_db_lookup __P((db_symtab_t *, char *));
db_sym_t X_db_search_symbol __P((db_symtab_t *, db_addr_t, db_strategy_t,
db_expr_t *));
@ -44,7 +48,7 @@ int X_db_sym_numargs __P((db_symtab_t *, db_sym_t, int *, char **));
#ifdef DB_ELF_SYMBOLS /* XXX */
void ddb_init __P((void *, void *));
#else
void ddb_init __P((void));
void ddb_init __P((int, void *, void *));
#endif
/* db_examine.c */