[Lldb-commits] [lldb] [lldb-dap] Use protocol types for exceptioninfo (PR #165858)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 5 06:08:41 PST 2025
DavidSpickett wrote:
Is it a lifetime problem?
```
result.insert({"description", ERB.description.c_str()});
```
Inserts a KV into json::Object.
```
struct Object::KV {
ObjectKey K;
Value V;
};
```
```
inline std::pair<Object::iterator, bool> Object::insert(KV E) {
return try_emplace(std::move(E.K), std::move(E.V));
}
```
`std::move` of `const char*` just copies the pointer, but for a `std::string` it would copy the memory (/transfer ownership of it). And on some platforms we have reused the memory by the time it's encoded to JSON.
Not sure though because there's some laters of templates in the way. This is the only `toJSON` in the file that uses `c_str` though and it would explain why the API reproducer is fine.
If that makes sense to you, feel free to reland with that change. Otherwise give me any more ideas and I'll continue to dig.
https://github.com/llvm/llvm-project/pull/165858
More information about the lldb-commits
mailing list