bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdbserver problem + patch


From: Bart Van Assche
Subject: gdbserver problem + patch
Date: Sun, 24 Dec 2000 14:51:41 +0000

Hello,

I experienced a problem while attempting to use gdb and gdbserver:
gdbserver reported the error "Reply contains invalid hex digit" while
(at least in my opinion) it shouldn't. The problem appeared on a i386
Linux system (RedHat 6.1 with kernel 2.2.18), both with gdb 4.18 and gdb
5.0, and gdbserver from the 5.0 distribution. See below for instructions
on how to reproduce the problem.

The problem disappeared when I added ' && *from' to the loop condition
in the function convert_ascii_to_int in source file remote-utils.c of
gdbserver:

****************** original ******************
void
convert_ascii_to_int (from, to, n)
     char *from, *to;
     int n;
{
  int nib1, nib2;
  while (n--)
    {
      nib1 = fromhex (*from++);
      nib2 = fromhex (*from++);
      *to++ = (((nib1 & 0x0f) << 4) & 0xf0) | (nib2 & 0x0f);
    }
}

****************** modified ******************
void
convert_ascii_to_int (from, to, n)
     char *from, *to;
     int n;
{
  int nib1, nib2;
  while (n-- > 0 && *from)
    {
      nib1 = fromhex (*from++);
      nib2 = fromhex (*from++);
      *to++ = (((nib1 & 0x0f) << 4) & 0xf0) | (nib2 & 0x0f);
    }
}


------------------------------------------------------------------------------------------
How to reproduce the problem:


gdbserver localhost:2345 program & \
(printf "target remote localhost:2345\n where\n break main\n cont\n
quit\n" | gdb program)

gdbserver output:
-----------------
Process program created; pid = 1428
Remote debugging using localhost:2345
Reply contains invalid hex digit


gdb output:
-----------
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
(gdb) target remote localhost:2345
Remote debugging using localhost:2345
0x40001780 in ?? ()
(gdb) where
#0  0x40001780 in ?? ()
#1  0xffffffff in ?? ()
(gdb) break main
Breakpoint 1 at 0x8049056: file queue-test.cpp, line 6.
(gdb) cont
Continuing.
Ignoring packet error, continuing...

Breakpoint 1, main (arg=1, argv=0xbffffc14) at queue-test.cpp:6
6         std::deque<int> q;
(gdb) 










---
Bart Van Assche.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]