This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] Trust readonly sections if target has memory protection


> From: Yao Qi <yao@codesourcery.com>
> Date: Fri, 6 Sep 2013 10:01:59 +0800
> 
> This patch first changes command "trust-readonly-sections" to an
> auto_boolean command, so "auto" means that GDB trusts read-only
> sections if the target has memory protection.  Then, this patch adds a
> gdbarch hook method "has_memory_protection".  Patch 2/2 is to
> implement the hook method for linux target.
> 
> gdb:
> 
> 2013-09-06  Yao Qi  <yao@codesourcery.com>
> 
> 	* arch-utils.c (default_has_memory_protection): New function.
> 	* arch-utils.h (default_has_memory_protection): Declaration.
> 	* gdbarch.sh (has_memory_protection): New hook method.
> 	* gdbarch.c: Re-generated.
> 	* gdbarch.h: Re-generated.
> 	* target.c (trust_readonly): Change type to 'enum auto_boolean'
> 	and initialize it to 'AUTO_BOOLEAN_AUTO'.
> 	(trust_readonly_p): New function.
> 	(memory_xfer_partial_1): Call trust_readonly_p.
> 	(initialize_targets): Register command
> 	"trust-readonly-sections" as add_setshow_auto_boolean_cmd.
> 
> 	* NEWS: Describe the default option of
> 	"trust-readonly-sections" becomes "auto" and the related
> 	changes.
> 
> gdb/doc:
> 
> 2013-09-06  Yao Qi  <yao@codesourcery.com>
> 
> 	* gdb.texinfo (Files): Explain the default option of
> 	"trust-readonly-sections" is "auto".

Is it possible NOT to split documentation changes between changesets,
when they are all parts of the same patch series?  Reviewing changes
piecemeal like that is extremely inconvenient and error-prone,
especially since you never tell in the beginning that the
documentation changes are split.  TIA.

>  *** Changes since GDB 7.6
>  
> +* The default value of option "trust-readonly-sections" is "auto".  GDB
> +  trusts the contents of read-only sections from the object file on the
> +  GNU/Linux targets.

The second sentence is in contradiction with the first.  "Auto" means
GDB decides automatically whether to trust these section; it does not
mean the decision is YES for GNU/Linux and NO otherwise.

> +@item set trust-readonly-sections auto
> +This is the default mode.  Tell @value{GDBN} to trust read-only
> +sections on some targets which have memory protection, such as
> +GNU/Linux, because the contents of the section in the target program
> +can't change.

Again, no need to mention one platform here.  Such references quickly
become obsolete with time.

> +When this mode is auto, memory reads from readonly sections will be\n\
> +read from the object file if the target has memory protection.\n"),

I would suggest

  When this mode is auto, GDB will decide based on the target memory
  protection features whether to read readonly sections from object file
  instead of from the inferior's memory.

IOW, "auto" means GDB will decide by its own internal logic.

Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]