13c1e38eaSMarcel Moolenaar /* 23c1e38eaSMarcel Moolenaar * Copyright (c) 2004 David Xu <[email protected]> 33c1e38eaSMarcel Moolenaar * All rights reserved. 43c1e38eaSMarcel Moolenaar * 53c1e38eaSMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 63c1e38eaSMarcel Moolenaar * modification, are permitted provided that the following conditions 73c1e38eaSMarcel Moolenaar * are met: 83c1e38eaSMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 93c1e38eaSMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 103c1e38eaSMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 113c1e38eaSMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 123c1e38eaSMarcel Moolenaar * documentation and/or other materials provided with the distribution. 133c1e38eaSMarcel Moolenaar * 143c1e38eaSMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 153c1e38eaSMarcel Moolenaar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 163c1e38eaSMarcel Moolenaar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 173c1e38eaSMarcel Moolenaar * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 183c1e38eaSMarcel Moolenaar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 193c1e38eaSMarcel Moolenaar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 203c1e38eaSMarcel Moolenaar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 213c1e38eaSMarcel Moolenaar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 223c1e38eaSMarcel Moolenaar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 233c1e38eaSMarcel Moolenaar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 243c1e38eaSMarcel Moolenaar * SUCH DAMAGE. 253c1e38eaSMarcel Moolenaar * 263c1e38eaSMarcel Moolenaar * $FreeBSD$ 273c1e38eaSMarcel Moolenaar */ 283c1e38eaSMarcel Moolenaar 293c1e38eaSMarcel Moolenaar #ifndef _LIBPTHREAD_DB_H_ 303c1e38eaSMarcel Moolenaar #define _LIBPTHREAD_DB_H_ 313c1e38eaSMarcel Moolenaar 323c1e38eaSMarcel Moolenaar #include <sys/ucontext.h> 333c1e38eaSMarcel Moolenaar #include <machine/reg.h> 343c1e38eaSMarcel Moolenaar 353c1e38eaSMarcel Moolenaar #include "thread_db_int.h" 363c1e38eaSMarcel Moolenaar 373c1e38eaSMarcel Moolenaar struct pt_map { 383c1e38eaSMarcel Moolenaar enum { 393c1e38eaSMarcel Moolenaar PT_NONE, 403c1e38eaSMarcel Moolenaar PT_USER, 413c1e38eaSMarcel Moolenaar PT_LWP 423c1e38eaSMarcel Moolenaar } type; 433c1e38eaSMarcel Moolenaar 443c1e38eaSMarcel Moolenaar union { 453c1e38eaSMarcel Moolenaar lwpid_t lwp; 463c1e38eaSMarcel Moolenaar psaddr_t thr; 473c1e38eaSMarcel Moolenaar }; 483c1e38eaSMarcel Moolenaar }; 493c1e38eaSMarcel Moolenaar 503c1e38eaSMarcel Moolenaar struct td_thragent { 513c1e38eaSMarcel Moolenaar TD_THRAGENT_FIELDS; 523c1e38eaSMarcel Moolenaar psaddr_t libkse_debug_addr; 533c1e38eaSMarcel Moolenaar psaddr_t thread_list_addr; 543c1e38eaSMarcel Moolenaar psaddr_t thread_listgen_addr; 553c1e38eaSMarcel Moolenaar psaddr_t thread_activated_addr; 563c1e38eaSMarcel Moolenaar psaddr_t thread_active_threads_addr; 573c1e38eaSMarcel Moolenaar psaddr_t thread_keytable_addr; 583c1e38eaSMarcel Moolenaar int thread_activated; 59*cd980d46SDavid Xu int thread_off_dtv; 60*cd980d46SDavid Xu int thread_off_kse_locklevel; 61*cd980d46SDavid Xu int thread_off_kse; 62*cd980d46SDavid Xu int thread_off_tlsindex; 63*cd980d46SDavid Xu int thread_off_attr_flags; 64*cd980d46SDavid Xu int thread_size_key; 65*cd980d46SDavid Xu int thread_off_tcb; 66*cd980d46SDavid Xu int thread_off_linkmap; 67*cd980d46SDavid Xu int thread_off_tmbx; 68*cd980d46SDavid Xu int thread_off_thr_locklevel; 69*cd980d46SDavid Xu int thread_off_next; 70*cd980d46SDavid Xu int thread_off_state; 71*cd980d46SDavid Xu int thread_max_keys; 72*cd980d46SDavid Xu int thread_off_key_allocated; 73*cd980d46SDavid Xu int thread_off_key_destructor; 74*cd980d46SDavid Xu int thread_state_zoombie; 75*cd980d46SDavid Xu int thread_state_running; 763c1e38eaSMarcel Moolenaar struct pt_map *map; 773c1e38eaSMarcel Moolenaar int map_len; 783c1e38eaSMarcel Moolenaar }; 793c1e38eaSMarcel Moolenaar 803c1e38eaSMarcel Moolenaar void pt_md_init(void); 813c1e38eaSMarcel Moolenaar void pt_reg_to_ucontext(const struct reg *, ucontext_t *); 823c1e38eaSMarcel Moolenaar void pt_ucontext_to_reg(const ucontext_t *, struct reg *); 833c1e38eaSMarcel Moolenaar void pt_fpreg_to_ucontext(const struct fpreg *, ucontext_t *); 843c1e38eaSMarcel Moolenaar void pt_ucontext_to_fpreg(const ucontext_t *, struct fpreg *); 853c1e38eaSMarcel Moolenaar int pt_reg_sstep(struct reg *reg, int step); 863c1e38eaSMarcel Moolenaar 873c1e38eaSMarcel Moolenaar #endif /* _LIBPTHREAD_DB_H_ */ 88