6f646ac99a646f446affada7476e69ef72d9883d
[cacao.git] / src / native / jvmti / VMjdwp.c
1 /* src/native/vm/VMjdwp.c - jvmti->jdwp interface
2
3    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    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    Author: Martin Platter
28
29    Changes:             
30
31
32    $Id: VMjdwp.c 3588 2005-11-06 14:01:10Z motse $
33
34 */
35
36 #include "jvmti.h"
37 #include "vm/loader.h"
38 #include "vm/exceptions.h"
39 #include "vm/jit/asmpart.h"
40
41 static jmethodID notifymid = NULL;
42 static jclass Jdwpclass = NULL;
43
44 void notify (jobject event){
45         methodinfo *m;
46     if (notifymid == NULL) {
47         Jdwpclass = 
48             load_class_from_sysloader(utf_new_char("gnu.classpath.jdwp.Jdwp"));
49         if (!Jdwpclass)
50             throw_main_exception_exit();
51         
52         notifymid = class_resolveclassmethod(
53             Jdwpclass,
54             utf_new_char("notify"), 
55             utf_new_char("(Lgnu.classpath.jdwp.event.Event;)V"),
56             class_java_lang_Object,
57             true);
58
59         if (!notifymid)
60             throw_main_exception_exit();
61     }
62     
63     asm_calljavafunction(m, Jdwpclass, event, NULL, NULL);
64 }
65
66
67 static void SingleStep (jvmtiEnv *jvmti_env,
68                         JNIEnv* jni_env,
69                         jthread thread,
70                         jmethodID method,
71                         jlocation location) {
72   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
73 }
74
75 static void Breakpoint (jvmtiEnv *jvmti_env,
76                         JNIEnv* jni_env,
77                         jthread thread,
78                         jmethodID method,
79                         jlocation location) {
80   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
81 }
82
83 static void FieldAccess    (jvmtiEnv *jvmti_env,
84                             JNIEnv* jni_env,
85                             jthread thread,
86                             jmethodID method,
87                             jlocation location,
88                             jclass field_klass,
89                             jobject object,
90                             jfieldID field)
91 {
92   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
93 }
94
95 static void FieldModification (jvmtiEnv *jvmti_env,
96                                JNIEnv* jni_env,
97                                jthread thread,
98                                jmethodID method,
99                                jlocation location,
100                                jclass field_klass,
101                                jobject object,
102                                jfieldID field,
103                                char signature_type,
104                                jvalue new_value) {
105   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
106 }
107
108 static void FramePop (jvmtiEnv *jvmti_env,
109                       JNIEnv* jni_env,
110                       jthread thread,
111                       jmethodID method,
112                       jboolean was_popped_by_exception){
113   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
114 }
115
116 static void MethodEntry (jvmtiEnv *jvmti_env,
117                          JNIEnv* jni_env,
118                          jthread thread,
119                          jmethodID method){
120   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
121 }
122
123 static void MethodExit (jvmtiEnv *jvmti_env,
124                         JNIEnv* jni_env,
125                         jthread thread,
126                         jmethodID method,
127                         jboolean was_popped_by_exception,
128                         jvalue return_value){
129   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
130 }
131
132 static void NativeMethodBind (jvmtiEnv *jvmti_env,
133                               JNIEnv* jni_env,
134                               jthread thread,
135                               jmethodID method,
136                               void* address,
137                               void** new_address_ptr){
138   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
139 }
140
141 static void Exception (jvmtiEnv *jvmti_env,
142                        JNIEnv* jni_env,
143                        jthread thread,
144                        jmethodID method,
145                        jlocation location,
146                        jobject exception,
147                        jmethodID catch_method,
148                        jlocation catch_location){
149   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
150 }
151
152 static void ExceptionCatch (jvmtiEnv *jvmti_env,
153                             JNIEnv* jni_env,
154                             jthread thread,
155                             jmethodID method,
156                             jlocation location,
157                             jobject exception){
158   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
159 }
160
161 static void ThreadStart (jvmtiEnv *jvmti_env,
162                          JNIEnv* jni_env,
163                          jthread thread){
164   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
165 }
166
167 static void ThreadEnd (jvmtiEnv *jvmti_env,
168                        JNIEnv* jni_env,
169                        jthread thread){
170   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
171 }
172
173 static void ClassLoad (jvmtiEnv *jvmti_env,
174                        JNIEnv* jni_env,
175                        jthread thread,
176                        jclass klass){
177   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
178 }
179
180 static void ClassPrepare (jvmtiEnv *jvmti_env,
181                           JNIEnv* jni_env,
182                           jthread thread,
183                           jclass klass){
184   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
185 }
186
187 static void ClassFileLoadHook (jvmtiEnv *jvmti_env,
188                                JNIEnv* jni_env,
189                                jclass class_being_redefined,
190                                jobject loader,
191                                const char* name,
192                                jobject protection_domain,
193                                jint class_data_len,
194                                const unsigned char* class_data,
195                                jint* new_class_data_len,
196                                unsigned char** new_class_data){
197   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
198 }
199
200 static void VMStart (jvmtiEnv *jvmti_env,
201                      JNIEnv* jni_env) {
202   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
203 }
204
205 static void VMInit (jvmtiEnv *jvmti_env, 
206                     JNIEnv* jni_env,
207                     jthread thread) {
208   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
209 }
210
211 static void VMDeath (jvmtiEnv *jvmti_env,
212                      JNIEnv* jni_env) {
213   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
214 }
215
216
217 static void CompiledMethodLoad    (jvmtiEnv *jvmti_env,
218                                    jmethodID method,
219                                    jint code_size,
220                                    const void* code_addr,
221                                    jint map_length,
222                                    const jvmtiAddrLocationMap* map,
223                                    const void* compile_info) {
224   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
225 }
226
227 static void CompiledMethodUnload (jvmtiEnv *jvmti_env,
228                                   jmethodID method,
229                                   const void* code_addr){
230   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
231 }
232
233 static void DynamicCodeGenerated (jvmtiEnv *jvmti_env,
234                                   const char* name,
235                                   const void* address,
236                                   jint length){
237   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
238 }
239
240 static void DataDumpRequest (jvmtiEnv *jvmti_env){
241   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
242 }
243
244 static void MonitorContendedEnter (jvmtiEnv *jvmti_env,
245                                    JNIEnv* jni_env,
246                                    jthread thread,
247                                    jobject object){
248   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
249 }
250
251 static void MonitorContendedEntered (jvmtiEnv *jvmti_env,
252                                      JNIEnv* jni_env,
253                                      jthread thread,
254                                      jobject object){
255   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
256 }
257
258 static void MonitorWait (jvmtiEnv *jvmti_env,
259                          JNIEnv* jni_env,
260                          jthread thread,
261                          jobject object,
262                          jlong timeout){
263   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
264 }
265
266 static void MonitorWaited (jvmtiEnv *jvmti_env,
267                            JNIEnv* jni_env,
268                            jthread thread,
269                            jobject object,
270                            jboolean timed_out){
271   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
272 }
273
274 static void VMObjectAlloc (jvmtiEnv *jvmti_env,
275                            JNIEnv* jni_env,
276                            jthread thread,
277                            jobject object,
278                            jclass object_klass,
279                            jlong size){
280   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
281 }
282
283 static void ObjectFree (jvmtiEnv *jvmti_env,
284                         jlong tag){
285   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
286 }
287
288 static void GarbageCollectionStart (jvmtiEnv *jvmti_env){
289   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
290 }
291
292 static void GarbageCollectionFinish (jvmtiEnv *jvmti_env){
293   log_text ("JVMTI-Event: IMPLEMENT ME!!!");
294 }
295
296
297 jvmtiEventCallbacks jvmti_jdwp_EventCallbacks = {
298     &VMInit,
299     &VMDeath,
300     &ThreadStart,
301     &ThreadEnd,
302     &ClassFileLoadHook,
303     &ClassLoad,
304     &ClassPrepare,
305     &VMStart,
306     &Exception,
307     &ExceptionCatch,
308     &SingleStep,
309     &FramePop,
310     &Breakpoint,
311     &FieldAccess,
312     &FieldModification,
313     &MethodEntry,
314     &MethodExit,
315     &NativeMethodBind,
316     &CompiledMethodLoad,
317     &CompiledMethodUnload,
318     &DynamicCodeGenerated,
319     &DataDumpRequest,
320     NULL,
321     &MonitorWait,
322     &MonitorWaited,
323     &MonitorContendedEnter,
324     &MonitorContendedEntered,
325     NULL,
326     NULL,
327     NULL,
328     NULL,
329     &GarbageCollectionStart,
330     &GarbageCollectionFinish,
331     &ObjectFree,
332     &VMObjectAlloc,
333 };
334
335
336 /*
337  * These are local overrides for various environment variables in Emacs.
338  * Please do not remove this and leave it at the end of the file, where
339  * Emacs will automagically detect them.
340  * ---------------------------------------------------------------------
341  * Local variables:
342  * mode: c
343  * indent-tabs-mode: t
344  * c-basic-offset: 4
345  * tab-width: 4
346  * End:
347  */