This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Seems like a bug in target_read_stack / dcache_xfer_memory?

Doug Evans wrote:
On Thu, Oct 22, 2009 at 12:54 PM, Michael Snyder <> wrote:
Michael Snyder wrote:
Doug Evans wrote:
On Mon, Oct 19, 2009 at 2:35 PM, Michael Snyder <>
Anyway, yes, that's what it does.  dcache returns zero,
and memory_xfer_partial bails out instead of trying the
next target down the target stack.
Hi.  If it will help I'll play with your testcase tomorrow.
I'll also volunteer to make a pass through the code and add some
[I mention that just in case you or someone is already in the process
of doing that.]
Sure it will help. Thanks, Doug.
And the test case is in the repo now -- solib-precsave.exp.
How to run tests:

Thanks for the testcase. You may be right about needing to test for "res == 0" but I'm less sure now, so I'm going to leave it as is, at least for now. dcache calls target_read (TARGET_OBJECT_RAW_MEMORY) which should DTRT. And in fact it does with this patch. :-) Checked in.

Thanks for the fix. It handles the case I was concerned with.

2009-10-23 Doug Evans <>

        * record.c (record_core_xfer_partial): Pass correct offset to

Index: record.c
RCS file: /cvs/src/src/gdb/record.c,v
retrieving revision 1.33
diff -u -p -r1.33 record.c
--- record.c    23 Oct 2009 16:11:37 -0000      1.33
+++ record.c    23 Oct 2009 17:07:08 -0000
@@ -1629,6 +1629,7 @@ record_core_xfer_partial (struct target_
                if (offset >= p->addr)
                    struct record_core_buf_entry *entry;
+                  ULONGEST sec_offset;

                    if (offset >= p->endaddr)
@@ -1636,7 +1637,7 @@ record_core_xfer_partial (struct target_
                    if (offset + len > p->endaddr)
                      len = p->endaddr - offset;

-                   offset -= p->addr;
+                   sec_offset = offset - p->addr;

                    /* Read readbuf or write writebuf p, offset, len.  */
                    /* Check flags.  */
@@ -1673,7 +1674,8 @@ record_core_xfer_partial (struct target_
                            record_core_buf_list = entry;

-                        memcpy (entry->buf + offset, writebuf, (size_t) len);
+                        memcpy (entry->buf + sec_offset, writebuf,
+                               (size_t) len);
@@ -1683,7 +1685,8 @@ record_core_xfer_partial (struct target_
                                    object, annex, readbuf, writebuf,
                                    offset, len);

-                       memcpy (readbuf, entry->buf + offset, (size_t) len);
+                       memcpy (readbuf, entry->buf + sec_offset,
+                              (size_t) len);

return len;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]