Patchwork [FYI] Remove fromhex implementation from gdbreplay

login
register
mail settings
Submitter Tom Tromey
Date June 2, 2019, 10:44 p.m.
Message ID <20190602224459.1539-1-tom@tromey.com>
Download mbox | patch
Permalink /patch/32967/
State New
Headers show

Comments

Tom Tromey - June 2, 2019, 10:44 p.m.
gdbreplay had its own implementation of fromhex.  This patch changes
it to use the one in common/.

gdb/gdbserver/ChangeLog
2019-06-02  Tom Tromey  <tom@tromey.com>

	* gdbreplay.c (fromhex): Remove.
	* Makefile.in (GDBREPLAY_OBS): Add rsp-low.o.
---
 gdb/gdbserver/ChangeLog   |  5 +++++
 gdb/gdbserver/Makefile.in |  1 +
 gdb/gdbserver/gdbreplay.c | 21 +--------------------
 3 files changed, 7 insertions(+), 20 deletions(-)

Patch

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index f5fc55034ee..71865508d7a 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -291,6 +291,7 @@  GDBREPLAY_OBS = \
 	common/cleanups.o \
 	common/common-exceptions.o \
 	common/common-utils.o \
+	common/rsp-low.o \
 	common/errors.o \
 	common/netstuff.o \
 	common/print-utils.o \
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 2800e7834df..f4fd5686ef7 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -49,6 +49,7 @@ 
 #endif
 
 #include "common/netstuff.h"
+#include "common/rsp-low.h"
 
 #ifndef HAVE_SOCKLEN_T
 typedef int socklen_t;
@@ -288,26 +289,6 @@  remote_open (char *name)
   fflush (stderr);
 }
 
-static int
-fromhex (int ch)
-{
-  if (ch >= '0' && ch <= '9')
-    {
-      return (ch - '0');
-    }
-  if (ch >= 'A' && ch <= 'F')
-    {
-      return (ch - 'A' + 10);
-    }
-  if (ch >= 'a' && ch <= 'f')
-    {
-      return (ch - 'a' + 10);
-    }
-  fprintf (stderr, "\nInvalid hex digit '%c'\n", ch);
-  fflush (stderr);
-  exit (1);
-}
-
 static int
 logchar (FILE *fp)
 {