@@ -17,6 +17,24 @@ static inline bool isDigit(char c) {
1717}
1818
1919
20+ // Based on: https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#:~:text=Table%C2%A04.5.%C2%A0Method%20access%20and%20property%20flags
21+ // Good practice order from: https://checkstyle.sourceforge.io/config_modifier.html#ModifierOrder
22+ const static std::pair<int , std::string> access_flags [] = {
23+ std::make_pair (0x0001 , " public" ),
24+ std::make_pair (0x0002 , " private" ),
25+ std::make_pair (0x0004 , " protected" ),
26+ std::make_pair (0x0400 , " abstract" ),
27+ std::make_pair (0x0008 , " static" ),
28+ std::make_pair (0x0010 , " final" ),
29+ std::make_pair (0x0020 , " synchronized" ),
30+ std::make_pair (0x0100 , " native" ),
31+ std::make_pair (0x0800 , " strict" ),
32+ std::make_pair (0x0040 , " bridge" ),
33+ std::make_pair (0x0080 , " varargs" ),
34+ std::make_pair (0x1000 , " synthetic" ),
35+ };
36+
37+
2038Matcher::Matcher (const char * pattern) {
2139 if (pattern[0 ] == ' *' ) {
2240 _type = MATCH_ENDS_WITH;
@@ -84,7 +102,7 @@ FrameName::FrameName(Arguments& args, int style, int epoch, Mutex& thread_names_
84102{
85103 // Require printf to use standard C format regardless of system locale
86104 _saved_locale = uselocale (newlocale (LC_NUMERIC_MASK, " C" , (locale_t )0 ));
87-
105+ _includemm = args. _includemm ;
88106 buildFilter (_include, args._buf , args._include );
89107 buildFilter (_exclude, args._buf , args._exclude );
90108
@@ -165,6 +183,7 @@ void FrameName::javaMethodName(jmethodID method) {
165183 char * class_name = NULL ;
166184 char * method_name = NULL ;
167185 char * method_sig = NULL ;
186+ jint modifiers = 0 ;
168187
169188 jvmtiEnv* jvmti = VM::jvmti ();
170189 jvmtiError err;
@@ -174,6 +193,16 @@ void FrameName::javaMethodName(jmethodID method) {
174193 (err = jvmti->GetClassSignature (method_class, &class_name, NULL )) == 0 ) {
175194 // Trim 'L' and ';' off the class descriptor like 'Ljava/lang/Object;'
176195 javaClassName (class_name + 1 , strlen (class_name) - 2 , _style);
196+ if (_includemm) {
197+ jvmti->GetMethodModifiers (method, &modifiers);
198+ std::string modifiers_to_append = " " ;
199+ for (int i=0 ; i<(sizeof (access_flags) / sizeof (access_flags[0 ])); i++) {
200+ if (modifiers & access_flags[i].first ) {
201+ modifiers_to_append.append (access_flags[i].second + " " );
202+ }
203+ }
204+ _str.insert (0 , modifiers_to_append);
205+ }
177206 _str.append (" ." ).append (method_name);
178207 if (_style & STYLE_SIGNATURES) {
179208 if (_style & STYLE_NO_SEMICOLON) {
0 commit comments