1/* 2 * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC. 3 * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY 4 * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION 5 * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems 6 * To anyone who acknowledges that this file is provided "AS IS" without 7 * any express or implied warranty: permission to use, copy, modify, and 8 * distribute this file for any purpose is hereby granted without fee, 9 * provided that the above copyright notices and this notice appears in 10 * all source code copies, and that none of the names listed above be used 11 * in advertising or publicity pertaining to distribution of the software 12 * without specific, written prior permission. None of these organizations 13 * makes any representations about the suitability of this software for 14 * any purpose. 15 */ 16/* 17 * This file defines the internal interface to the core of CMA 18 * debugging services. (The client interface to debugging services 19 * is provided by cma_debug_client.h). 20 */ 21 22#ifndef CMA_DEB_CORE 23#define CMA_DEB_CORE 24 25/* 26 * INCLUDE FILES 27 */ 28#include <cma.h> 29#include <cma_mutex.h> 30#include <cma_queue.h> 31#include <cma_tcb_defs.h> 32#include <cma_util.h> 33 34/* 35 * CONSTANTS AND MACROS 36 */ 37 38 39/* 40 * TYPEDEFS 41 */ 42 43/*FIX-ME* Need to use sizes that are platform specific */ 44typedef long int cma___t_debug_ctx[17]; 45 46/* 47 * Type defing the format of known object lists 48 */ 49typedef struct CMA__T_KNOWN_OBJECT { 50 cma__t_queue queue; /* Queue header for known objects */ 51 cma__t_int_mutex *mutex; /* Mutex to control access to queue */ 52 } cma__t_known_object; 53 54 55/* 56 * Type defining the registration for one debug client (e.g. Ada) 57 */ 58typedef struct CMA__T_DEB_REGISTRY { 59 cma_t_address entry; /* Client's debug entry point */ 60 cma_t_key key; /* Client's context key */ 61 cma_t_integer fac; /* Client's debug facility number */ 62 cma_t_boolean has_prolog; /* Client's TCBs have std prolog */ 63 } cma__t_deb_registry; 64 65#define cma__c_deb_max_clients 10 66 67/* 68 * Type defining the global debugging state for all threads. 69 */ 70typedef struct CMA__T_DEBUG_STATE { 71 /* 72 * The following flag is set if changes were made while in the 73 * debugger that may make the ready lists inconsistent. For 74 * example, if a thread priority is changed in the debugger, the 75 * thread is not moved between queues. Making things consistent 76 * is deferred to when the dispatcher is next invoked -- which we 77 * try to make very soon. 78 */ 79 cma_t_boolean is_inconsistency; /* Ready lists are inconsistent */ 80 81 82 cma_t_boolean events_enabled; /* Set if _any_ event is enabled */ 83 cma_t_boolean flags[cma__c_debevt__dim]; 84 /* Which events are enabled */ 85 cma__t_int_tcb *next_to_run; /* TCB of thread to run next */ 86 87 cma__t_int_mutex *mutex; /* Mutex for registering clients */ 88 cma_t_integer client_count; /* Count of debug clients */ 89 cma__t_deb_registry clients[cma__c_deb_max_clients+1]; 90 /* Array of current debug 91 clients */ 92 } cma__t_debug_state; 93 94 95/* 96 * Routine that will symbolize and address and print it. 97 */ 98typedef void (*cma__t_print_symbol) (cma_t_address); 99 100 101/* 102 * GLOBAL DATA 103 */ 104 105/* 106 * Variable holding the global debugging state 107 * 108 * (This is primarily written by the debugger interface and read 109 * by the thread dispatcher). 110 */ 111extern cma__t_debug_state cma__g_debug_state; 112 113/* 114 * Known object queues 115 */ 116extern cma__t_known_object cma__g_known_atts; 117extern cma__t_known_object cma__g_known_cvs; 118extern cma__t_known_object cma__g_known_mutexes; 119extern cma__t_known_object cma__g_known_threads; 120 121/* 122 * INTERNAL INTERFACES 123 */ 124 125/* Get information while in debugger context */ 126extern void cma__deb_get (cma__t_int_tcb *, 127 cma_t_debug_get, 128 cma_t_address, 129 cma_t_integer,cma_t_integer); 130 131/* Set information while in debugger context */ 132extern void cma__deb_set (cma__t_int_tcb *, cma_t_debug_set, 133 cma_t_address, cma_t_integer); 134 135extern void cma__init_debug (void); 136 137extern void cma__reinit_debug (cma_t_integer); 138 139extern void cma__deb_anytcb_to_tcb (cma_t_tcb_header *, cma__t_int_tcb **); 140 141extern void cma__deb_fac_to_client (cma_t_integer, cma_t_key *); 142 143extern void cma__deb_get_client_info (cma_t_key, cma_t_address *, 144 cma_t_boolean *); 145 146extern void cma__deb_get_context (cma__t_int_tcb *, cma_t_key,cma_t_address *); 147 148extern cma__t_int_tcb *cma__deb_get_self_tcb (void); 149 150extern void cma__deb_get_time_slice (cma_t_interval *); 151 152extern cma__t_int_tcb *cma__deb_next_tcb (cma__t_int_tcb *, 153 cma_t_integer *, 154 cma_t_integer *, 155 cma_t_boolean *); 156 157extern cma_t_boolean cma__deb_set_alert (cma__t_int_tcb *); 158 159extern void cma__deb_set_next_thread (cma__t_int_tcb *); 160 161extern void cma__deb_set_force_dispatch (cma_t_address ); 162 163extern void cma__deb_set_time_slice (cma_t_interval); 164 165extern void cma__deb_show_thread (cma__t_int_tcb *, cma_t_boolean, 166 cma_t_boolean, cma___t_debug_ctx, 167 cma__t_eol_routine, 168 cma__t_eol_routine, cma__t_print_symbol); 169 170extern void 171cma__deb_show_stats (cma__t_int_tcb *, cma_t_boolean, 172 cma_t_boolean, cma__t_eol_routine, 173 cma__t_eol_routine, cma__t_print_symbol); 174#endif 175