From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [commit] target.c: fix errors on x86_64-windows due to casting to long
Date: Fri, 09 Jan 2009 13:17:00 -0000 [thread overview]
Message-ID: <20090109131711.GA24431@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
Hello,
Continuing on my series of patches to port GDB to x86_64 Windows (Vista),
here is a patch that fixes some compilation errors inside target.c which
are due to casting pointers to long... As suggested, I modified my
original patch to use intptr_t instead of my very-own home-made ptr_int_t.
2009-01-09 Joel Brobecker <brobecker@adacore.com>
* target.c (target_xfer_partial): Use host_address_to_string to
print the address of readbuf and writebuf. Cast the address of
elements inside the myaddr buffer into intptr_t.
(deprecated_debug_xfer_memory): Use paddress to print memaddr.
Cast the address of elements inside the myaddr buffer into
intptr_t.
Tested on x86-linux. I will commit tomorrow, since Mark already reviewed
this code and suggested the use of the intptr_t type.
--
Joel
[-- Attachment #2: cast.diff --]
[-- Type: text/plain, Size: 1828 bytes --]
diff --git a/gdb/target.c b/gdb/target.c
index 0f9e42a..78a0a1b 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1200,11 +1200,12 @@ target_xfer_partial (struct target_ops *ops,
const unsigned char *myaddr = NULL;
fprintf_unfiltered (gdb_stdlog,
- "%s:target_xfer_partial (%d, %s, 0x%lx, 0x%lx, %s, %s) = %s",
+ "%s:target_xfer_partial (%d, %s, %s, %s, %s, %s) = %s",
ops->to_shortname,
(int) object,
(annex ? annex : "(null)"),
- (long) readbuf, (long) writebuf,
+ host_address_to_string (readbuf),
+ host_address_to_string (writebuf),
core_addr_to_string_nz (offset),
plongest (len), plongest (retval));
@@ -1219,7 +1220,7 @@ target_xfer_partial (struct target_ops *ops,
fputs_unfiltered (", bytes =", gdb_stdlog);
for (i = 0; i < retval; i++)
{
- if ((((long) &(myaddr[i])) & 0xf) == 0)
+ if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
{
if (targetdebug < 2 && i > 0)
{
@@ -2717,9 +2718,9 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
attrib, target);
fprintf_unfiltered (gdb_stdlog,
- "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
- (unsigned int) memaddr, /* possable truncate long long */
- len, write ? "write" : "read", retval);
+ "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
+ paddress (memaddr), len, write ? "write" : "read",
+ retval);
if (retval > 0)
{
@@ -2728,7 +2729,7 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
fputs_unfiltered (", bytes =", gdb_stdlog);
for (i = 0; i < retval; i++)
{
- if ((((long) &(myaddr[i])) & 0xf) == 0)
+ if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
{
if (targetdebug < 2 && i > 0)
{
next reply other threads:[~2009-01-09 13:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 13:17 Joel Brobecker [this message]
2009-01-11 13:25 ` Joel Brobecker
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=20090109131711.GA24431@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/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