From 7f79c47ecf671587d1ef45a7b164b970607c5faf Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Fri, 13 Nov 2009 23:26:19 +0000 Subject: [PATCH] * dcache.c (dcache_hit, dcache_read_line): Tweak comments. (dcache_peek_byte, dcache_init, dcache_xfer_memory): Ditto. * target.c (memory_xfer_partial): Tweak comments. (target_xfer_partial, target_write_memory): Add comment. (target_read_partial): Remove note from 2003-10-21. (target_read, target_write): Add comments. --- gdb/ChangeLog | 9 +++++++++ gdb/dcache.c | 16 +++++++++++----- gdb/target.c | 23 +++++++++++++++-------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 29539b1..7769fff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-11-13 Doug Evans + + * dcache.c (dcache_hit, dcache_read_line): Tweak comments. + (dcache_peek_byte, dcache_init, dcache_xfer_memory): Ditto. + * target.c (memory_xfer_partial): Tweak comments. + (target_xfer_partial, target_write_memory): Add comment. + (target_read_partial): Remove note from 2003-10-21. + (target_read, target_write): Add comments. + 2009-11-13 Daniel Jacobowitz * inline-frame.c (find_inline_frame_state): Check for changed PC diff --git a/gdb/dcache.c b/gdb/dcache.c index d926e9d..b71b707 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -251,7 +251,7 @@ dcache_invalidate_line (DCACHE *dcache, CORE_ADDR addr) } /* If addr is present in the dcache, return the address of the block - containing it. */ + containing it. Otherwise return NULL. */ static struct dcache_block * dcache_hit (DCACHE *dcache, CORE_ADDR addr) @@ -269,7 +269,9 @@ dcache_hit (DCACHE *dcache, CORE_ADDR addr) return db; } -/* Fill a cache line from target memory. */ +/* Fill a cache line from target memory. + The result is 1 for success, 0 if the (entire) cache line + wasn't readable. */ static int dcache_read_line (DCACHE *dcache, struct dcache_block *db) @@ -356,7 +358,7 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr) return db; } -/* Using the data cache DCACHE return the contents of the byte at +/* Using the data cache DCACHE, store in *PTR the contents of the byte at address ADDR in the remote machine. Returns 1 for success, 0 for error. */ @@ -411,7 +413,7 @@ dcache_splay_tree_compare (splay_tree_key a, splay_tree_key b) return -1; } -/* Initialize the data cache. */ +/* Allocate and initialize a data cache. */ DCACHE * dcache_init (void) @@ -460,7 +462,11 @@ dcache_free (DCACHE *dcache) to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is nonzero. - The meaning of the result is the same as for target_write. */ + Return the number of bytes actually transfered, or -1 if the + transfer is not supported or otherwise fails. Return of a non-negative + value less than LEN indicates that no further transfer is possible. + NOTE: This is different than the to_xfer_partial interface, in which + positive values less than LEN mean further transfers may be possible. */ int dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache, diff --git a/gdb/target.c b/gdb/target.c index fc24730..a5bf53f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1181,8 +1181,8 @@ target_section_by_addr (struct target_ops *target, CORE_ADDR addr) return NULL; } -/* Perform a partial memory transfer. The arguments and return - value are just as for target_xfer_partial. */ +/* Perform a partial memory transfer. + For docs see target.h, to_xfer_partial. */ static LONGEST memory_xfer_partial (struct target_ops *ops, enum target_object object, @@ -1360,6 +1360,8 @@ make_show_memory_breakpoints_cleanup (int show) (void *) (uintptr_t) current); } +/* For docs see target.h, to_xfer_partial. */ + static LONGEST target_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, @@ -1474,6 +1476,11 @@ target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len) return EIO; } +/* Write LEN bytes from MYADDR to target memory at address MEMADDR. + Returns either 0 for success or an errno value if any error occurs. + If an error occurs, no guarantee is made about how much data got written. + Callers that can deal with partial writes should call target_write. */ + int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len) { @@ -1637,11 +1644,7 @@ current_xfer_partial (struct target_ops *ops, enum target_object object, return -1; } -/* Target vector read/write partial wrapper functions. - - NOTE: cagney/2003-10-21: I wonder if having "to_xfer_partial - (inbuf, outbuf)", instead of separate read/write methods, make life - easier. */ +/* Target vector read/write partial wrapper functions. */ static LONGEST target_read_partial (struct target_ops *ops, @@ -1662,6 +1665,9 @@ target_write_partial (struct target_ops *ops, } /* Wrappers to perform the full transfer. */ + +/* For docs on target_read see target.h. */ + LONGEST target_read (struct target_ops *ops, enum target_object object, @@ -1750,7 +1756,6 @@ target_read_until_error (struct target_ops *ops, return len; } - /* An alternative to target_write with progress callbacks. */ LONGEST @@ -1786,6 +1791,8 @@ target_write_with_progress (struct target_ops *ops, return len; } +/* For docs on target_write see target.h. */ + LONGEST target_write (struct target_ops *ops, enum target_object object, -- 2.7.4