/* Program to dump out a Java(TM) .class file.
Functionally similar to Sun's javap.
- Copyright (C) 1996, 97-99, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int flag_print_methods = 1;
int flag_print_attributes = 1;
+/* When non zero, warn when source file is newer than matching class
+ file. */
+int flag_newer = 1;
+
/* Print names of classes that have a "main" method. */
int flag_print_main = 0;
else \
JCF_SKIP (jcf, 4 * n); }
+#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) \
+{ int n = (COUNT); \
+ COMMON_HANDLE_ATTRIBUTE(jcf, attribute_name, attribute_length); \
+ while (n--) \
+ { \
+ uint16 inner_class_info_index = JCF_readu2 (jcf); \
+ uint16 outer_class_info_index = JCF_readu2 (jcf); \
+ uint16 inner_name_index = JCF_readu2 (jcf); \
+ uint16 inner_class_access_flags = JCF_readu2 (jcf); \
+ \
+ if (flag_print_class_info) \
+ { \
+ fprintf (out, "\n class: "); \
+ if (flag_print_constant_pool) \
+ fprintf (out, "%d=", inner_class_info_index); \
+ print_constant_terse (out, jcf, \
+ inner_class_info_index, CONSTANT_Class); \
+ fprintf (out, " (%d=", inner_name_index); \
+ print_constant_terse (out, jcf, inner_name_index, CONSTANT_Utf8); \
+ fprintf (out, "), access flags: 0x%x", inner_class_access_flags); \
+ print_access_flags (out, inner_class_access_flags, 'c'); \
+ fprintf (out, ", outer class: "); \
+ if (flag_print_constant_pool) \
+ fprintf (out, "%d=", outer_class_info_index); \
+ print_constant_terse (out, jcf, \
+ outer_class_info_index, CONSTANT_Class); \
+ } \
+ } \
+ if (flag_print_class_info) \
+ fputc ('\n', out); \
+}
+
#define PROCESS_OTHER_ATTRIBUTE(JCF, INDEX, LENGTH) \
{ COMMON_HANDLE_ATTRIBUTE(JCF, INDEX, LENGTH); \
fputc ('\n', out); JCF_SKIP (JCF, LENGTH); }
if (flags & ACC_PUBLIC) fprintf (stream, " public");
if (flags & ACC_PRIVATE) fprintf (stream, " private");
if (flags & ACC_PROTECTED) fprintf (stream, " protected");
+ if (flags & ACC_ABSTRACT) fprintf (stream, " abstract");
if (flags & ACC_STATIC) fprintf (stream, " static");
if (flags & ACC_FINAL) fprintf (stream, " final");
+ if (flags & ACC_TRANSIENT) fprintf (stream, " transient");
+ if (flags & ACC_VOLATILE) fprintf (stream, " volatile");
+ if (flags & ACC_NATIVE) fprintf (stream, " native");
if (flags & ACC_SYNCHRONIZED)
{
if (context == 'c')
else
fprintf (stream, " synchronized");
}
- if (flags & ACC_VOLATILE) fprintf (stream, " volatile");
- if (flags & ACC_TRANSIENT) fprintf (stream, " transient");
- if (flags & ACC_NATIVE) fprintf (stream, " native");
if (flags & ACC_INTERFACE) fprintf (stream, " interface");
- if (flags & ACC_ABSTRACT) fprintf (stream, " abstract");
+ if (flags & ACC_STRICT) fprintf (stream, " strictfp");
}
case CONSTANT_Float:
{
jfloat fnum = JPOOL_FLOAT (jcf, index);
- fprintf (out, "%s%.10g", verbosity > 1 ? "Float " : "", (double) fnum);
+ fprintf (out, "%s%.10g", verbosity > 0 ? "Float " : "", (double) fnum);
if (verbosity > 1)
fprintf (out, ", bits = 0x%08lx", (long) (* (int32 *) &fnum));
break;
case CONSTANT_Double:
{
jdouble dnum = JPOOL_DOUBLE (jcf, index);
- fprintf (out, "%s%.20g", verbosity > 1 ? "Double " : "", dnum);
+ fprintf (out, "%s%.20g", verbosity > 0 ? "Double " : "", dnum);
if (verbosity > 1)
{
int32 hi, lo;
/* This is used to mark options with no short value. */
#define LONG_OPT(Num) ((Num) + 128)
-#define OPT_classpath LONG_OPT (0)
-#define OPT_CLASSPATH LONG_OPT (1)
-#define OPT_HELP LONG_OPT (2)
-#define OPT_VERSION LONG_OPT (3)
-#define OPT_JAVAP LONG_OPT (4)
+#define OPT_classpath LONG_OPT (0)
+#define OPT_CLASSPATH OPT_classpath
+#define OPT_bootclasspath LONG_OPT (1)
+#define OPT_extdirs LONG_OPT (2)
+#define OPT_HELP LONG_OPT (3)
+#define OPT_VERSION LONG_OPT (4)
+#define OPT_JAVAP LONG_OPT (5)
-static struct option options[] =
+static const struct option options[] =
{
- { "classpath", required_argument, NULL, OPT_classpath },
- { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
- { "help", no_argument, NULL, OPT_HELP },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPT_VERSION },
- { "javap", no_argument, NULL, OPT_JAVAP },
- { "print-main", no_argument, &flag_print_main, 1 },
- { NULL, no_argument, NULL, 0 }
+ { "classpath", required_argument, NULL, OPT_classpath },
+ { "bootclasspath", required_argument, NULL, OPT_bootclasspath },
+ { "extdirs", required_argument, NULL, OPT_extdirs },
+ { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "javap", no_argument, NULL, OPT_JAVAP },
+ { "print-main", no_argument, &flag_print_main, 1 },
+ { NULL, no_argument, NULL, 0 }
};
static void
printf (" --javap Generate output in `javap' format\n");
printf ("\n");
printf (" --classpath PATH Set path to find .class files\n");
- printf (" --CLASSPATH PATH Set path to find .class files\n");
printf (" -IDIR Append directory to class path\n");
+ printf (" --bootclasspath PATH Override built-in class path\n");
+ printf (" --extdirs PATH Set extensions directory path\n");
printf (" -o FILE Set output file name\n");
printf ("\n");
printf (" --help Print this help, then exit\n");
static void
version ()
{
- printf ("jcf-dump (%s)\n\n", version_string);
- printf ("Copyright (C) 1998, 1999 Free Software Foundation, Inc.\n");
+ printf ("jcf-dump (GCC) %s\n\n", version_string);
+ printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
printf ("This is free software; see the source for copying conditions. There is NO\n");
printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
exit (0);
jcf_path_classpath_arg (optarg);
break;
- case OPT_CLASSPATH:
- jcf_path_CLASSPATH_arg (optarg);
+ case OPT_bootclasspath:
+ jcf_path_bootclasspath_arg (optarg);
+ break;
+
+ case OPT_extdirs:
+ jcf_path_extdirs_arg (optarg);
break;
case OPT_HELP:
case OPT_JAVAP:
flag_javap_compatible++;
flag_print_constant_pool = 0;
+ flag_print_attributes = 0;
break;
default:
usage ();
}
- jcf_path_seal ();
+ jcf_path_seal (verbose);
if (flag_print_main)
{
#define SPECIAL_IINC(OPERAND_TYPE) \
i = saw_wide ? IMMEDIATE_u2 : IMMEDIATE_u1; \
fprintf (out, " %d", i); \
- INT_temp = saw_wide ? IMMEDIATE_s2 : IMMEDIATE_s1; \
+ i = saw_wide ? IMMEDIATE_s2 : IMMEDIATE_s1; \
saw_wide = 0; \
fprintf (out, " %d", i)