diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 5 | ||||
-rw-r--r-- | gdb/remote.c | 13 |
4 files changed, 25 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7e5b290..eac6037 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-05-01 David Taylor <dtaylor@emc.com> + + * remote.c (compare_sections_command): Add -r option to compare + all loadable read-only sections. + 2014-04-30 Siva Chandra Reddy <sivachandra@google.com> * dwarf2loc.c (dwarf2_locexpr_baton_eval, diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2b0f686..1e60575 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-01 David Taylor <dtaylor@emc.com> + + * gdb.texinfo (compare-sections): Document the new -r (read-only) + option. + 2014-04-24 Michael Sturm <michael.sturm@mintel.com> Walfred Tedeschi <walfred.tedeschi@intel.com> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9d91075..7f7650d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -8772,11 +8772,12 @@ situations. @table @code @kindex compare-sections -@item compare-sections @r{[}@var{section-name}@r{]} +@item compare-sections @r{[}@var{section-name}@r{|}@code{-r}@r{]} Compare the data of a loadable section @var{section-name} in the executable file of the program being debugged with the same section in the remote machine's memory, and report any mismatches. With no -arguments, compares all loadable sections. This command's +arguments, compares all loadable sections. With an argument of +@code{-r}, compares all loadable read-only sections. This command's availability depends on the target's support for the @code{"qCRC"} remote request. @end table diff --git a/gdb/remote.c b/gdb/remote.c index 4177b39..ba04d0c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8484,6 +8484,7 @@ compare_sections_command (char *args, int from_tty) int matched = 0; int mismatched = 0; int res; + int read_only = 0; if (!exec_bfd) error (_("command cannot be used without an exec file")); @@ -8491,11 +8492,20 @@ compare_sections_command (char *args, int from_tty) /* Make sure the remote is pointing at the right process. */ set_general_process (); + if (args != NULL && strcmp (args, "-r") == 0) + { + read_only = 1; + args = NULL; + } + for (s = exec_bfd->sections; s; s = s->next) { if (!(s->flags & SEC_LOAD)) continue; /* Skip non-loadable section. */ + if (read_only && (s->flags & SEC_READONLY) == 0) + continue; /* Skip writeable sections */ + size = bfd_get_section_size (s); if (size == 0) continue; /* Skip zero-length section. */ @@ -11771,7 +11781,8 @@ the packets being used"), add_cmd ("compare-sections", class_obscure, compare_sections_command, _("\ Compare section data on target to the exec file.\n\ -Argument is a single section name (default: all loaded sections)."), +Argument is a single section name (default: all loaded sections).\n\ +To compare only read-only loaded sections, specify the -r option."), &cmdlist); add_cmd ("packet", class_maintenance, packet_command, _("\ |