Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	  Pierre Muller <muller@ics.u-strasbg.fr>
Subject: Re: New ARI regression Fri Oct 23 01:57:01 UTC 2009
Date: Fri, 23 Oct 2009 22:37:00 -0000	[thread overview]
Message-ID: <4AE22E96.5010309@vmware.com> (raw)
In-Reply-To: <200910231949.35405.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

Pedro Alves wrote:

> These functions aren't always "network order" now, and are
> hence misnamed.  Rename or eliminate them by inlining they
> bodies at the call sites.  Alternatively, if you wanted to
> keep using "netorder", you could just simply always
> hardcode BFD_ENDIAN_BIG, or pull htonl from gnulib.
> 

Yeah.  Sorry for all the back-and-forth.  I like the last idea.
How's this patch?




[-- Attachment #2: bigend.txt --]
[-- Type: text/plain, Size: 1775 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.34
diff -u -p -r1.34 record.c
--- record.c	23 Oct 2009 17:12:25 -0000	1.34
+++ record.c	23 Oct 2009 22:33:56 -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
@@ -1956,27 +1955,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), 
+			  BFD_ENDIAN_BIG, 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), 
+			  BFD_ENDIAN_BIG, 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), 
+			  BFD_ENDIAN_BIG, input);
+  return ret;
 }
 
 /* Restore the execution log from a core_bfd file.  */

  reply	other threads:[~2009-10-23 22:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091023015701.GA26378@sourceware.org>
2009-10-23  8:58 ` Pierre Muller
2009-10-23 16:07   ` Michael Snyder
2009-10-23 16:51     ` Pedro Alves
2009-10-23 17:19       ` Michael Snyder
2009-10-23 18:49         ` Pedro Alves
2009-10-23 22:37           ` Michael Snyder [this message]
2009-10-23 22:58             ` Pedro Alves
2009-10-23 23:42               ` Michael Snyder
2009-10-24  3:33                 ` Hui Zhu

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=4AE22E96.5010309@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    --cc=pedro@codesourcery.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