1*3c1e38eaSMarcel Moolenaar /* 2*3c1e38eaSMarcel Moolenaar * Copyright (c) 2004 David Xu <[email protected]> 3*3c1e38eaSMarcel Moolenaar * All rights reserved. 4*3c1e38eaSMarcel Moolenaar * 5*3c1e38eaSMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 6*3c1e38eaSMarcel Moolenaar * modification, are permitted provided that the following conditions 7*3c1e38eaSMarcel Moolenaar * are met: 8*3c1e38eaSMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 9*3c1e38eaSMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 10*3c1e38eaSMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 11*3c1e38eaSMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 12*3c1e38eaSMarcel Moolenaar * documentation and/or other materials provided with the distribution. 13*3c1e38eaSMarcel Moolenaar * 14*3c1e38eaSMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*3c1e38eaSMarcel Moolenaar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*3c1e38eaSMarcel Moolenaar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*3c1e38eaSMarcel Moolenaar * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*3c1e38eaSMarcel Moolenaar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*3c1e38eaSMarcel Moolenaar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*3c1e38eaSMarcel Moolenaar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*3c1e38eaSMarcel Moolenaar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*3c1e38eaSMarcel Moolenaar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*3c1e38eaSMarcel Moolenaar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*3c1e38eaSMarcel Moolenaar * SUCH DAMAGE. 25*3c1e38eaSMarcel Moolenaar * 26*3c1e38eaSMarcel Moolenaar * $FreeBSD$ 27*3c1e38eaSMarcel Moolenaar */ 28*3c1e38eaSMarcel Moolenaar 29*3c1e38eaSMarcel Moolenaar #ifndef _LIBPTHREAD_DB_H_ 30*3c1e38eaSMarcel Moolenaar #define _LIBPTHREAD_DB_H_ 31*3c1e38eaSMarcel Moolenaar 32*3c1e38eaSMarcel Moolenaar #include <sys/ucontext.h> 33*3c1e38eaSMarcel Moolenaar #include <machine/reg.h> 34*3c1e38eaSMarcel Moolenaar 35*3c1e38eaSMarcel Moolenaar #include "thread_db_int.h" 36*3c1e38eaSMarcel Moolenaar 37*3c1e38eaSMarcel Moolenaar struct pt_map { 38*3c1e38eaSMarcel Moolenaar enum { 39*3c1e38eaSMarcel Moolenaar PT_NONE, 40*3c1e38eaSMarcel Moolenaar PT_USER, 41*3c1e38eaSMarcel Moolenaar PT_LWP 42*3c1e38eaSMarcel Moolenaar } type; 43*3c1e38eaSMarcel Moolenaar 44*3c1e38eaSMarcel Moolenaar union { 45*3c1e38eaSMarcel Moolenaar lwpid_t lwp; 46*3c1e38eaSMarcel Moolenaar psaddr_t thr; 47*3c1e38eaSMarcel Moolenaar }; 48*3c1e38eaSMarcel Moolenaar }; 49*3c1e38eaSMarcel Moolenaar 50*3c1e38eaSMarcel Moolenaar struct td_thragent { 51*3c1e38eaSMarcel Moolenaar TD_THRAGENT_FIELDS; 52*3c1e38eaSMarcel Moolenaar psaddr_t libkse_debug_addr; 53*3c1e38eaSMarcel Moolenaar psaddr_t thread_list_addr; 54*3c1e38eaSMarcel Moolenaar psaddr_t thread_listgen_addr; 55*3c1e38eaSMarcel Moolenaar psaddr_t thread_activated_addr; 56*3c1e38eaSMarcel Moolenaar psaddr_t thread_active_threads_addr; 57*3c1e38eaSMarcel Moolenaar psaddr_t thread_keytable_addr; 58*3c1e38eaSMarcel Moolenaar int thread_activated; 59*3c1e38eaSMarcel Moolenaar struct pt_map *map; 60*3c1e38eaSMarcel Moolenaar int map_len; 61*3c1e38eaSMarcel Moolenaar }; 62*3c1e38eaSMarcel Moolenaar 63*3c1e38eaSMarcel Moolenaar void pt_md_init(void); 64*3c1e38eaSMarcel Moolenaar void pt_reg_to_ucontext(const struct reg *, ucontext_t *); 65*3c1e38eaSMarcel Moolenaar void pt_ucontext_to_reg(const ucontext_t *, struct reg *); 66*3c1e38eaSMarcel Moolenaar void pt_fpreg_to_ucontext(const struct fpreg *, ucontext_t *); 67*3c1e38eaSMarcel Moolenaar void pt_ucontext_to_fpreg(const ucontext_t *, struct fpreg *); 68*3c1e38eaSMarcel Moolenaar int pt_reg_sstep(struct reg *reg, int step); 69*3c1e38eaSMarcel Moolenaar 70*3c1e38eaSMarcel Moolenaar #endif /* _LIBPTHREAD_DB_H_ */ 71