From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com, "J. Johnston" <jjohnstn@redhat.com>
Subject: [commit] Order parameters "rw", not "wr"
Date: Mon, 10 Nov 2003 21:20:00 -0000 [thread overview]
Message-ID: <3FB0010D.7040108@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
Hello,
I've just tripped over two new interfaces where I (for reasons I don't
know or remember) ordered a parameter pair "w-r" (write, read) instead
of "r-w" (read, write). When trying to implement of these interfaces I
consistently got the parameter order backwards (read, write)(1).
The attached patch re-orders the xfer_partial interface so its
read/write buffers are ordered read/write (i.e., sanely). I'm doing it
now before too many things start to depend on the interface.
argh,
Andrew
(1) I also got parameters to pread/pwrite wrong so its a pretty bad day
all round.
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 6816 bytes --]
2003-11-10 Andrew Cagney <cagney@redhat.com>
* target.h (struct target_ops): Order xfer buffer parameters "read
write" not "write read".
* bfd-target.c (target_bfd_xfer_partial): Update.
* remote.c (remote_xfer_partial): Update.
* inftarg.c (child_xfer_partial): Update.
* target.c (default_xfer_partial): Update.
(target_read_partial, target_write_partial): Update.
(debug_to_xfer_partial): Update.
Index: bfd-target.c
===================================================================
RCS file: /cvs/src/src/gdb/bfd-target.c,v
retrieving revision 1.1
diff -u -r1.1 bfd-target.c
--- bfd-target.c 31 Oct 2003 19:19:51 -0000 1.1
+++ bfd-target.c 10 Nov 2003 20:42:33 -0000
@@ -71,8 +71,8 @@
LONGEST
target_bfd_xfer_partial (struct target_ops *ops,
enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset, LONGEST len)
+ const char *annex, void *readbuf,
+ const void *writebuf, ULONGEST offset, LONGEST len)
{
switch (object)
{
Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.19
diff -u -r1.19 inftarg.c
--- inftarg.c 7 Nov 2003 21:33:37 -0000 1.19
+++ inftarg.c 10 Nov 2003 20:42:33 -0000
@@ -556,10 +556,9 @@
memory transfers, fall back to the old memory xfer functions. */
static LONGEST
-child_xfer_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset, LONGEST len)
+child_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, void *readbuf,
+ const void *writebuf, ULONGEST offset, LONGEST len)
{
switch (object)
{
@@ -577,13 +576,13 @@
#ifndef NATIVE_XFER_UNWIND_TABLE
#define NATIVE_XFER_UNWIND_TABLE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
#endif
- return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, writebuf,
- readbuf, offset, len);
+ return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf,
+ offset, len);
#endif
#if 0
case TARGET_OBJECT_AUXV:
- return native_xfer_auxv (PIDGET (inferior_ptid), writebuf, readbuf,
+ return native_xfer_auxv (PIDGET (inferior_ptid), readbuf, writebuf,
offset, len);
#endif
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.121
diff -u -r1.121 remote.c
--- remote.c 31 Oct 2003 15:25:34 -0000 1.121
+++ remote.c 10 Nov 2003 20:42:35 -0000
@@ -5103,7 +5103,7 @@
static LONGEST
remote_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, const void *writebuf, void *readbuf,
+ const char *annex, void *readbuf, const void *writebuf,
ULONGEST offset, LONGEST len)
{
struct remote_state *rs = get_remote_state ();
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.65
diff -u -r1.65 target.c
--- target.c 6 Nov 2003 19:56:26 -0000 1.65
+++ target.c 10 Nov 2003 20:42:35 -0000
@@ -75,9 +75,9 @@
static LONGEST default_xfer_partial (struct target_ops *ops,
enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset,
- LONGEST len);
+ const char *annex, void *readbuf,
+ const void *writebuf,
+ ULONGEST offset, LONGEST len);
/* Transfer LEN bytes between target address MEMADDR and GDB address
MYADDR. Returns 0 for success, errno code for failure (which
@@ -1074,10 +1074,9 @@
/* More generic transfers. */
static LONGEST
-default_xfer_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset, LONGEST len)
+default_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, void *readbuf,
+ const void *writebuf, ULONGEST offset, LONGEST len)
{
if (object == TARGET_OBJECT_MEMORY
&& ops->to_xfer_memory != NULL)
@@ -1109,7 +1108,7 @@
}
else if (ops->beneath != NULL)
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- writebuf, readbuf, offset, len);
+ readbuf, writebuf, offset, len);
else
return -1;
}
@@ -1127,7 +1126,7 @@
ULONGEST offset, LONGEST len)
{
gdb_assert (ops->to_xfer_partial != NULL);
- return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
+ return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
}
LONGEST
@@ -1137,7 +1136,7 @@
ULONGEST offset, LONGEST len)
{
gdb_assert (ops->to_xfer_partial != NULL);
- return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
+ return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
}
/* Wrappers to perform the full transfer. */
@@ -2289,20 +2288,19 @@
}
static LONGEST
-debug_to_xfer_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset, LONGEST len)
+debug_to_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, void *readbuf, const void *writebuf,
+ ULONGEST offset, LONGEST len)
{
LONGEST retval;
retval = debug_target.to_xfer_partial (&debug_target, object, annex,
- writebuf, readbuf, offset, len);
+ readbuf, writebuf, offset, len);
fprintf_unfiltered (gdb_stdlog,
"target_xfer_partial (%d, %s, 0x%lx, 0x%lx, 0x%s, %s) = %s\n",
(int) object, (annex ? annex : "(null)"),
- (long) writebuf, (long) readbuf, paddr_nz (offset),
+ (long) readbuf, (long) writebuf, paddr_nz (offset),
paddr_d (len), paddr_d (retval));
return retval;
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.52
diff -u -r1.52 target.h
--- target.h 6 Nov 2003 02:52:27 -0000 1.52
+++ target.h 10 Nov 2003 20:42:35 -0000
@@ -410,9 +410,9 @@
and target_write_partial for details of each variant. One, and
only one, of readbuf or writebuf must be non-NULL. */
LONGEST (*to_xfer_partial) (struct target_ops *ops,
- enum target_object object,
- const char *annex, const void *writebuf,
- void *readbuf, ULONGEST offset, LONGEST len);
+ enum target_object object, const char *annex,
+ void *readbuf, const void *writebuf,
+ ULONGEST offset, LONGEST len);
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
next reply other threads:[~2003-11-10 21:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-10 21:20 Andrew Cagney [this message]
2003-11-12 2:18 ` Richard Henderson
2003-11-13 15:27 ` Andrew Cagney
2003-11-13 15:40 ` Daniel Jacobowitz
2003-11-13 16:36 ` Andrew Cagney
2003-11-13 16:39 ` Daniel Jacobowitz
2003-11-13 17:46 ` Andrew Cagney
2003-11-13 18:01 ` Andrew Cagney
2003-11-13 19:19 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FB0010D.7040108@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=jjohnstn@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox