From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12606 invoked by alias); 2 Mar 2014 19:53:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 12528 invoked by uid 89); 2 Mar 2014 19:53:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 02 Mar 2014 19:53:54 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s22Jr56K010705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Mar 2014 14:53:06 -0500 Received: from host1.jankratochvil.net (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s22Jr4JU020192; Sun, 2 Mar 2014 14:53:05 -0500 Subject: [PATCH v4 2/8] Merge multiple hex conversions From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Aleksandar Ristovski Date: Sun, 02 Mar 2014 19:53:00 -0000 Message-ID: <20140302195304.10290.79936.stgit@host1.jankratochvil.net> In-Reply-To: <20140302195248.10290.22958.stgit@host1.jankratochvil.net> References: <20140302195248.10290.22958.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00018.txt.bz2 Hi, here most of the patch has been reimplemented in the meantime and this is only a small remaint. Jan gdb/ 2014-02-26 Aleksandar Ristovski = '0' && ch <= '9') { @@ -327,11 +327,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 c46e2df..e675772 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -55,6 +55,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; @@ -226,21 +227,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