summaryrefslogtreecommitdiffstats
path: root/sys/ddb
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-11 01:50:09 +0000
committermarcel <marcel@FreeBSD.org>2004-07-11 01:50:09 +0000
commit240d7c6f403b210d3609f1593f55dd73266bc844 (patch)
tree455628d11a47bf6cf18a005a3216112eaa368a2e /sys/ddb
parent1a65a2060a2262e120c5eff2469817075342e795 (diff)
downloadFreeBSD-src-240d7c6f403b210d3609f1593f55dd73266bc844.zip
FreeBSD-src-240d7c6f403b210d3609f1593f55dd73266bc844.tar.gz
Remove now unused files:
db_elf.c, db_kld.c: The new KDB backend supports both at the same time. db_sysctl.c: The functionality has been moved to sys/kern/subr_kdb.c. db_trap.c: The DDB entry point has been moved to sys/ddb/db_main.c.
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_elf.c421
-rw-r--r--sys/ddb/db_kld.c133
-rw-r--r--sys/ddb/db_sysctl.c77
-rw-r--r--sys/ddb/db_trap.c77
4 files changed, 0 insertions, 708 deletions
diff --git a/sys/ddb/db_elf.c b/sys/ddb/db_elf.c
deleted file mode 100644
index a24f3b7..0000000
--- a/sys/ddb/db_elf.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/* $NetBSD: db_elf.c,v 1.4 1998/05/03 18:49:54 thorpej Exp $ */
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ddb.h"
-
-#ifdef DDB_NOKLDSYM
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#ifdef __i386__
-#include <machine/bootinfo.h>
-#endif
-
-#include <ddb/ddb.h>
-#include <ddb/db_sym.h>
-
-#include <machine/elf.h>
-
-#ifndef _ALIGNED_POINTER
-#define _ALIGNED_POINTER(ptr, type) 1
-#endif
-
-static char *db_elf_find_strtab(db_symtab_t *);
-
-#define STAB_TO_SYMSTART(stab) ((Elf_Sym *)((stab)->start))
-#define STAB_TO_SYMEND(stab) ((Elf_Sym *)((stab)->end))
-#define STAB_TO_EHDR(stab) ((Elf_Ehdr *)((stab)->private))
-#define STAB_TO_SHDR(stab, e) ((Elf_Shdr *)((stab)->private + (e)->e_shoff))
-
-void X_db_sym_init(void *symtab, void *esymtab, char *name);
-
-/*
- * Find the symbol table and strings; tell ddb about them.
- */
-void
-X_db_sym_init(symtab, esymtab, name)
- void *symtab; /* pointer to start of symbol table */
- void *esymtab; /* pointer to end of string table,
- for checking - rounded up to integer
- boundary */
- char *name;
-{
- Elf_Ehdr *elf;
- Elf_Shdr *shp;
- Elf_Sym *symp, *symtab_start, *symtab_end;
- char *strtab_start, *strtab_end;
- int i;
-
- if (_ALIGNED_POINTER(symtab, long) == 0) {
- printf("DDB: bad symbol table start address %p\n", symtab);
- return;
- }
-
- symtab_start = symtab_end = NULL;
- strtab_start = strtab_end = NULL;
-
- /*
- * The format of the symbols loaded by the boot program is:
- *
- * Elf exec header
- * first section header
- * . . .
- * . . .
- * last section header
- * first symbol or string table section
- * . . .
- * . . .
- * last symbol or string table section
- */
-
- /*
- * Validate the Elf header.
- */
- elf = (Elf_Ehdr *)symtab;
- if (elf->e_ident[EI_MAG0] != ELFMAG0
- || elf->e_ident[EI_MAG1] != ELFMAG1
- || elf->e_ident[EI_MAG2] != ELFMAG2
- || elf->e_ident[EI_MAG3] != ELFMAG3)
- goto badheader;
-
- if (!ELF_MACHINE_OK(elf->e_machine))
- goto badheader;
-
- /*
- * We need to avoid the section header string table (small string
- * table which names the sections). We do this by assuming that
- * the following two conditions will be true:
- *
- * (1) .shstrtab will be smaller than one page.
- * (2) .strtab will be larger than one page.
- *
- * When we encounter what we think is the .shstrtab, we change
- * its section type Elf_sht_null so that it will be ignored
- * later.
- */
- shp = (Elf_Shdr *)((char*)symtab + elf->e_shoff);
- for (i = 0; i < elf->e_shnum; i++) {
- if (shp[i].sh_addr || i == elf->e_shstrndx)
- continue;
- switch (shp[i].sh_type) {
- case SHT_STRTAB:
- if (shp[i].sh_size < PAGE_SIZE) {
- shp[i].sh_type = SHT_NULL;
- continue;
- }
- if (strtab_start != NULL)
- goto multiple_strtab;
- strtab_start = (char *)symtab + shp[i].sh_offset;
- strtab_end = (char *)symtab + shp[i].sh_offset +
- shp[i].sh_size;
- break;
-
- case SHT_SYMTAB:
- if (symtab_start != NULL)
- goto multiple_symtab;
- symtab_start = (Elf_Sym *)((char*)symtab + shp[i].sh_offset);
- symtab_end = (Elf_Sym *)((char*)symtab + shp[i].sh_offset +
- shp[i].sh_size);
- break;
-
- default:
- /* Ignore all other sections. */
- break;
- }
- }
-
- /*
- * Now, sanity check the symbols against the string table.
- */
- if (symtab_start == NULL || strtab_start == NULL ||
- _ALIGNED_POINTER(symtab_start, long) == 0 ||
- _ALIGNED_POINTER(strtab_start, long) == 0)
- goto badheader;
- for (symp = symtab_start; symp < symtab_end; symp++)
- if (symp->st_name + strtab_start > strtab_end)
- goto badheader;
-
- /*
- * Link the symbol table into the debugger.
- */
- db_add_symbol_table((char *)symtab_start,
- (char *)symtab_end, name, (char *)symtab);
- printf("[ preserving %lu bytes of %s symbol table ]\n",
- (u_long)roundup(((char*)esymtab - (char*)symtab), sizeof(u_long)), name);
- return;
-
- badheader:
- printf("[ %s symbol table not valid ]\n", name);
- return;
-
- multiple_strtab:
- printf("[ %s has multiple string tables ]\n", name);
- return;
-
- multiple_symtab:
- printf("[ %s has multiple symbol tables ]\n", name);
- return;
-}
-
-/*
- * Internal helper function - return a pointer to the string table
- * for the current symbol table.
- */
-static char *
-db_elf_find_strtab(stab)
- db_symtab_t *stab;
-{
- Elf_Ehdr *elf = STAB_TO_EHDR(stab);
- Elf_Shdr *shp = STAB_TO_SHDR(stab, elf);
- int i;
-
- for (i = 0; i < elf->e_shnum; i++) {
- if (shp[i].sh_type == SHT_STRTAB
- && !shp[i].sh_addr && i != elf->e_shstrndx)
- return (stab->private + shp[i].sh_offset);
- }
-
- return (NULL);
-}
-
-/*
- * Lookup the symbol with the given name.
- */
-c_db_sym_t
-X_db_lookup(stab, symstr)
- db_symtab_t *stab;
- const char *symstr;
-{
- Elf_Sym *symp, *symtab_start, *symtab_end;
- char *strtab;
-
- symtab_start = STAB_TO_SYMSTART(stab);
- symtab_end = STAB_TO_SYMEND(stab);
-
- strtab = db_elf_find_strtab(stab);
- if (strtab == NULL)
- return ((db_sym_t)0);
-
- for (symp = symtab_start; symp < symtab_end; symp++) {
- if (symp->st_name != 0 &&
- db_eqname(strtab + symp->st_name, symstr, 0))
- return ((db_sym_t)symp);
- }
-
- return ((db_sym_t)0);
-}
-
-/*
- * Search for the symbol with the given address (matching within the
- * provided threshold).
- */
-c_db_sym_t
-X_db_search_symbol(symtab, off, strategy, diffp)
- db_symtab_t *symtab;
- db_addr_t off;
- db_strategy_t strategy;
- db_expr_t *diffp; /* in/out */
-{
- Elf_Sym *rsymp, *symp, *symtab_start, *symtab_end;
- db_expr_t diff = *diffp;
-
- symtab_start = STAB_TO_SYMSTART(symtab);
- symtab_end = STAB_TO_SYMEND(symtab);
-
- rsymp = NULL;
-
- for (symp = symtab_start; symp < symtab_end; symp++) {
- if (symp->st_name == 0)
- continue;
- if (ELF_ST_TYPE(symp->st_info) != STT_OBJECT &&
- ELF_ST_TYPE(symp->st_info) != STT_FUNC &&
- ELF_ST_TYPE(symp->st_info) != STT_NOTYPE)
- continue;
-
- if (off >= symp->st_value) {
- if ((off - symp->st_value) < diff) {
- diff = off - symp->st_value;
- rsymp = symp;
- if (diff == 0) {
- if (strategy == DB_STGY_PROC &&
- ELF_ST_TYPE(symp->st_info) ==
- STT_FUNC &&
- ELF_ST_BIND(symp->st_info) !=
- STB_LOCAL)
- break;
- if (strategy == DB_STGY_ANY &&
- ELF_ST_BIND(symp->st_info) !=
- STB_LOCAL)
- break;
- }
- } else if ((off - symp->st_value) == diff) {
- if (rsymp == NULL)
- rsymp = symp;
- else if (ELF_ST_BIND(rsymp->st_info) ==
- STB_LOCAL &&
- ELF_ST_BIND(symp->st_info) !=
- STB_LOCAL) {
- /* pick the external symbol */
- rsymp = symp;
- }
- }
- }
- }
-
- if (rsymp == NULL)
- *diffp = off;
- else
- *diffp = diff;
-
- return ((db_sym_t)rsymp);
-}
-
-/*
- * Return the name and value for a symbol.
- */
-void
-X_db_symbol_values(symtab, sym, namep, valuep)
- db_symtab_t *symtab;
- c_db_sym_t sym;
- const char **namep;
- db_expr_t *valuep;
-{
- const Elf_Sym *symp = (const Elf_Sym *)sym;
- char *strtab;
-
- if (namep) {
- strtab = db_elf_find_strtab(symtab);
- if (strtab == NULL)
- *namep = NULL;
- else
- *namep = strtab + symp->st_name;
- }
-
- if (valuep)
- *valuep = symp->st_value;
-}
-
-/*
- * Return the file and line number of the current program counter
- * if we can find the appropriate debugging symbol.
- */
-boolean_t
-X_db_line_at_pc(symtab, cursym, filename, linenum, off)
- db_symtab_t *symtab;
- c_db_sym_t cursym;
- char **filename;
- int *linenum;
- db_expr_t off;
-{
-
- /*
- * XXX We don't support this (yet).
- */
- return (FALSE);
-}
-
-/*
- * Returns the number of arguments to a function and their
- * names if we can find the appropriate debugging symbol.
- */
-boolean_t
-X_db_sym_numargs(symtab, cursym, nargp, argnamep)
- db_symtab_t *symtab;
- c_db_sym_t cursym;
- int *nargp;
- char **argnamep;
-{
-
- /*
- * XXX We don't support this (yet).
- */
- return (FALSE);
-}
-
-/*
- * Initialization routine for Elf files.
- */
-
-#ifdef __i386__
-void *ksym_start, *ksym_end;
-#else
-extern void *ksym_start, *ksym_end;
-#endif
-
-void
-kdb_init(void)
-{
- static Elf_Ehdr elf;
- static Elf_Shdr sh[2];
-
-#ifdef __i386__
- ksym_start = (void *)bootinfo.bi_symtab;
- ksym_end = (void *)bootinfo.bi_esymtab;
-#endif
- if (ksym_end <= ksym_start)
- return;
-
- /*
- * The FreeBSD boot program doesn't actually load any headers, so
- * fake just enough for the routines in this file to work.
- */
- elf.e_ident[EI_MAG0] = ELFMAG0;
- elf.e_ident[EI_MAG1] = ELFMAG1;
- elf.e_ident[EI_MAG2] = ELFMAG2;
- elf.e_ident[EI_MAG3] = ELFMAG3;
- elf.e_machine = ELF_ARCH;
- elf.e_shoff = (uintptr_t)(void *)&sh[0] - (uintptr_t)(void *)&elf;
- sh[0].sh_type = SHT_SYMTAB;
- sh[0].sh_offset = (uintptr_t)ksym_start + sizeof(long) -
- (uintptr_t)(void *)&elf;
- sh[0].sh_size = *(int *)ksym_start;
- sh[1].sh_type = SHT_STRTAB;
- sh[1].sh_offset = sh[0].sh_offset + sh[0].sh_size + sizeof(long);
- sh[1].sh_size = (uintptr_t)ksym_end - (uintptr_t)ksym_start -
- sizeof(long) - sh[0].sh_size - sizeof(long);
- elf.e_shstrndx = -1;
- elf.e_shnum = 2;
-
- X_db_sym_init(&elf, ksym_end, "kernel");
-}
-
-#endif /* DDB_NOKLDSYM */
diff --git a/sys/ddb/db_kld.c b/sys/ddb/db_kld.c
deleted file mode 100644
index b811f21..0000000
--- a/sys/ddb/db_kld.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * 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.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * from db_aout.c,v 1.20 1998/06/07 17:09:36 dfr Exp
- */
-/*
- * Author: David B. Golub, Carnegie Mellon University
- * Date: 7/90
- */
-/*
- * Symbol table routines for kld maintained kernels.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ddb.h"
-
-#ifndef DDB_NOKLDSYM
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/linker.h>
-
-#include <ddb/ddb.h>
-#include <ddb/db_sym.h>
-
-c_db_sym_t
-X_db_lookup(stab, symstr)
- db_symtab_t *stab;
- const char * symstr;
-{
- c_linker_sym_t sym;
-
- if (linker_ddb_lookup(symstr, &sym) == 0)
- return (c_db_sym_t) sym;
- else
- return (c_db_sym_t) 0;
-}
-
-c_db_sym_t
-X_db_search_symbol(symtab, off, strategy, diffp)
- db_symtab_t * symtab;
- register
- db_addr_t off;
- db_strategy_t strategy;
- db_expr_t *diffp; /* in/out */
-{
- c_linker_sym_t sym;
- long diff;
-
- if (linker_ddb_search_symbol((caddr_t) off, &sym, &diff) == 0) {
- *diffp = (db_expr_t) diff;
- return (c_db_sym_t) sym;
- }
-
- return 0;
-}
-
-/*
- * Return the name and value for a symbol.
- */
-void
-X_db_symbol_values(symtab, dbsym, namep, valuep)
- db_symtab_t *symtab;
- c_db_sym_t dbsym;
- const char **namep;
- db_expr_t *valuep;
-{
- c_linker_sym_t sym = (c_linker_sym_t) dbsym;
- linker_symval_t symval;
-
- linker_ddb_symbol_values(sym, &symval);
- if (namep)
- *namep = (const char*) symval.name;
- if (valuep)
- *valuep = (db_expr_t) symval.value;
-}
-
-
-boolean_t
-X_db_line_at_pc(symtab, cursym, filename, linenum, off)
- db_symtab_t * symtab;
- c_db_sym_t cursym;
- char **filename;
- int *linenum;
- db_expr_t off;
-{
- return FALSE;
-}
-
-boolean_t
-X_db_sym_numargs(symtab, cursym, nargp, argnamep)
- db_symtab_t * symtab;
- c_db_sym_t cursym;
- int *nargp;
- char **argnamep;
-{
- return FALSE;
-}
-
-/*
- * Initialization routine for a.out files.
- */
-void
-kdb_init()
-{
- db_add_symbol_table(0, 0, "kernel", 0);
-}
-
-#endif /* !DDB_NOKLDSYM */
diff --git a/sys/ddb/db_sysctl.c b/sys/ddb/db_sysctl.c
deleted file mode 100644
index a8bb5df..0000000
--- a/sys/ddb/db_sysctl.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * db_sysctl.c
- *
- * Copyright (c) 2000 Whistle Communications, Inc.
- * All rights reserved.
- *
- * Subject to the following obligations and disclaimer of warranty, use and
- * redistribution of this software, in source or object code forms, with or
- * without modifications are expressly permitted by Whistle Communications;
- * provided, however, that:
- * 1. Any and all reproductions of the source or object code must include the
- * copyright notice above and the following disclaimer of warranties; and
- * 2. No rights are granted, in any manner or form, to use Whistle
- * Communications, Inc. trademarks, including the mark "WHISTLE
- * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
- * such appears in the above copyright notice or in the software.
- *
- * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
- * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
- * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
- * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
- * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
- * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
- * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
- * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
- * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Archie Cobbs <archie@whistle.com>
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/reboot.h>
-
-#define DESCRIPTION "Set to `ddb' or `gdb' to enter the kernel debugger"
-#define READ_MODE ""
-#define MODE_DDB "ddb"
-#define MODE_GDB "gdb"
-
-static int
-sysctl_debug_enter_debugger(SYSCTL_HANDLER_ARGS)
-{
- char dmode[64];
- int error;
-
- strncpy(dmode, READ_MODE, sizeof(dmode) - 1);
- dmode[sizeof(dmode) - 1] = '\0';
- error = sysctl_handle_string(oidp, &dmode[0], sizeof(dmode), req);
-
- if (error == 0 && req->newptr != NULL) {
- if (strcmp(dmode, MODE_DDB) == 0)
- boothowto &= ~RB_GDB;
- else if (strcmp(dmode, MODE_GDB) == 0)
- boothowto |= RB_GDB;
- else
- return EINVAL;
- Debugger("debug.enter_debugger");
- }
- return error;
-}
-
-SYSCTL_PROC(_debug, OID_AUTO, enter_debugger, CTLTYPE_STRING | CTLFLAG_RW,
- 0, 0, sysctl_debug_enter_debugger, "A", DESCRIPTION);
-
diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c
deleted file mode 100644
index 63c92b2..0000000
--- a/sys/ddb/db_trap.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * 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.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-/*
- * Author: David B. Golub, Carnegie Mellon University
- * Date: 7/90
- */
-
-/*
- * Trap entry point to kernel debugger.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <ddb/ddb.h>
-#include <ddb/db_command.h>
-
-#include <machine/setjmp.h>
-
-extern jmp_buf db_jmpbuf;
-
-void
-db_trap(type, code)
- int type, code;
-{
- boolean_t bkpt;
- boolean_t watchpt;
-
- bkpt = IS_BREAKPOINT_TRAP(type, code);
- watchpt = IS_WATCHPOINT_TRAP(type, code);
-
- if (db_stop_at_pc(&bkpt)) {
- if (db_inst_count) {
- db_printf("After %d instructions (%d loads, %d stores),\n",
- db_inst_count, db_load_count, db_store_count);
- }
- if (bkpt)
- db_printf("Breakpoint at\t");
- else if (watchpt)
- db_printf("Watchpoint at\t");
- else
- db_printf("Stopped at\t");
- db_dot = PC_REGS(DDB_REGS);
- if (setjmp(db_jmpbuf) == 0)
- db_print_loc_and_inst(db_dot);
-
- db_command_loop();
- }
-
- db_restart_at_pc(watchpt);
-}
OpenPOWER on IntegriCloud