public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Aleksandar Ristovski <ARistovski@qnx.com>
Subject: [PATCH v7 02/10] Merge multiple hex conversions
Date: Sun, 14 Jun 2015 19:26:00 -0000	[thread overview]
Message-ID: <20150614192559.18346.31036.stgit@host1.jankratochvil.net> (raw)
In-Reply-To: <20150614192542.18346.87859.stgit@host1.jankratochvil.net>

Hi,

here most of the patch has been reimplemented in the meantime and this is only
a small remaint.

Approved by:
	https://sourceware.org/ml/gdb-patches/2014-05/msg00366.html


Jan


gdb/gdbserver/ChangeLog
2014-02-26  Aleksandar Ristovski  <aristovski@qnx.com
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Merge multiple hex conversions.
	* gdbreplay.c (tohex): Rename to 'fromhex'.
	(logchar): Use fromhex.

gdb/ChangeLog
2014-02-26  Aleksandar Ristovski  <aristovski@qnx.com
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Merge multiple hex conversions.
	* monitor.c: Include rsp-low.h.
	(fromhex): Remove definition.
---
 gdb/gdbserver/gdbreplay.c |    6 +++---
 gdb/monitor.c             |   16 +---------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index a02a824..79aa8aa 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -259,7 +259,7 @@ remote_open (char *name)
 }
 
 static int
-tohex (int ch)
+fromhex (int ch)
 {
   if (ch >= '0' && ch <= '9')
     {
@@ -322,11 +322,11 @@ logchar (FILE *fp)
 	  ch2 = fgetc (fp);
 	  fputc (ch2, stdout);
 	  fflush (stdout);
-	  ch = tohex (ch2) << 4;
+	  ch = fromhex (ch2) << 4;
 	  ch2 = fgetc (fp);
 	  fputc (ch2, stdout);
 	  fflush (stdout);
-	  ch |= tohex (ch2);
+	  ch |= fromhex (ch2);
 	  break;
 	default:
 	  /* Treat any other char as just itself */
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 548dae3..c7f5fc7 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -54,6 +54,7 @@
 #include "regcache.h"
 #include "gdbthread.h"
 #include "readline/readline.h"
+#include "rsp-low.h"
 
 static char *dev_name;
 static struct target_ops *targ_ops;
@@ -225,21 +226,6 @@ monitor_error (char *function, char *message,
 	   message, safe_string);
 }
 
-/* Convert hex digit A to a number.  */
-
-static int
-fromhex (int a)
-{
-  if (a >= '0' && a <= '9')
-    return a - '0';
-  else if (a >= 'a' && a <= 'f')
-    return a - 'a' + 10;
-  else if (a >= 'A' && a <= 'F')
-    return a - 'A' + 10;
-  else
-    error (_("Invalid hex digit %d"), a);
-}
-
 /* monitor_vsprintf - similar to vsprintf but handles 64-bit addresses
 
    This function exists to get around the problem that many host platforms

  parent reply	other threads:[~2015-06-14 19:26 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-14 19:25 [PATCH v7 00/10] Validate binary before use Jan Kratochvil
2015-06-14 19:25 ` [PATCH v7 01/10] Move utility functions to common/ Jan Kratochvil
2015-06-15 13:22   ` Joel Brobecker
2015-06-15 15:07     ` [commit] " Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 07/10] Move linux_find_memory_regions_full & co Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 03/10] Code cleanup: Rename enum -> enum filterflags Jan Kratochvil
2015-06-15 13:34   ` Joel Brobecker
2015-06-15 15:12     ` [commit] " Jan Kratochvil
2015-07-08 14:38   ` Pedro Alves
2015-06-14 19:26 ` Jan Kratochvil [this message]
2015-06-15 13:33   ` [PATCH v7 02/10] Merge multiple hex conversions Joel Brobecker
2015-06-15 15:09     ` [commit] " Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 06/10] Prepare linux_find_memory_regions_full & co. for move Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 04/10] Create empty nat/linux-maps.[ch] and common/target-utils.[ch] Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 05/10] Move gdb_regex* to common/ Jan Kratochvil
2015-07-08 14:39   ` Pedro Alves
2015-07-14 20:13     ` Jan Kratochvil
2015-06-14 19:27 ` [PATCH v7 10/10] Tests for validate symbol file using build-id Jan Kratochvil
2015-07-08 14:44   ` Pedro Alves
2015-06-14 19:27 ` [PATCH v7 08/10] gdbserver build-id attribute generator Jan Kratochvil
2015-07-08 14:41   ` Pedro Alves
2015-06-14 19:27 ` [PATCH v7 09/10] Validate symbol file using build-id Jan Kratochvil
2015-06-21 10:16   ` [PATCH v8 " Jan Kratochvil
2015-06-22 12:55     ` Aleksandar Ristovski
2015-06-22 20:37       ` Jan Kratochvil
2015-06-22 20:41         ` Aleksandar Ristovski
2015-06-22 22:25     ` Doug Evans
2015-06-23 20:47       ` Jan Kratochvil
2015-07-08 14:44         ` Pedro Alves
2015-07-12 19:09           ` Jan Kratochvil
2015-07-12 19:29             ` [PATCH v9 " Jan Kratochvil
2015-07-12 19:54               ` Eli Zaretskii
2015-07-12 20:01                 ` Jan Kratochvil
2015-07-13  2:30                   ` Eli Zaretskii
2015-07-13 10:34                 ` Pedro Alves
2015-07-13 12:38                   ` Jan Kratochvil
2015-07-14 16:14                     ` Doug Evans
2015-07-15  8:21                       ` Jan Kratochvil
2015-07-15 14:59                         ` Doug Evans
2015-06-27 21:05       ` [PATCH v8 " Jan Kratochvil
2015-07-08 15:40         ` Doug Evans
2015-07-12 19:27           ` Jan Kratochvil
2015-07-15 16:36 ` [commit] [PATCH v7 00/10] Validate binary before use Jan Kratochvil
2015-07-15 18:33   ` [revert] " Jan Kratochvil

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=20150614192559.18346.31036.stgit@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=ARistovski@qnx.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).