Merge to subtype-trunk (manually: src/vm/linker.hpp, src/vm/vftbl.hpp)
[cacao.git] / src / native / jvmti / cacaodbg.h
index b5d1deb5e9eccd6fabb3f7dcdd28ad63519afe3b..04abbd85c2a04d45fef38bc426c7a8557e85d100 100644 (file)
@@ -1,9 +1,7 @@
-/* src/native/jvmti/cacaodbg.h - contains cacao specifics for debugging support                                  
+/* src/native/jvmti/cacaodbg.h - contains cacao specifics for debugging support
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
-
-   Authors: Martin Platter
-
-   Changes: 
-
-
-   $Id: cacao.c,v 3.165 2006/01/03 23:44:38 twisti Exp $
-
 */
 
 #ifndef _CACAODBG_H
 #define _CACAODBG_H
 
-#include "threads/native/threads.h"
+#include "threads/mutex.h"
+#include "threads/thread.hpp"
 #include "native/jvmti/jvmti.h"
 #include "native/include/java_lang_String.h"
 #include <ltdl.h>
 
 
 
-
 typedef struct {
        jvmtiEvent ev;
        jvmtiEnv *jvmti_env;
@@ -73,11 +62,36 @@ typedef struct {
 } genericEventData;
 
 
+
+#if defined(ENABLE_THREADS)
+struct _jrawMonitorID {
+    java_lang_String *name;
+};
+
+
+#endif
+
+
+/* constants where system breakpoints are stored in the breakpoint table       */
+#define SETSYSBRKPT             0 /* used for setsysbrkpt calls                */
+#define CACAODBGSERVERQUIT      1 
+#define NOTHARDCODEDBRK         2 /* here is where the first not hard coded 
+                                                                    breakpoint is stored                      */
+#define THREADSTARTBRK          2 
+#define THREADENDBRK            3 
+#define CLASSLOADBRK            4
+#define CLASSPREPARERK          5
+#define CLASSFILELOADHOOKBRK    6
+#define COMPILEDMETHODLOADBRK   7
+#define COMPILEDMETHODUNLOADBRK 8
+#define BEGINUSERBRK            9 /* here is where the first user breakpoint  
+                                                                    is stored                                 */
+
 struct _brkpt {
     jmethodID method;
     jlocation location;
     void* addr; /* memory address          */
-    long orig;  /* original memory content */
+       int count;
 };
 
 
@@ -90,62 +104,43 @@ struct brkpts {
 
 typedef struct {
        int running;
-       void* breakpointhandler;
-       bool setbrkpt;
+       bool addbrkpt;
        void* brkaddr;
-       long brkorig;
        struct brkpts jvmtibrkpt;
 } cacaodbgcommunication;
 
 cacaodbgcommunication *dbgcom;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
-struct _jrawMonitorID {
-    java_lang_String *name;
-};
-
-struct _threadmap {
-       pthread_t tid;
-       threadobject* cacaothreadobj;   
-};
-
-struct threadmap {
-       struct _threadmap* map;
-       int num;
-       int size;
-};
-
-struct threadmap thmap;
-#endif
-
-
-/* constants where system breakpoints are stored in the breakpoint table     */
-#define SETTHREADOBJECTBRK    0 /* used for EVENT_THREAD_START               */
-#define BEGINUSERBRK          1 /* here is where the first user breakpoint is 
-                                                                  stored                                    */
-
-
-bool jdwp;                  /* debugger via jdwp                              */
-bool jvmti;                 /* jvmti agent                                    */
-
-char *transport, *agentarg; /* arguments for jdwp transport and agent load    */
-bool suspend;               /* should the virtual machine suspend on startup? */
-
-extern pthread_mutex_t dbgcomlock;
-
-void setup_jdwp_thread(char* transport);
-void cacaobreakpointhandler();
-jvmtiEnv* new_jvmtienv();
-void set_jvmti_phase(jvmtiPhase p);
-void fireEvent(genericEventData* data);
-bool VMjdwpInit();
-void agentload(char* opt_arg, bool agentbypath, lt_dlhandle  *handle, char **libname);
-void agentunload();
-void addbrkpt(void* addr, jmethodID method, jlocation location);
-void setsysbrkpt(int sysbrk, void* addr);
-jvmtiError allthreads (jint * threads_count_ptr, threadobject *** threads_ptr);
-jthread getcurrentthread();
-
+bool jvmti;                 /* jvmti agent  */
+
+extern mutex_t dbgcomlock;
+
+jvmtiEnv* jvmti_new_environment();
+void jvmti_set_phase(jvmtiPhase p);
+void jvmti_fireEvent(genericEventData* data);
+void jvmti_agentload(char* opt_arg, bool agentbypath, 
+                                        lt_dlhandle  *handle, char **libname);
+void jvmti_agentunload();
+void jvmti_add_breakpoint(void* addr, jmethodID method, jlocation location);
+void jvmti_set_system_breakpoint(int sysbrk, bool mode);
+jvmtiError jvmti_get_all_threads (jint * threads_count_ptr, 
+                                                                 threadobject *** threads_ptr);
+jthread jvmti_get_current_thread();
+void jvmti_cacao_debug_init();
+void jvmti_cacaodbgserver_quit();
+
+void jvmti_ClassLoadPrepare(bool prepared, classinfo *c);
+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);
+void jvmti_MonitorContendedEntering(bool entered, jobject obj);
+void jvmti_MonitorWaiting(bool wait, jobject obj, jlong timeout);
+void jvmti_ThreadStartEnd(jvmtiEvent ev);
+void jvmti_NativeMethodBind(jmethodID method, void* address, 
+                                                       void** new_address_ptr);
 #endif
 
 /*