Debugger: DAP Debugging vatriables request segfault
I'm getting segfault after requesting "variables" with "variablesReference" which I get after "scopes" request.
Communication log:
Response: QJsonObject({"body":{"scopes":[{"expensive":false,"name":"Locals","presentationHint":"locals","source":{"name":"/home/artem/work/testproj/untitleWidget/CMakeLists.txt","path":"/home/artem/work/testproj/untitleWidget/CMakeLists.txt"},"variablesReference":1}]},"command":"scopes","request_seq":31,"seq":10,"success":true,"type":"response"})
Request: "Content-Length: 86\r\n\r\n{\"arguments\":{\"variablesReference\":1},\"command\":\"variables\",\"seq\":32,\"type\":\"request\"}"
Error:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
The problem is here:
toBeReturned.emplace_back(
dap::Variable{ {},
{},
{},
variables->GetName(),
{},
PrivatePropertyHint,
SupportsVariableType ? "collection" : nullptr, // Can be changed to: SupportsVariableType ? "collection" : "",
variables->GetValue(),
variables->GetId() });
Or maybe change the "optional" somehow or use std::nullopt.
Edited by Artem Hex