X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fsymfile.c;h=6f9c81c8b9489bab878e4839e79b9104a4dac005;hb=d6ba6a11642cdbec4ce91fefe455920b5c073f60;hp=68ec491d3572d49dfe2bfddcb5cfe11accea3041;hpb=741d7538b7540fea1086fe6ab962227d2cf7418e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symfile.c b/gdb/symfile.c index 68ec491d35..6f9c81c8b9 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1443,11 +1443,33 @@ find_separate_debug_file (const char *dir, = dirnames_to_char_ptr_vec (debug_file_directory); gdb::unique_xmalloc_ptr canon_sysroot = gdb_realpath (gdb_sysroot); + /* MS-Windows/MS-DOS don't allow colons in file names; we must + convert the drive letter into a one-letter directory, so that the + file name resulting from splicing below will be valid. + + FIXME: The below only works when GDB runs on MS-Windows/MS-DOS. + There are various remote-debugging scenarios where such a + transformation of the drive letter might be required when GDB runs + on a Posix host, see + + https://sourceware.org/ml/gdb-patches/2019-04/msg00605.html + + If some of those scenarions 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; + if (HAS_DRIVE_SPEC (dir_notarget)) + { + drive = dir_notarget[0]; + dir_notarget = STRIP_DRIVE_SPEC (dir_notarget); + } + for (const gdb::unique_xmalloc_ptr &debugdir : debugdir_vec) { debugfile = target_prefix ? "target:" : ""; debugfile += debugdir.get (); debugfile += "/"; + debugfile += drive; debugfile += dir_notarget; debugfile += debuglink; @@ -2189,12 +2211,6 @@ set_objfile_default_section_offset (struct objfile *objf, /* This function allows the addition of incrementally linked object files. It does not modify any state in the target, only in the debugger. */ -/* Note: ezannoni 2000-04-13 This function/command used to have a - special case syntax for the rombug target (Rombug is the boot - monitor for Microware's OS-9 / OS-9000, see remote-os9k.c). In the - rombug case, the user doesn't need to supply a text address, - instead a call to target_link() (in target.c) would supply the - value to use. We are now discontinuing this type of ad hoc syntax. */ static void add_symbol_file_command (const char *args, int from_tty) @@ -2336,6 +2352,9 @@ add_symbol_file_command (const char *args, int from_tty) objf = symbol_file_add (filename.get (), add_flags, §ion_addrs, flags); + if (!objfile_has_symbols (objf) && objf->per_bfd->minimal_symbol_count <= 0) + warning (_("newly-added symbol file \"%s\" does not provide any symbols"), + filename.get ()); if (seen_offset) set_objfile_default_section_offset (objf, section_addrs, offset); @@ -2427,19 +2446,12 @@ remove_symbol_file_command (const char *args, int from_tty) void reread_symbols (void) { - struct objfile *objfile; long new_modtime; struct stat new_statbuf; int res; std::vector new_objfiles; - /* With the addition of shared libraries, this should be modified, - the load time should be saved in the partial symbol tables, since - different tables may come from different source files. FIXME. - This routine should then walk down each partial symbol table - and see if the symbol table that it originates from has been changed. */ - - for (objfile = object_files; objfile; objfile = objfile->next) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->obfd == NULL) continue; @@ -2556,7 +2568,7 @@ reread_symbols (void) objfile->sections = NULL; objfile->compunit_symtabs = NULL; objfile->template_symbols = NULL; - objfile->static_links = NULL; + objfile->static_links.reset (nullptr); /* obstack_init also initializes the obstack so it is empty. We could use obstack_specify_allocation but @@ -2901,12 +2913,6 @@ clear_symtab_users (symfile_add_flags add_flags) clear_pc_function_cache (); gdb::observers::new_objfile.notify (NULL); - /* Clear globals which might have pointed into a removed objfile. - FIXME: It's not clear which of these are supposed to persist - between expressions and which ought to be reset each time. */ - expression_context_block = NULL; - innermost_block.reset (); - /* Varobj may refer to old symbols, perform a cleanup. */ varobj_invalidate (); @@ -3868,7 +3874,7 @@ test_set_ext_lang_command () SELF_CHECK (lang == language_unknown); /* Test adding a new extension using the CLI command. */ - gdb::unique_xmalloc_ptr args_holder (xstrdup (".hello rust")); + auto args_holder = make_unique_xstrdup (".hello rust"); ext_args = args_holder.get (); set_ext_lang_command (NULL, 1, NULL);