* [RFA] Eliminate byteswap.h functions from record.c
@ 2009-10-23 16:45 Michael Snyder
2009-10-23 16:54 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2009-10-23 16:45 UTC (permalink / raw)
To: gdb-patches
[-- 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. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Eliminate byteswap.h functions from record.c
2009-10-23 16:45 [RFA] Eliminate byteswap.h functions from record.c Michael Snyder
@ 2009-10-23 16:54 ` Pedro Alves
2009-10-23 17:19 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2009-10-23 16:54 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Snyder
On Friday 23 October 2009 17:38:11, Michael Snyder wrote:
> + store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
> + BYTE_ORDER, input);
Same remark about BYTE_ORDER != enum bfd_endian.
--
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Eliminate byteswap.h functions from record.c
2009-10-23 16:54 ` Pedro Alves
@ 2009-10-23 17:19 ` Michael Snyder
0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2009-10-23 17:19 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
Pedro Alves wrote:
> On Friday 23 October 2009 17:38:11, Michael Snyder wrote:
>> + store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
>> + BYTE_ORDER, input);
>
> Same remark about BYTE_ORDER != enum bfd_endian.
>
Yes, thanks, just posted a new patch in that thread.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-23 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-23 16:45 [RFA] Eliminate byteswap.h functions from record.c Michael Snyder
2009-10-23 16:54 ` Pedro Alves
2009-10-23 17:19 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox