* Removed all Id tags.
[cacao.git] / src / native / jvmti / cacaodbg.h
index cf84fecb911d2374695dc614948a8c820d4a649c..75ea36767ce0a301e3e7e249f4cb104dd5999c2f 100644 (file)
@@ -1,4 +1,4 @@
-/* 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,
 
    Authors: Martin Platter
 
-   Changes: 
-
-
-   $Id: cacao.c,v 3.165 2006/01/03 23:44:38 twisti Exp $
+   Changes:
 
 */
 
 
 #include "threads/native/threads.h"
 #include "native/jvmti/jvmti.h"
+#include "native/include/java_lang_String.h"
+#include <ltdl.h>
+
 
-#define MSGQEVENT        1
-#define MSGQPTRACEREQ    2
-#define MSGQPTRACEANS    3
 
 typedef struct {
        jvmtiEvent ev;
@@ -71,36 +68,37 @@ typedef struct {
        jlong jlong;
 } genericEventData;
 
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+
+
+#if defined(ENABLE_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 HEREWEGOBRK           0 /* used for suspend VM on startup            */
-#define SETTHREADOBJECTBRK    1 /* used for EVENT_THREAD_START               */
-#define BEGINUSERBRK          2 /* here is where the first user breakpoint is 
-                                                                  stored                                    */
+/* 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;
-    long orig; /* original memory content */
+    void* addr; /* memory address          */
+       int count;
 };
 
 
@@ -110,39 +108,46 @@ struct brkpts {
        int size;
 };
 
-struct brkpts jvmtibrkpt;
-
-bool jdwp;                  /* debugger via jdwp                              */
-bool jvmti;                 /* jvmti agent                                    */
-bool dbgprocess;            /* ture if debugger else debuggee process         */
-pid_t debuggee;             /* PID of debuggee                                */
-
-char *transport, *agentarg; /* arguments for jdwp transport and agent load    */
-bool suspend;               /* should the virtual machine suspend on startup? */
-
-
-bool cacaodbgfork();
-void cacaodbglisten(char* transport);
-jvmtiEnv* new_jvmtienv();
-void set_jvmti_phase(jvmtiPhase p);
-bool contdebuggee(int signal);
-void stopdebuggee();
-void fireEvent(genericEventData* data);
-bool VMjdwpInit(jvmtiEnv *jvmti_env);
-jvmtiEnv* remotedbgjvmtienv;
-jvmtiEventCallbacks jvmti_jdwp_EventCallbacks;
-void agentload(char* opt_arg);
-void agentunload();
-
-void getchildproc (char **ptr, void* addr, int count);
-void addbrkpt(void* addr, jmethodID method, jlocation location);
-void setsysbrkpt(int sysbrk, void* addr);
-jthread threadobject2jthread(threadobject* thread);
-jvmtiError allthreads (jint * threads_count_ptr, threadobject ** threads_ptr);
-jthread getcurrentthread();
-
-void ipcrm();
 
+typedef struct {
+       int running;
+       bool addbrkpt;
+       void* brkaddr;
+       struct brkpts jvmtibrkpt;
+} cacaodbgcommunication;
+
+cacaodbgcommunication *dbgcom;
+
+bool jvmti;                 /* jvmti agent  */
+
+extern pthread_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
 
 /*