diff options
author | Pedro Alves <palves@redhat.com> | 2014-05-20 19:11:39 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-05-20 19:11:39 +0100 |
commit | 936d299246c2be32cfc92e0ad824f31d5b8cec73 (patch) | |
tree | b177ec4c4f4bc0061c5abc62169cb40878599d2c /gdb/doc | |
parent | 9440a9045928d3d4624b8dbcfbd98587a49d35e7 (diff) | |
download | gdb-936d299246c2be32cfc92e0ad824f31d5b8cec73.zip gdb-936d299246c2be32cfc92e0ad824f31d5b8cec73.tar.gz gdb-936d299246c2be32cfc92e0ad824f31d5b8cec73.tar.bz2 |
Make compare-sections work against all targets; add compare-sections [-r] tests.
This does two things:
1. Adds a test.
Recently compare-sections got a new "-r" switch, but given no test
existed for compare-sections, the patch was allowed in with no
testsuite addition. This now adds a test for both compare-sections
and compare-sections -r.
2. Makes the compare-sections command work against all targets.
Currently, compare-sections only works with remote targets, and only
those that support the qCRC packet. The patch makes it so that if the
target doesn't support accelerating memory verification, then GDB
falls back to comparing memory itself. This is of course slower, but
it's better than nothing, IMO. While testing against extended-remote
GDBserver I noticed that we send the qCRC request to the target if
we're connected, but not yet running a program. That can't work of
course -- the patch fixes that. This all also goes in the direction
of bridging the local/remote parity gap.
I didn't decouple 1. from 2., because that would mean that the test
would need to handle the case of the target not supporting the
command.
Tested on x86_64 Fedora 17, native, remote GDBserver, and
extended-remote GDBserver. I also hack-disabled qCRC support to make
sure the fallback paths in remote.c work.
gdb/doc/
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Memory) <compare-sections>: Generalize comments to
not be remote specific. Add cross reference to the qCRC packet.
(Separate Debug Files): Update cross reference to the qCRC packet.
(General Query Packets) <qCRC packet>: Add anchor.
gdb/
2014-05-20 Pedro Alves <palves@redhat.com>
* NEWS: Mention that compare-sections now works with all targets.
* remote.c (PACKET_qCRC): New enum value.
(remote_verify_memory): Don't send qCRC if the target has no
execution. Use packet_support/packet_ok. If the target doesn't
support the qCRC packet, fallback to a deep memory copy.
(compare_sections_command): Say "target image" instead of "remote
executable".
(_initialize_remote): Add PACKET_qCRC to the list of config
packets that have no associated command. Extend comment.
* target.c (simple_verify_memory, default_verify_memory): New
function.
* target.h (struct target_ops) <to_verify_memory>: Default to
default_verify_memory.
(simple_verify_memory): New declaration.
* target-delegates.c: Regenerate.
gdb/testsuite/
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/compare-sections.c: New file.
* gdb.base/compare-sections.exp: New file.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 31 |
2 files changed, 25 insertions, 13 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 30094ef..7d0fdbd 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2014-05-20 Pedro Alves <palves@redhat.com> + + * gdb.texinfo (Memory) <compare-sections>: Generalize comments to + not be remote specific. Add cross reference to the qCRC packet. + (Separate Debug Files): Update cross reference to the qCRC packet. + (General Query Packets) <qCRC packet>: Add anchor. + 2014-05-17 Doug Evans <xdje42@gmail.com> Copy over changes from guile.texi. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a6bde12..6092ff4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -8765,23 +8765,28 @@ are from the last memory unit printed; this is not the same as the last address printed if several units were printed on the last line of output. @cindex remote memory comparison +@cindex target memory comparison @cindex verify remote memory image +@cindex verify target memory image When you are debugging a program running on a remote target machine -(@pxref{Remote Debugging}), you may wish to verify the program's image in the -remote machine's memory against the executable file you downloaded to -the target. The @code{compare-sections} command is provided for such -situations. +(@pxref{Remote Debugging}), you may wish to verify the program's image +in the remote machine's memory against the executable file you +downloaded to the target. Or, on any target, you may want to check +whether the program has corrupted its own read-only sections. The +@code{compare-sections} command is provided for such situations. @table @code @kindex compare-sections @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 +the target machine's memory, and report any mismatches. With no 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. +@code{-r}, compares all loadable read-only sections. + +Note: for remote targets, this command can be accelerated if the +target supports computing the CRC checksum of a block of memory +(@pxref{qCRC packet}). @end table @node Auto Display @@ -17579,11 +17584,10 @@ the final result is inverted to ensure trailing zeros also affect the CRC. @emph{Note:} This is the same CRC polynomial as used in handling the -@dfn{Remote Serial Protocol} @code{qCRC} packet (@pxref{Remote Protocol, -, @value{GDBN} Remote Serial Protocol}). However in the -case of the Remote Serial Protocol, the CRC is computed @emph{most} -significant bit first, and the result is not inverted, so trailing -zeros have no effect on the CRC value. +@dfn{Remote Serial Protocol} @code{qCRC} packet (@pxref{qCRC packet}). +However in the case of the Remote Serial Protocol, the CRC is computed +@emph{most} significant bit first, and the result is not inverted, so +trailing zeros have no effect on the CRC value. To complete the description, we show below the code of the function which produces the CRC used in @code{.gnu_debuglink}. Inverting the @@ -34722,6 +34726,7 @@ Any other reply implies the old thread ID. @item qCRC:@var{addr},@var{length} @cindex CRC of memory block, remote request @cindex @samp{qCRC} packet +@anchor{qCRC packet} Compute the CRC checksum of a block of memory using CRC-32 defined in IEEE 802.3. The CRC is computed byte at a time, taking the most significant bit of each byte first. The initial pattern code |