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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits