minor reformatting for target.c:read_whatever_is_readable

gdb/ChangeLog:

        * target.c (read_whatever_is_readable): Reformat comment,
        with a minor typo fix. Minor reformatting of the code.
This commit is contained in:
Joel Brobecker 2011-03-08 04:53:36 +00:00
parent 36073a929d
commit f1a507a15e
2 changed files with 26 additions and 20 deletions

View File

@ -1,3 +1,8 @@
2011-03-08 Joel Brobecker <brobecker@adacore.com>
* target.c (read_whatever_is_readable): Reformat comment,
with a minor typo fix. Minor reformatting of the code.
2011-03-08 Yao Qi <yao@codesourcery.com> 2011-03-08 Yao Qi <yao@codesourcery.com>
* arm-tdep.c: Remove prototype declaration displaced_in_arm_mode. * arm-tdep.c: Remove prototype declaration displaced_in_arm_mode.

View File

@ -1934,26 +1934,26 @@ target_read (struct target_ops *ops,
return len; return len;
} }
/** Assuming that the entire [begin, end) range of memory cannot be read, /* Assuming that the entire [begin, end) range of memory cannot be
try to read whatever subrange is possible to read. read, try to read whatever subrange is possible to read.
The function results, in RESULT, either zero or one memory block. The function returns, in RESULT, either zero or one memory block.
If there's a readable subrange at the beginning, it is completely If there's a readable subrange at the beginning, it is completely
read and returned. Any further readable subrange will not be read. read and returned. Any further readable subrange will not be read.
Otherwise, if there's a readable subrange at the end, it will be Otherwise, if there's a readable subrange at the end, it will be
completely read and returned. Any readable subranges before it (obviously, completely read and returned. Any readable subranges before it
not starting at the beginning), will be ignored. In other cases -- (obviously, not starting at the beginning), will be ignored. In
either no readable subrange, or readable subrange (s) that is neither other cases -- either no readable subrange, or readable subrange(s)
at the beginning, or end, nothing is returned. that is neither at the beginning, or end, nothing is returned.
The purpose of this function is to handle a read across a boundary of The purpose of this function is to handle a read across a boundary
accessible memory in a case when memory map is not available. The above of accessible memory in a case when memory map is not available.
restrictions are fine for this case, but will give incorrect results if The above restrictions are fine for this case, but will give
the memory is 'patchy'. However, supporting 'patchy' memory would require incorrect results if the memory is 'patchy'. However, supporting
trying to read every single byte, and it seems unacceptable solution. 'patchy' memory would require trying to read every single byte,
Explicit memory map is recommended for this case -- and and it seems unacceptable solution. Explicit memory map is
target_read_memory_robust will take care of reading multiple ranges recommended for this case -- and target_read_memory_robust will
then. */ take care of reading multiple ranges then. */
static void static void
read_whatever_is_readable (struct target_ops *ops, read_whatever_is_readable (struct target_ops *ops,
@ -2000,8 +2000,8 @@ read_whatever_is_readable (struct target_ops *ops,
ULONGEST first_half_begin, first_half_end; ULONGEST first_half_begin, first_half_end;
ULONGEST second_half_begin, second_half_end; ULONGEST second_half_begin, second_half_end;
LONGEST xfer; LONGEST xfer;
ULONGEST middle = current_begin + (current_end - current_begin)/2; ULONGEST middle = current_begin + (current_end - current_begin)/2;
if (forward) if (forward)
{ {
first_half_begin = current_begin; first_half_begin = current_begin;
@ -2053,6 +2053,7 @@ read_whatever_is_readable (struct target_ops *ops,
{ {
/* The [current_end, end) range has been read. */ /* The [current_end, end) range has been read. */
LONGEST rlen = end - current_end; LONGEST rlen = end - current_end;
r.data = xmalloc (rlen); r.data = xmalloc (rlen);
memcpy (r.data, buf + current_end - begin, rlen); memcpy (r.data, buf + current_end - begin, rlen);
r.begin = current_end; r.begin = current_end;