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