harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r597138 [11/15] - in /harmony/enhanced/drlvm/trunk: build/make/ build/make/components/vm/ vm/include/ vm/include/open/ vm/jitrino/src/codegenerator/ia32/ vm/port/src/encoder/ia32_em64t/ vm/port/src/lil/ia32/pim/ vm/tests/ncai/ vm/tests/ncai...
Date Wed, 21 Nov 2007 16:29:54 GMT
Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,1082 @@
+/**
+ * @author Valentin Al. Sitnick
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+#include "utils.h"
+
+typedef struct
+{
+    jvmtiError  code;
+    const char* text;
+
+} jvmti_error_text;
+
+static jvmti_error_text jvmti_errors[] =
+{
+    {JVMTI_ERROR_NONE, "JVMTI_ERROR_NONE"},
+    {JVMTI_ERROR_NULL_POINTER, "JVMTI_ERROR_NULL_POINTER"},
+    {JVMTI_ERROR_OUT_OF_MEMORY, "JVMTI_ERROR_OUT_OF_MEMORY"},
+    {JVMTI_ERROR_ACCESS_DENIED, "JVMTI_ERROR_ACCESS_DENIED"},
+    {JVMTI_ERROR_UNATTACHED_THREAD, "JVMTI_ERROR_UNATTACHED_THREAD"},
+    {JVMTI_ERROR_INVALID_ENVIRONMENT, "JVMTI_ERROR_INVALID_ENVIRONMENT"},
+    {JVMTI_ERROR_WRONG_PHASE, "JVMTI_ERROR_WRONG_PHASE"},
+    {JVMTI_ERROR_INTERNAL, "JVMTI_ERROR_INTERNAL"},
+    {JVMTI_ERROR_NOT_AVAILABLE, "JVMTI_ERROR_NOT_AVAILABLE"},
+    {JVMTI_ERROR_MUST_POSSESS_CAPABILITY, "JVMTI_ERROR_MUST_POSSESS_CAPABILITY"},
+};
+
+const char* get_jvmti_eror_text(jvmtiError code)
+{
+    for (unsigned int i = 0; i < sizeof(jvmti_errors) / sizeof(jvmti_errors[0]); i++)
+    {
+        if (jvmti_errors[i].code == code)
+            return jvmti_errors[i].text;
+    }
+
+    return "Unknown jvmti error";
+}
+
+/* *********************************************************************** */
+
+/*
+ * Function for outputting names of current states of thread as a string.
+ */
+void thread_state_output_as_string(long state)
+{
+    bool pipe = false;
+    if (state & JVMTI_THREAD_STATE_ALIVE )
+    {
+        fprintf(stderr, " _ALIVE ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_TERMINATED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _TERMINATED ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_RUNNABLE )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _RUNNABLE ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _BLOCKED_ON_MONITOR_ENTER ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_WAITING )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _WAITING ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_WAITING_INDEFINITELY )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _WAITING_INDEFINITELY ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _WAITING_WITH_TIMEOUT ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_SLEEPING )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _SLEEPING ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _IN_OBJECT_WAIT ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_PARKED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _PARKED ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_SUSPENDED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _SUSPENDED ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_INTERRUPTED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _INTERRUPTED ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_IN_NATIVE )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _IN_NATIVE ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_VENDOR_1 )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _VENDOR_1 ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_VENDOR_2 )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _VENDOR_2 ");
+        pipe = true;
+    }
+
+    if (state & JVMTI_THREAD_STATE_VENDOR_3 )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _VENDOR_3 ");
+        pipe = true;
+    }
+    return;
+}
+
+/*
+ * Function for outputting names of current statuses of class as a string.
+ */
+void class_status_output_as_string(long status)
+{
+    bool pipe = false;
+    if ( status & JVMTI_CLASS_STATUS_VERIFIED )
+    {
+        fprintf(stderr, " _VERIFIED ");
+        pipe = true;
+    }
+
+    if ( status & JVMTI_CLASS_STATUS_PREPARED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _PREPARED ");
+        pipe = true;
+    }
+
+    if ( status & JVMTI_CLASS_STATUS_INITIALIZED )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _INITIALIZED ");
+        pipe = true;
+    }
+
+    if ( status & JVMTI_CLASS_STATUS_ERROR )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _ERROR ");
+        pipe = true;
+    }
+
+    if ( status & JVMTI_CLASS_STATUS_ARRAY )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _ARRAY ");
+        pipe = true;
+    }
+
+    if ( status & JVMTI_CLASS_STATUS_PRIMITIVE )
+    {
+        if (pipe) fprintf(stderr, "|");
+        fprintf(stderr, " _PRIMITIVE ");
+        pipe = true;
+    }
+
+    return;
+}
+
+/*
+ * Function for comparing of 2 capabilities structure and output result
+ * of this operation.
+ */
+int cmp_caps_and_output_results(jvmtiCapabilities c1,
+        jvmtiCapabilities c2, const char* name1, const char* name2)
+{
+    int diff = 0;
+
+    if (c1.can_tag_objects
+            != c2.can_tag_objects)
+    {
+        fprintf(stderr, "\t\tDIFF: can_tag_objects %d in %s  and %d in %s\n",
+                c1.can_tag_objects, name1, c2.can_tag_objects, name2);
+        diff++;
+    }
+    if (c1.can_generate_field_modification_events
+            != c2.can_generate_field_modification_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_field_modification_events %d in %s  and %d in %s\n",
+                c1.can_generate_field_modification_events, name1, c2.can_generate_field_modification_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_field_access_events
+            != c2.can_generate_field_access_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_field_access_events %d in %s  and %d in %s\n",
+                c1.can_generate_field_access_events, name1, c2.can_generate_field_access_events, name2);
+        diff++;
+    }
+    if (c1.can_get_bytecodes
+            != c2.can_get_bytecodes)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_bytecodes %d in %s  and %d in %s\n",
+                c1.can_get_bytecodes, name1, c2.can_get_bytecodes, name2);
+        diff++;
+    }
+    if (c1.can_get_synthetic_attribute
+            != c2.can_get_synthetic_attribute)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_synthetic_attribute in %d in %s  and %d in %s\n",
+                c1.can_get_synthetic_attribute, name1, c2.can_get_synthetic_attribute, name2);
+        diff++;
+    }
+    if (c1.can_get_owned_monitor_info
+            != c2.can_get_owned_monitor_info)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_owned_monitor_info in %d in %s  and %d in %s\n",
+                c1.can_get_owned_monitor_info, name1, c2.can_get_owned_monitor_info, name2);
+        diff++;
+    }
+    if (c1.can_get_current_contended_monitor
+            != c2.can_get_current_contended_monitor)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_current_contended_monitor %d in %s  and %d in %s\n",
+                c1.can_get_current_contended_monitor, name1, c2.can_get_current_contended_monitor, name2);
+        diff++;
+    }
+    if (c1.can_get_monitor_info
+            != c2.can_get_monitor_info)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_monitor_info %d in %s  and %d in %s\n",
+                c1.can_get_monitor_info, name1, c2.can_get_monitor_info, name2);
+        diff++;
+    }
+    if (c1.can_pop_frame
+            != c2.can_pop_frame)
+    {
+        fprintf(stderr, "\t\tDIFF: can_pop_frame %d in %s  and %d in %s\n",
+                c1.can_pop_frame, name1, c2.can_pop_frame, name2);
+        diff++;
+    }
+    if (c1.can_redefine_classes
+            != c2.can_redefine_classes)
+    {
+        fprintf(stderr, "\t\tDIFF: can_redefine_classes %d in %s  and %d in %s\n",
+                c1.can_redefine_classes, name1, c2.can_redefine_classes, name2);
+        diff++;
+    }
+    if (c1.can_signal_thread
+            != c2.can_signal_thread)
+    {
+        fprintf(stderr, "\t\tDIFF: can_signal_thread %d in %s  and %d in %s\n",
+                c1.can_signal_thread, name1, c2.can_signal_thread, name2);
+        diff++;
+    }
+    if (c1.can_get_source_file_name
+            != c2.can_get_source_file_name)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_source_file_name %d in %s  and %d in %s\n",
+                c1.can_get_source_file_name, name1, c2.can_get_source_file_name, name2);
+        diff++;
+    }
+    if (c1.can_get_line_numbers
+            != c2.can_get_line_numbers)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_line_numbers %d in %s  and %d in %s\n",
+                c1.can_get_line_numbers, name1, c2.can_get_line_numbers, name2);
+        diff++;
+    }
+    if (c1.can_get_source_debug_extension
+            != c2.can_get_source_debug_extension)
+    {
+        fprintf(stderr, "\t\tDIFF: can_get_source_debug_extension %d in %s  and %d in %s\n",
+                c1.can_get_source_debug_extension, name1, c2.can_get_source_debug_extension, name2);
+        diff++;
+    }
+    if (c1.can_access_local_variables
+            != c2.can_access_local_variables)
+    {
+        fprintf(stderr, "\t\tDIFF: can_access_local_variables %d in %s  and %d in %s\n",
+                c1.can_access_local_variables, name1, c2.can_access_local_variables, name2);
+        diff++;
+    }
+    if (c1.can_maintain_original_method_order
+            != c2.can_maintain_original_method_order)
+    {
+        fprintf(stderr, "\t\tDIFF: can_maintain_original_method_order %d in %s  and %d in %s\n",
+                c1.can_maintain_original_method_order, name1, c2.can_maintain_original_method_order, name2);
+        diff++;
+    }
+    if (c1.can_generate_single_step_events
+            != c2.can_generate_single_step_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_single_step_events %d in %s  and %d in %s\n",
+                c1.can_generate_single_step_events, name1, c2.can_generate_single_step_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_exception_events
+            != c2.can_generate_exception_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_exception_events %d in %s  and %d in %s\n",
+                c1.can_generate_exception_events, name1, c2.can_generate_exception_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_frame_pop_events
+            != c2.can_generate_frame_pop_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_frame_pop_events %d in %s  and %d in %s\n",
+                c1.can_generate_frame_pop_events, name1, c2.can_generate_frame_pop_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_breakpoint_events
+            != c2.can_generate_breakpoint_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_breakpoint_events %d in %s  and %d in %s\n",
+                c1.can_generate_breakpoint_events, name1, c2.can_generate_breakpoint_events, name2);
+        diff++;
+    }
+    if (c1.can_suspend
+            != c2.can_suspend)
+    {
+        fprintf(stderr, "\t\tDIFF: can_suspend %d in %s  and %d in %s\n",
+                c1.can_suspend, name1, c2.can_suspend, name2);
+        diff++;
+    }
+    if (c1.can_redefine_any_class
+            != c2.can_redefine_any_class)
+    {
+        fprintf(stderr, "\t\tDIFF: can_redefine_any_class %d in %s  and %d in %s\n",
+                c1.can_redefine_any_class, name1, c2.can_redefine_any_class, name2);
+        diff++;
+    }
+    if (c1.can_get_current_thread_cpu_time
+            != c2.can_get_current_thread_cpu_time)
+    {
+        fprintf(stderr, "\t\tDIFF: can_tag_objects %d in %s  and %d in %s\n",
+                c1.can_tag_objects, name1, c2.can_tag_objects, name2);
+        diff++;
+    }
+    if (c1.can_get_thread_cpu_time
+            != c2.can_get_thread_cpu_time)
+    {
+        fprintf(stderr, "\t\tDIFF: can_tag_objects %d in %s  and %d in %s\n",
+                c1.can_tag_objects, name1, c2.can_tag_objects, name2);
+        diff++;
+    }
+    if (c1.can_generate_method_entry_events
+            != c2.can_generate_method_entry_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_method_entry_events %d in %s  and %d in %s\n",
+                c1.can_generate_method_entry_events, name1, c2.can_generate_method_entry_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_method_exit_events
+            != c2.can_generate_method_exit_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_method_exit_events %d in %s  and %d in %s\n",
+                c1.can_generate_method_exit_events, name1, c2.can_generate_method_exit_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_all_class_hook_events
+            != c2.can_generate_all_class_hook_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_all_class_hook_events %d in %s  and %d in %s\n",
+                c1.can_generate_all_class_hook_events, name1, c2.can_generate_all_class_hook_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_compiled_method_load_events
+            != c2.can_generate_compiled_method_load_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_compiled_method_load_events %d in %s  and %d in %s\n",
+                c1.can_generate_compiled_method_load_events, name1, c2.can_generate_compiled_method_load_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_monitor_events
+            != c2.can_generate_monitor_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_monitor_events %d in %s  and %d in %s\n",
+                c1.can_generate_monitor_events, name1, c2.can_generate_monitor_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_vm_object_alloc_events
+            != c2.can_generate_vm_object_alloc_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_vm_object_alloc_events %d in %s  and %d in %s\n",
+                c1.can_generate_vm_object_alloc_events, name1, c2.can_generate_vm_object_alloc_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_native_method_bind_events
+            != c2.can_generate_native_method_bind_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_native_method_bind_events %d in %s  and %d in %s\n",
+                c1.can_generate_native_method_bind_events, name1, c2.can_generate_native_method_bind_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_garbage_collection_events
+            != c2.can_generate_garbage_collection_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_garbage_collection_events %d in %s  and %d in %s\n",
+                c1.can_generate_garbage_collection_events, name1, c2.can_generate_garbage_collection_events, name2);
+        diff++;
+    }
+    if (c1.can_generate_object_free_events
+            != c2.can_generate_object_free_events)
+    {
+        fprintf(stderr, "\t\tDIFF: can_generate_object_free_events %d in %s  and %d in %s\n",
+                c1.can_generate_object_free_events, name1, c2.can_generate_object_free_events, name2);
+        diff++;
+    }
+
+    if (0 != diff)
+    {
+        fprintf(stderr, "\t\tDIFF: capabilities %s and %s has %d differences\n", name1, name2, diff);
+    }
+    else
+    {
+        fprintf(stderr, "\t\tDIFF: capabilities %s and %s are identical\n", name1, name2);
+    }
+
+    return diff;
+}
+
+void print_capabilities(jvmtiCapabilities c, const char* name)
+{
+    fprintf(stderr, "\t\t%s.can_tag_objects = %d\n",
+            name, c.can_tag_objects);
+    fprintf(stderr, "\t\t%s.can_generate_field_modification_events = %d\n",
+            name, c.can_generate_field_modification_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_field_access_events = %d\n",
+            name, c.can_generate_field_access_events);
+
+    fprintf(stderr, "\t\t%s.can_get_bytecodes = %d\n",
+            name, c.can_get_bytecodes);
+
+    fprintf(stderr, "\t\t%s.can_get_synthetic_attribute = %d\n",
+            name, c.can_get_synthetic_attribute);
+
+    fprintf(stderr, "\t\t%s.can_get_owned_monitor_info = %d\n",
+            name, c.can_get_owned_monitor_info);
+
+    fprintf(stderr, "\t\t%s.can_get_current_contended_monitor = %d\n",
+            name, c.can_get_current_contended_monitor);
+
+    fprintf(stderr, "\t\t%s.can_get_monitor_info = %d\n",
+            name, c.can_get_monitor_info);
+
+    fprintf(stderr, "\t\t%s.can_pop_frame = %d\n",
+            name, c.can_pop_frame);
+
+    fprintf(stderr, "\t\t%s.can_redefine_classes = %d\n",
+            name, c.can_redefine_classes);
+
+    fprintf(stderr, "\t\t%s.can_signal_thread = %d\n",
+            name, c.can_signal_thread);
+
+    fprintf(stderr, "\t\t%s.can_get_source_file_name = %d\n",
+            name, c.can_get_source_file_name);
+
+    fprintf(stderr, "\t\t%s.can_get_line_numbers = %d\n",
+            name, c.can_get_line_numbers);
+
+    fprintf(stderr, "\t\t%s.can_get_source_debug_extension = %d\n",
+            name, c.can_get_source_debug_extension);
+
+    fprintf(stderr, "\t\t%s.can_access_local_variables = %d\n",
+            name, c.can_access_local_variables);
+
+    fprintf(stderr, "\t\t%s.can_maintain_original_method_order = %d\n",
+            name, c.can_maintain_original_method_order);
+
+    fprintf(stderr, "\t\t%s.can_generate_single_step_events = %d\n",
+            name, c.can_generate_single_step_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_exception_events = %d\n",
+            name, c.can_generate_exception_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_frame_pop_events = %d\n",
+            name, c.can_generate_frame_pop_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_breakpoint_events = %d\n",
+            name, c.can_generate_breakpoint_events);
+
+    fprintf(stderr, "\t\t%s.can_suspend = %d\n",
+            name, c.can_suspend);
+
+    fprintf(stderr, "\t\t%s.can_redefine_any_class = %d\n",
+            name, c.can_redefine_any_class);
+
+    fprintf(stderr, "\t\t%s.can_tag_objects = %d\n",
+            name, c.can_tag_objects);
+
+    fprintf(stderr, "\t\t%s.can_tag_objects = %d\n",
+            name, c.can_tag_objects);
+
+    fprintf(stderr, "\t\t%s.can_generate_method_entry_events = %d\n",
+            name, c.can_generate_method_entry_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_method_exit_events = %d\n",
+            name, c.can_generate_method_exit_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_all_class_hook_events = %d\n",
+            name, c.can_generate_all_class_hook_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_compiled_method_load_events = %d\n",
+            name, c.can_generate_compiled_method_load_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_monitor_events = %d\n",
+            name, c.can_generate_monitor_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_vm_object_alloc_events = %d\n",
+            name, c.can_generate_vm_object_alloc_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_native_method_bind_events = %d\n",
+            name, c.can_generate_native_method_bind_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_garbage_collection_events = %d\n",
+            name, c.can_generate_garbage_collection_events);
+
+    fprintf(stderr, "\t\t%s.can_generate_object_free_events = %d\n",
+            name, c.can_generate_object_free_events);
+}
+
+
+/*
+ * Function for making ZERO capabilities
+ */
+void make_caps_zero(jvmtiCapabilities* c1)
+{
+    memset(c1, 0, sizeof(jvmtiCapabilities));
+
+    return;
+}
+
+/*
+ * Function for making SET capabilities
+ */
+void make_caps_set_all(jvmtiCapabilities* c1)
+{
+    memset(c1, 0xff, sizeof(jvmtiCapabilities));
+
+    return;
+}
+
+/*
+ * Check Phase
+ *     1. special phase parameter is
+ *         0 - any phases (no check)
+ *         1 - ONLOAD only
+ *         2 - ONLOAD & LIVE
+ *         3 - START & LIVE
+ *         4 - LIVE only
+ */
+
+bool check_phase_debug(jvmtiEnv* jvmti_env, int phase_param, bool is_debug)
+{
+    jvmtiPhase phase;
+    jvmtiError result = jvmti_env->GetPhase(&phase);
+
+    if (is_debug)
+    {
+        fprintf(stderr, "\tnative: GetPhase result = %d (must be zero) \n", result);
+        fprintf(stderr, "\tnative: current phase is %d (must be 4 (LIVE-phase)) \n", phase);
+    }
+
+    if (result != JVMTI_ERROR_NONE) return false;
+
+    if (phase_param)
+    {
+        if (((phase_param == 1) && (phase == JVMTI_PHASE_ONLOAD)) ||
+            ((phase_param == 2) && (phase == JVMTI_PHASE_ONLOAD) && (phase == JVMTI_PHASE_LIVE)) ||
+            ((phase_param == 3) && (phase == JVMTI_PHASE_START) && (phase == JVMTI_PHASE_LIVE)) ||
+            ((phase_param == 4) && (phase == JVMTI_PHASE_LIVE))) return true;
+        else
+            return false;
+    }
+
+    return true;
+}
+
+bool check_phase_and_method_debug(jvmtiEnv* jvmti_env, jmethodID method, int phase_param,
+        const char* exp_name, bool is_debug)
+{
+    char* name;
+    char* signature;
+    char* generic;
+
+    if (!check_phase_debug(jvmti_env, phase_param, is_debug))
+        return false;
+
+    jvmtiError result = jvmti_env->GetMethodName(method, &name, &signature, &generic);
+
+    if (is_debug)
+    {
+        fprintf(stderr, "\tnative: GetMethodName result = %d (must be zero) \n", result);
+        fprintf(stderr, "\tnative: method name is %s \n", name);
+        fprintf(stderr, "\tnative: signature name is %s \n", signature);
+        fprintf(stderr, "\tnative: generic name is %s \n", generic);
+        fflush(stderr);
+    }
+
+    if (result != JVMTI_ERROR_NONE) return false;
+
+    if (strcmp(name, exp_name))
+        return false;
+    else
+        return true;
+}
+
+bool check_phase_and_thread_debug(jvmtiEnv* jvmti_env, jthread thread, int phase_param,
+        const char* exp_name, bool is_debug)
+{
+    jvmtiThreadInfo tinfo;
+
+    if (!check_phase_debug(jvmti_env, phase_param, is_debug))
+        return false;
+
+    jvmtiError result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (is_debug)
+    {
+        fprintf(stderr, "\tnative: GetThreadInfo result = %d (must be zero) \n", result);
+        fprintf(stderr, "\tnative: current thread name is %s (must be zero) \n", tinfo.name);
+    }
+
+    if (strcmp(tinfo.name, exp_name) || (result != JVMTI_ERROR_NONE))
+        return false;
+    else
+        return true;
+}
+/*
+jthread create_not_alive_thread(JNIEnv* jni_env, jvmtiEnv* jvmti_env)
+{
+    jclass clazz;
+    jmethodID mid;
+    jthread thread;
+
+    fprintf(stderr, "\tnative: JNI: funcs start\n");
+
+    clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz) return NULL;
+    fprintf(stderr, "\tnative: JNI: FindClass - Ok\n");
+
+    mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid) return NULL;
+    fprintf(stderr, "\tnative: JNI: GetMethodID - Ok\n");
+
+    thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!thread) return NULL;
+    fprintf(stderr, "\tnative: JNI: NewObject - Ok\n");
+
+    return thread;
+}
+*/
+bool is_needed_field_found(jvmtiEnv* jvmti_env, const char* filename, const char* fieldname,
+        jclass* myclass, jfieldID* myfield, bool is_debug)
+{
+
+    jint class_count;
+    jclass* classes;
+    jclass my_class = NULL;
+    char* source_name;
+    jint field_count;
+    jfieldID* fields;
+    jfieldID my_field = NULL;
+
+    jvmtiError result = jvmti_env->GetLoadedClasses(&class_count, &classes);
+    fprintf(stderr, "\tnative: GetLoadedClasses result = %d (must be zero) \n", result);
+    fprintf(stderr, "\tnative: class_count is %d \n", class_count);
+    fprintf(stderr, "\tnative: classes is %p \n", classes);
+    fflush(stderr);
+
+    if ( result != JVMTI_ERROR_NONE ) return false;
+
+    for (int i = 0; i < class_count; i++)
+    {
+        result = jvmti_env->GetSourceFileName(classes[i], &source_name);
+        if (is_debug)
+        {
+            fprintf(stderr, "\tnative: GetSourceFileName result = %d (must be zero) \n", result);
+            fprintf(stderr, "\tnative: source_name is %s \n", source_name);
+            fprintf(stderr, "\tnative: classes is %p \n", classes);
+            fflush(stderr);
+        }
+
+        if (result != JVMTI_ERROR_NONE) continue;
+
+        if (!strcmp(source_name, filename))
+        {
+            fprintf(stderr, "\tnative: GetSourceFileName result = %d (must be zero) \n", result);
+            fprintf(stderr, "\tnative: source_name is %s \n", source_name);
+            fprintf(stderr, "\tnative: classes is %p \n", classes);
+            fflush(stderr);
+
+            my_class = classes[i];
+            break;
+        }
+    }
+
+    result = jvmti_env->GetClassFields(my_class, &field_count, &fields);
+    fprintf(stderr, "\tnative: GetClassFields result = %d (must be zero) \n", result);
+    fprintf(stderr, "\tnative: fields_ptr is %p \n", fields);
+    fprintf(stderr, "\tnative: field_count_ptr is %d \n", field_count);
+    fprintf(stderr, "\tnative: my_class is %p \n", my_class);
+    fflush(stderr);
+
+    if ( result != JVMTI_ERROR_NONE ) return false;
+
+    for (int j = 0; j < field_count; j++)
+    {
+        char* name;
+        char* signature;
+        char* generic;
+
+        result = jvmti_env->GetFieldName(my_class, fields[j], &name, &signature, &generic);
+        if (is_debug)
+        {
+            fprintf(stderr, "\tnative: GetFieldName result = %d (must be zero) \n", result);
+            fprintf(stderr, "\tnative: classes is %p \n", my_class);
+            fprintf(stderr, "\tnative: fields_ptr[%d] is %p \n", j, fields[j]);
+            fprintf(stderr, "\tnative: field name is %s \n", name);
+            fprintf(stderr, "\tnative: field signature is %s \n", signature);
+            fprintf(stderr, "\tnative: field generic is %s \n", generic);
+            fflush(stderr);
+        }
+        if ( result != JVMTI_ERROR_NONE ) continue;
+
+        if (!strcmp(name, fieldname))
+        {
+            fprintf(stderr, "\tnative: GetFieldName result = %d (must be zero) \n", result);
+            fprintf(stderr, "\tnative: classes is %p \n", my_class);
+            fprintf(stderr, "\tnative: fields_ptr[%d] is %p \n", j, fields[j]);
+            fprintf(stderr, "\tnative: field name is %s \n", name);
+            fprintf(stderr, "\tnative: field signature is %s \n", signature);
+            fprintf(stderr, "\tnative: field generic is %s \n", generic);
+            fflush(stderr);
+
+            my_field = fields[j];
+            break;
+        }
+    }
+
+    if (!my_class || !my_field) return false;
+
+    *myclass = my_class;
+    *myfield = my_field;
+
+    return true;
+}
+
+jint func_for_Agent_OnLoad_JVMTI(JavaVM *vm, char *options, void *reserved, Callbacks* callbacks,
+        jvmtiEvent* events, jint size, const char* test_case_name, bool is_debug, jvmtiEnv** jvmti)
+{
+    jvmtiEnv* jvmti_env;
+    jvmtiError result;
+    jvmtiCapabilities pc;
+    jvmtiEventCallbacks cb = {NULL};
+
+    //warning fix
+    int w_fix = sizeof(options);
+    w_fix += sizeof(reserved);
+    w_fix += sizeof (is_debug);
+    //
+
+    /* Getting of jvmti environment */
+    if (vm->GetEnv((void**)&jvmti_env, JVMTI_VERSION_1_0) != JNI_OK)
+    {
+        fprintf(stderr, "Failure of initialization of JVMTI environment");
+        return JNI_ERR;
+    }
+
+    *jvmti = jvmti_env;
+
+    result = jvmti_env->GetPotentialCapabilities(&pc);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the getting of potential capabilities");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: GetPotentialCapabilities error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    bool mentry = false, mexit = false, fpopnot = false;
+
+    for (jint mee_ind = 0; mee_ind < size; mee_ind++)
+    {
+        if (events[mee_ind] == JVMTI_EVENT_METHOD_ENTRY)
+            mentry = true;
+        if (events[mee_ind] == JVMTI_EVENT_METHOD_EXIT)
+            mexit = true;
+        if (events[mee_ind] == JVMTI_EVENT_FRAME_POP)
+            fpopnot = true;
+    }
+
+    if (!mentry)
+        pc.can_generate_method_entry_events = 0;
+    if (!mexit)
+        pc.can_generate_method_exit_events = 0;
+    if (!fpopnot)
+        pc.can_generate_frame_pop_events = 0;
+
+    result = jvmti_env->AddCapabilities(&pc);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the adding of all possible capabilities");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: AddCapabilities error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    memset(&cb, 0, sizeof(cb));
+
+    cb.SingleStep              = callbacks->cbSingleStep;
+    cb.Breakpoint              = callbacks->cbBreakpoint;
+    cb.FieldAccess             = callbacks->cbFieldAccess;
+    cb.FieldModification       = callbacks->cbFieldModification;
+    cb.FramePop                = callbacks->cbFramePop;
+    cb.MethodEntry             = callbacks->cbMethodEntry;
+    cb.MethodExit              = callbacks->cbMethodExit;
+    cb.NativeMethodBind        = callbacks->cbNativeMethodBind;
+    cb.Exception               = callbacks->cbException;
+    cb.ExceptionCatch          = callbacks->cbExceptionCatch;
+    cb.ThreadStart             = callbacks->cbThreadStart;
+    cb.ThreadEnd               = callbacks->cbThreadEnd;
+    cb.ClassLoad               = callbacks->cbClassLoad;
+    cb.ClassPrepare            = callbacks->cbClassPrepare;
+    cb.ClassFileLoadHook       = callbacks->cbClassFileLoadHook;
+    cb.VMStart                 = callbacks->cbVMStart;
+    cb.VMInit                  = callbacks->cbVMInit;
+    cb.VMDeath                 = callbacks->cbVMDeath;
+    cb.CompiledMethodLoad      = callbacks->cbCompiledMethodLoad;
+    cb.CompiledMethodUnload    = callbacks->cbCompiledMethodUnload;
+    cb.DynamicCodeGenerated    = callbacks->cbDynamicCodeGenerated;
+    cb.DataDumpRequest         = callbacks->cbDataDumpRequest;
+    cb.MonitorContendedEnter   = callbacks->cbMonitorContendedEnter;
+    cb.MonitorContendedEntered = callbacks->cbMonitorContendedEntered;
+    cb.MonitorWait             = callbacks->cbMonitorWait;
+    cb.MonitorWaited           = callbacks->cbMonitorWaited;
+    cb.VMObjectAlloc           = callbacks->cbVMObjectAlloc;
+    cb.ObjectFree              = callbacks->cbObjectFree;
+    cb.GarbageCollectionStart  = callbacks->cbGarbageCollectionStart;
+    cb.GarbageCollectionFinish = callbacks->cbGarbageCollectionFinish;
+
+    for (int j = 0; j < size; j++)
+    {
+        result = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, events[j], NULL);
+
+        if (result == JVMTI_ERROR_NONE) continue;
+
+        fprintf(stderr, "\n\tERROR during the adding of SetEventNotificationMode");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: SetEventNotificationMode error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    result = jvmti_env->SetEventCallbacks(&cb, sizeof(cb));
+
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the adding of SetEventCallbacks");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: SetEventCallbacks error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    fprintf(stderr, "\n----------------------------------------------------");
+    fprintf(stderr, "\ntest");
+    fprintf(stderr, " %s ", test_case_name);
+    fprintf(stderr, "is started\n{\n");
+    fflush(stderr);
+
+    return JNI_OK;
+}
+
+/*
+ * Universal agent function;
+ */
+jint func_for_Agent_OnLoad(JavaVM *vm, char *options, void *reserved, Callbacks* callbacks,
+        jvmtiEvent* events, jint size, const char* test_case_name, bool is_debug)
+{
+    jvmtiEnv* jvmti_env;
+    jvmtiError result;
+    jvmtiCapabilities pc;
+    jvmtiEventCallbacks cb = {NULL};
+
+    //warning fix
+    int w_fix = sizeof(options);
+    w_fix += sizeof(reserved);
+    w_fix += sizeof (is_debug);
+    //
+
+    /* Getting of jvmti environment */
+    if (vm->GetEnv((void**)&jvmti_env, JVMTI_VERSION_1_0) != JNI_OK)
+    {
+        fprintf(stderr, "Failure of initialization of JVMTI environment");
+        return JNI_ERR;
+    }
+
+    result = jvmti_env->GetPotentialCapabilities(&pc);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the getting of potential capabilities");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: GetPotentialCapabilities error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    bool mentry = false, mexit = false, fpopnot = false;
+
+    for (jint mee_ind = 0; mee_ind < size; mee_ind++)
+    {
+        if (events[mee_ind] == JVMTI_EVENT_METHOD_ENTRY)
+            mentry = true;
+        if (events[mee_ind] == JVMTI_EVENT_METHOD_EXIT)
+            mexit = true;
+        if (events[mee_ind] == JVMTI_EVENT_FRAME_POP)
+            fpopnot = true;
+    }
+
+    if (!mentry)
+        pc.can_generate_method_entry_events = 0;
+    if (!mexit)
+        pc.can_generate_method_exit_events = 0;
+    if (!fpopnot)
+        pc.can_generate_frame_pop_events = 0;
+
+    result = jvmti_env->AddCapabilities(&pc);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the adding of all possible capabilities");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: AddCapabilities error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    memset(&cb, 0, sizeof(cb));
+
+    cb.SingleStep              = callbacks->cbSingleStep;
+    cb.Breakpoint              = callbacks->cbBreakpoint;
+    cb.FieldAccess             = callbacks->cbFieldAccess;
+    cb.FieldModification       = callbacks->cbFieldModification;
+    cb.FramePop                = callbacks->cbFramePop;
+    cb.MethodEntry             = callbacks->cbMethodEntry;
+    cb.MethodExit              = callbacks->cbMethodExit;
+    cb.NativeMethodBind        = callbacks->cbNativeMethodBind;
+    cb.Exception               = callbacks->cbException;
+    cb.ExceptionCatch          = callbacks->cbExceptionCatch;
+    cb.ThreadStart             = callbacks->cbThreadStart;
+    cb.ThreadEnd               = callbacks->cbThreadEnd;
+    cb.ClassLoad               = callbacks->cbClassLoad;
+    cb.ClassPrepare            = callbacks->cbClassPrepare;
+    cb.ClassFileLoadHook       = callbacks->cbClassFileLoadHook;
+    cb.VMStart                 = callbacks->cbVMStart;
+    cb.VMInit                  = callbacks->cbVMInit;
+    cb.VMDeath                 = callbacks->cbVMDeath;
+    cb.CompiledMethodLoad      = callbacks->cbCompiledMethodLoad;
+    cb.CompiledMethodUnload    = callbacks->cbCompiledMethodUnload;
+    cb.DynamicCodeGenerated    = callbacks->cbDynamicCodeGenerated;
+    cb.DataDumpRequest         = callbacks->cbDataDumpRequest;
+    cb.MonitorContendedEnter   = callbacks->cbMonitorContendedEnter;
+    cb.MonitorContendedEntered = callbacks->cbMonitorContendedEntered;
+    cb.MonitorWait             = callbacks->cbMonitorWait;
+    cb.MonitorWaited           = callbacks->cbMonitorWaited;
+    cb.VMObjectAlloc           = callbacks->cbVMObjectAlloc;
+    cb.ObjectFree              = callbacks->cbObjectFree;
+    cb.GarbageCollectionStart  = callbacks->cbGarbageCollectionStart;
+    cb.GarbageCollectionFinish = callbacks->cbGarbageCollectionFinish;
+
+    for (int j = 0; j < size; j++)
+    {
+        result = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, events[j], NULL);
+
+        if (result == JVMTI_ERROR_NONE) continue;
+
+        fprintf(stderr, "\n\tERROR during the adding of SetEventNotificationMode");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: SetEventNotificationMode error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    result = jvmti_env->SetEventCallbacks(&cb, sizeof(cb));
+
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\n\tERROR during the adding of SetEventCallbacks");
+        fprintf(stderr, "\n\tERROR: test interupted");
+        fprintf(stderr, "\n\tnative: SetEventCallbacks error_code is %d",
+                result);
+        return JNI_ERR;
+    }
+
+    fprintf(stderr, "\n----------------------------------------------------");
+    fprintf(stderr, "\ntest");
+    fprintf(stderr, " %s ", test_case_name);
+    fprintf(stderr, "is started\n{\n");
+    fflush(stderr);
+
+    return JNI_OK;
+}
+
+/*
+ * Universal VMDeath callback function;
+ */
+void func_for_callback_VMDeath(JNIEnv* jni_env, jvmtiEnv* jvmti_env,
+        const char* test_case_name, bool test, bool util)
+{
+
+    //warning fix
+    int w_fix = 1;
+    w_fix += sizeof(jni_env);
+    w_fix += sizeof(jvmti_env);
+    //
+
+    fprintf(stderr, "\n\tTest of function ");
+    fprintf(stderr, "%s ", test_case_name);
+    fprintf(stderr, "             : ");
+    fflush(stderr);
+
+    if (test && util)
+        fprintf(stderr, " passed \n");
+    else
+        fprintf(stderr, " failed \n");
+
+    fprintf(stderr, "\n} /* test ");
+    fprintf(stderr, "%s ", test_case_name);
+    fprintf(stderr, "is finished */ \n\n");
+    fflush(stderr);
+
+    return;
+}
+
+/* *********************************************************************** */
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.h?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.h Wed Nov 21 08:29:40 2007
@@ -0,0 +1,508 @@
+/**
+ * @author Valentin Al. Sitnick
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+
+#ifndef _UTILS_H_
+#define _UTILS_H_
+
+#ifdef LINUX
+#include <unistd.h>
+#else
+#include <windows.h>
+#endif
+
+#include "jvmti.h"
+#include "events.h"
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+
+
+#define FREE_TINFO  jvmti_env->Deallocate((unsigned char*)(tinfo.name));
+
+#define FREE_TLIST  jvmti_env->Deallocate((unsigned char*)(threads));
+
+#define FREE_CLIST  jvmti_env->Deallocate((unsigned char*)(classes));
+
+#define FREE_MLIST  jvmti_env->Deallocate((unsigned char*)(methods));
+
+#define FREE_FLIST  jvmti_env->Deallocate((unsigned char*)(fids));
+
+#define FREE_VARIABLE_TABLE_EL                                             \
+    jvmti_env->Deallocate((unsigned char*)table[i].name);                  \
+    jvmti_env->Deallocate((unsigned char*)table[i].signature);             \
+    jvmti_env->Deallocate((unsigned char*)table[i].generic_signature);
+
+#define FREE_VARIABLE_TABLE                                                \
+    jvmti_env->Deallocate((unsigned char*)table);
+
+#define FREE_METHOD_NAME_OUT                                               \
+    jvmti_env->Deallocate((unsigned char*)name);                           \
+    jvmti_env->Deallocate((unsigned char*)sign);                           \
+    jvmti_env->Deallocate((unsigned char*)generic);
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_ENV_INIT {                                             \
+    /* initialization of JVMTI environment */                              \
+    {                                                                      \
+        jint res = JNI_OK;                                                 \
+                                                                           \
+        res = vm->GetEnv((void**)&jvmti, JVMTI_VERSION_1_0);               \
+                                                                           \
+        if (res != JNI_OK) {                                               \
+           printf ("Failure of initialization of JVMTI environment: %d\n", \
+                   (int)res);                                              \
+           return res;                                                     \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_JAVA_LIB_PATH_WINDOWS {                            \
+    /* adding .dll & .so directories to "java.library.path" */             \
+    {                                                                      \
+        results[0] = jvmti->SetSystemProperty(                             \
+                "java.library.path", ".\\dll\\.");                         \
+        if  (results[0] != JVMTI_ERROR_NONE) {                             \
+            printf("Failure of adding library path : %d \n", results[0]);  \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_JAVA_LIB_PATH_LINUX {                              \
+    /* adding .dll & .so directories to "java.library.path" */             \
+    {                                                                      \
+        results[0] = jvmti->SetSystemProperty(                             \
+                "java.library.path", "./so");                              \
+        if  (results[0] != JVMTI_ERROR_NONE) {                             \
+            printf("Failure of adding library path : %d \n", results[0]);  \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_CAPABILITIES_INIT {                                    \
+    /* initialization of needed capabilities and calbacks */               \
+    {                                                                      \
+        results[1] = jvmti->GetPotentialCapabilities(&possible_caps);      \
+        results[2] = jvmti->AddCapabilities(&possible_caps);               \
+                                                                           \
+        if  ((results[1] != JVMTI_ERROR_NONE) ||                           \
+             (results[2] != JVMTI_ERROR_NONE)) {                           \
+            printf("Failure of adding capabilities : pot=%d add=%d \n",    \
+                    results[1],                                            \
+                    results[2]);                                           \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_CALLBACK_EXCEPTION_INIT {                          \
+    /* events enabling */                                                  \
+    {                                                                      \
+        jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION };                   \
+                                                                           \
+        memset(&callbacks, 0, sizeof(callbacks));                          \
+        callbacks.Exception = callbackException;                           \
+                                                                           \
+        results[3] =                                                       \
+            jvmti->SetEventNotificationMode(                               \
+                    JVMTI_ENABLE, events[0], NULL);                        \
+                                                                           \
+        if (results[3] != JVMTI_ERROR_NONE) {                              \
+            printf("Failure of enabling event: %d\n", results[3]);         \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_CALLBACK_VMINIT_INIT {                             \
+    /* events enabling */                                                  \
+    {                                                                      \
+        jvmtiEvent events[] = { JVMTI_EVENT_VM_INIT };                     \
+                                                                           \
+        memset(&callbacks, 0, sizeof(callbacks));                          \
+        callbacks.VMInit = callbackVMInit;                                 \
+                                                                           \
+        results[3] =                                                       \
+            jvmti->SetEventNotificationMode(                               \
+                    JVMTI_ENABLE, events[0], NULL);                        \
+                                                                           \
+        if (results[3] != JVMTI_ERROR_NONE) {                              \
+            printf("Failure of enabling event: %d\n", results[3]);         \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_CALLBACK_THREAD_START_INIT {                       \
+    /* events enabling */                                                  \
+    {                                                                      \
+        jvmtiEvent events[] = { JVMTI_EVENT_THREAD_START };                \
+                                                                           \
+        memset(&callbacks, 0, sizeof(callbacks));                          \
+        callbacks.ThreadStart = callbackThreadStart;                       \
+                                                                           \
+        results[3] =                                                       \
+            jvmti->SetEventNotificationMode(                               \
+                    JVMTI_ENABLE, events[0], NULL);                        \
+                                                                           \
+        if (results[3] != JVMTI_ERROR_NONE) {                              \
+            printf("Failure of enabling event: %d\n", results[3]);         \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_SET_CALLBACK_THRD_START_INIT {                         \
+    /* events enabling */                                                  \
+    {                                                                      \
+        jvmtiEvent events[] = { JVMTI_EVENT_THREAD_START };                \
+                                                                           \
+        memset(&callbacks, 0, sizeof(callbacks));                          \
+        callbacks.ThreadStart = callbackThreadStart;                       \
+                                                                           \
+        results[3] =                                                       \
+            jvmti->SetEventNotificationMode(                               \
+                    JVMTI_ENABLE, events[0], NULL);                        \
+                                                                           \
+        if (results[3] != JVMTI_ERROR_NONE) {                              \
+            printf("Failure of enabling event: %d\n", results[3]);         \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define AGENT_JVMTI_CALLBACKS_INIT {                                       \
+    /* set event callbacks */                                              \
+    {                                                                      \
+        results[7] =                                                       \
+                jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));   \
+        if (results[7] != JVMTI_ERROR_NONE) {                              \
+            printf("Failure of setting event callbacks: %d\n",             \
+                    results[7]);                                           \
+            return JNI_ERR;                                                \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define START_TEST_CHECK                                                   \
+    jint test_start = 0;                                                   \
+    jvmtiPhase phase;                                                      \
+    jvmtiThreadInfo tinfo;                                                 \
+                                                                           \
+    if (jvmti_env->GetPhase(&phase) == JVMTI_ERROR_NONE)                   \
+    {                                                                      \
+        if (phase == JVMTI_PHASE_LIVE)                                     \
+        {                                                                  \
+            test_start = 1;                                                \
+        }                                                                  \
+    }                                                                      \
+                                                                           \
+    if (test_start)                                                        \
+    {                                                                      \
+        test_start = 0;                                                    \
+                                                                           \
+        if (jvmti_env->GetThreadInfo(thread, &tinfo)                       \
+                == JVMTI_ERROR_NONE)                                       \
+        {                                                                  \
+            if (!strcmp(tinfo.name, "agent"))                              \
+            {                                                              \
+                test_start = 1;                                            \
+            }                                                              \
+        }                                                                  \
+    }
+
+/***************************************************************************/
+
+#define CHECK_BEFORE_START()                                               \
+    jvmtiPhase phase;                                                      \
+    bool test_can_be_started = false;                                      \
+                                                                           \
+    if (jvmti_env->GetPhase(&phase) == JVMTI_ERROR_NONE)                   \
+    {                                                                      \
+        if (phase == JVMTI_PHASE_LIVE)                                     \
+        {                                                                  \
+            jvmtiThreadInfo tinfo ;                                        \
+                                                                           \
+            if (jvmti_env->GetThreadInfo(thread, &tinfo)                   \
+                    == JVMTI_ERROR_NONE)                                   \
+            {                                                              \
+                if (!strcmp(tinfo.name, "agent"))                          \
+                {                                                          \
+                    test_can_be_started = true;                            \
+                }                                                          \
+            }                                                              \
+                                                                           \
+            FREE_TINFO;                                                    \
+        }                                                                  \
+    }
+
+/***************************************************************************/
+
+#define GET_CURRENT_JCLASS_AND_SPECIAL_METHOD_ID()                         \
+{                                                                          \
+    jint ccount;                                                           \
+    jclass cc = NULL;                                                      \
+    jclass* classes;                                                       \
+    jvmtiError r_get_classes =                                             \
+        jvmti_env->GetLoadedClasses(&ccount, &classes);                    \
+                                                                           \
+    if (r_get_classes == JVMTI_ERROR_NONE)                                 \
+    {                                                                      \
+        for (int i = 0; i < ccount; i++)                                   \
+        {                                                                  \
+            char* s;                                                       \
+            char* g;                                                       \
+            jvmtiError r_get_class_sign =                                  \
+                  jvmti_env->GetClassSignature(classes[i], &s, &g);        \
+                                                                           \
+            if (r_get_class_sign == JVMTI_ERROR_NONE)                      \
+            {                                                              \
+                if (!strcmp(s, filename))                                  \
+                {                                                          \
+                    cc = classes[i];                                       \
+                    break;                                                 \
+                }                                                          \
+            }                                                              \
+        }                                                                  \
+    }                                                                      \
+    else                                                                   \
+    {                                                                      \
+        printf(" FAILED \n\terror during GetLoadedClasses");               \
+        return;                                                            \
+    }                                                                      \
+    if (cc)                                                                \
+    {                                                                      \
+        jint mcount;                                                       \
+        jmethodID* methods;                                                \
+        jvmtiError r = jvmti_env->GetClassMethods(cc, &mcount, &methods);  \
+        if (r == JVMTI_ERROR_NONE)                                         \
+        {                                                                  \
+            for (int i = 0; i < mcount; i++)                               \
+            {                                                              \
+                char* name;                                                \
+                char* signature;                                           \
+                char* generic;                                             \
+                if (jvmti_env->GetMethodName(methods[i], &name, &signature,\
+                            &generic) == JVMTI_ERROR_NONE)                 \
+                {                                                          \
+                    if (!strcmp(name, "special_method"))                   \
+                    {                                                      \
+                        method = methods[i];                               \
+                        break;                                             \
+                    }                                                      \
+                }                                                          \
+            }                                                              \
+        }                                                                  \
+    }                                                                      \
+    if (!cc || !method)                                                    \
+    {                                                                      \
+        printf(" FAILED\n\tError during class or method definition\n class = %x, method = %x\n ",\
+                cc, method);                                               \
+        return;                                                            \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+#define GET_CURRENT_JCLASS()                                               \
+{                                                                          \
+    jint ccount;                                                           \
+    jclass cc = NULL;                                                      \
+    jclass* classes;                                                       \
+    jvmtiError r_get_classes =                                             \
+        jvmti_env->GetLoadedClasses(&ccount, &classes);                    \
+                                                                           \
+    if (r_get_classes == JVMTI_ERROR_NONE)                                 \
+    {                                                                      \
+        for (int i = 0; i < ccount; i++)                                   \
+        {                                                                  \
+            char* s;                                                       \
+            char* g;                                                       \
+            jvmtiError r_get_class_sign =                                  \
+                  jvmti_env->GetClassSignature(classes[i], &s, &g);        \
+                                                                           \
+            if (r_get_class_sign == JVMTI_ERROR_NONE)                      \
+            {                                                              \
+                if (!strcmp(s, filename))                                  \
+                {                                                          \
+                    cc = classes[i];                                       \
+                    break;                                                 \
+                }                                                          \
+            }                                                              \
+        }                                                                  \
+    }                                                                      \
+    else                                                                   \
+    {                                                                      \
+        printf(" FAILED \n\terror during GetLoadedClasses");               \
+        return;                                                            \
+    }                                                                      \
+                                                                           \
+    if (!cc)                                                               \
+    {                                                                      \
+        printf(" FAILED\n\tError during class definition\n class = %x",    \
+                cc);                                                       \
+        return;                                                            \
+    }                                                                      \
+                                                                           \
+    clazz = cc;                                                            \
+}
+
+/***************************************************************************/
+
+#define GET_NEEDED_FID()                                                   \
+                                                                           \
+if (jvmti_env->GetClassFields(clazz, &fcount, &fids) == JVMTI_ERROR_NONE)  \
+{                                                                          \
+    for (int i = 0; i < fcount; i++)                                       \
+    {                                                                      \
+        char* field_name;                                                  \
+        char* field_signature;                                             \
+        char* field_generic;                                               \
+                                                                           \
+        if (jvmti_env->GetFieldName(clazz, fids[i], &field_name,           \
+                  &field_signature, &field_generic) == JVMTI_ERROR_NONE)   \
+        {                                                                  \
+            if (!strcmp(field_name, "special_field"))                      \
+            {                                                              \
+                if (!strcmp(field_signature, "Z"))                         \
+                {                                                          \
+                    fid = fids[i];                                         \
+                    break;                                                 \
+                }                                                          \
+            }                                                              \
+        }                                                                  \
+    }                                                                      \
+}
+
+/***************************************************************************/
+
+void thread_state_output_as_string(long state);
+
+void class_status_output_as_string(long status);
+
+void print_capabilities(jvmtiCapabilities c, const char* name);
+
+int cmp_caps_and_output_results(jvmtiCapabilities c1,
+        jvmtiCapabilities c2, const char* name1, const char* name2);
+
+void make_caps_zero(jvmtiCapabilities* c1);
+
+void make_caps_set_all(jvmtiCapabilities* c1);
+
+/***************************************************************************/
+
+#define CAPABILITY_TURN_OFF(cap)                                           \
+{                                                                          \
+    jvmtiCapabilities zero_caps;                                           \
+    jvmtiError result;                                                     \
+    make_caps_zero(&zero_caps);                                            \
+    zero_caps.cap = 1;                                                     \
+    result = jvmti->RelinquishCapabilities(&zero_caps);                    \
+    if (result != JVMTI_ERROR_NONE)                                        \
+    {                                                                      \
+        fprintf(stderr,                                                    \
+                "Error during RelinquishCapabilities. Test Stopped\n");    \
+        fflush(stderr);                                                    \
+        return JNI_ERR;                                                    \
+    }                                                                      \
+}                                                                          \
+
+/***************************************************************************/
+
+#define CAPABILITY_TURN_OFF_VOID(cap)                                      \
+{                                                                          \
+    jvmtiCapabilities zero_caps;                                           \
+    jvmtiError result;                                                     \
+    make_caps_zero(&zero_caps);                                            \
+    zero_caps.cap = 1;                                                     \
+    result = jvmti_env->RelinquishCapabilities(&zero_caps);                \
+    if (result != JVMTI_ERROR_NONE)                                        \
+    {                                                                      \
+        fprintf(stderr,                                                    \
+                "Error during RelinquishCapabilities. Test Stopped\n");    \
+        fflush(stderr);                                                    \
+        return;                                                            \
+    }                                                                      \
+}                                                                          \
+
+/***************************************************************************/
+
+#define CAPABILITY_CHECK()                                                 \
+{                                                                          \
+    jvmtiCapabilities full_caps;                                           \
+    jvmtiCapabilities caps;                                                \
+    make_caps_set_all(&full_caps);                                         \
+    result = jvmti_env->GetCapabilities(&caps);                            \
+    if (result != JVMTI_ERROR_NONE)                                        \
+    {                                                                      \
+        fprintf(stderr,                                                    \
+                "Error during GetCapabilities. Test Stopped\n");           \
+        fflush(stderr);                                                    \
+        return;                                                            \
+    }                                                                      \
+    int diff = cmp_caps_and_output_results(full_caps, caps,                \
+            "potential", "current");                                       \
+}                                                                          \
+
+/***************************************************************************/
+
+#define SPP_NONE              0
+#define SPP_ONLOAD_ONLY       1
+#define SPP_ONLOAD_AND_LIVE   2
+#define SPP_START_AND_LIVE    3
+#define SPP_LIVE_ONLY         4
+
+#define DEBUG_OUT             0
+
+bool check_phase_debug(jvmtiEnv* jvmti_env, int phase_param, bool is_debug);
+
+bool check_phase_and_method_debug(jvmtiEnv* jvmti_env, jmethodID method, int phase_param,
+        const char* exp_name, bool is_debug);
+
+bool check_phase_and_thread_debug(jvmtiEnv* jvmti_env, jthread thread, int phase_param,
+        const char* exp_name, bool is_debug);
+
+jthread create_not_alive_thread(JNIEnv* jni_env, jvmtiEnv* jvmti_env);
+
+bool is_needed_field_found(jvmtiEnv* jvmti_env, const char* filename, const char* fieldname,
+        jclass* myclass, jfieldID* myfield, bool is_debug);
+
+void func_for_callback_VMDeath(JNIEnv* jni_env, jvmtiEnv* jvmti_env,
+        const char* test_case_name, bool test, bool util);
+
+jint func_for_Agent_OnLoad(JavaVM *vm, char *options, void *reserved, Callbacks* callbacks,
+        jvmtiEvent* events, jint size, const char* test_case_name, bool is_debug);
+
+jint func_for_Agent_OnLoad_JVMTI(JavaVM *vm, char *options, void *reserved, Callbacks* callbacks,
+        jvmtiEvent* events, jint size, const char* test_case_name, bool is_debug, jvmtiEnv** jvmti_env);
+
+//////////////////////////////////////////////////////////////////////////
+
+const char* get_jvmti_eror_text(jvmtiError);
+
+#endif /* _UTILS_H_ */

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/utils.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/start.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/start.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/start.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/start.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,92 @@
+#! /bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov.
+# @version: $Revision$
+#
+
+system=`uname`
+
+USE_INTERPRETER="-Dvm.use_interpreter=0"
+
+FIND=/usr/bin/find
+
+#detect architecture
+TMPARCH=`uname -m |sed -e 's/i.86/i386/'`
+if [ "$TMPARCH" = "i386" ]; then
+    TST_ARCH="ia32"
+else
+    echo "Architectures other than IA32 are not supported yet"
+    exit
+fi
+
+
+#
+# Select compiler for native libs creating
+# - 'gcc' for GNU Compiler (default for Linux)
+# - 'icc' for Intel Compiler (optional for Linux)
+# - 'cl' Microsoft Compiler (default for Windows)
+# - 'icl' for Intel Compiler (optional for Windows)
+
+if [ $system = "Linux" ]; then
+
+    PREFERRED_COMPILER=gcc
+    ALT_COMPILER=icc
+
+    C_COMPILER=$PREFERRED_COMPILER
+
+    if [ -z "$VTSSUITE_ROOT" ] ; then
+        VTSSUITE_ROOT="$PWD"
+    fi
+
+    if [ -z "$REF_JAVA_HOME" ] ; then
+        REF_JAVA_HOME="$JAVA_HOME"
+    fi
+
+    if [ -z "$TST_JAVA_HOME" ] ; then
+        if [ ! -d "../../../build/lnx_${TST_ARCH}_${PREFERRED_COMPILER}_debug/deploy/jdk" ] ; then
+            TST_JAVA_HOME="../../../build/lnx_${TST_ARCH}_${ALT_COMPILER}_debug/deploy/jdk"
+        else
+            TST_JAVA_HOME="../../../build/lnx_${TST_ARCH}_${PREFERRED_COMPILER}_debug/deploy/jdk"
+        fi
+    fi
+
+    TST_JAVA="$TST_JAVA_HOME/jre/bin/java"
+    TST_JAVA_INCLUDE="$TST_JAVA_HOME/include"
+
+
+    export LD_LIBRARY_PATH="$VTSSUITE_ROOT/bin/lib"
+
+else # for Windows
+
+    PREFERRED_COMPILER=cl
+    ALT_COMPILER=icl
+
+    C_COMPILER=$PREFERRED_COMPILER
+
+    PREFERRED_COMPILER=`echo -n $PREFERRED_COMPILER |sed -e 's/^cl/msvc/'`
+    ALT_COMPILER=`echo -n $ALT_COMPILER |sed -e 's/^cl/msvc/'`
+
+    if [ -z "$VTSSUITE_ROOT" ] ; then
+        VTSSUITE_ROOT="$PWD"
+    fi
+
+    if [ -z "$REF_JAVA_HOME" ] ; then
+        REF_JAVA_HOME="$JAVA_HOME"
+    fi
+
+    if [ -z "$TST_JAVA_HOME" ] ; then
+        if [ ! -d "../../../build/win_${TST_ARCH}_${PREFERRED_COMPILER}_debug/deploy/jdk" ] ; then
+            TST_JAVA_HOME="../../../build/win_${TST_ARCH}_${ALT_COMPILER}_debug/deploy/jdk"
+        else
+            TST_JAVA_HOME="../../../build/win_${TST_ARCH}_${PREFERRED_COMPILER}_debug/deploy/jdk"
+        fi
+    fi
+
+    TST_JAVA="$TST_JAVA_HOME/jre/bin/java.exe"
+    TST_JAVA_INCLUDE="$TST_JAVA_HOME/include"
+
+    export PATH=$PATH:$VTSSUITE_ROOT/bin/lib
+fi
+
+source parse_args.sh
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/start.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_build.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_build.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_build.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_build.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,100 @@
+#! /bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov
+# @version: $Revision$
+#
+
+# STEP 5: set all environment variables needed for test building
+
+echo
+echo Test building
+
+if [ ! -d $VTSSUITE_ROOT/bin/classes ]; then
+    mkdir -p $VTSSUITE_ROOT/bin/classes
+fi
+
+if [ ! -d $VTSSUITE_ROOT/bin/lib ]; then
+    mkdir -p $VTSSUITE_ROOT/bin/lib
+fi
+
+JAVAC_OPTS=" -g -source 1.4 -target 1.4 "
+
+if [ $system = "Linux" ]; then
+    CXX=g++
+    CXXOPTIONS="-shared -fPIC"
+    TARGET_OS=LINUX
+    TARGET_OS_1=PLATFORM_POSIX
+    TARGET_OS_2=POSIX
+
+    JAVAC_OPTS=$JAVAC_OPTS" -classpath $VTSSUITE_ROOT/bin/classes "
+    JAVAC_OPTS=$JAVAC_OPTS" -d $VTSSUITE_ROOT/bin/classes "
+else
+    JAVAC_OPTS=$JAVAC_OPTS" -classpath `cygpath -w $VTSSUITE_ROOT/bin/classes`"
+    JAVAC_OPTS=$JAVAC_OPTS" -d `cygpath -w $VTSSUITE_ROOT/bin/classes` "
+
+    source ms_envs.sh
+fi
+
+# STEP 6.1: compile special java files
+#echo "Compiling special java-files... "
+
+#if [ $system = "Linux" ]; then
+#    $REF_JAVA_HOME/bin/javac $JAVAC_OPTS $VTSSUITE_ROOT/share/*.java
+#else
+
+#    $REF_JAVA_HOME/bin/javac.exe $JAVAC_OPTS `cygpath -w $VTSSUITE_ROOT/share/*.java`
+#fi
+
+# STEP 6.2: build test (compile java file(s) and creade native
+#           lib (dll/so) for each test)
+for tst in $testname; do
+
+    echo " "
+
+    ${FIND} $VTSSUITE_ROOT -type d -name $tst | while read line;
+    do
+        if [ $system = "Linux" ]; then               ####Linux
+            if [ -e "$line/${tst}.java" ] ; then
+                echo "Compiling file ${tst}.java"
+                $REF_JAVA_HOME/bin/javac $JAVAC_OPTS $line/${tst}.java
+            else
+                echo "Java file for this test is not found."
+            fi
+
+            if [ -e "$line/${tst}.cpp" ] ; then
+                echo "Compiling file ${tst}.cpp ---> $C_COMPILER"
+
+                $C_COMPILER -O1 -g -Wall \
+                    -I$VTSSUITE_ROOT/share \
+                    -I$TST_JAVA_INCLUDE \
+                    -D$TARGET_OS -D$TARGET_OS_1 -D$TARGET_OS_2 $CXXOPTIONS \
+                    -o $VTSSUITE_ROOT/bin/lib/lib${tst}.so \
+                    $VTSSUITE_ROOT/share/*.cpp $line/*.cpp
+            fi
+        else                                       ####Windows
+            if [ -e "$line/${tst}.java" ] ; then
+                echo "Compiling file ${tst}.java"
+                $REF_JAVA_HOME/bin/javac.exe $JAVAC_OPTS \
+                    `cygpath -w $line/${tst}.java`
+            else
+                echo "Java file for this test is not found."
+            fi
+
+            if [ -e "$line/${tst}.cpp" ] ; then
+
+                echo "Compiling file ${tst}.cpp ---> $C_COMPILER "
+
+                $C_COMPILER /nologo /W3 \
+                    /I`cygpath -w $VTSSUITE_ROOT/share` \
+                    /I`cygpath -w $TST_JAVA_INCLUDE` \
+                    /Fo`cygpath -w $VTSSUITE_ROOT/bin/lib/` \
+                    /Fe`cygpath -w $VTSSUITE_ROOT/bin/lib/${tst}` \
+                    /LDd /Zi `cygpath -w $line/*.cpp` \
+                    `cygpath -w \
+                        $VTSSUITE_ROOT/share/events.cpp` \
+                    `cygpath -w \
+                        $VTSSUITE_ROOT/share/utils.cpp`
+            fi
+        fi
+    done
+done

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_build.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_list.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_list.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_list.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_list.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,122 @@
+#! /bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov
+# @version: $Revision$
+#
+
+#------------------------------------------------------------------------------
+#     Array with all possible group names.
+
+group_name[1]="GetAllModules";
+group_name[2]="GetModuleInfo";
+group_name[3]="GetAllThreads";
+group_name[4]="GetThreadHandle";
+group_name[5]="GetThreadInfo";
+group_name[6]="SuspendResumeThread";
+group_name[7]="TerminateThread";
+group_name[8]="ReadMemory";
+group_name[9]="GetFrameCount";
+group_name[10]="GetStackTrace";
+group_name[11]="all";
+
+#------------------------------------------------------------------------------
+#     Array with tests devided by groups. Array index corresponds to index in
+# group_name array.
+
+#--------------------------------------
+
+group[1]="  GetAllModules01
+            GetAllModules02
+            GetAllModules03
+            GetAllModules01n
+            GetAllModules02n
+         "
+#--------------------------------------
+
+group[2]="  GetModuleInfo01
+            GetModuleInfo01n
+            GetModuleInfo02n
+         "
+#--------------------------------------
+
+group[3]="  GetAllThreads01
+            GetAllThreads02
+            GetAllThreads01n
+            GetAllThreads02n
+         "
+#--------------------------------------
+
+group[4]="  GetThreadHandle01
+            GetThreadHandle02
+            GetThreadHandle01n
+            GetThreadHandle02n
+         "
+#--------------------------------------
+
+
+group[5]="  GetThreadInfo01
+            GetThreadInfo02
+            GetThreadInfo01n
+            GetThreadInfo02n
+         "
+#--------------------------------------
+
+group[6]="  ResumeThread01
+            ResumeThread01n
+            ResumeThread02n
+            ResumeThread03n
+            SuspendThread01
+            SuspendThread02
+            SuspendThread01n
+            SuspendThread02n
+            SuspendThread03n
+         "
+#--------------------------------------
+
+group[7]="  TerminateThread01
+            TerminateThread02
+            TerminateThread01n
+            TerminateThread02n
+         "
+#--------------------------------------
+
+group[8]="  ReadMemory01
+            ReadMemory02
+            ReadMemory03
+            ReadMemory04
+         "
+#--------------------------------------
+
+group[9]="  GetFrameCount01
+            GetFrameCount02
+            GetFrameCount03
+            GetFrameCount01n
+            GetFrameCount02n
+            GetFrameCount03n
+            GetFrameCount04n
+            GetFrameCount05n
+            GetFrameCount06n
+         "
+#--------------------------------------
+
+group[10]=" GetStackTrace01
+            GetStackTrace02
+            GetStackTrace03
+            GetStackTrace04
+            GetStackTrace01n
+            GetStackTrace02n
+            GetStackTrace03n
+            GetStackTrace04n
+            GetStackTrace05n
+            GetStackTrace06n
+          "
+#--------------------------------------
+
+group[11]="
+          "
+#--------------------------------------
+
+# vim:ff=unix
+
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_list.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_run.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_run.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_run.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_run.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,32 @@
+#! /bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov
+# @version: $Revision$
+#
+
+if [ $system = "Linux" ]; then
+    export CLASSPATH="$VTSSUITE_ROOT/bin/classes"
+#    cp_options="-cp $VTSSUITE_ROOT/bin/classes -Djava.library.path=$VTSSUITE_ROOT/bin/lib"
+else
+    export CLASSPATH=`cygpath -m $VTSSUITE_ROOT/bin/classes`
+#    cp_options="-cp `cygpath -w $VTSSUITE_ROOT/bin/classes` -Djava.library.path=`cygpath -w $VTSSUITE_ROOT/bin/lib`"
+fi
+
+echo
+echo "Test running..."
+
+#CUSTOM_PROPS=-Djava.bla_bla_bla.property="bla_bla_bla_bla_bla"
+
+for tst in $testname; do
+
+    ${FIND} $VTSSUITE_ROOT/bin/classes -name "${tst}.class" | while read line;
+    do
+        AGENT="-agentlib:${tst}"
+        CLASS="ncai.funcs.${tst}"
+
+        echo $TST_JAVA $cp_options $AGENT $CLASS
+        $TST_JAVA $cp_options $AGENT $CLASS
+
+    done
+done
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/test_run.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def?rev=597138&r1=597137&r2=597138&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def Wed Nov 21 08:29:40 2007
@@ -91,6 +91,12 @@
 hythread_native_resource_is_live
 hythread_reclaim_resources
 
+hythread_suspend_thread_native
+hythread_resume_thread_native
+hythread_get_suspend_count_native
+hythread_get_thread_context
+hythread_set_thread_context
+
 hysem_post
 hysem_wait
 hysem_destroy

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp?rev=597138&r1=597137&r2=597138&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp Wed Nov 21 08:29:40 2007
@@ -93,6 +93,12 @@
 hythread_native_resource_is_live;
 hythread_reclaim_resources;
 
+hythread_suspend_thread_native;
+hythread_resume_thread_native;
+hythread_get_suspend_count_native;
+hythread_get_thread_context;
+hythread_set_thread_context;
+
 hythread_add_task;
 hythread_get_function_pointer;
 hythread_get_data_pointer;



Mime
View raw message