Proper x86_64 mnemonics
[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, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21    02111-1307, USA.
22
23 */
24
25 #ifndef _CACAODBG_H
26 #define _CACAODBG_H
27
28 #include "threads/mutex.h"
29 #include "threads/thread.h"
30 #include "native/jvmti/jvmti.h"
31 #include "native/include/java_lang_String.h"
32 #include <ltdl.h>
33
34
35
36 typedef struct {
37         jvmtiEvent ev;
38         jvmtiEnv *jvmti_env;
39         jthread thread;
40         jmethodID method;
41         jlocation location;
42         jclass klass;
43         jobject object;
44         jfieldID field;
45         char signature_type;
46         jvalue value;
47         jboolean b;
48         void* address;
49         void** new_address_ptr;
50         jmethodID catch_method;
51         jlocation catch_location;
52         char* name;
53         jobject protection_domain;
54         jint jint1;
55         jint jint2;
56         unsigned char* class_data;
57         jint* new_class_data_len;
58         unsigned char** new_class_data;
59         jvmtiAddrLocationMap* map;
60         void* compile_info;
61         jlong jlong;
62 } genericEventData;
63
64
65
66 #if defined(ENABLE_THREADS)
67 struct _jrawMonitorID {
68     java_lang_String *name;
69 };
70
71
72 #endif
73
74
75 /* constants where system breakpoints are stored in the breakpoint table       */
76 #define SETSYSBRKPT             0 /* used for setsysbrkpt calls                */
77 #define CACAODBGSERVERQUIT      1 
78 #define NOTHARDCODEDBRK         2 /* here is where the first not hard coded 
79                                                                      breakpoint is stored                      */
80 #define THREADSTARTBRK          2 
81 #define THREADENDBRK            3 
82 #define CLASSLOADBRK            4
83 #define CLASSPREPARERK          5
84 #define CLASSFILELOADHOOKBRK    6
85 #define COMPILEDMETHODLOADBRK   7
86 #define COMPILEDMETHODUNLOADBRK 8
87 #define BEGINUSERBRK            9 /* here is where the first user breakpoint  
88                                                                      is stored                                 */
89
90 struct _brkpt {
91     jmethodID method;
92     jlocation location;
93     void* addr; /* memory address          */
94         int count;
95 };
96
97
98 struct brkpts {
99         struct _brkpt* brk;
100         int num;
101         int size;
102 };
103
104
105 typedef struct {
106         int running;
107         bool addbrkpt;
108         void* brkaddr;
109         struct brkpts jvmtibrkpt;
110 } cacaodbgcommunication;
111
112 cacaodbgcommunication *dbgcom;
113
114 bool jvmti;                 /* jvmti agent  */
115
116 extern mutex_t dbgcomlock;
117
118 jvmtiEnv* jvmti_new_environment();
119 void jvmti_set_phase(jvmtiPhase p);
120 void jvmti_fireEvent(genericEventData* data);
121 void jvmti_agentload(char* opt_arg, bool agentbypath, 
122                                          lt_dlhandle  *handle, char **libname);
123 void jvmti_agentunload();
124 void jvmti_add_breakpoint(void* addr, jmethodID method, jlocation location);
125 void jvmti_set_system_breakpoint(int sysbrk, bool mode);
126 jvmtiError jvmti_get_all_threads (jint * threads_count_ptr, 
127                                                                   threadobject *** threads_ptr);
128 jthread jvmti_get_current_thread();
129 void jvmti_cacao_debug_init();
130 void jvmti_cacaodbgserver_quit();
131
132 void jvmti_ClassLoadPrepare(bool prepared, classinfo *c);
133 void jvmti_ClassFileLoadHook(utf* name, int class_data_len, 
134                                                          unsigned char* class_data, 
135                                                          java_objectheader* loader, 
136                                                          java_objectheader* protection_domain, 
137                                                          jint* new_class_data_len, 
138                                                          unsigned char** new_class_data);
139 void jvmti_MonitorContendedEntering(bool entered, jobject obj);
140 void jvmti_MonitorWaiting(bool wait, jobject obj, jlong timeout);
141 void jvmti_ThreadStartEnd(jvmtiEvent ev);
142 void jvmti_NativeMethodBind(jmethodID method, void* address, 
143                                                         void** new_address_ptr);
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  */