* src/vm/hashtable.h,
[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
47 typedef struct {
48         jvmtiEvent ev;
49         jvmtiEnv *jvmti_env;
50         jthread thread;
51         jmethodID method;
52         jlocation location;
53         jclass klass;
54         jobject object;
55         jfieldID field;
56         char signature_type;
57         jvalue value;
58         jboolean b;
59         void* address;
60         void** new_address_ptr;
61         jmethodID catch_method;
62         jlocation catch_location;
63         char* name;
64         jobject protection_domain;
65         jint jint1;
66         jint jint2;
67         unsigned char* class_data;
68         jint* new_class_data_len;
69         unsigned char** new_class_data;
70         jvmtiAddrLocationMap* map;
71         void* compile_info;
72         jlong jlong;
73 } genericEventData;
74
75
76 struct _brkpt {
77     jmethodID method;
78     jlocation location;
79     void* addr; /* memory address          */
80     long orig;  /* original memory content */
81 };
82
83
84 struct brkpts {
85         struct _brkpt* brk;
86         int num;
87         int size;
88 };
89
90
91 typedef struct {
92         int running;
93         void* breakpointhandler;
94         bool setbrkpt;
95         void* brkaddr;
96         long brkorig;
97         struct brkpts jvmtibrkpt;
98 } cacaodbgcommunication;
99
100 cacaodbgcommunication *dbgcom;
101
102 #if defined(ENABLE_THREADS)
103 struct _jrawMonitorID {
104     java_lang_String *name;
105 };
106
107 struct _threadmap {
108         pthread_t tid;
109         threadobject* cacaothreadobj;   
110 };
111
112 struct threadmap {
113         struct _threadmap* map;
114         int num;
115         int size;
116 };
117
118 struct threadmap thmap;
119 #endif
120
121
122 /* constants where system breakpoints are stored in the breakpoint table     */
123 #define SETTHREADOBJECTBRK    0 /* used for EVENT_THREAD_START               */
124 #define BEGINUSERBRK          1 /* here is where the first user breakpoint is 
125                                                                    stored                                    */
126
127
128 bool jdwp;                  /* debugger via jdwp                              */
129 bool jvmti;                 /* jvmti agent                                    */
130
131 char *transport, *agentarg; /* arguments for jdwp transport and agent load    */
132 bool suspend;               /* should the virtual machine suspend on startup? */
133
134 extern pthread_mutex_t dbgcomlock;
135
136 void setup_jdwp_thread(char* transport);
137 void cacaobreakpointhandler();
138 jvmtiEnv* new_jvmtienv();
139 void set_jvmti_phase(jvmtiPhase p);
140 void fireEvent(genericEventData* data);
141 bool VMjdwpInit();
142 void agentload(char* opt_arg, bool agentbypath, lt_dlhandle  *handle, char **libname);
143 void agentunload();
144 void addbrkpt(void* addr, jmethodID method, jlocation location);
145 void setsysbrkpt(int sysbrk, void* addr);
146 jvmtiError allthreads (jint * threads_count_ptr, threadobject *** threads_ptr);
147 jthread getcurrentthread();
148
149 #endif
150
151 /*
152  * These are local overrides for various environment variables in Emacs.
153  * Please do not remove this and leave it at the end of the file, where
154  * Emacs will automagically detect them.
155  * ---------------------------------------------------------------------
156  * Local variables:
157  * mode: c
158  * indent-tabs-mode: t
159  * c-basic-offset: 4
160  * tab-width: 4
161  * End:
162  */