simulavr-devel
[Top][All Lists]
Advanced

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

AW: [Simulavr-devel] [patch #3453] gdbserver.c gdb_extract_hex_nu m(...)


From: Frost_Tobias
Subject: AW: [Simulavr-devel] [patch #3453] gdbserver.c gdb_extract_hex_nu m(...) bug fix (for more recent gdb versions)
Date: Tue, 19 Oct 2004 09:13:37 +0200

No, the patch's correct.
Num will be shifted by 4 every time the while is executed and then stored.
Then the low nibble will be ored into num

Example:

*p = ABCDEF

will be: (each line is one while-execution)

    num         
0x0000 000A     
0x0000 00AB
0x0000 0ABC
0x0000 ABCD
0x000A BCDE
0x00AB CDEF 

 num = (num << (i * 4)) | hex2nib (*p);  (replaced by following line) */

without the patch you'll get: 

(i=0) -> no shift         0x0000 000A  
(i=1 -> shifted with 4) ->     num = 0x0000 00A0  | 0x0B  -> num = 0x0000
00AB
(i=2 -> num shifted with 8) -> num = 0x0000 AB00 | 0x0C -> num = 0x0000 AB0C
(ERROR!)

  
 

-----Ursprüngliche Nachricht-----
Von: Klaus Rudolph [mailto:address@hidden
Gesendet: Montag, 18. Oktober 2004 17:16
An: address@hidden
Betreff: [Simulavr-devel] [patch #3453] gdbserver.c
gdb_extract_hex_num(...) bug fix (for more recent gdb versions)


This mail is an automated notification from the patch tracker
 of the project: Simulavr: an AVR simulator.

/**************************************************************************/
[patch #3453] Latest Modifications:

Changes by: 
                Klaus Rudolph <address@hidden>
'Date: 
                Mon 18.10.2004 at 15:07 (Europe/Berlin)

------------------ Additional Follow-up Comments
----------------------------
Can you give me an idea what problem the patch should fix?

Your new line:
 num = (num << 4) | hex2nib (*p);
could never work I think. This will always change 
the "0000000X0" position but nothing else!?.
If the tranmitted var is longer you have to change
the init of max_shifts but that is not done....

maybe I am totally confused today, but please let us know
what your problem is.

Why you have not send a patch file as patch?







/**************************************************************************/
[patch #3453] Full Item Snapshot:

URL: <http://savannah.nongnu.org/patch/?func=detailitem&item_id=3453>
Project: Simulavr: an AVR simulator
Submitted by: Paul Schlie
On: Mon 18.10.2004 at 12:48

Category:  bug fix
Priority:  9 - Immediate
Resolution:  None
Privacy:  Public
Assigned to:  None
Originator Email:  
Status:  Open


Summary:  gdbserver.c gdb_extract_hex_num(...) bug fix (for more recent gdb
versions)

Original Submission:  static int
gdb_extract_hex_num (char **pkt, char stop)
{
    int i = 0;
    int num = 0;
    char *p = *pkt;
    int max_shifts = sizeof (int) * 2 - 1; /* max number of nibbles to shift
                                              through */

    while ((*p != stop) && (*p != ''))
    {
        if (i > max_shifts)
            avr_error ("number too large");

/* This is broken for values encoded with greater than two hex digits, which
    is typical in gdb sessions when leading 0's are encoded for integer
values
        num = (num << (i * 4)) | hex2nib (*p);  (replaced by following line)
*/
        num = (num << 4) | hex2nib (*p);
        i++;
        p++;
    }

    *pkt = p;
    return num;
}


Follow-up Comments
------------------


-------------------------------------------------------
Date: Mon 18.10.2004 at 15:07       By: Klaus Rudolph <zfrdh>
Can you give me an idea what problem the patch should fix?

Your new line:
 num = (num << 4) | hex2nib (*p);
could never work I think. This will always change 
the "0000000X0" position but nothing else!?.
If the tranmitted var is longer you have to change
the init of max_shifts but that is not done....

maybe I am totally confused today, but please let us know
what your problem is.

Why you have not send a patch file as patch?













For detailed info, follow this link:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=3453>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





_______________________________________________
Simulavr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/simulavr-devel




reply via email to

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