src/vm/vm.c(usage): added information for jvmti agent for jdwp
[cacao.git] / src / native / jvmti / cacaodbg.h
1 /* src/native/jvmti/cacaodbg.h - contains cacao specifics for debugging support
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Martin Platter
28
29    Changes: 
30
31
32    $Id: cacao.c,v 3.165 2006/01/03 23:44:38 twisti Exp $
33
34 */
35
36 #ifndef _CACAODBG_H
37 #define _CACAODBG_H
38
39 #include "threads/native/threads.h"
40 #include "native/jvmti/jvmti.h"
41 #include "native/include/java_lang_String.h"
42 #include <ltdl.h>
43
44
45
46 typedef struct {
47         jvmtiEvent ev;
48         jvmtiEnv *jvmti_env;
49         jthread thread;
50         jmethodID method;
51         jlocation location;
52         jclass klass;
53         jobject object;
54         jfieldID field;
55         char signature_type;
56         jvalue value;
57         jboolean b;
58         void* address;
59         void** new_address_ptr;
60         jmethodID catch_method;
61         jlocation catch_location;
62         char* name;
63         jobject protection_domain;
64         jint jint1;
65         jint jint2;
66         unsigned char* class_data;
67         jint* new_class_data_len;
68         unsigned char** new_class_data;
69         jvmtiAddrLocationMap* map;
70         void* compile_info;
71         jlong jlong;
72 } genericEventData;
73
74
75
76 #if defined(ENABLE_THREADS)
77 struct _jrawMonitorID {
78     java_lang_String *name;
79 };
80
81
82 #endif
83
84
85 /* constants where system breakpoints are stored in the breakpoint table       */
86 #define SETSYSBRKPT             0 /* used for setsysbrkpt calls                */
87 #define CACAODBGSERVERQUIT      1 
88 #define NOTHARDCODEDBRK         2 /* here is where the first not hard coded 
89                                                                      breakpoint is stored                      */
90 #define THREADSTARTBRK          2 
91 #define THREADENDBRK            3 
92 #define CLASSLOADBRK            4
93 #define CLASSPREPARERK          5
94 #define CLASSFILELOADHOOKBRK    6
95 #define COMPILEDMETHODLOADBRK   7
96 #define COMPILEDMETHODUNLOADBRK 8
97 #define BEGINUSERBRK            9 /* here is where the first user breakpoint  
98                                                                      is stored                                 */
99
100 struct _brkpt {
101     jmethodID method;
102     jlocation location;
103     void* addr; /* memory address          */
104         int count;
105 };
106
107
108 struct brkpts {
109         struct _brkpt* brk;
110         int num;
111         int size;
112 };
113
114
115 typedef struct {
116         int running;
117         bool addbrkpt;
118         void* brkaddr;
119         struct brkpts jvmtibrkpt;
120 } cacaodbgcommunication;
121
122 cacaodbgcommunication *dbgcom;
123
124 bool jvmti;                 /* jvmti agent                                     */
125
126 extern pthread_mutex_t dbgcomlock;
127
128 void setup_jdwp_thread(char* transport);
129 void jvmti_cacao_breakpointhandler();
130 bool jvmti_VMjdwpInit();
131 jvmtiEnv* jvmti_new_environment();
132 void jvmti_set_phase(jvmtiPhase p);
133 void jvmti_fireEvent(genericEventData* data);
134 void jvmti_agentload(char* opt_arg, bool agentbypath, 
135                                          lt_dlhandle  *handle, char **libname);
136 void jvmti_agentunload();
137 void jvmti_add_breakpoint(void* addr, jmethodID method, jlocation location);
138 void jvmti_set_system_breakpoint(int sysbrk, bool mode);
139 jvmtiError jvmti_get_all_threads (jint * threads_count_ptr, 
140                                                                   threadobject *** threads_ptr);
141 jthread jvmti_get_current_thread();
142 void jvmti_cacao_debug_init();
143 void jvmti_cacaodbgserver_quit();
144 #endif
145
146 /*
147  * These are local overrides for various environment variables in Emacs.
148  * Please do not remove this and leave it at the end of the file, where
149  * Emacs will automagically detect them.
150  * ---------------------------------------------------------------------
151  * Local variables:
152  * mode: c
153  * indent-tabs-mode: t
154  * c-basic-offset: 4
155  * tab-width: 4
156  * End:
157  */