thread_db_int.h revision 183021
1132332Smarcel/* 2132332Smarcel * Copyright (c) 2004 David Xu <davidxu@freebsd.org> 3132332Smarcel * All rights reserved. 4132332Smarcel * 5132332Smarcel * Redistribution and use in source and binary forms, with or without 6132332Smarcel * modification, are permitted provided that the following conditions 7132332Smarcel * are met: 8132332Smarcel * 1. Redistributions of source code must retain the above copyright 9132332Smarcel * notice, this list of conditions and the following disclaimer. 10132332Smarcel * 2. Redistributions in binary form must reproduce the above copyright 11132332Smarcel * notice, this list of conditions and the following disclaimer in the 12132332Smarcel * documentation and/or other materials provided with the distribution. 13132332Smarcel * 14132332Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15132332Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16132332Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17132332Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18132332Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19132332Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20132332Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21132332Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22132332Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23132332Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24132332Smarcel * SUCH DAMAGE. 25132332Smarcel * 26132332Smarcel * $FreeBSD: head/lib/libthread_db/thread_db_int.h 183021 2008-09-14 16:07:21Z marcel $ 27132332Smarcel */ 28132332Smarcel 29132332Smarcel#ifndef _THREAD_DB_INT_H_ 30132332Smarcel#define _THREAD_DB_INT_H_ 31132332Smarcel 32132332Smarcel#include <sys/types.h> 33132332Smarcel#include <sys/queue.h> 34132332Smarcel 35132332Smarcel#define TD_THRAGENT_FIELDS \ 36132332Smarcel struct ta_ops *ta_ops; \ 37132332Smarcel TAILQ_ENTRY(td_thragent) ta_next; \ 38132332Smarcel struct ps_prochandle *ph 39132332Smarcel 40132332Smarcelstruct ta_ops { 41132332Smarcel td_err_e (*to_init)(void); 42132332Smarcel 43132332Smarcel td_err_e (*to_ta_clear_event)(const td_thragent_t *, 44132332Smarcel td_thr_events_t *); 45132332Smarcel td_err_e (*to_ta_delete)(td_thragent_t *); 46132332Smarcel td_err_e (*to_ta_event_addr)(const td_thragent_t *, td_thr_events_e, 47132332Smarcel td_notify_t *); 48132332Smarcel td_err_e (*to_ta_event_getmsg)(const td_thragent_t *, 49132332Smarcel td_event_msg_t *); 50132332Smarcel td_err_e (*to_ta_map_id2thr)(const td_thragent_t *, thread_t, 51132332Smarcel td_thrhandle_t *); 52132332Smarcel td_err_e (*to_ta_map_lwp2thr)(const td_thragent_t *, lwpid_t, 53132332Smarcel td_thrhandle_t *); 54132332Smarcel td_err_e (*to_ta_new)(struct ps_prochandle *, td_thragent_t **); 55132332Smarcel td_err_e (*to_ta_set_event)(const td_thragent_t *, td_thr_events_t *); 56132332Smarcel td_err_e (*to_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *, 57132332Smarcel void *, td_thr_state_e, int, sigset_t *, unsigned int); 58132332Smarcel td_err_e (*to_ta_tsd_iter)(const td_thragent_t *, td_key_iter_f *, 59132332Smarcel void *); 60132332Smarcel 61132332Smarcel td_err_e (*to_thr_clear_event)(const td_thrhandle_t *, 62132332Smarcel td_thr_events_t *); 63132332Smarcel td_err_e (*to_thr_dbresume)(const td_thrhandle_t *); 64132332Smarcel td_err_e (*to_thr_dbsuspend)(const td_thrhandle_t *); 65132332Smarcel td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int); 66132332Smarcel td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *, 67132332Smarcel td_event_msg_t *); 68132332Smarcel td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *); 69132332Smarcel td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *); 70132332Smarcel td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t); 71132332Smarcel td_err_e (*to_thr_set_event)(const td_thrhandle_t *, 72132332Smarcel td_thr_events_t *); 73132332Smarcel td_err_e (*to_thr_setfpregs)(const td_thrhandle_t *, 74132332Smarcel const prfpregset_t *); 75132332Smarcel td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t); 76132332Smarcel td_err_e (*to_thr_validate)(const td_thrhandle_t *); 77180982Smarcel td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *, psaddr_t, 78180982Smarcel size_t, psaddr_t *); 79132332Smarcel 80132332Smarcel /* FreeBSD specific extensions. */ 81132332Smarcel td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int); 82146818Sdfr#if defined(__i386__) 83146818Sdfr td_err_e (*to_thr_getxmmregs)(const td_thrhandle_t *, char *); 84146818Sdfr td_err_e (*to_thr_setxmmregs)(const td_thrhandle_t *, const char *); 85146818Sdfr#endif 86132332Smarcel}; 87132332Smarcel 88132332Smarcel#ifdef TD_DEBUG 89132332Smarcel#define TDBG(...) ps_plog(__VA_ARGS__) 90132332Smarcel#define TDBG_FUNC() ps_plog("%s\n", __func__) 91132332Smarcel#else 92132332Smarcel#define TDBG(...) 93132332Smarcel#define TDBG_FUNC() 94132332Smarcel#endif 95132332Smarcel 96181065Smarcelstruct td_thragent; 97181065Smarcel 98183021Smarcelint thr_pread_int(const struct td_thragent *, psaddr_t, uint32_t *); 99183021Smarcelint thr_pread_long(const struct td_thragent *, psaddr_t, uint64_t *); 100183021Smarcelint thr_pread_ptr(const struct td_thragent *, psaddr_t, psaddr_t *); 101181065Smarcel 102183021Smarcelint thr_pwrite_int(const struct td_thragent *, psaddr_t, uint32_t); 103183021Smarcelint thr_pwrite_long(const struct td_thragent *, psaddr_t, uint64_t); 104183021Smarcelint thr_pwrite_ptr(const struct td_thragent *, psaddr_t, psaddr_t); 105181065Smarcel 106132332Smarcel#endif /* _THREAD_DB_INT_H_ */ 107