From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFA] Eliminate byteswap.h functions from record.c
Date: Fri, 23 Oct 2009 16:45:00 -0000 [thread overview]
Message-ID: <4AE1DBF3.1040501@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 79 bytes --]
Since these aren't available on all hosts, let's use the
"native gdb" method.
[-- Attachment #2: bswap.txt --]
[-- Type: text/plain, Size: 1763 bytes --]
2009-10-23 Michael Snyder <msnyder@vmware.com>
* record.c (top level): Don't include byteswap.h.
(netorder64): Use store_unsigned_integer instead of bswap_64.
(netorder32): Use store_unsigned_integer instead of bswap_32.
(netorder16): Use store_unsigned_integer instead of bswap_16.
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 16:40:05 -0000
@@ -31,7 +31,6 @@
#include "elf-bfd.h"
#include "gcore.h"
-#include <byteswap.h>
#include <signal.h>
/* This module implements "target record", also known as "process
@@ -1953,27 +1952,33 @@ bfdcore_read (bfd *obfd, asection *osec,
}
static inline uint64_t
-netorder64 (uint64_t fromfile)
+netorder64 (uint64_t input)
{
- return (BYTE_ORDER == BFD_ENDIAN_LITTLE)
- ? bswap_64 (fromfile)
- : fromfile;
+ uint64_t ret;
+
+ store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
+ BYTE_ORDER, input);
+ return ret;
}
static inline uint32_t
-netorder32 (uint32_t fromfile)
+netorder32 (uint32_t input)
{
- return (BYTE_ORDER == BFD_ENDIAN_LITTLE)
- ? bswap_32 (fromfile)
- : fromfile;
+ uint32_t ret;
+
+ store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
+ BYTE_ORDER, input);
+ return ret;
}
static inline uint16_t
-netorder16 (uint16_t fromfile)
+netorder16 (uint16_t input)
{
- return (BYTE_ORDER == BFD_ENDIAN_LITTLE)
- ? bswap_16 (fromfile)
- : fromfile;
+ uint16_t ret;
+
+ store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
+ BYTE_ORDER, input);
+ return ret;
}
/* Restore the execution log from a core_bfd file. */
next reply other threads:[~2009-10-23 16:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 16:45 Michael Snyder [this message]
2009-10-23 16:54 ` Pedro Alves
2009-10-23 17:19 ` Michael Snyder
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=4AE1DBF3.1040501@vmware.com \
--to=msnyder@vmware.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