-void
-maintenance_print_psymbols (char *args, int from_tty)
-{
- char **argv;
- struct ui_file *outfile;
- struct cleanup *cleanups;
- char *symname = NULL;
- char *filename = DEV_TTY;
- struct objfile *objfile;
- struct partial_symtab *ps;
-
- dont_repeat ();
-
- if (args == NULL)
- {
- error ("print-psymbols takes an output file name and optional symbol file name");
- }
- else if ((argv = buildargv (args)) == NULL)
- {
- nomem (0);
- }
- cleanups = make_cleanup_freeargv (argv);
-
- if (argv[0] != NULL)
- {
- filename = argv[0];
- /* If a second arg is supplied, it is a source file name to match on */
- if (argv[1] != NULL)
- {
- symname = argv[1];
- }
- }
-
- filename = tilde_expand (filename);
- make_cleanup (xfree, filename);
-
- outfile = gdb_fopen (filename, FOPEN_WT);
- if (outfile == 0)
- perror_with_name (filename);
- make_cleanup_ui_file_delete (outfile);
-
- immediate_quit++;
- ALL_PSYMTABS (objfile, ps)
- if (symname == NULL || (STREQ (symname, ps->filename)))
- dump_psymtab (objfile, ps, outfile);
- immediate_quit--;
- do_cleanups (cleanups);
-}
-
-static void
-print_partial_symbols (struct partial_symbol **p, int count, char *what,
- struct ui_file *outfile)
-{
- fprintf_filtered (outfile, " %s partial symbols:\n", what);
- while (count-- > 0)
- {
- fprintf_filtered (outfile, " `%s'", DEPRECATED_SYMBOL_NAME (*p));
- if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
- {
- fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
- }
- fputs_filtered (", ", outfile);
- switch (SYMBOL_NAMESPACE (*p))
- {
- case UNDEF_NAMESPACE:
- fputs_filtered ("undefined namespace, ", outfile);
- break;
- case VAR_NAMESPACE:
- /* This is the usual thing -- don't print it */
- break;
- case STRUCT_NAMESPACE:
- fputs_filtered ("struct namespace, ", outfile);
- break;
- case LABEL_NAMESPACE:
- fputs_filtered ("label namespace, ", outfile);
- break;
- default:
- fputs_filtered ("<invalid namespace>, ", outfile);
- break;
- }
- switch (SYMBOL_CLASS (*p))
- {
- case LOC_UNDEF:
- fputs_filtered ("undefined", outfile);
- break;
- case LOC_CONST:
- fputs_filtered ("constant int", outfile);
- break;
- case LOC_STATIC:
- fputs_filtered ("static", outfile);
- break;
- case LOC_INDIRECT:
- fputs_filtered ("extern global", outfile);
- break;
- case LOC_REGISTER:
- fputs_filtered ("register", outfile);
- break;
- case LOC_ARG:
- fputs_filtered ("pass by value", outfile);
- break;
- case LOC_REF_ARG:
- fputs_filtered ("pass by reference", outfile);
- break;
- case LOC_REGPARM:
- fputs_filtered ("register parameter", outfile);
- break;
- case LOC_REGPARM_ADDR:
- fputs_filtered ("register address parameter", outfile);
- break;
- case LOC_LOCAL:
- fputs_filtered ("stack parameter", outfile);
- break;
- case LOC_TYPEDEF:
- fputs_filtered ("type", outfile);
- break;
- case LOC_LABEL:
- fputs_filtered ("label", outfile);
- break;
- case LOC_BLOCK:
- fputs_filtered ("function", outfile);
- break;
- case LOC_CONST_BYTES:
- fputs_filtered ("constant bytes", outfile);
- break;
- case LOC_LOCAL_ARG:
- fputs_filtered ("shuffled arg", outfile);
- break;
- case LOC_UNRESOLVED:
- fputs_filtered ("unresolved", outfile);
- break;
- case LOC_OPTIMIZED_OUT:
- fputs_filtered ("optimized out", outfile);
- break;
- case LOC_COMPUTED:
- case LOC_COMPUTED_ARG:
- fputs_filtered ("computed at runtime", outfile);
- break;
- default:
- fputs_filtered ("<invalid location>", outfile);
- break;
- }
- fputs_filtered (", ", outfile);
- print_address_numeric (SYMBOL_VALUE_ADDRESS (*p), 1, outfile);
- fprintf_filtered (outfile, "\n");
- p++;
- }
-}
-