dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / mdb / common / modules / genunix / findstack.h
blobd024a20ab0a9f754b232f667d5182117510bcb7e
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _MDB_FINDSTACK_H
27 #define _MDB_FINDSTACK_H
29 #include <mdb/mdb_modapi.h>
30 #include <sys/param.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 typedef struct findstack_info {
37 uintptr_t *fsi_stack; /* place to record frames */
38 uintptr_t fsi_sp; /* stack pointer */
39 uintptr_t fsi_pc; /* pc */
40 uintptr_t fsi_sobj_ops; /* sobj_ops */
41 uint_t fsi_tstate; /* t_state */
42 uchar_t fsi_depth; /* stack depth */
43 uchar_t fsi_failed; /* search failed */
44 uchar_t fsi_overflow; /* stack was deeper than max_depth */
45 uchar_t fsi_panic; /* thread called panic() */
46 uchar_t fsi_max_depth; /* stack frames available */
47 } findstack_info_t;
49 #define FSI_FAIL_BADTHREAD 1
50 #define FSI_FAIL_THREADCORRUPT 2
51 #define FSI_FAIL_STACKNOTFOUND 3
53 typedef struct stacks_module {
54 char sm_name[MAXPATHLEN]; /* name of module */
55 uintptr_t sm_text; /* base address of text in module */
56 size_t sm_size; /* size of text in module */
57 } stacks_module_t;
59 extern int findstack(uintptr_t, uint_t, int, const mdb_arg_t *);
60 extern int findstack_debug(uintptr_t, uint_t, int, const mdb_arg_t *);
63 * The following routines are implemented in findstack.c, shared across both
64 * genunix and libc.
66 extern int stacks(uintptr_t, uint_t, int, const mdb_arg_t *);
67 extern void stacks_cleanup(int);
70 * The following routines are specific to their context (kernel vs. user-land)
71 * and are therefore implemented in findstack_subr.c (of which each of genunix
72 * and libc have their own copy).
74 extern void stacks_help(void);
75 extern int stacks_findstack(uintptr_t, findstack_info_t *, uint_t);
76 extern void stacks_findstack_cleanup();
77 extern int stacks_module(stacks_module_t *);
79 extern int findstack_debug_on;
81 #define fs_dprintf(x) \
82 if (findstack_debug_on) { \
83 mdb_printf("findstack debug: "); \
84 /*CSTYLED*/ \
85 mdb_printf x ; \
88 #ifdef __cplusplus
90 #endif
92 #endif /* _MDB_FINDSTACK_H */