aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorDavid Taylor <dtaylor@emc.com>2014-05-01 18:09:43 +0100
committerPedro Alves <palves@redhat.com>2014-05-01 18:09:43 +0100
commit95cf3b38cd2fae4a53c8ff12bef21b2ae3fdd0cb (patch)
tree1b4b41e6e17c5aeec13fac06f3df9e366011352b /gdb/remote.c
parent86a80a50f2cb244e6b9ec18b93675972baa50d78 (diff)
downloadgdb-95cf3b38cd2fae4a53c8ff12bef21b2ae3fdd0cb.zip
gdb-95cf3b38cd2fae4a53c8ff12bef21b2ae3fdd0cb.tar.gz
gdb-95cf3b38cd2fae4a53c8ff12bef21b2ae3fdd0cb.tar.bz2
compare-sections: New -r option.
When connecting to a remote system, we use the compare-sections command to verify that the box is running the code that we think it is running. Since the system is up and running and *NOT* 'freshly downloaded without yet executing anything', read-write sections, of course, differ from what they were in the executable file. Comparing read-write sections takes time and more importantly the MIS-MATCHED output is confusing to some users. The compare-sections command compares all loadable sections including read-write sections. This patch gives the user the option to compare just the loadable read-only sections. gdb/ 2014-05-01 David Taylor <dtaylor@emc.com> * remote.c (compare_sections_command): Add -r option to compare all loadable read-only sections. gdb/doc/ 2014-05-01 David Taylor <dtaylor@emc.com> * gdb.texinfo (compare-sections): Document the new -r (read-only) option.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c13
1 files changed, 12 insertions, 1 deletions
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, _("\