[Lldb-commits] [PATCH] D144937: [LLDB] Expose several methods in SBWatchpoint
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 28 12:49:26 PST 2023
JDevlieghere requested changes to this revision.
JDevlieghere added inline comments.
This revision now requires changes to proceed.
================
Comment at: lldb/source/API/SBWatchpoint.cpp:329-341
+ // We can't return `watchpoint_sp->GetWatchSpec().c_str()`
+ // because the temporary std::string will be destroyed
+ // when this function finishes. Instead we store our own
+ // copy in this class and give clients the C string used
+ // by the copy.
+ if (m_cached_watch_spec.size() == 0) {
+ m_cached_watch_spec = watchpoint_sp->GetWatchSpec();
----------------
As Ismail and Jason pointed out, the way to do this is wrapping it into a ConstString:
```
return ConstString(watchpoint_sp->GetWatchSpec()).AsCString();
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144937/new/
https://reviews.llvm.org/D144937
More information about the lldb-commits
mailing list