[Lldb-commits] [PATCH] D32585: Implementation of remote packets for Trace data.

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 11 10:19:31 PDT 2017


zturner added inline comments.


================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1125
+    uint64_t extracted_value;
+    value.getAsInteger(16, extracted_value);
+
----------------
Should you be checking the return value of `getAsInteger` here?  What if it didn't parse as an integer?  Confusingly, the function returns true if it failed and false if it suceeded, so watch out.


================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1200
+    uint64_t extracted_value;
+    if (!value.getAsInteger(16, extracted_value)) {
+      if (name.equals("threadid"))
----------------
Can you invert the conditional here and use an early exit from the loop if there's an error?


https://reviews.llvm.org/D32585





More information about the lldb-commits mailing list