Menu

#505 Watches window does not show tabs in strings

Undefined
invalid
Bug_Report
2022-04-19
2017-05-06
No

When watching a char[] variable, the string represented does not show tabs.

I see some things in the string like \", (for a double quote) and \, (for a backslash) as expected.

But if there is a tab character (0x09) I would expect to see a \t, but it does not show up.

Thaiks, Mark.

Discussion

  • Teodor Petrov

    Teodor Petrov - 2017-05-07
    • labels: Watch Window, tab --> Watch Window, debugger
     
  • Adam Kessler

    Adam Kessler - 2018-03-26

    This is shown for me too on Code::Blocks 17.12 on Windows 10 Version 1709. Having a string with a tab character like "this is a tab" doesn't even show the proper whitespace in the Watch window while debugging. Perhaps testing with other whitespace characters and other ways of declaring and initializing character arrays may lead to more information about the nature of the problem.

     
  • Andrew Cottrell

    Andrew Cottrell - 2022-04-19

    In C::B 20.03 with GDB 11.2 using the following code snippet (in a test app):

       char cTest[300];
        memset(cTest, 0x00, 300);
        for( int i=0; i<0xFF; i++)
        {
            cTest[i] = i;
        }
    

    The watch data is shown as:
    \000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201‚ƒ„…†‡\210‰Š‹Œ\215Ž\217\220‘’“”•–—\230\231š›œ\235žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇ"...]

    The data shown is not in hex, but octal. So tab character 0x09 is shown as \t which is what was requested.

    As such with C::B 20.03 and GDB 11.2 the watch works as requested.

    BTW I would use the memory dump dialog to show a string if you want to see non printable characters as it shows the hex and ascii values.

    If you want the values shown in teh string as hex instead of ocal then please raise another ticket and request the GDB debugger plugin change the watch value deault to be changes from octal to hex using the GDB "-var-set-format name format-spec" command.

     
  • Morten MacFly

    Morten MacFly - 2022-04-19
    • status: open --> invalid
    • assigned_to: Morten MacFly
     

Log in to post a comment.

MongoDB Logo MongoDB