From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96904 invoked by alias); 30 Nov 2017 11:53:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 96892 invoked by uid 89); 30 Nov 2017 11:53:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:4513 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Nov 2017 11:53:08 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B72E6883C9; Thu, 30 Nov 2017 11:53:07 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 581616062A; Thu, 30 Nov 2017 11:52:58 +0000 (UTC) Subject: Re: [PATCH v4] Add support for the readnever concept To: Sergio Durigan Junior , GDB Patches References: <1467838463-15786-1-git-send-email-brobecker@adacore.com> <20171130002529.10592-1-sergiodj@redhat.com> Cc: Joel Brobecker , Yao Qi , Eli Zaretskii From: Pedro Alves Message-ID: <6765d36f-8603-9cd3-0476-801a5bfe0865@redhat.com> Date: Thu, 30 Nov 2017 11:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171130002529.10592-1-sergiodj@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00828.txt.bz2 On 11/30/2017 12:25 AM, Sergio Durigan Junior wrote: > - Split off the fix to 'symbol-file' command argument parsing. This > patch depends on it > (). This info above conflicts with ... > While implementing the code for the 'symbol-file' command, I noticed a > bug in 'symbol_file_command': GDB adds the symbol file before > finishing parsing all the options, which means that the position of an > option in the command impacts whether it will be considered or not. I > changed the code there in order to only add the symbol file after all > options have been parsed. ... this info here. The patch still has that bit... > > It's also worth mentioning that this patch tests whether GDB correctly > fails to initialize if both '--readnow' and '--readnever' options are > passed. We didn't have any infrastructure to test that, so I added a > new version of 'gdb_spawn', called 'gdb_spawn_ignore_error', which can > be used to start a GDB that will fail without compromising the entire > testcase. This is stale. > gdb/testsuite/ChangeLog: > > 2017-11-29 Joel Brobecker > Sergio Durigan Junior > Pedro Alves > > * gdb.base/readnever.c, gdb.base/readnever.exp: New files. > * lib/gdb.exp (default_gdb_spawn): Add 'ignore_error' > parameter. Handle case when 'ignore_error' is set. > (gdb_spawn_ignore_error): New function. Also stale... > @@ -699,7 +700,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) > } > } > > - bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); > + if (!readnever_symbol_files && !(objfile->flags & OBJF_READNEVER)) > + bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); I realized something: is it really ever possible to get here with readnever_symbol_files && !(objfile->flags & OBJF_READNEVER) ?? If readnever_symbol_files is set, then it'll have been propagated to objfile->flags before we get here, no? So references to the global readnever_symbol_files can (and should) be removed from the readers, right? This removes the need for the new '#include "top.h"'s too, so please remove those from the patch along the way. > > if (info->stabsects) > { > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 4f552225aa..a3127dd637 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -1037,6 +1037,15 @@ Read each symbol file's entire symbol table immediately, rather than > the default, which is to read it incrementally as it is needed. > This makes startup slower, but makes future operations faster. > > +@item --readnever > +@cindex @code{--readnever}, command-line option > +Do not read each symbol file's symbolic debug information. This makes > +startup faster but at the expense of not being able to perform > +symbolic debugging. DWARF unwind information is also not read, > +meaning backtraces may become incomplete or inaccurate. One use of > +this is when a user simply wants to do the following sequence: attach, > +dump core, detach. Loading the debugging information in this case is > +an unnecessary cause of delay. > @end table > > @node Mode Options > @@ -18576,6 +18585,14 @@ tables by using the @samp{-readnow} option with any of the commands that > load symbol table information, if you want to be sure @value{GDBN} has the > entire symbol table available. > > +@cindex @code{-readnever}, option for symbol-file command > +@cindex never read symbols > +@cindex symbols, never read > +@item symbol-file @r{[} -readnever @r{]} @var{filename} > +@itemx file @r{[} -readnever @r{]} @var{filename} > +You can instruct @value{GDBN} to never read the symbolic information > +contained in @var{filename} by using the @samp{-readnever} option. Maybe copy the rationale for this found in "--readnever" here or xref the "--readnever" command line option? > #define READNOW_HELP \ > "The '-readnow' option will cause GDB to read the entire symbol file\n\ > immediately. This makes the command slower, but may make future operations\n\ > -faster." > +faster.\n" > + > +#define READNEVER_HELP \ > + "The '-readnever' option will prevent GDB from reading the symbol file's\n\ > +symbolic debug information." > Why not merge these two macros in one? We'll always want to use them together, in the same order? You could rename the macro to READNOW_READNEVER_HELP for example. Thanks, Pedro Alves