[Lldb-commits] [PATCH] D74096: [lldb/API] Fix the dangling pointer issue in SBThread::GetStopDescription

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 5 16:01:38 PST 2020


JDevlieghere added inline comments.


================
Comment at: lldb/source/API/SBThread.cpp:357
             stop_desc = wp_desc;
             stop_desc_len = sizeof(wp_desc); // Include the NULL byte for size
           } break;
----------------
This looks like some "optimization" to not have to compute the strlen below if the string is known. I dont't think we need this anymore with the description being a string? 


================
Comment at: lldb/source/API/SBThread.cpp:394
+          if (!stop_desc.empty()) {
             if (dst)
+              return ::snprintf(dst, dst_len, "%s", stop_desc.c_str()) +
----------------
You could simplify this 

```
if (!stop_desc.empty() && dst) {
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74096/new/

https://reviews.llvm.org/D74096





More information about the lldb-commits mailing list