[Lldb-commits] [PATCH] Fix process's output to stdout/stderr (MI)

Greg Clayton clayborg at gmail.com
Tue Feb 24 09:58:46 PST 2015


We need to support all characters and any test should include all characters from 0 - 255 all in a string to ensure we can decode things properly on the other end.


================
Comment at: tools/lldb-mi/MIUtilString.cpp:863
@@ +862,3 @@
+            default:
+                strNew.push_back(cUnescapedChar);
+                break;
----------------
Most of our escape code functions actually do a switch on all characters instead of checking bEscapeCharNotFound. Just do the switch and in the default case do:

if (::isprint(cUnescapedChar))
    strNew.push_back(cUnescapedChar);
else
{
    char hex_escape[8];
    int hex_escape_len = snprintf(hex_escape, sizeof(hex_escape), "\\x%02x", cUnescapedChar);
    strNew.append(hex_escape, hex_escape_len); 
}


================
Comment at: tools/lldb-mi/MIUtilString.cpp:933-938
@@ +932,8 @@
+            {
+                const MIuint nEscapedCharPos(ms_strEscapeCharacters.find(cEscapedChar));
+                const bool bEscapedCharNotLegal(nEscapedCharPos == (MIuint)std::string::npos);
+                if (bEscapedCharNotLegal)
+                    strNew.push_back(cBckSlash);
+                strNew.push_back(cEscapedChar);
+                break;
+            }
----------------
Handle \xHH escaped characters here if we add support above using the isprint stuff above.

http://reviews.llvm.org/D7858

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list