Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "John S. Kallal" <kallal@CyberMax.local>
To: gdb-patches@sources.redhat.com
Cc: msnyder@cygnus.com
Subject: [PATCH] Fix some error added with HEX2BIN, 2nd version
Date: Wed, 16 May 2001 16:33:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.21.0105161929080.729-100000@CyberMax.local> (raw)

	Forget about the code clean-up for now.  
        Maybe I will do the whole file later.
        Here is just the bug fixes. 

	I think there is another place where 
	hex2bin() is called that also have pointer update
        problems.  I did NOT review and change all area 
        that make a call to function hex2bin as I have
        no way of testing other areas in file remote.c. 
	However function remote_async_wait() seem to have 
	the same problem.


2001-05-16  John S Kallal  <jskallal@home.com>

	*  remote.c (remote_wait): Added new local variable fieldsize.
	(remote_wait) : Using fieldsize to save number of bytes read by
	the call to hex2bin().  Update buffer reading pointer using 
	value of variable fieldsize.  This fixes a bug added when 
	the hex2bin() call was added.
	
	*  remote.c (remote_write_bytes) : Fix string pointer 
        update bug and string non-termination bug added when
	function hex2bin() call was added.



--- ../gdb+dejagnu-20010516-org/gdb/remote.c	Wed May 16 12:03:47 2001
+++ gdb/remote.c	Wed May 16 12:10:10 2001
@@ -2862,6 +2862,8 @@ Packet: '%s'\n",
 		  }
 		else
 		  {
+		    int fieldsize;
+		  		
 		    p = p1;
 
 		    if (*p++ != ':')
@@ -2874,8 +2876,9 @@ Packet: '%s'\n",
 Packet: '%s'\n",
 			       regno, p, buf);
 
-		    if (hex2bin (p, regs, REGISTER_RAW_SIZE (regno))
-			< REGISTER_RAW_SIZE (regno))
+		    fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (regno));
+		    p += 2*fieldsize;
+		    if ( fieldsize < REGISTER_RAW_SIZE (regno))
 		      warning ("Remote reply is too short: %s", buf);
 		    supply_register (regno, regs);
 		  }
@@ -3628,6 +3631,8 @@ remote_write_bytes (CORE_ADDR memaddr, c
 	 increasing byte addresses.  Each byte is encoded as a two hex
 	 value.  */
       nr_bytes = bin2hex (myaddr, p, todo);
+      p += 2*nr_bytes;
+      *p = '0';
       break;
     case PACKET_SUPPORT_UNKNOWN:
       internal_error (__FILE__, __LINE__,


             reply	other threads:[~2001-05-16 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 16:33 John S. Kallal [this message]
2001-05-17 10:54 ` Michael Snyder

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=Pine.LNX.4.21.0105161929080.729-100000@CyberMax.local \
    --to=kallal@cybermax.local \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@cygnus.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