Changes: Edwin Steiner
Samuel Vinson
- $Id: cacao.c,v 3.165 2006/01/03 23:44:38 twisti Exp $
*/
}
-/* setup_jdwp_thread *****************************************************
-
- Helper function to start JDWP threads
-
-*******************************************************************************/
-
-void setup_jdwp_thread(char* transport) {
- java_objectheader *o;
- methodinfo *m;
- java_lang_String *s;
- classinfo *class;
-
- /* new gnu.classpath.jdwp.Jdwp() */
- class = load_class_from_sysloader(
- utf_new_char("gnu.classpath.jdwp.Jdwp"));
- if (!class)
- throw_main_exception_exit();
-
- o = builtin_new(class);
-
- if (!o)
- throw_main_exception_exit();
-
- m = class_resolveclassmethod(class,
- utf_init,
- NULL,
- class_java_lang_Object,
- true);
- if (!m)
- throw_main_exception_exit();
-
- vm_call_method(m,o);
-
- /* configure(transport,NULL) */
- m = class_resolveclassmethod(
- class, utf_new_char("configure"),
- utf_new_char("(Ljava/lang/String;)V"),
- class_java_lang_Object,
- false);
-
- s = javastring_new_from_ascii(&transport[1]);
-
- vm_call_method(m,o,s);
-
- if (!m)
- throw_main_exception_exit();
-
-
- /* _doInitialization */
- m = class_resolveclassmethod(class,
- utf_new_char("_doInitialization"),
- utf_new_char("()V"),
- class,
- false);
-
- if (!m)
- throw_main_exception_exit();
-
- vm_call_method(m,o);
-}
/* jvmti_cacaodbgserver_quit **************************************************
void jvmti_cacao_debug_init() {
pid_t dbgserver;
- void* addr[2];
/* start new cacaodbgserver if needed*/
pthread_mutex_lock(&dbgcomlock);
if (dbgcom == NULL) {
dbgcom = heap_allocate(sizeof(cacaodbgcommunication),true,NULL);
dbgcom->running = 1;
+ jvmti = true;
breakpointtable_creator();
/* set addresses of hard coded TRAPs */
__asm__ ("movl $cacaodbgserver_quit,%0;"
:"=m"(dbgcom->jvmtibrkpt.brk[CACAODBGSERVERQUIT].addr));
- jvmti_get_threads_breakpoints(addr);
- dbgcom->jvmtibrkpt.brk[THREADSTARTBRK].addr = addr[0];
- dbgcom->jvmtibrkpt.brk[THREADENDBRK].addr = addr[1];
-
dbgserver = fork();
if (dbgserver == (-1)) {
log_text("cacaodbgserver fork error");
}
+/* jvmti_ClassFileLoadHook ****************************************************
+
+ prepares firing a new Class File Load Hook event
+
+*******************************************************************************/
+
+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) {
+ genericEventData d;
+
+ d.ev = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK;
+ d.klass = NULL; /* class is not redefined */
+ d.object = loader;
+ d.name = (char*)MNEW(char,(utf_bytes(name)+1));
+ utf_sprint_convert_to_latin1(d.name, name);
+ d.protection_domain = protection_domain;
+ d.class_data = class_data;
+ d.jint1 = class_data_len;
+ d.new_class_data_len = new_class_data_len;
+ d.new_class_data = new_class_data;
+
+ jvmti_fireEvent(&d);
+ MFREE(d.name,char,utf_bytes(name)+1);
+}
+
+
+/* jvmti_ClassFileLoadHook ****************************************************
+
+ prepares firing a new Class Prepare or Load event
+
+*******************************************************************************/
+
+void jvmti_ClassLoadPrepare(bool prepared, classinfo *c) {
+ genericEventData d;
+
+ if (prepared)
+ d.ev = JVMTI_EVENT_CLASS_PREPARE;
+ else
+ d.ev = JVMTI_EVENT_CLASS_LOAD;
+
+ d.klass = c;
+ jvmti_fireEvent(&d);
+}
+
+
+/* jvmti_MonitorContendedEntering *********************************************
+
+ prepares firing a new Monitor Contended Enter or Entered event
+
+*******************************************************************************/
+
+void jvmti_MonitorContendedEntering(bool entered, jobject obj) {
+ genericEventData d;
+
+ if (entered)
+ d.ev = JVMTI_EVENT_MONITOR_CONTENDED_ENTERED;
+ else
+ d.ev = JVMTI_EVENT_MONITOR_CONTENDED_ENTER;
+
+ d.object = obj;
+
+ jvmti_fireEvent(&d);
+}
+
+/* jvmti_MonitorWaiting ******************************************************
+
+ prepares firing a new Monitor Wait or Waited event
+
+*******************************************************************************/
+
+void jvmti_MonitorWaiting(bool wait, jobject obj, jlong timeout) {
+ genericEventData d;
+
+ if (wait) {
+ d.ev = JVMTI_EVENT_MONITOR_WAIT;
+ d.jlong = timeout;
+ } else {
+ d.ev = JVMTI_EVENT_MONITOR_WAITED;
+ d.b = timeout != 0;
+ }
+
+ d.object = obj;
+
+ jvmti_fireEvent(&d);
+}
+
+/* jvmti_ThreadStartEnd ********************************************************
+
+ prepares firing a new Thread Start or End event
+
+*******************************************************************************/
+
+void jvmti_ThreadStartEnd(jvmtiEvent ev) {
+ genericEventData d;
+
+ d.ev = ev;
+ jvmti_fireEvent(&d);
+}
+
+/* jvmti_NativeMethodBind *****************************************************
+
+ prepares firing a new Native Method Bind event
+
+*******************************************************************************/
+
+void jvmti_NativeMethodBind(jmethodID method, void* address,
+ void** new_address_ptr) {
+ genericEventData d;
+
+ d.ev = JVMTI_EVENT_NATIVE_METHOD_BIND;
+ d.method = method;
+ d.address = address;
+ d.new_address_ptr = new_address_ptr;
+
+ jvmti_fireEvent(&d);
+}
+
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where