diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-03-08 04:53:36 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-03-08 04:53:36 +0000 |
commit | f1a507a15eef00a452f75c8be0f8a39e97a3f244 (patch) | |
tree | fc1f9e6917ac51ca802accbd24cf75ad205e9a24 /gdb | |
parent | 36073a929d8567b50ef5ed93b34cd8c6151a3d08 (diff) | |
download | gdb-f1a507a15eef00a452f75c8be0f8a39e97a3f244.zip gdb-f1a507a15eef00a452f75c8be0f8a39e97a3f244.tar.gz gdb-f1a507a15eef00a452f75c8be0f8a39e97a3f244.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/target.c | 45 |
2 files changed, 28 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e1ed5c4..135a161 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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> * arm-tdep.c: Remove prototype declaration displaced_in_arm_mode. diff --git a/gdb/target.c b/gdb/target.c index edf7e1c..0792707 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1934,33 +1934,33 @@ target_read (struct target_ops *ops, return len; } -/** Assuming that the entire [begin, end) range of memory cannot be read, - try to read whatever subrange is possible to read. - - The function results, in RESULT, either zero or one memory block. - If there's a readable subrange at the beginning, it is completely - read and returned. Any further readable subrange will not be read. - Otherwise, if there's a readable subrange at the end, it will be - completely read and returned. Any readable subranges before it (obviously, - not starting at the beginning), will be ignored. In other cases -- - either no readable subrange, or readable subrange (s) 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 - accessible memory in a case when memory map is not available. The above - restrictions are fine for this case, but will give incorrect results if - the memory is 'patchy'. However, supporting 'patchy' memory would require - trying to read every single byte, and it seems unacceptable solution. - Explicit memory map is recommended for this case -- and - target_read_memory_robust will take care of reading multiple ranges - then. */ +/* Assuming that the entire [begin, end) range of memory cannot be + read, try to read whatever subrange is possible to read. + + The function returns, in RESULT, either zero or one memory block. + If there's a readable subrange at the beginning, it is completely + read and returned. Any further readable subrange will not be read. + Otherwise, if there's a readable subrange at the end, it will be + completely read and returned. Any readable subranges before it + (obviously, not starting at the beginning), will be ignored. In + other cases -- either no readable subrange, or readable subrange(s) + 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 accessible memory in a case when memory map is not available. + The above restrictions are fine for this case, but will give + incorrect results if the memory is 'patchy'. However, supporting + 'patchy' memory would require trying to read every single byte, + and it seems unacceptable solution. Explicit memory map is + recommended for this case -- and target_read_memory_robust will + take care of reading multiple ranges then. */ static void read_whatever_is_readable (struct target_ops *ops, ULONGEST begin, ULONGEST end, VEC(memory_read_result_s) **result) { - gdb_byte *buf = xmalloc (end-begin); + gdb_byte *buf = xmalloc (end - begin); ULONGEST current_begin = begin; ULONGEST current_end = end; int forward; @@ -2000,8 +2000,8 @@ read_whatever_is_readable (struct target_ops *ops, ULONGEST first_half_begin, first_half_end; ULONGEST second_half_begin, second_half_end; LONGEST xfer; - ULONGEST middle = current_begin + (current_end - current_begin)/2; + if (forward) { 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. */ LONGEST rlen = end - current_end; + r.data = xmalloc (rlen); memcpy (r.data, buf + current_end - begin, rlen); r.begin = current_end; |