< prev index next >

src/hotspot/share/classfile/classPrinter.hpp

Print this page

37 // in debug.cpp (inside a debugger, such as gdb).
38 //
39 // The ClassPrinter::print_xxx() functions hold the ClassLoaderDataGraph_lock
40 // (and the ttyLocker if ClassPrinter::PRINT_BYTECODE is selected). A deadlock
41 // may happen if these functions are called in a context where these locks
42 // are already held. Use with caution.
43 
44 class ClassPrinter : public AllStatic {
45   class KlassPrintClosure;
46 
47 public:
48 
49   enum Mode : int {
50     PRINT_METHOD_NAME       = 1 << 0,
51     PRINT_BYTECODE          = 1 << 1,
52     PRINT_BYTECODE_ADDR     = 1 << 2,
53     PRINT_DYNAMIC           = 1 << 3, // extra information for invokedynamic (and dynamic constant ...)
54     PRINT_METHOD_HANDLE     = 1 << 4, // extra information for invokehandle
55     PRINT_CLASS_DETAILS     = 1 << 5, // print details of the C++ and Java objects that represent classes
56     PRINT_METHOD_DETAILS    = 1 << 6, // print details of the C++ objects that represent methods

57   };
58   static bool has_mode(int flags, Mode mode) {
59     return (flags & static_cast<int>(mode)) != 0;
60   }
61 
62   static void print_flags_help(outputStream* os);
63 
64   // Parameters for print_classes() and print_methods():
65   //
66   // - The patterns are matched by StringUtils::is_star_match()
67   // - class_name_pattern matches Klass::external_name(). E.g., "java/lang/Object" or "*ang/Object"
68   // - method_pattern may optionally include the signature. E.g., "wait", "wait:()V" or "*ai*t:(*)V"
69   // - flags must be OR'ed from ClassPrinter::Mode
70   //
71   //   print_classes("java/lang/Object", 0x3, os)            -> find j.l.Object and disasm all of its methods
72   //   print_methods("*ang/Object*", "wait", 0xff, os)       -> detailed disasm of all "wait" methods in j.l.Object
73   //   print_methods("*ang/Object*", "wait:(*J*)V", 0x1, os) -> list all "wait" methods in j.l.Object that have a long parameter
74   static void print_classes(const char* class_name_pattern, int flags, outputStream* os);
75   static void print_methods(const char* class_name_pattern,
76                             const char* method_pattern, int flags, outputStream* os);

37 // in debug.cpp (inside a debugger, such as gdb).
38 //
39 // The ClassPrinter::print_xxx() functions hold the ClassLoaderDataGraph_lock
40 // (and the ttyLocker if ClassPrinter::PRINT_BYTECODE is selected). A deadlock
41 // may happen if these functions are called in a context where these locks
42 // are already held. Use with caution.
43 
44 class ClassPrinter : public AllStatic {
45   class KlassPrintClosure;
46 
47 public:
48 
49   enum Mode : int {
50     PRINT_METHOD_NAME       = 1 << 0,
51     PRINT_BYTECODE          = 1 << 1,
52     PRINT_BYTECODE_ADDR     = 1 << 2,
53     PRINT_DYNAMIC           = 1 << 3, // extra information for invokedynamic (and dynamic constant ...)
54     PRINT_METHOD_HANDLE     = 1 << 4, // extra information for invokehandle
55     PRINT_CLASS_DETAILS     = 1 << 5, // print details of the C++ and Java objects that represent classes
56     PRINT_METHOD_DETAILS    = 1 << 6, // print details of the C++ objects that represent methods
57     PRINT_PROFILE           = 1 << 7, // print MDO contents
58   };
59   static bool has_mode(int flags, Mode mode) {
60     return (flags & static_cast<int>(mode)) != 0;
61   }
62 
63   static void print_flags_help(outputStream* os);
64 
65   // Parameters for print_classes() and print_methods():
66   //
67   // - The patterns are matched by StringUtils::is_star_match()
68   // - class_name_pattern matches Klass::external_name(). E.g., "java/lang/Object" or "*ang/Object"
69   // - method_pattern may optionally include the signature. E.g., "wait", "wait:()V" or "*ai*t:(*)V"
70   // - flags must be OR'ed from ClassPrinter::Mode
71   //
72   //   print_classes("java/lang/Object", 0x3, os)            -> find j.l.Object and disasm all of its methods
73   //   print_methods("*ang/Object*", "wait", 0xff, os)       -> detailed disasm of all "wait" methods in j.l.Object
74   //   print_methods("*ang/Object*", "wait:(*J*)V", 0x1, os) -> list all "wait" methods in j.l.Object that have a long parameter
75   static void print_classes(const char* class_name_pattern, int flags, outputStream* os);
76   static void print_methods(const char* class_name_pattern,
77                             const char* method_pattern, int flags, outputStream* os);
< prev index next >