aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-08-27 21:56:38 +0000
committerDoug Evans <dje@google.com>2009-08-27 21:56:38 +0000
commit55333a841d32ff6f428ef0b4ad7a615e0774db38 (patch)
treefaa3c9d6c4341a5269bba93a62f96f1468760b0a /gdb
parentb96fec5e9946372e442ab5fac1e3af11f4cc48ad (diff)
downloadgdb-55333a841d32ff6f428ef0b4ad7a615e0774db38.zip
gdb-55333a841d32ff6f428ef0b4ad7a615e0774db38.tar.gz
gdb-55333a841d32ff6f428ef0b4ad7a615e0774db38.tar.bz2
* NEWS: Add note on "info sharedlibrary".
Remove note on "set print symbol-loading". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * 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. * solib.c: Include interps.h. (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. Rewrite to use ui_out routines to format output. * symfile.c (print_symbol_loading): Delete. (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; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo (Symbols): Delete `set print symbol-loading'. (Files): Add note on new optional regex arg to `info sharedlibrary'.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog28
-rw-r--r--gdb/NEWS7
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo24
-rw-r--r--gdb/main.c4
-rw-r--r--gdb/objfiles.c28
-rw-r--r--gdb/objfiles.h4
-rw-r--r--gdb/solib.c126
-rw-r--r--gdb/symfile.c45
-rw-r--r--gdb/symfile.h7
10 files changed, 174 insertions, 104 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 46d3073..374be95 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,31 @@
+2009-08-27 Doug Evans <dje@google.com>
+
+ * NEWS: Add note on "info sharedlibrary".
+ Remove note on "set print symbol-loading".
+ * main.c (captured_main): Pass !batch for from_tty when calling
+ symbol_file_add_main.
+ * 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.
+ * solib.c: Include interps.h.
+ (solib_read_symbols): Back out patch of 2008-07-10.
+ Add test for info_verbose for symbol loading messages for
+ consistency with symfile.c.
+ (info_sharedlibrary_command): Handle optional parameter of regex of
+ libraries to list. Inform user of libraries without debugging info.
+ Rewrite to use ui_out routines to format output.
+ * symfile.c (print_symbol_loading): Delete.
+ (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;
+ and only check file being loaded, not all files.
+ (reread_symbols): Test file being loaded for whether it has symbols,
+ not all files.
+ (__initialize_symfile): Delete `set print symbol-loading'.
+ * symfile.h (print_symbol_loading): Delete.
+
2009-08-27 Jan Kratochvil <jan.kratochvil@redhat.com>
* varobj.c (varobj_create): Error if the specified frame was not found
diff --git a/gdb/NEWS b/gdb/NEWS
index bf98b15..179c977 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -48,6 +48,9 @@ remote targets. To use this feature, specify a system root that begins
with the `remote:' prefix, either via the `set sysroot' command or via
the `--with-sysroot' configure-time option.
+* "info sharedlibrary" now takes an optional regex of libraries to show,
+and it now reports if a shared library has no debugging information.
+
* Commands `set debug-file-directory', `set solib-search-path' and `set args'
now complete on file names.
@@ -278,10 +281,6 @@ 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 debug timestamp
show debug timestamp
Control display of timestamps with GDB debugging output.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 3e1f55c..3423ee2 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-27 Doug Evans <dje@google.com>
+
+ * gdb.texinfo (Symbols): Delete `set print symbol-loading'.
+ (Files): Add note on new optional regex arg to `info sharedlibrary'.
+
2009-08-26 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gdbint.texinfo (Releasing GDB): Fix confusing sentence
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index df88db7..cc66d12 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -12637,22 +12637,6 @@ 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 show print symbol-loading
-@item show print symbol-loading
-Show whether messages will be printed when @value{GDBN} loads symbols.
-
@kindex maint print symbols
@cindex symbol dump
@kindex maint print psymbols
@@ -13525,9 +13509,11 @@ command:
@table @code
@kindex info sharedlibrary
@kindex info share
-@item info share
-@itemx info sharedlibrary
-Print the names of the shared libraries which are currently loaded.
+@item info share @var{regex}
+@itemx info sharedlibrary @var{regex}
+Print the names of the shared libraries which are currently loaded
+that match @var{regex}. If @var{regex} is omitted then print
+all shared libraries that are loaded.
@kindex sharedlibrary
@kindex share
diff --git a/gdb/main.c b/gdb/main.c
index 8b66f78..55411a8 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -801,14 +801,14 @@ Excess command line arguments ignored. (%s%s)\n"),
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)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 109a66e..3fa68f6 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -700,6 +700,22 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
breakpoint_re_set ();
}
+/* 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. */
@@ -711,10 +727,8 @@ have_partial_symbols (void)
ALL_OBJFILES (ofp)
{
- if (ofp->psymtabs != NULL)
- {
- return 1;
- }
+ if (objfile_has_partial_symbols (ofp))
+ return 1;
}
return 0;
}
@@ -730,10 +744,8 @@ have_full_symbols (void)
ALL_OBJFILES (ofp)
{
- if (ofp->symtabs != NULL)
- {
- return 1;
- }
+ if (objfile_has_full_symbols (ofp))
+ return 1;
}
return 0;
}
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index bd9382b..6abcb0f 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -472,6 +472,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);
diff --git a/gdb/solib.c b/gdb/solib.c
index 8e86769..c7fd0fc 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -46,6 +46,7 @@
#include "readline/readline.h"
#include "remote.h"
#include "solib.h"
+#include "interps.h"
/* Architecture-specific operations. */
@@ -472,12 +473,12 @@ solib_read_symbols (struct so_list *so, int flags)
if (so->symbols_loaded)
{
- if (from_tty)
+ if (from_tty || info_verbose)
printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name);
}
else if (so->abfd == NULL)
{
- if (from_tty)
+ if (from_tty || info_verbose)
printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name);
}
else
@@ -493,7 +494,7 @@ solib_read_symbols (struct so_list *so, int flags)
"Error while reading shared library symbols:\n");
return 0;
}
- if (from_tty && print_symbol_loading)
+ if (from_tty || info_verbose)
printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
so->symbols_loaded = 1;
return 1;
@@ -784,52 +785,117 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
DESCRIPTION
Walk through the shared library list and print information
- about each attached library.
+ about each attached library matching PATTERN. If PATTERN is elided,
+ print them all.
*/
static void
-info_sharedlibrary_command (char *ignore, int from_tty)
+info_sharedlibrary_command (char *pattern, int from_tty)
{
struct so_list *so = NULL; /* link map state variable */
int header_done = 0;
+ int so_missing_debug_info = 0;
int addr_width;
+ int nr_libs;
+ struct cleanup *table_cleanup;
+ struct gdbarch *gdbarch = target_gdbarch;
+
+ if (pattern)
+ {
+ char *re_err = re_comp (pattern);
+
+ if (re_err)
+ error (_("Invalid regexp: %s"), re_err);
+ }
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
- addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4);
+ addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);
update_solib_list (from_tty, 0);
- for (so = so_list_head; so; so = so->next)
+ /* make_cleanup_ui_out_table_begin_end needs to know the number of
+ rows, so we need to make two passes over the libs. */
+
+ for (nr_libs = 0, so = so_list_head; so; so = so->next)
{
if (so->so_name[0])
{
- if (!header_done)
- {
- printf_unfiltered ("%-*s%-*s%-12s%s\n", addr_width, "From",
- addr_width, "To", "Syms Read",
- "Shared Object Library");
- header_done++;
- }
+ if (pattern && ! re_exec (so->so_name))
+ continue;
+ ++nr_libs;
+ }
+ }
+
+ table_cleanup =
+ make_cleanup_ui_out_table_begin_end (uiout, 4, nr_libs,
+ "SharedLibraryTable");
+
+ /* The "- 1" is because ui_out adds one space between columns. */
+ ui_out_table_header (uiout, addr_width - 1, ui_left, "from", "From");
+ ui_out_table_header (uiout, addr_width - 1, ui_left, "to", "To");
+ ui_out_table_header (uiout, 12 - 1, ui_left, "syms-read", "Syms Read");
+ ui_out_table_header (uiout, 0, ui_noalign,
+ "name", "Shared Object Library");
+
+ ui_out_table_body (uiout);
+
+ for (so = so_list_head; so; so = so->next)
+ {
+ struct cleanup *lib_cleanup;
- printf_unfiltered ("%-*s", addr_width,
- so->addr_high != 0
- ? hex_string_custom (
- (LONGEST) so->addr_low,
- addr_width - 4)
- : "");
- printf_unfiltered ("%-*s", addr_width,
- so->addr_high != 0
- ? hex_string_custom (
- (LONGEST) so->addr_high,
- addr_width - 4)
- : "");
- printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
- printf_unfiltered ("%s\n", so->so_name);
+ if (! so->so_name[0])
+ continue;
+ if (pattern && ! re_exec (so->so_name))
+ continue;
+
+ lib_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "lib");
+
+ if (so->addr_high != 0)
+ {
+ ui_out_field_core_addr (uiout, "from", gdbarch, so->addr_low);
+ ui_out_field_core_addr (uiout, "to", gdbarch, so->addr_high);
+ }
+ else
+ {
+ ui_out_field_skip (uiout, "from");
+ ui_out_field_skip (uiout, "to");
}
+
+ if (! ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ()))
+ && so->symbols_loaded
+ && !objfile_has_partial_symbols (so->objfile)
+ && !objfile_has_full_symbols (so->objfile))
+ {
+ so_missing_debug_info = 1;
+ ui_out_field_string (uiout, "syms-read", "Yes (*)");
+ }
+ else
+ ui_out_field_string (uiout, "syms-read",
+ so->symbols_loaded ? "Yes" : "No");
+
+ ui_out_field_string (uiout, "name", so->so_name);
+
+ ui_out_text (uiout, "\n");
+
+ do_cleanups (lib_cleanup);
}
- if (so_list_head == NULL)
+
+ do_cleanups (table_cleanup);
+
+ if (nr_libs == 0)
+ {
+ if (pattern)
+ ui_out_message (uiout, 0,
+ _("No shared libraries matched.\n"));
+ else
+ ui_out_message (uiout, 0,
+ _("No shared libraries loaded at this time.\n"));
+ }
+ else
{
- printf_unfiltered (_("No shared libraries loaded at this time.\n"));
+ if (so_missing_debug_info)
+ ui_out_message (uiout, 0,
+ _("(*): Shared library is missing debugging information.\n"));
}
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 5a50a09..2f3441c 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -171,13 +171,6 @@ Dynamic symbol table reloading multiple times in one run is %s.\n"),
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. */
-
-int print_symbol_loading = 1;
-
/* If non-zero, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
attaching to the inferior. This is almost always what users will
@@ -989,12 +982,9 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
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,
@@ -1007,7 +997,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
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 ("");
@@ -1049,15 +1039,12 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
xfree (debugfile);
}
- if (!have_partial_symbols () && !have_full_symbols ()
- && print_symbol_loading)
+ if ((from_tty || info_verbose)
+ && !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 ("...");
- else
- printf_unfiltered ("\n");
+ printf_unfiltered (_("(no debugging symbols found)..."));
wrap_here ("");
}
@@ -1066,10 +1053,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
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 ||
@@ -2438,7 +2422,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"));
@@ -4207,12 +4192,4 @@ the global debug-file directory prepended."),
NULL,
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,
- NULL,
- NULL,
- &setprintlist, &showprintlist);
}
diff --git a/gdb/symfile.h b/gdb/symfile.h
index bba242c..8c9249c 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -284,13 +284,6 @@ extern char *obconcat (struct obstack *obstackp, const char *, const char *,
/* Variables */
-/* 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. */
-
-extern int print_symbol_loading;
-
/* If non-zero, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
attaching to the inferior. This is almost always what users will