mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-20 14:22:35 +08:00
2004-10-01 Andrew Cagney <cagney@gnu.org>
* target.c (xfer_using_stratum): Change return type to LONGEST. On each iteration offset, readbuf and writebuf. * inf-ptrace.c (inf_ptrace_xfer_partial): Simplify computation of partial_length, and read/modify/write predicate, update comments. Pass buffer.word to ptrace write.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2004-10-01 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* target.c (xfer_using_stratum): Change return type to LONGEST.
|
||||||
|
On each iteration offset, readbuf and writebuf.
|
||||||
|
* inf-ptrace.c (inf_ptrace_xfer_partial): Simplify computation of
|
||||||
|
partial_length, and read/modify/write predicate, update comments.
|
||||||
|
Pass buffer.word to ptrace write.
|
||||||
|
|
||||||
2004-10-01 Paul N. Hilfinger <Hilfinger@gnat.com>
|
2004-10-01 Paul N. Hilfinger <Hilfinger@gnat.com>
|
||||||
|
|
||||||
* symfile.c (init_filename_language_table): Add extensions for
|
* symfile.c (init_filename_language_table): Add extensions for
|
||||||
|
@ -514,25 +514,27 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
|
|||||||
ULONGEST rounded_offset;
|
ULONGEST rounded_offset;
|
||||||
LONGEST partial_len;
|
LONGEST partial_len;
|
||||||
|
|
||||||
/* Round the start address down to the next long word boundary. */
|
/* Round the start offset down to the next long word
|
||||||
|
boundary. */
|
||||||
rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
|
rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
|
||||||
|
|
||||||
/* Truncate the length so that at max a single word will be
|
/* Since ptrace will transfer a single word starting at that
|
||||||
transfered. Remember, this function is required to perform
|
rounded_offset the partial_len needs to be adjusted down to
|
||||||
only a partial read so no more than one word should be
|
that (remember this function only does a single transfer).
|
||||||
transfered). */
|
Should the required length be even less, adjust it down
|
||||||
if (rounded_offset + sizeof (PTRACE_TYPE_RET) < offset + len)
|
again. */
|
||||||
partial_len = sizeof (PTRACE_TYPE_RET) - (offset - rounded_offset);
|
partial_len = (rounded_offset + sizeof (PTRACE_TYPE_RET)) - offset;
|
||||||
else
|
if (partial_len > len)
|
||||||
partial_len = len;
|
partial_len = len;
|
||||||
|
|
||||||
if (writebuf)
|
if (writebuf)
|
||||||
{
|
{
|
||||||
/* Fill start and end extra bytes of buffer with existing
|
/* If OFFSET:PARTIAL_LEN is smaller than
|
||||||
memory data. */
|
ROUNDED_OFFSET:WORDSIZE then a read/modify write will
|
||||||
|
be needed. Read in the entire word. */
|
||||||
if (rounded_offset < offset
|
if (rounded_offset < offset
|
||||||
|| (partial_len + (offset - rounded_offset)
|
|| (offset + partial_len
|
||||||
< sizeof (PTRACE_TYPE_RET)))
|
< rounded_offset + sizeof (PTRACE_TYPE_RET)))
|
||||||
/* Need part of initial word -- fetch it. */
|
/* Need part of initial word -- fetch it. */
|
||||||
buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
|
buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
|
||||||
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
||||||
@ -545,7 +547,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
|
ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
|
||||||
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
||||||
(int) buffer.byte);
|
buffer.word);
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
/* Using the appropriate one (I or D) is necessary for
|
/* Using the appropriate one (I or D) is necessary for
|
||||||
@ -553,7 +555,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
|
ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
|
||||||
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
(PTRACE_TYPE_ARG3) (long) rounded_offset,
|
||||||
(int) buffer.byte);
|
buffer.word);
|
||||||
if (errno)
|
if (errno)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
11
gdb/target.c
11
gdb/target.c
@ -927,9 +927,9 @@ target_xfer_partial (struct target_ops *ops,
|
|||||||
implementing another singluar mechanism (for instance, a generic
|
implementing another singluar mechanism (for instance, a generic
|
||||||
object:annex onto inferior:object:annex say). */
|
object:annex onto inferior:object:annex say). */
|
||||||
|
|
||||||
static int
|
static LONGEST
|
||||||
xfer_using_stratum (enum target_object object, const char *annex,
|
xfer_using_stratum (enum target_object object, const char *annex,
|
||||||
CORE_ADDR memaddr, int len, void *readbuf,
|
ULONGEST offset, LONGEST len, void *readbuf,
|
||||||
const void *writebuf)
|
const void *writebuf)
|
||||||
{
|
{
|
||||||
LONGEST xfered;
|
LONGEST xfered;
|
||||||
@ -946,7 +946,7 @@ xfer_using_stratum (enum target_object object, const char *annex,
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
xfered = target_xfer_partial (target, object, annex,
|
xfered = target_xfer_partial (target, object, annex,
|
||||||
readbuf, writebuf, memaddr, len);
|
readbuf, writebuf, offset, len);
|
||||||
if (xfered > 0)
|
if (xfered > 0)
|
||||||
{
|
{
|
||||||
/* The partial xfer succeeded, update the counts, check that
|
/* The partial xfer succeeded, update the counts, check that
|
||||||
@ -955,6 +955,11 @@ xfer_using_stratum (enum target_object object, const char *annex,
|
|||||||
len -= xfered;
|
len -= xfered;
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
offset += xfered;
|
||||||
|
if (readbuf != NULL)
|
||||||
|
readbuf = (bfd_byte *) readbuf + xfered;
|
||||||
|
if (writebuf != NULL)
|
||||||
|
writebuf = (bfd_byte *) writebuf + xfered;
|
||||||
target = target_stack;
|
target = target_stack;
|
||||||
}
|
}
|
||||||
else if (xfered < 0)
|
else if (xfered < 0)
|
||||||
|
Reference in New Issue
Block a user