* [PATCH] Fix some error added with HEX2BIN
@ 2001-05-15 18:17 John S. Kallal
2001-05-15 19:05 ` Michael Snyder
0 siblings, 1 reply; 2+ messages in thread
From: John S. Kallal @ 2001-05-15 18:17 UTC (permalink / raw)
To: gdb-patches; +Cc: msnyder
The following patch corrects some errors that I think
where added by the followin patch:
http://sources.redhat.com/ml/gdb-patches/2001-05/msg00017.html .
Without the patches, I was unable to work with the Linux
version of GDBSERVER.
2001-05-15 John S Kallal <jskallal@home.com>
* remote.c (remote_write_bytes) : Fixed string
pointer & string end byte bug added when function
of hex2bin added.
* remote.c (remote_wait): Remove unused i variable.
Merge variables p1 and p_temp into a single variable pt.
Change long strings to use standard C string
concatenation. Added new variable fieldsize to fix
string pointer adjustment bug added when function call
of hex2bin added.
*** ../gdb+dejagnu-20010515-org/gdb/remote.c Tue May 15 10:26:57 2001
--- gdb/remote.c Tue May 15 12:13:59 2001
***************
*** 2825,2831 ****
continue;
case 'T': /* Status with PC, SP, FP, ... */
{
- int i;
long regno;
char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE);
--- 2825,2830 ----
***************
*** 2839,2882 ****
while (*p)
{
! unsigned char *p1;
! char *p_temp;
/* Read the register number */
! regno = strtol ((const char *) p, &p_temp, 16);
! p1 = (unsigned char *) p_temp;
! if (p1 == p) /* No register number present here */
{
! p1 = (unsigned char *) strchr ((const char *) p, ':');
! if (p1 == NULL)
! warning ("Malformed packet(a) (missing colon): %s\n\
! Packet: '%s'\n",
! p, buf);
! if (strncmp ((const char *) p, "thread", p1 - p) == 0)
{
! p_temp = unpack_varlen_hex (++p1, &thread_num);
record_currthread (thread_num);
- p = (unsigned char *) p_temp;
}
}
else
{
! p = p1;
if (*p++ != ':')
! warning ("Malformed packet(b) (missing colon): %s\n\
! Packet: '%s'\n",
! p, buf);
if (regno >= NUM_REGS)
! warning ("Remote sent bad register number %ld: %s\n\
! Packet: '%s'\n",
! regno, p, buf);
! if (hex2bin (p, regs, REGISTER_RAW_SIZE (regno))
! < REGISTER_RAW_SIZE (regno))
warning ("Remote reply is too short: %s", buf);
supply_register (regno, regs);
}
--- 2838,2880 ----
while (*p)
{
! char *pt;
/* Read the register number */
! regno = strtol ((const char *) p, &pt, 16);
! if (pt == (char *)p) /* No register number present here */
{
! pt = strchr ((const char *) p, ':');
! if (pt == NULL)
! warning ("Malformed packet(a) (missing colon): %s\n"
! "Packet: '%s'\n", p, buf);
!
! if (strncmp ((const char *) p, "thread", pt - (char *)p) == 0)
{
! p = (unsigned char *)(unpack_varlen_hex (++pt, &thread_num) );
record_currthread (thread_num);
}
}
else
{
! int fieldsize;
!
! p = pt;
if (*p++ != ':')
! warning ("Malformed packet(b) (missing colon): %s\n"
! "Packet: '%s'\n", p, buf);
if (regno >= NUM_REGS)
! warning ("Remote sent bad register number %ld: %s\n"
! "Packet: '%s'\n", regno, p, buf);
! 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);
}
***************
*** 2928,2935 ****
if (symfile_objfile == NULL)
{
! warning ("Relocation packet received with no symbol file. \
! Packet Dropped");
goto got_status;
}
--- 2926,2933 ----
if (symfile_objfile == NULL)
{
! warning ("Relocation packet received with no symbol file. "
! "Packet Dropped");
goto got_status;
}
***************
*** 3628,3633 ****
--- 3626,3633 ----
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__,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix some error added with HEX2BIN
2001-05-15 18:17 [PATCH] Fix some error added with HEX2BIN John S. Kallal
@ 2001-05-15 19:05 ` Michael Snyder
0 siblings, 0 replies; 2+ messages in thread
From: Michael Snyder @ 2001-05-15 19:05 UTC (permalink / raw)
To: John S. Kallal; +Cc: gdb-patches
John,
Could you submit these changes separately, please?
We like to review changes that affect the behavior
separately from changes that are in the nature of clean-ups.
I think your bug-fix is correct, but it would be awkward to
approve that part and not the clean-up parts.
Thanks,
Michael
"John S. Kallal" wrote:
>
> The following patch corrects some errors that I think
> where added by the followin patch:
>
> http://sources.redhat.com/ml/gdb-patches/2001-05/msg00017.html .
>
> Without the patches, I was unable to work with the Linux
> version of GDBSERVER.
>
> 2001-05-15 John S Kallal <jskallal@home.com>
>
> * remote.c (remote_write_bytes) : Fixed string
> pointer & string end byte bug added when function
> of hex2bin added.
>
> * remote.c (remote_wait): Remove unused i variable.
> Merge variables p1 and p_temp into a single variable pt.
> Change long strings to use standard C string
> concatenation. Added new variable fieldsize to fix
> string pointer adjustment bug added when function call
> of hex2bin added.
>
> *** ../gdb+dejagnu-20010515-org/gdb/remote.c Tue May 15 10:26:57 2001
> --- gdb/remote.c Tue May 15 12:13:59 2001
> ***************
> *** 2825,2831 ****
> continue;
> case 'T': /* Status with PC, SP, FP, ... */
> {
> - int i;
> long regno;
> char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE);
>
> --- 2825,2830 ----
> ***************
> *** 2839,2882 ****
>
> while (*p)
> {
> ! unsigned char *p1;
> ! char *p_temp;
>
> /* Read the register number */
> ! regno = strtol ((const char *) p, &p_temp, 16);
> ! p1 = (unsigned char *) p_temp;
>
> ! if (p1 == p) /* No register number present here */
> {
> ! p1 = (unsigned char *) strchr ((const char *) p, ':');
> ! if (p1 == NULL)
> ! warning ("Malformed packet(a) (missing colon): %s\n\
> ! Packet: '%s'\n",
> ! p, buf);
> ! if (strncmp ((const char *) p, "thread", p1 - p) == 0)
> {
> ! p_temp = unpack_varlen_hex (++p1, &thread_num);
> record_currthread (thread_num);
> - p = (unsigned char *) p_temp;
> }
> }
> else
> {
> ! p = p1;
>
> if (*p++ != ':')
> ! warning ("Malformed packet(b) (missing colon): %s\n\
> ! Packet: '%s'\n",
> ! p, buf);
>
> if (regno >= NUM_REGS)
> ! warning ("Remote sent bad register number %ld: %s\n\
> ! Packet: '%s'\n",
> ! regno, p, buf);
>
> ! if (hex2bin (p, regs, REGISTER_RAW_SIZE (regno))
> ! < REGISTER_RAW_SIZE (regno))
> warning ("Remote reply is too short: %s", buf);
> supply_register (regno, regs);
> }
>
> --- 2838,2880 ----
>
> while (*p)
> {
> ! char *pt;
>
> /* Read the register number */
> ! regno = strtol ((const char *) p, &pt, 16);
>
> ! if (pt == (char *)p) /* No register number present here */
> {
> ! pt = strchr ((const char *) p, ':');
> ! if (pt == NULL)
> ! warning ("Malformed packet(a) (missing colon): %s\n"
> ! "Packet: '%s'\n", p, buf);
> !
> ! if (strncmp ((const char *) p, "thread", pt - (char *)p) == 0)
> {
> ! p = (unsigned char *)(unpack_varlen_hex (++pt, &thread_num) );
> record_currthread (thread_num);
> }
> }
> else
> {
> ! int fieldsize;
> !
> ! p = pt;
>
> if (*p++ != ':')
> ! warning ("Malformed packet(b) (missing colon): %s\n"
> ! "Packet: '%s'\n", p, buf);
>
> if (regno >= NUM_REGS)
> ! warning ("Remote sent bad register number %ld: %s\n"
> ! "Packet: '%s'\n", regno, p, buf);
>
> ! 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);
> }
>
> ***************
> *** 2928,2935 ****
>
> if (symfile_objfile == NULL)
> {
> ! warning ("Relocation packet received with no symbol file. \
> ! Packet Dropped");
> goto got_status;
> }
>
> --- 2926,2933 ----
>
> if (symfile_objfile == NULL)
> {
> ! warning ("Relocation packet received with no symbol file. "
> ! "Packet Dropped");
> goto got_status;
> }
>
> ***************
> *** 3628,3633 ****
> --- 3626,3633 ----
> 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__,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-05-15 19:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15 18:17 [PATCH] Fix some error added with HEX2BIN John S. Kallal
2001-05-15 19:05 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox