2009-06-18 Doug Evans * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * solib.c (solib_read_symbols): Back out patch of 2008-07-10. * symfile.c (print_symbol_loading_warnings): Renamed from print_symbol_loading, initialize to 0 instead of 1. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose || print_symbol_loading_warnings, and include the file name if not already printed. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Update name of `set print symbol-loading-warnings'. * NEWS: `set print symbol-loading' renamed to `set print symbol-loading-warnings'. * doc/gdb.texinfo: `set print symbol-loading' renamed to `set print symbol-loading-warnings'. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.313 diff -u -p -r1.313 NEWS --- NEWS 11 Jun 2009 11:57:46 -0000 1.313 +++ NEWS 18 Jun 2009 23:59:23 -0000 @@ -193,9 +193,10 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. +set print symbol-loading-warnings +show print symbol-loading-warnings + Control printing of warnings when auto-loading files without + debugging symbols. set debug timestamp show debug timestamp Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.76 diff -u -p -r1.76 main.c --- main.c 27 Apr 2009 10:24:08 -0000 1.76 +++ main.c 18 Jun 2009 23:59:23 -0000 @@ -801,14 +801,14 @@ Excess command line arguments ignored. ( open it, better only print one error message. catch_command_errors returns non-zero on success! */ if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } else { if (execarg != NULL) catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL); if (symarg != NULL) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } if (corearg && pidarg) Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.83 diff -u -p -r1.83 objfiles.c --- objfiles.c 14 May 2009 23:33:08 -0000 1.83 +++ objfiles.c 18 Jun 2009 23:59:24 -0000 @@ -677,6 +677,22 @@ objfile_relocate (struct objfile *objfil breakpoint_re_set_objfile (objfile); } +/* Return non-zero if OBJFILE has partial symbols. */ + +int +objfile_has_partial_symbols (struct objfile *objfile) +{ + return objfile->psymtabs != NULL; +} + +/* Return non-zero if OBJFILE has full symbols. */ + +int +objfile_has_full_symbols (struct objfile *objfile) +{ + return objfile->symtabs != NULL; +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ @@ -688,10 +704,8 @@ have_partial_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->psymtabs != NULL) - { - return 1; - } + if (objfile_has_partial_symbols (ofp)) + return 1; } return 0; } @@ -707,10 +721,8 @@ have_full_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->symtabs != NULL) - { - return 1; - } + if (objfile_has_full_symbols (ofp)) + return 1; } return 0; } Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.59 diff -u -p -r1.59 objfiles.h --- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59 +++ objfiles.h 18 Jun 2009 23:59:24 -0000 @@ -478,6 +478,10 @@ extern void free_all_objfiles (void); extern void objfile_relocate (struct objfile *, struct section_offsets *); +extern int objfile_has_partial_symbols (struct objfile *objfile); + +extern int objfile_has_full_symbols (struct objfile *objfile); + extern int have_partial_symbols (void); extern int have_full_symbols (void); Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.120 diff -u -p -r1.120 solib.c --- solib.c 16 Jun 2009 18:49:25 -0000 1.120 +++ solib.c 18 Jun 2009 23:59:24 -0000 @@ -502,7 +502,7 @@ solib_read_symbols (struct so_list *so, "Error while reading shared library symbols:\n"); return 0; } - if (from_tty && print_symbol_loading) + if (from_tty) printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); so->symbols_loaded = 1; return 1; Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.232 diff -u -p -r1.232 symfile.c --- symfile.c 17 Jun 2009 18:34:34 -0000 1.232 +++ symfile.c 18 Jun 2009 23:59:24 -0000 @@ -169,12 +169,10 @@ Dynamic symbol table reloading multiple value); } -/* If non-zero, gdb will notify the user when it is loading symbols - from a file. This is almost always what users will want to have happen; - but for programs with lots of dynamically linked libraries, the output - can be more noise than signal. */ +/* If non-zero, gdb will warn the user when it is auto-loading symbols + from files that don't have symbols. */ -int print_symbol_loading = 1; +static int print_symbol_loading_warnings = 0; /* If non-zero, shared library symbols will be added automatically when the inferior is created, new libraries are loaded, or when @@ -987,12 +986,9 @@ symbol_file_add_with_addrs_or_offsets (b deprecated_pre_add_symbol_hook (name); else { - if (print_symbol_loading) - { - printf_unfiltered (_("Reading symbols from %s..."), name); - wrap_here (""); - gdb_flush (gdb_stdout); - } + printf_unfiltered (_("Reading symbols from %s..."), name); + wrap_here (""); + gdb_flush (gdb_stdout); } } syms_from_objfile (objfile, addrs, offsets, num_offsets, @@ -1005,7 +1001,7 @@ symbol_file_add_with_addrs_or_offsets (b if ((flags & OBJF_READNOW) || readnow_symbol_files) { - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); wrap_here (""); @@ -1047,15 +1043,21 @@ symbol_file_add_with_addrs_or_offsets (b xfree (debugfile); } - if (!have_partial_symbols () && !have_full_symbols () - && print_symbol_loading) + /* Warn if there are no debugging symbols in OBJFILE. + Always warn if the request is from the command line, or verbose is on. + Otherwise, only warn if the user explicitly requests it: when + debugging applications that used many shared libraries (e.g. 100s), + this is more noise than signal. */ + + if ((from_tty || info_verbose || print_symbol_loading_warnings) + && !objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); if (from_tty || info_verbose) - printf_unfiltered ("..."); + printf_unfiltered ("(no debugging symbols found) ..."); else - printf_unfiltered ("\n"); + printf_unfiltered ("(no debugging symbols found in %s)\n", name); wrap_here (""); } @@ -1064,10 +1066,7 @@ symbol_file_add_with_addrs_or_offsets (b if (deprecated_post_add_symbol_hook) deprecated_post_add_symbol_hook (); else - { - if (print_symbol_loading) - printf_unfiltered (_("done.\n")); - } + printf_unfiltered (_("done.\n")); } /* We print some messages regardless of whether 'from_tty || @@ -2414,7 +2413,8 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); - if (!have_partial_symbols () && !have_full_symbols ()) + if (!objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); printf_unfiltered (_("(no debugging symbols found)\n")); @@ -4167,10 +4167,10 @@ the global debug-file directory prepende show_debug_file_directory, &setlist, &showlist); - add_setshow_boolean_cmd ("symbol-loading", no_class, - &print_symbol_loading, _("\ -Set printing of symbol loading messages."), _("\ -Show printing of symbol loading messages."), NULL, + add_setshow_boolean_cmd ("symbol-loading-warnings", no_class, + &print_symbol_loading_warnings, _("\ +Set printing of warnings when auto-loading files without symbols."), _("\ +Show printing of warnings when auto-loading files without symbols."), NULL, NULL, NULL, &setprintlist, &showprintlist); Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.600 diff -u -p -r1.600 gdb.texinfo --- doc/gdb.texinfo 15 Jun 2009 12:11:36 -0000 1.600 +++ doc/gdb.texinfo 18 Jun 2009 23:59:24 -0000 @@ -12480,21 +12480,21 @@ is printed as follows: @item show opaque-type-resolution Show whether opaque types are resolved or not. -@kindex set print symbol-loading -@cindex print messages when symbols are loaded -@item set print symbol-loading -@itemx set print symbol-loading on -@itemx set print symbol-loading off -The @code{set print symbol-loading} command allows you to enable or -disable printing of messages when @value{GDBN} loads symbols. -By default, these messages will be printed, and normally this is what -you want. Disabling these messages is useful when debugging applications -with lots of shared libraries where the quantity of output can be more -annoying than useful. +@kindex set print symbol-loading-warnings +@cindex print warnings when auto-loading files without symbols +@item set print symbol-loading-warnings +@itemx set print symbol-loading-warnings on +@itemx set print symbol-loading-warnings off +The @code{set print symbol-loading-warnings} command allows you to enable or +disable printing of warning messages when @value{GDBN} implicitly loads symbols +for files. By default, these messages are disabled. +When debugging applications with lots of shared libraries the quantity +of output can be more annoying than useful. -@kindex show print symbol-loading +@kindex show print symbol-loading-warnings @item show print symbol-loading -Show whether messages will be printed when @value{GDBN} loads symbols. +Show whether warnings will be printed when @value{GDBN} implicitly loads +symbols for files. @kindex maint print symbols @cindex symbol dump