41 #if INCLUDE_JVMTI |
41 #if INCLUDE_JVMTI |
42 # include "oops/oop.inline.hpp" |
42 # include "oops/oop.inline.hpp" |
43 # include "prims/jvmtiEnter.hpp" |
43 # include "prims/jvmtiEnter.hpp" |
44 # include "prims/jvmtiRawMonitor.hpp" |
44 # include "prims/jvmtiRawMonitor.hpp" |
45 # include "prims/jvmtiUtil.hpp" |
45 # include "prims/jvmtiUtil.hpp" |
46 |
|
47 // There are known-bad format/arg pairings in the code generated by this file. |
|
48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
|
49 |
46 |
50 </xsl:text> |
47 </xsl:text> |
51 |
48 |
52 <xsl:if test="$trace = 'Trace'"> |
49 <xsl:if test="$trace = 'Trace'"> |
53 <xsl:text> |
50 <xsl:text> |
541 JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env); |
538 JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env); |
542 if (!jvmti_env->is_valid()) { |
539 if (!jvmti_env->is_valid()) { |
543 </xsl:text> |
540 </xsl:text> |
544 <xsl:if test="$trace='Trace'"> |
541 <xsl:if test="$trace='Trace'"> |
545 <xsl:text> if (trace_flags) { |
542 <xsl:text> if (trace_flags) { |
546 tty->print_cr("JVMTI [%s] %s %s env=%d", curr_thread_name, func_name, |
543 tty->print_cr("JVMTI [%s] %s %s env=" PTR_FORMAT, curr_thread_name, func_name, |
547 JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), env); |
544 JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env)); |
548 } |
545 } |
549 </xsl:text> |
546 </xsl:text> |
550 </xsl:if> |
547 </xsl:if> |
551 <xsl:text> return JVMTI_ERROR_INVALID_ENVIRONMENT; |
548 <xsl:text> return JVMTI_ERROR_INVALID_ENVIRONMENT; |
552 } |
549 } |
758 } |
755 } |
759 if (!rmonitor->is_valid()) { |
756 if (!rmonitor->is_valid()) { |
760 </xsl:text> |
757 </xsl:text> |
761 <xsl:apply-templates select=".." mode="traceError"> |
758 <xsl:apply-templates select=".." mode="traceError"> |
762 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param> |
759 <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param> |
763 <xsl:with-param name="comment"> - not a raw monitor 0x%x</xsl:with-param> |
760 <xsl:with-param name="comment"> - not a raw monitor " PTR_FORMAT "</xsl:with-param> |
764 <xsl:with-param name="extraValue">, rmonitor</xsl:with-param> |
761 <xsl:with-param name="extraValue">, p2i(rmonitor)</xsl:with-param> |
765 </xsl:apply-templates> |
762 </xsl:apply-templates> |
766 <xsl:text> |
763 <xsl:text> |
767 } |
764 } |
768 </xsl:text> |
765 </xsl:text> |
769 </xsl:template> |
766 </xsl:template> |
775 <xsl:text>); |
772 <xsl:text>); |
776 if (thread_oop == NULL) { |
773 if (thread_oop == NULL) { |
777 </xsl:text> |
774 </xsl:text> |
778 <xsl:apply-templates select=".." mode="traceError"> |
775 <xsl:apply-templates select=".." mode="traceError"> |
779 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> |
776 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> |
780 <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = 0x%x</xsl:with-param> |
777 <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = " PTR_FORMAT "</xsl:with-param> |
781 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
778 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
782 </xsl:apply-templates> |
779 </xsl:apply-templates> |
783 <xsl:text> |
780 <xsl:text> |
784 } |
781 } |
785 if (!thread_oop->is_a(SystemDictionary::Thread_klass())) { |
782 if (!thread_oop->is_a(SystemDictionary::Thread_klass())) { |
786 </xsl:text> |
783 </xsl:text> |
787 <xsl:apply-templates select=".." mode="traceError"> |
784 <xsl:apply-templates select=".." mode="traceError"> |
788 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> |
785 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> |
789 <xsl:with-param name="comment"> - oop is not a thread - jthread = 0x%x</xsl:with-param> |
786 <xsl:with-param name="comment"> - oop is not a thread - jthread = " PTR_FORMAT "</xsl:with-param> |
790 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
787 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
791 </xsl:apply-templates> |
788 </xsl:apply-templates> |
792 <xsl:text> |
789 <xsl:text> |
793 } |
790 } |
794 java_thread = java_lang_Thread::thread(thread_oop); |
791 java_thread = java_lang_Thread::thread(thread_oop); |
795 if (java_thread == NULL) { |
792 if (java_thread == NULL) { |
796 </xsl:text> |
793 </xsl:text> |
797 <xsl:apply-templates select=".." mode="traceError"> |
794 <xsl:apply-templates select=".." mode="traceError"> |
798 <xsl:with-param name="err"> |
795 <xsl:with-param name="err"> |
799 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text> |
796 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text> |
800 </xsl:with-param> |
797 </xsl:with-param> |
801 <xsl:with-param name="comment"> - not a Java thread - jthread = 0x%x</xsl:with-param> |
798 <xsl:with-param name="comment"> - not a Java thread - jthread = " PTR_FORMAT "</xsl:with-param> |
802 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
799 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
803 </xsl:apply-templates> |
800 </xsl:apply-templates> |
804 <xsl:text> |
801 <xsl:text> |
805 } |
802 } |
806 </xsl:text> |
803 </xsl:text> |
807 </xsl:template> |
804 </xsl:template> |
840 <xsl:text> |
837 <xsl:text> |
841 if (depth < 0) { |
838 if (depth < 0) { |
842 </xsl:text> |
839 </xsl:text> |
843 <xsl:apply-templates select=".." mode="traceError"> |
840 <xsl:apply-templates select=".." mode="traceError"> |
844 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param> |
841 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param> |
845 <xsl:with-param name="comment"> - negative depth - jthread = 0x%x</xsl:with-param> |
842 <xsl:with-param name="comment"> - negative depth - jthread = " INT32_FORMAT "</xsl:with-param> |
846 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
843 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
847 </xsl:apply-templates> |
844 </xsl:apply-templates> |
848 <xsl:text> |
845 <xsl:text> |
849 } |
846 } |
850 </xsl:text> |
847 </xsl:text> |
859 <xsl:text>); |
856 <xsl:text>); |
860 if (k_mirror == NULL) { |
857 if (k_mirror == NULL) { |
861 </xsl:text> |
858 </xsl:text> |
862 <xsl:apply-templates select=".." mode="traceError"> |
859 <xsl:apply-templates select=".." mode="traceError"> |
863 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
860 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
864 <xsl:with-param name="comment"> - resolved to NULL - jclass = 0x%x</xsl:with-param> |
861 <xsl:with-param name="comment"> - resolved to NULL - jclass = " PTR_FORMAT "</xsl:with-param> |
865 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
862 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
866 </xsl:apply-templates> |
863 </xsl:apply-templates> |
867 <xsl:text> |
864 <xsl:text> |
868 } |
865 } |
869 if (!k_mirror->is_a(SystemDictionary::Class_klass())) { |
866 if (!k_mirror->is_a(SystemDictionary::Class_klass())) { |
870 </xsl:text> |
867 </xsl:text> |
871 <xsl:apply-templates select=".." mode="traceError"> |
868 <xsl:apply-templates select=".." mode="traceError"> |
872 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
869 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
873 <xsl:with-param name="comment"> - not a class - jclass = 0x%x</xsl:with-param> |
870 <xsl:with-param name="comment"> - not a class - jclass = " PTR_FORMAT "</xsl:with-param> |
874 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
871 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
875 </xsl:apply-templates> |
872 </xsl:apply-templates> |
876 <xsl:text> |
873 <xsl:text> |
877 } |
874 } |
878 </xsl:text> |
875 </xsl:text> |
879 <xsl:if test="count(@method|@field)=1"> |
876 <xsl:if test="count(@method|@field)=1"> |
880 <xsl:text> |
877 <xsl:text> |
881 if (java_lang_Class::is_primitive(k_mirror)) { |
878 if (java_lang_Class::is_primitive(k_mirror)) { |
882 </xsl:text> |
879 </xsl:text> |
883 <xsl:apply-templates select=".." mode="traceError"> |
880 <xsl:apply-templates select=".." mode="traceError"> |
884 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
881 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
885 <xsl:with-param name="comment"> - is a primitive class - jclass = 0x%x</xsl:with-param> |
882 <xsl:with-param name="comment"> - is a primitive class - jclass = " PTR_FORMAT "</xsl:with-param> |
886 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
883 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
887 </xsl:apply-templates> |
884 </xsl:apply-templates> |
888 <xsl:text> |
885 <xsl:text> |
889 } |
886 } |
890 Klass* k_oop = java_lang_Class::as_Klass(k_mirror); |
887 Klass* k_oop = java_lang_Class::as_Klass(k_mirror); |
891 if (k_oop == NULL) { |
888 if (k_oop == NULL) { |
892 </xsl:text> |
889 </xsl:text> |
893 <xsl:apply-templates select=".." mode="traceError"> |
890 <xsl:apply-templates select=".." mode="traceError"> |
894 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
891 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param> |
895 <xsl:with-param name="comment"> - no Klass* - jclass = 0x%x</xsl:with-param> |
892 <xsl:with-param name="comment"> - no Klass* - jclass = " PTR_FORMAT "</xsl:with-param> |
896 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> |
893 <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param> |
897 </xsl:apply-templates> |
894 </xsl:apply-templates> |
898 <xsl:text> |
895 <xsl:text> |
899 } |
896 } |
900 </xsl:text> |
897 </xsl:text> |
901 </xsl:if> |
898 </xsl:if> |
1032 <xsl:template match="inbuf" mode="traceInFormat"> |
1029 <xsl:template match="inbuf" mode="traceInFormat"> |
1033 <xsl:param name="name"/> |
1030 <xsl:param name="name"/> |
1034 <xsl:text> </xsl:text> |
1031 <xsl:text> </xsl:text> |
1035 <xsl:value-of select="$name"/> |
1032 <xsl:value-of select="$name"/> |
1036 <xsl:variable name="child" select="child::*[position()=1]"/> |
1033 <xsl:variable name="child" select="child::*[position()=1]"/> |
1037 <xsl:choose> |
1034 <xsl:choose>g |
1038 <xsl:when test="name($child)='char'"> |
1035 <xsl:when test="name($child)='char'"> |
1039 <xsl:text>='%s'</xsl:text> |
1036 <xsl:text>='%s'</xsl:text> |
1040 </xsl:when> |
1037 </xsl:when> |
1041 <xsl:otherwise> |
1038 <xsl:otherwise> |
1042 <xsl:text>=0x%x</xsl:text> |
1039 <xsl:text>=" PTR_FORMAT "</xsl:text> |
1043 </xsl:otherwise> |
1040 </xsl:otherwise> |
1044 </xsl:choose> |
1041 </xsl:choose> |
1045 </xsl:template> |
1042 </xsl:template> |
1046 |
1043 |
1047 <xsl:template match="inbuf" mode="traceInValue"> |
1044 <xsl:template match="inbuf" mode="traceInValue"> |
1048 <xsl:param name="name"/> |
1045 <xsl:param name="name"/> |
1049 <xsl:text>, </xsl:text> |
1046 <xsl:text>, </xsl:text> |
1050 <xsl:value-of select="$name"/> |
1047 <xsl:variable name="child" select="child::*[position()=1]"/> |
|
1048 <xsl:choose> |
|
1049 <xsl:when test="name($child)='char'"> |
|
1050 <xsl:value-of select="$name"/> |
|
1051 </xsl:when> |
|
1052 <xsl:otherwise> |
|
1053 p2i(<xsl:value-of select="$name"/>) |
|
1054 </xsl:otherwise> |
|
1055 </xsl:choose> |
1051 </xsl:template> |
1056 </xsl:template> |
1052 |
1057 |
1053 <xsl:template match="ptrtype" mode="traceInFormat"> |
1058 <xsl:template match="ptrtype" mode="traceInFormat"> |
1054 <xsl:param name="name"/> |
1059 <xsl:param name="name"/> |
1055 <xsl:variable name="child" select="child::*[position()=1]"/> |
1060 <xsl:variable name="child" select="child::*[position()=1]"/> |
1056 <xsl:choose> |
1061 <xsl:choose> |
1057 <xsl:when test="name($child)='jclass'"> |
1062 <xsl:when test="name($child)='jclass'"> |
1058 <xsl:text> </xsl:text> |
1063 <xsl:text> </xsl:text> |
1059 <xsl:value-of select="$name"/> |
1064 <xsl:value-of select="$name"/> |
1060 <xsl:text>=0x%x</xsl:text> |
1065 <xsl:text>=" PTR_FORMAT "</xsl:text> |
1061 </xsl:when> |
1066 </xsl:when> |
1062 <xsl:otherwise> |
1067 <xsl:otherwise> |
1063 <xsl:apply-templates select="$child" mode="traceInFormat"/> |
1068 <xsl:apply-templates select="$child" mode="traceInFormat"/> |
1064 </xsl:otherwise> |
1069 </xsl:otherwise> |
1065 </xsl:choose> |
1070 </xsl:choose> |
1069 <xsl:param name="name"/> |
1074 <xsl:param name="name"/> |
1070 <xsl:variable name="child" select="child::*[position()=1]"/> |
1075 <xsl:variable name="child" select="child::*[position()=1]"/> |
1071 <xsl:choose> |
1076 <xsl:choose> |
1072 <xsl:when test="name($child)='jclass'"> |
1077 <xsl:when test="name($child)='jclass'"> |
1073 <xsl:text>, </xsl:text> |
1078 <xsl:text>, </xsl:text> |
1074 <xsl:value-of select="$name"/> |
1079 p2i(<xsl:value-of select="$name"/>) |
1075 </xsl:when> |
1080 </xsl:when> |
1076 <xsl:otherwise> |
1081 <xsl:otherwise> |
1077 <xsl:apply-templates select="$child" mode="traceInValue"/> |
1082 <xsl:apply-templates select="$child" mode="traceInValue"/> |
1078 </xsl:otherwise> |
1083 </xsl:otherwise> |
1079 </xsl:choose> |
1084 </xsl:choose> |
1081 |
1086 |
1082 <xsl:template match="inptr" mode="traceInFormat"> |
1087 <xsl:template match="inptr" mode="traceInFormat"> |
1083 <xsl:param name="name"/> |
1088 <xsl:param name="name"/> |
1084 <xsl:text> </xsl:text> |
1089 <xsl:text> </xsl:text> |
1085 <xsl:value-of select="$name"/> |
1090 <xsl:value-of select="$name"/> |
1086 <xsl:text>=0x%x</xsl:text> |
1091 <xsl:text>=" PTR_FORMAT "</xsl:text> |
1087 </xsl:template> |
1092 </xsl:template> |
1088 |
1093 |
1089 <xsl:template match="inptr" mode="traceInValue"> |
1094 <xsl:template match="inptr" mode="traceInValue"> |
1090 <xsl:param name="name"/> |
1095 <xsl:param name="name"/> |
1091 <xsl:text>, </xsl:text> |
1096 <xsl:text>, </xsl:text> |
1092 <xsl:value-of select="$name"/> |
1097 p2i(<xsl:value-of select="$name"/>) |
1093 </xsl:template> |
1098 </xsl:template> |
1094 |
1099 |
1095 <xsl:template match="jrawMonitorID|jfieldID" mode="traceInFormat"> |
1100 <xsl:template match="jrawMonitorID|jfieldID" mode="traceInFormat"> |
1096 <xsl:param name="name"/> |
1101 <xsl:param name="name"/> |
1097 <xsl:text> </xsl:text> |
1102 <xsl:text> </xsl:text> |
1212 </xsl:choose> |
1217 </xsl:choose> |
1213 </xsl:otherwise> |
1218 </xsl:otherwise> |
1214 </xsl:choose> |
1219 </xsl:choose> |
1215 </xsl:template> |
1220 </xsl:template> |
1216 |
1221 |
1217 <xsl:template match="jint|jlocation" mode="traceInFormat"> |
1222 <xsl:template match="jint" mode="traceInFormat"> |
1218 <xsl:param name="name"/> |
1223 <xsl:param name="name"/> |
1219 <xsl:text> </xsl:text> |
1224 <xsl:text> </xsl:text> |
1220 <xsl:value-of select="$name"/> |
1225 <xsl:value-of select="$name"/> |
1221 <xsl:text>=%d</xsl:text> |
1226 <xsl:text>=" INT32_FORMAT "</xsl:text> |
|
1227 </xsl:template> |
|
1228 |
|
1229 <xsl:template match="jlocation" mode="traceInFormat"> |
|
1230 <xsl:param name="name"/> |
|
1231 <xsl:text> </xsl:text> |
|
1232 <xsl:value-of select="$name"/> |
|
1233 <xsl:text>=" INT64_FORMAT "</xsl:text> |
1222 </xsl:template> |
1234 </xsl:template> |
1223 |
1235 |
1224 <xsl:template match="jlong" mode="traceInFormat"> |
1236 <xsl:template match="jlong" mode="traceInFormat"> |
1225 <xsl:param name="name"/> |
1237 <xsl:param name="name"/> |
1226 <xsl:text> </xsl:text> |
1238 <xsl:text> </xsl:text> |
1227 <xsl:value-of select="$name"/> |
1239 <xsl:value-of select="$name"/> |
1228 <xsl:text>=%ld</xsl:text> |
1240 <xsl:text>=" INT64_FORMAT "</xsl:text> |
1229 </xsl:template> |
1241 </xsl:template> |
1230 |
1242 |
1231 <xsl:template match="size_t" mode="traceInFormat"> |
1243 <xsl:template match="size_t" mode="traceInFormat"> |
1232 <xsl:param name="name"/> |
1244 <xsl:param name="name"/> |
1233 <xsl:text> </xsl:text> |
1245 <xsl:text> </xsl:text> |