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

Greg Clayton clayborg at gmail.com
Wed Feb 25 10:44:36 PST 2015


See inlined comments on your use of shared_ptr.


================
Comment at: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp:1383
@@ -1386,2 +1382,3 @@
     CMIUtilString text;
+    std::shared_ptr<char> spStdoutBuffer(new char[1024]);
     lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetSelectedTarget().GetProcess();
----------------
Any reason you don't just use a stack based string "char spStdoutBuffer[1024];"?

Also are you making a shared pointer to a char and then feeding it something that needs to be deleted with "delete[]" but it won't, it will get deleted with just "delete"?

================
Comment at: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp:1416
@@ -1421,2 +1415,3 @@
     CMIUtilString text;
+    std::shared_ptr<char> spStderrBuffer(new char[1024]);
     lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetSelectedTarget().GetProcess();
----------------
See above comment on spStdoutBuffer and apply same fix here.

http://reviews.llvm.org/D7858

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






More information about the lldb-commits mailing list