CACAO
cacaodbg.h
Go to the documentation of this file.
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.hpp"
30 #include "native/jvmti/jvmti.h"
31 #include "native/include/java_lang_String.h"
32 #include <ltdl.h>
33 
34 
35 
36 typedef struct {
40  jmethodID method;
44  jfieldID field;
46  jvalue value;
47  jboolean b;
48  void* address;
50  jmethodID catch_method;
52  char* name;
54  jint jint1;
55  jint jint2;
56  unsigned char* class_data;
58  unsigned char** new_class_data;
60  void* compile_info;
61  jlong jlong;
63 
64 
65 
66 #if defined(ENABLE_THREADS)
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;
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;
111 
113 
114 bool jvmti; /* jvmti agent */
115 
116 extern mutex_t dbgcomlock;
117 
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);
131 
132 void jvmti_ClassLoadPrepare(bool prepared, classinfo *c);
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);
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  */
mutex_t dbgcomlock
Definition: jvmti.c:79
char signature_type
Definition: cacaodbg.h:45
jboolean b
Definition: cacaodbg.h:47
char * opt_arg
Definition: options.cpp:47
void jvmti_add_breakpoint(void *addr, jmethodID method, jlocation location)
Definition: cacaodbg.c:180
jobject object
Definition: cacaodbg.h:43
JNIEnv jclass jobject const char jobject protection_domain
Definition: jvmti.h:312
jfieldID field
Definition: cacaodbg.h:44
struct _brkpt * brk
Definition: cacaodbg.h:99
java_lang_String * name
Definition: cacaodbg.h:68
void jvmti_cacaodbgserver_quit()
Definition: cacaodbg.c:211
int size
Definition: cacaodbg.h:101
void jvmti_ThreadStartEnd(jvmtiEvent ev)
Definition: cacaodbg.c:407
void jvmti_set_phase(jvmtiPhase p)
Definition: jvmti.c:4386
void jvmti_ClassLoadPrepare(bool prepared, classinfo *c)
Definition: cacaodbg.c:347
JNIEnv jthread jmethodID void void ** new_address_ptr
Definition: jvmti.h:264
bool jvmti
Definition: cacaodbg.h:114
jlocation catch_location
Definition: cacaodbg.h:51
void jvmti_ClassFileLoadHook(utf *name, int class_data_len, unsigned char *class_data, java_objectheader *loader, java_objectheader *protection_domain, jint *new_class_data_len, unsigned char **new_class_data)
Definition: cacaodbg.c:317
jvmtiEnv * jvmti_env
Definition: cacaodbg.h:38
jclass klass
Definition: cacaodbg.h:42
unsigned char * class_data
Definition: cacaodbg.h:56
jvmtiAddrLocationMap * map
Definition: cacaodbg.h:59
void * address
Definition: cacaodbg.h:48
jmethodID method
Definition: cacaodbg.h:91
JNIEnv jclass jobject const char * name
Definition: jvmti.h:312
JNIEnv jthread jobject jlong timeout
Definition: jvmti.h:373
void ** new_address_ptr
Definition: cacaodbg.h:49
jthread jvmti_get_current_thread()
Definition: cacaodbg.c:95
void jvmti_MonitorContendedEntering(bool entered, jobject obj)
Definition: cacaodbg.c:366
JNIEnv jclass jobject const char jobject jint class_data_len
Definition: jvmti.h:312
jmethodID catch_method
Definition: cacaodbg.h:50
jvmtiEnv * jvmti_new_environment()
Definition: jvmti.c:4429
jvmtiError
Definition: jvmti.h:49
void jvmti_fireEvent(genericEventData *data)
Definition: jvmti.c:402
void jvmti_cacao_debug_init()
Definition: cacaodbg.c:272
JNIEnv jthread jmethodID method
Definition: jvmti.h:207
jlocation location
Definition: cacaodbg.h:41
int count
Definition: cacaodbg.h:94
jvmtiError jvmti_get_all_threads(jint *threads_count_ptr, threadobject ***threads_ptr)
Definition: cacaodbg.c:52
JNIEnv jthread jmethodID void * address
Definition: jvmti.h:264
JNIEnv jclass jobject loader
Definition: jvmti.h:312
JNIEnv jclass jobject const char jobject jint const unsigned char jint unsigned char ** new_class_data
Definition: jvmti.h:312
void jvmti_NativeMethodBind(jmethodID method, void *address, void **new_address_ptr)
Definition: cacaodbg.c:420
void jvmti_agentunload()
Definition: jvmti.c:4533
void * addr
Definition: cacaodbg.h:93
jlong jlocation
Definition: jvmti.h:44
GNU Classpath java/lang/String.
jvmtiEvent
Definition: jvmti.h:635
jint * new_class_data_len
Definition: cacaodbg.h:57
int num
Definition: cacaodbg.h:100
jvmtiPhase
Definition: jvmti.h:156
unsigned char ** new_class_data
Definition: cacaodbg.h:58
jvmtiEvent ev
Definition: cacaodbg.h:37
void jvmti_set_system_breakpoint(int sysbrk, bool mode)
Definition: cacaodbg.c:134
jlocation location
Definition: cacaodbg.h:92
JNIEnv jclass jobject const char jobject jint const unsigned char jint * new_class_data_len
Definition: jvmti.h:312
void jvmti_agentload(char *opt_arg, bool agentbypath, lt_dlhandle *handle, char **libname)
Definition: jvmti.c:4465
JNIEnv jthread jmethodID jlocation location
Definition: jvmti.h:207
JNIEnv jclass jobject const char jobject jint const unsigned char * class_data
Definition: jvmti.h:312
jvalue value
Definition: cacaodbg.h:46
void jvmti_MonitorWaiting(bool wait, jobject obj, jlong timeout)
Definition: cacaodbg.c:385
void * compile_info
Definition: cacaodbg.h:60
cacaodbgcommunication * dbgcom
Definition: cacaodbg.h:112
jobject protection_domain
Definition: cacaodbg.h:53
jmethodID method
Definition: cacaodbg.h:40
jthread thread
Definition: cacaodbg.h:39