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 clients */ 91 } cma__t_debug_state; 92 93 94/* 95 * Routine that will symbolize and address and print it. 96 */ 97typedef void (*cma__t_print_symbol) (cma_t_address); 98 99 100/* 101 * GLOBAL DATA 102 */ 103 104/* 105 * Variable holding the global debugging state 106 * 107 * (This is primarily written by the debugger interface and read 108 * by the thread dispatcher). 109 */ 110extern cma__t_debug_state cma__g_debug_state; 111 112/* 113 * Known object queues 114 */ 115extern cma__t_known_object cma__g_known_atts; 116extern cma__t_known_object cma__g_known_cvs; 117extern cma__t_known_object cma__g_known_mutexes; 118extern cma__t_known_object cma__g_known_threads; 119 120/* 121 * INTERNAL INTERFACES 122 */ 123 124/* Get information while in debugger context */ 125extern void cma__deb_get 126 (cma__t_int_tcb *,cma_t_debug_get,cma_t_address,cma_t_integer,cma_t_integer); 127 128/* Set information while in debugger context */ 129extern void cma__deb_set (cma__t_int_tcb *,cma_t_debug_set,cma_t_address,cma_t_integer); 130 131extern void cma__init_debug (void); 132 133extern void cma__reinit_debug (cma_t_integer); 134 135extern void cma__deb_anytcb_to_tcb (cma_t_tcb_header *,cma__t_int_tcb **); 136 137extern void cma__deb_fac_to_client (cma_t_integer,cma_t_key *); 138 139extern void cma__deb_get_client_info (cma_t_key,cma_t_address *,cma_t_boolean *); 140 141extern void cma__deb_get_context (cma__t_int_tcb *,cma_t_key,cma_t_address *); 142 143extern cma__t_int_tcb *cma__deb_get_self_tcb (void); 144 145extern void cma__deb_get_time_slice (cma_t_interval *); 146 147extern cma__t_int_tcb *cma__deb_next_tcb 148 (cma__t_int_tcb *,cma_t_integer *,cma_t_integer *,cma_t_boolean *); 149 150extern cma_t_boolean cma__deb_set_alert (cma__t_int_tcb *); 151 152extern void cma__deb_set_next_thread (cma__t_int_tcb *); 153 154extern void cma__deb_set_force_dispatch (cma_t_address ); 155 156extern void cma__deb_set_time_slice (cma_t_interval); 157 158extern void cma__deb_show_thread 159 (cma__t_int_tcb *,cma_t_boolean,cma_t_boolean,cma___t_debug_ctx,cma__t_eol_routine, 160 cma__t_eol_routine,cma__t_print_symbol); 161 162extern void 163cma__deb_show_stats (cma__t_int_tcb *,cma_t_boolean,cma_t_boolean,cma__t_eol_routine,cma__t_eol_routine,cma__t_print_symbol); 164#endif 165