Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/3] gdb: New maintenance command to disable bfd sharing.
Date: Mon, 17 Aug 2015 17:34:00 -0000	[thread overview]
Message-ID: <55D21B24.2090603@redhat.com> (raw)
In-Reply-To: <77dce5f054bd1f7be0f87fe36c5d7e4acdef7c9b.1439454670.git.andrew.burgess@embecosm.com>

On 08/13/2015 01:44 PM, Andrew Burgess wrote:
> In some rare maintainer cases it is desirable to be able to disable bfd
> sharing.  This patch adds new commands maintenance set/show commands for
> bfd-sharing, allowing gdb's bfd cache to be turned off.


>  * Support for process record-replay and reverse debugging on aarch64*-linux*
> diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
> index 846ac24..9d553db 100644
> --- a/gdb/doc/ChangeLog
> +++ b/gdb/doc/ChangeLog
> @@ -1,3 +1,10 @@
> +2015-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
> +
> +	* gdb.texinfo (Maintenance Commands): Move documentation of "main
> +	info bfds" to...
> +	(File Caching): A New section.  Outline bfd caching, and add new
> +	description for "main set/show bfd-sharing".
> +
>  2015-08-07  Pedro Alves  <palves@redhat.com>
>  
>  	* gdb.texinfo (Maintenance Commands): Document "maint set/show
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 900970b..3cfb1a7 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -18190,6 +18190,36 @@ Set whether a source file may have multiple base names.
>  Show whether a source file may have multiple base names.
>  @end table
>  
> +@node File Caching
> +@section File Caching
> +@cindex caching of opened files
> +@cindex caching of bfd objects
> +
> +To speed up file loading, and reduce memory usage, @value{GDBN} will
> +reuse the @code{bfd} objects used to track open files.  @xref{Top, ,
> +BFD, bfd, The Binary File Descriptor Library}.  The following commands
> +allow visibility and control of the caching beaviour.

typo "beaviour".  (While at it, I think the manual is meant to
standardize on USA spelling, thus "behavior".)

> +
> +@table @code
> +@kindex maint info bfds
> +@item maint info bfds
> +This prints information about each @code{bfd} object that is known to
> +@value{GDBN}.
> +
> +@kindex maint set bfd-sharing
> +@kindex maint show bfd-sharing
> +@kindex bfd caching
> +@item maint set bfd-sharing
> +@item maint show bfd-sharing
> +Control whether @code{bfd} objects can be shared.  When sharing is
> +enabled @value{GDBN} will reuse already open @code{bfd} objects rather

I believe present tense is preferred in the manual, like:

s/will reuse/reuses/

> +than reopening the same file.  Turning sharing off does not cause
> +already shared @code{bfd} objects to be unshared, but all future files
> +that are opened will create a new @code{bfd} object.  Similarly,
> +re-enabling sharing will not cause multiple existing @code{bfd}

...re-enabling sharing does not cause...


> +objects to be collapsed into a single shared @code{bfd} object.
> +@end table
> +
>  @node Separate Debug Files
>  @section Debugging Information in Separate Files
>  @cindex separate debugging information files
> @@ -33987,11 +34017,6 @@ Shared library events.


> @@ -111,6 +111,11 @@ DEFINE_REGISTRY (bfd, GDB_BFD_DATA_ACCESSOR)
>  
>  static htab_t gdb_bfd_cache;
>  
> +/* When true gdb will reuse an existing bfd object if the filename,
> +   modification time, and file size all match.  */
> +
> +static int bfd_sharing;

Initialize it here?  Like:

 static int bfd_sharing = 1;

>    gdb_bfd_ref (abfd);
>    return abfd;
> @@ -942,4 +950,17 @@ _initialize_gdb_bfd (void)
>    add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\
>  List the BFDs that are currently open."),
>  	   &maintenanceinfolist);
> +
> +  add_setshow_boolean_cmd ("bfd-sharing", no_class,
> +			   &bfd_sharing, _("\
> +Set whether gdb will share bfds that appear to be the same file."), _("\
> +Show whether gdb will share bfds that appear to be the same file."), _("\
> +When enabled gdb will reuse existing bfds rather than reopening the\n\
> +same file.  To decide if two files are the same then gdb compares the\n\
> +filename, file size, file modification time, and file inode."),
> +			   NULL,
> +			   NULL,

Please add a show hook, for i18n.

> +			   &maintenance_set_cmdlist,
> +			   &maintenance_show_cmdlist);
> +  bfd_sharing = 1;

See above.

>  }
> 

Otherwise LGTM.

Thanks,
Pedro Alves


  parent reply	other threads:[~2015-08-17 17:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 12:45 [PATCH v2 0/3] bfd cache: tighten match criteria and debug commands Andrew Burgess
2015-08-13 12:45 ` [PATCH v2 2/3] gdb: New maintenance command to disable bfd sharing Andrew Burgess
2015-08-13 14:24   ` Eli Zaretskii
2015-08-17 17:34   ` Pedro Alves [this message]
2015-08-13 12:45 ` [PATCH v2 3/3] gdb: Add debug tracing for bfd cache activity Andrew Burgess
2015-08-17 17:34   ` Pedro Alves
2015-08-13 12:45 ` [PATCH v2 1/3] gdb: Improve cache matching criteria for the bfd cache Andrew Burgess
2015-08-17 17:34   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D21B24.2090603@redhat.com \
    --to=palves@redhat.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox