Add some rudimentary support for ELF symbols in DDB on the ARM ports.

On platforms which load the kernel sans symbols directly from firmware
(possibly in e.g. S-Record format), call ddb_init() with empty arguments,
so that it will search any compiled in SYMTAB_SPACE.  On all other platforms,
if __ELF__, also call ddb_init() with empty arguments until ELF bootloaders
which pass symbol information are ready.
This commit is contained in:
thorpej 2001-11-09 07:21:37 +00:00
parent 704b08b696
commit 147b1bdc1c
11 changed files with 56 additions and 42 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_machdep.c,v 1.3 2001/11/09 06:52:25 thorpej Exp $ */
/* $NetBSD: rpc_machdep.c,v 1.4 2001/11/09 07:21:37 thorpej Exp $ */
/*
* Copyright (c) 2000-2001 Reinoud Zandijk.
@ -965,14 +965,17 @@ initarm_new_bootloader(bootconf)
#endif /* NIPKDB */
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();
@ -1849,14 +1852,17 @@ initarm_old_bootloader(bootconf)
#endif /* NIPKDB */
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.7 2001/07/28 18:12:43 chris Exp $ */
/* $NetBSD: db_interface.c,v 1.8 2001/11/09 07:21:37 thorpej Exp $ */
/*
* Copyright (c) 1996 Scott K. Stevens
@ -343,18 +343,14 @@ db_machine_init()
#ifndef __ELF__
struct exec *kernexec = (struct exec *)KERNEL_TEXT_BASE;
int len;
#endif
#ifdef __ELF__
printf("[ ELF symbol tables not supported ]\n");
#else
/*
* The boot loader currently loads the kernel with the a.out
* header still attached.
*/
if (kernexec->a_syms == 0) {
printf("[No symbol table]\n");
printf("ddb: No symbol table\n");
} else {
/* cover the symbols themselves (what is the int for?? XXX) */
esym = (int)&end + kernexec->a_syms + sizeof(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.9 2001/03/13 23:56:49 bjh21 Exp $ */
/* $NetBSD: db_interface.c,v 1.10 2001/11/09 07:21:37 thorpej Exp $ */
/*
* Copyright (c) 1996 Scott K. Stevens
@ -307,7 +307,7 @@ db_machine_init()
*/
if (kernexec->a_syms == 0) {
printf("[No symbol table]\n");
printf("ddb: No symbol table\n");
} else {
/* cover the symbols themselves (what is the int for?? XXX) */
esym = (int)&end + kernexec->a_syms + sizeof(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofwgencfg_machdep.c,v 1.16 2001/11/09 06:52:25 thorpej Exp $ */
/* $NetBSD: ofwgencfg_machdep.c,v 1.17 2001/11/09 07:21:38 thorpej Exp $ */
/*
* Copyright 1997
@ -218,17 +218,19 @@ initarm(ofw_handle)
irq_init();
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
struct exec *kernexec = (struct exec *)KERNEL_TEXT_BASE;
extern int end;
extern char *esym;
ddb_init(kernexec->a_syms, &end, esym);
printf("ddb_init: a_syms = 0x%lx, end = %p, esym = %p\n",
kernexec->a_syms, &end, esym);
}
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: shark_machdep.c,v 1.23 2001/11/09 06:52:26 thorpej Exp $ */
/* $NetBSD: shark_machdep.c,v 1.24 2001/11/09 07:21:38 thorpej Exp $ */
/*
* Copyright 1997
@ -306,8 +306,10 @@ initarm(ofw_handle)
panic("Cannot claim FIQ vector.\n");
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
struct exec *kernexec = (struct exec *)KERNEL_TEXT_BASE;
extern int end;
@ -315,6 +317,8 @@ initarm(ofw_handle)
ddb_init(kernexec->a_syms, &end, esym);
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: cats_machdep.c,v 1.4 2001/11/09 06:52:26 thorpej Exp $ */
/* $NetBSD: cats_machdep.c,v 1.5 2001/11/09 07:21:38 thorpej Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
@ -737,14 +737,17 @@ initarm(bootinfo)
#endif
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
extern int end;
extern int *esym;
ddb_init(*(int *)&end, ((int *)&end) + 1, esym);
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: dnard_machdep.c,v 1.3 2001/11/09 06:52:26 thorpej Exp $ */
/* $NetBSD: dnard_machdep.c,v 1.4 2001/11/09 07:21:38 thorpej Exp $ */
/*
* Copyright 1997
@ -303,8 +303,10 @@ initarm(ofw_handle)
panic("Cannot claim FIQ vector.\n");
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
struct exec *kernexec = (struct exec *)KERNEL_TEXT_BASE;
extern int end;
@ -312,6 +314,8 @@ initarm(ofw_handle)
ddb_init(kernexec->a_syms, &end, esym);
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofwgencfg_machdep.c,v 1.2 2001/11/09 06:52:26 thorpej Exp $ */
/* $NetBSD: ofwgencfg_machdep.c,v 1.3 2001/11/09 07:21:39 thorpej Exp $ */
/*
* Copyright 1997
@ -218,17 +218,19 @@ initarm(ofw_handle)
irq_init();
#ifdef DDB
printf("ddb: ");
db_machine_init();
#ifdef __ELF__
ddb_init(0, NULL, NULL); /* XXX */
#else
{
struct exec *kernexec = (struct exec *)KERNEL_BASE;
extern int end;
extern char *esym;
ddb_init(kernexec->a_syms, &end, esym);
printf("ddb_init: a_syms = 0x%lx, end = %p, esym = %p\n",
kernexec->a_syms, &end, esym);
}
}
#endif /* __ELF__ */
if (boothowto & RB_KDB)
Debugger();
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: integrator_machdep.c,v 1.3 2001/11/09 06:52:27 thorpej Exp $ */
/* $NetBSD: integrator_machdep.c,v 1.4 2001/11/09 07:21:39 thorpej Exp $ */
/*
* Copyright (c) 2001 ARM Ltd
@ -829,11 +829,10 @@ initarm(bootinfo)
#endif
#ifdef DDB
printf("ddb: ");
db_machine_init();
#if 0
ddb_init(end[0], end + 1, esym);
#endif
/* Firmware doesn't load symbols. */
ddb_init(0, NULL, NULL);
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: iq80310_machdep.c,v 1.6 2001/11/09 06:52:27 thorpej Exp $ */
/* $NetBSD: iq80310_machdep.c,v 1.7 2001/11/09 07:21:39 thorpej Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
@ -788,11 +788,10 @@ initarm(void)
#endif
#ifdef DDB
printf("ddb: ");
db_machine_init();
#if 0
ddb_init(end[0], end + 1, esym);
#endif
/* Firmware doesn't load symbols. */
ddb_init(0, NULL, NULL);
if (boothowto & RB_KDB)
Debugger();

View File

@ -1,4 +1,4 @@
/* $NetBSD: netwinder_machdep.c,v 1.11 2001/11/09 06:52:27 thorpej Exp $ */
/* $NetBSD: netwinder_machdep.c,v 1.12 2001/11/09 07:21:39 thorpej Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
@ -787,11 +787,10 @@ initarm(bootinfo)
#endif
#ifdef DDB
printf("ddb: ");
db_machine_init();
#if 0
ddb_init(end[0], end + 1, esym);
#endif
/* Firmware doesn't load symbols. */
ddb_init(0, NULL, NULL);
if (boothowto & RB_KDB)
Debugger();