From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19075 invoked by alias); 19 Mar 2014 22:31:17 -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 19066 invoked by uid 89); 19 Mar 2014 22:31:17 -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,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD 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; Wed, 19 Mar 2014 22:30:50 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2JMUkEN015875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Mar 2014 18:30:46 -0400 Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2JMUjW3029312; Wed, 19 Mar 2014 18:30:45 -0400 Subject: [PATCH v5 2/8] Merge multiple hex conversions From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Aleksandar Ristovski Date: Wed, 19 Mar 2014 22:31:00 -0000 Message-ID: <20140319223044.14668.13369.stgit@host1.jankratochvil.net> In-Reply-To: <20140319223004.14668.20989.stgit@host1.jankratochvil.net> References: <20140319223004.14668.20989.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/msg00466.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