1132624Smarcel/* 2132624Smarcel * Copyright (c) 2004 Marcel Moolenaar 3132624Smarcel * All rights reserved. 4132624Smarcel * 5132624Smarcel * Redistribution and use in source and binary forms, with or without 6132624Smarcel * modification, are permitted provided that the following conditions 7132624Smarcel * are met: 8132624Smarcel * 9132624Smarcel * 1. Redistributions of source code must retain the above copyright 10132624Smarcel * notice, this list of conditions and the following disclaimer. 11132624Smarcel * 2. Redistributions in binary form must reproduce the above copyright 12132624Smarcel * notice, this list of conditions and the following disclaimer in the 13132624Smarcel * documentation and/or other materials provided with the distribution. 14132624Smarcel * 15132624Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16132624Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17132624Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18132624Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19132624Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20132624Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21132624Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22132624Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23132624Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24132624Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25132624Smarcel * 26132624Smarcel * $FreeBSD$ 27132624Smarcel */ 28132624Smarcel 29132624Smarcel#ifndef _KGDB_H_ 30132624Smarcel#define _KGDB_H_ 31132624Smarcel 32149954Smarcelstruct thread_info; 33142151Skan 34132624Smarcelextern kvm_t *kvm; 35132624Smarcel 36132624Smarcelstruct kthr { 37132624Smarcel struct kthr *next; 38142151Skan uintptr_t paddr; 39132624Smarcel uintptr_t kaddr; 40132624Smarcel uintptr_t kstack; 41132624Smarcel uintptr_t pcb; 42132624Smarcel int tid; 43142151Skan int pid; 44173681Sjhb u_char cpu; 45132624Smarcel}; 46132624Smarcel 47132624Smarcelextern struct kthr *curkthr; 48132624Smarcel 49178670Sjhbvoid initialize_kld_target(void); 50178670Sjhbvoid initialize_kgdb_target(void); 51178670Sjhbvoid kgdb_dmesg(void); 52246893SmarcelCORE_ADDR kgdb_trgt_core_pcb(u_int); 53246893SmarcelCORE_ADDR kgdb_trgt_stop_pcb(u_int, u_int); 54178670Sjhbvoid kgdb_trgt_new_objfile(struct objfile *); 55132624Smarcelvoid kgdb_trgt_fetch_registers(int); 56132624Smarcelvoid kgdb_trgt_store_registers(int); 57178670Sjhbvoid kld_init(void); 58178670Sjhbvoid kld_new_objfile(struct objfile *); 59132624Smarcel 60149954Smarcelframe_unwind_sniffer_ftype kgdb_trgt_trapframe_sniffer; 61149954Smarcel 62132624Smarcelstruct kthr *kgdb_thr_first(void); 63132624Smarcelstruct kthr *kgdb_thr_init(void); 64142151Skanstruct kthr *kgdb_thr_lookup_tid(int); 65142151Skanstruct kthr *kgdb_thr_lookup_pid(int); 66142151Skanstruct kthr *kgdb_thr_lookup_paddr(uintptr_t); 67142151Skanstruct kthr *kgdb_thr_lookup_taddr(uintptr_t); 68132624Smarcelstruct kthr *kgdb_thr_next(struct kthr *); 69132624Smarcelstruct kthr *kgdb_thr_select(struct kthr *); 70142151Skanchar *kgdb_thr_extra_thread_info(int); 71132624Smarcel 72210852SjhbCORE_ADDR kgdb_lookup(const char *sym); 73178670SjhbCORE_ADDR kgdb_parse_1(const char *, int); 74167142Skib 75178670Sjhb#define kgdb_parse(exp) kgdb_parse_1((exp), 0) 76178670Sjhb#define kgdb_parse_quiet(exp) kgdb_parse_1((exp), 1) 77178670Sjhb 78132624Smarcel#endif /* _KGDB_H_ */ 79