/* Generic symbol file reading for the GNU debugger, GDB.
- Copyright (C) 1990-2019 Free Software Foundation, Inc.
+ Copyright (C) 1990-2020 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
#include "completer.h"
#include "bcache.h"
#include "hashtab.h"
-#include "readline/readline.h"
+#include "readline/tilde.h"
#include "block.h"
#include "observable.h"
#include "exec.h"
int i;
/* Find lowest loadable section to be used as starting point for
- continguous sections. */
+ contiguous sections. */
lower_sect = NULL;
bfd_map_over_sections (abfd, find_lowest_section, &lower_sect);
if (lower_sect == NULL)
}
}
if ((add_flags & SYMFILE_NO_READ) == 0)
- require_partial_symbols (objfile, 0);
+ require_partial_symbols (objfile, false);
}
/* Initialize entry point information for this objfile. */
into a format-specific offset table --- a `struct section_offsets'.
The sectindex field is used to control the ordering of sections
with the same name. Upon return, it is updated to contain the
- correspondig BFD section index, or -1 if the section was not found.
+ corresponding BFD section index, or -1 if the section was not found.
ADD_FLAGS encodes verbosity level, whether this is main symbol or
- an extra symbol file such as dynamically loaded code, and wether
+ an extra symbol file such as dynamically loaded code, and whether
breakpoint reset should be deferred. */
static void
if an error occurs during symbol reading. */
gdb::optional<clear_symtab_users_cleanup> defer_clear_users;
- std::unique_ptr<struct objfile> objfile_holder (objfile);
+ objfile_up objfile_holder (objfile);
/* If ADDRS is NULL, put together a dummy address list.
We now establish the convention that an addr of zero means
if (symfile_objfile != NULL)
{
- delete symfile_objfile;
+ symfile_objfile->unlink ();
gdb_assert (symfile_objfile == NULL);
}
For NAME description see the objfile constructor.
ADD_FLAGS encodes verbosity, whether this is main symbol file or
- extra, such as dynamically loaded code, and what to do with breakpoins.
+ extra, such as dynamically loaded code, and what to do with breakpoints.
ADDRS is as described for syms_from_objfile_1, above.
ADDRS is ignored when SYMFILE_MAINLINE bit is set in ADD_FLAGS.
if (mainline)
flags |= OBJF_MAINLINE;
- objfile = new struct objfile (abfd, name, flags);
-
- if (parent)
- add_separate_debug_objfile (objfile, parent);
+ objfile = objfile::make (abfd, name, flags, parent);
/* We either created a new mapped symbol table, mapped an existing
symbol table file which has not had initial symbol reading
if (deprecated_pre_add_symbol_hook)
deprecated_pre_add_symbol_hook (name);
else
- {
- puts_filtered (_("Reading symbols from "));
- fputs_styled (name, file_name_style.style (), gdb_stdout);
- puts_filtered ("...\n");
- }
+ printf_filtered (_("Reading symbols from %ps...\n"),
+ styled_string (file_name_style.style (), name));
}
syms_from_objfile (objfile, addrs, add_flags);
if ((flags & OBJF_READNOW))
{
if (should_print)
- printf_filtered (_("Expanding full symbols from %s...\n"), name);
+ printf_filtered (_("Expanding full symbols from %ps...\n"),
+ styled_string (file_name_style.style (), name));
if (objfile->sf)
objfile->sf->qf->expand_all_symtabs (objfile);
file, and so printing it twice is just redundant. */
if (should_print && !objfile_has_symbols (objfile)
&& objfile->separate_debug_objfile == nullptr)
- printf_filtered (_("(No debugging symbols found in %s)\n"), name);
+ printf_filtered (_("(No debugging symbols found in %ps)\n"),
+ styled_string (file_name_style.style (), name));
if (should_print)
{
objfiles get stale by free_all_objfiles. */
no_shared_libraries (NULL, from_tty);
- free_all_objfiles ();
+ current_program_space->free_all_objfiles ();
gdb_assert (symfile_objfile == NULL);
if (from_tty)
https://sourceware.org/ml/gdb-patches/2019-04/msg00605.html
- If some of those scenarions need to be supported, we will need to
+ If some of those scenarios need to be supported, we will need to
use a different condition for HAS_DRIVE_SPEC and a different macro
instead of STRIP_DRIVE_SPEC, which work on Posix systems as well. */
std::string drive;
struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol;
if (sym != NULL)
- lang = SYMBOL_LANGUAGE (sym);
+ lang = sym->language ();
}
if (lang == language_unknown)
objfile_name (objf)))
error (_("Not confirmed."));
- delete objf;
+ objf->unlink ();
clear_symtab_users (0);
}
/* If we get an error, blow away this objfile (not sure if
that is the correct response for things like shared
libraries). */
- std::unique_ptr<struct objfile> objfile_holder (objfile);
+ objfile_up objfile_holder (objfile);
/* We need to do this whenever any symbols go away. */
clear_symtab_users_cleanup defer_clear_users (0);
automatically recreated by sym_read. */
free_objfile_separate_debug (objfile);
+ /* Clear the stale source cache. */
+ forget_cached_source_info ();
+
/* Remove any references to this objfile in the global
value lists. */
preserve_values (objfile);