Author Topic: debug and watches  (Read 7553 times)

Offline huvcbo

  • Single posting newcomer
  • *
  • Posts: 5
debug and watches
« on: January 13, 2014, 11:23:39 pm »
Hi,
i have code like this
std::string s = "EFEF9E9475C8C2D938C204EAE058F2B3";
unsigned char c[16];

unsigned char xi;
size_t loop, ix;
size_t count = 0;
loop = 0;                                 /* Toggles between 0 and 1 */
count = 0;                                /* Input count and input index S*/
ix = 0;                                   /* Output index */
while ( count < s.size() ) {
    do {
        x = s[count] & 0x4f;
   if (x & 0x40)
       x = (x - 'A') + 10;
   if (!loop)
       c[ix] = x << 4;                  /* First nybble  */
   else
       c[ix] |= x;                        /* Second nybble */
   loop ^= 1;
   count++;
   } while (loop && count < s.size());
    ix++;
}

when i have a watch on c i get <incomplete sequence>
why and what is that?

Appreciate any help.
/huvcbo

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: debug and watches
« Reply #1 on: January 13, 2014, 11:36:45 pm »
Can you enable full debugger logging. Run another session and paste the log inside code or quote tags?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline huvcbo

  • Single posting newcomer
  • *
  • Posts: 5
Re: debug and watches
« Reply #2 on: January 14, 2014, 10:10:44 am »
HI thanks for Your reply

here is part of the log
"[debug]Reading symbols from /home/sys_cbo/dev/McbDES/bin/Debug/McbDES...
[debug]done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) CentOS (7.0.1-45.el5.centos)
[debug]Copyright (C) 2009 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i386-redhat-linux-gnu".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) CentOS (7.0.1-45.el5.centos)


At /home/sys_cbo/dev/McbDES/McbMain.cpp:583

[debug]> whatis s
[debug]type = std::locale::string
[debug]>>>>>>cb_gdb:
[debug]> output s.c_str()[0]@s.size()
[debug]"EFEF9E9475C8C2D938C204EAE058F2B3">>>>>>cb_gdb:
[debug]> whatis x
[debug]type = unsigned char
[debug]>>>>>>cb_gdb:
[debug]> output x
[debug]15 '\017'>>>>>>cb_gdb:
[debug]> whatis ix
[debug]type = size_t
[debug]>>>>>>cb_gdb:
[debug]> output ix
[debug]14>>>>>>cb_gdb:
[debug]> whatis c
[debug]type = unsigned char [16]
[debug]>>>>>>cb_gdb:
[debug]> output c
[debug]"\357u\310\302\331\070\302\004\352\340X\000">>>>>>cb_gdb:
[debug]> next
[debug]/home/sys_cbo/dev/McbDES/McbMain.cpp:586:18249:beg:0x804fd03
[debug]>>>>>>cb_gdb:

At /home/sys_cbo/dev/McbDES/McbMain.cpp:586

[debug]> whatis s
[debug]type = std::locale::string
[debug]>>>>>>cb_gdb:
[debug]> output s.c_str()[0]@s.size()
[debug]"EFEF9E9475C8C2D938C204EAE058F2B3">>>>>>cb_gdb:
[debug]> whatis x
[debug]type = unsigned char
[debug]>>>>>>cb_gdb:
[debug]> output x
[debug]15 '\017'>>>>>>cb_gdb:
[debug]> whatis ix
[debug]type = size_t
[debug]>>>>>>cb_gdb:
[debug]> output ix
[debug]14>>>>>>cb_gdb:
[debug]> whatis c
[debug]type = unsigned char [16]
[debug]>>>>>>cb_gdb:
[debug]> output c
[debug]"\357u\310\302\331\070\302\004\352\340X", <incomplete sequence \360>>>>>>>cb_gdb:
[debug]> next
[debug]/home/sys_cbo/dev/McbDES/McbMain.cpp:587:18263:beg:0x804fd07
[debug]>>>>>>cb_gdb:

At /home/sys_cbo/dev/McbDES/McbMain.cpp:587

[debug]> whatis s
[debug]type = std::locale::string
[debug]>>>>>>cb_gdb:
[debug]> output s.c_str()[0]@s.size()
[debug]"EFEF9E9475C8C2D938C204EAE058F2B3">>>>>>cb_gdb:
[debug]> whatis x
[debug]type = unsigned char
[debug]>>>>>>cb_gdb:
[debug]> output x
[debug]15 '\017'>>>>>>cb_gdb:
[debug]> whatis ix
[debug]type = size_t
[debug]>>>>>>cb_gdb:
[debug]> output ix
[debug]14>>>>>>cb_gdb:
[debug]> whatis c
[debug]type = unsigned char [16]
[debug]>>>>>>cb_gdb:
[debug]> output c
[debug]"\357u\310\302\331\070\302\004\352\340X", <incomplete sequence \360>>>>>>>cb_gdb:
[debug]> next
"

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: debug and watches
« Reply #3 on: January 14, 2014, 07:32:37 pm »
Please use code tags! A just type code and surround it with [ and ] and to close the tag use [/ code ].

About the problem: GDB tries to print the garbage you have in c and fails on some strange characters.
Try char c[16]={}; and you'll see it will disappear.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]