This revision was automatically updated to reflect the committed changes. Closed by commit rG9a3f0cd717f6: Fix crash in lldb-vscode when missing function name (authored by zhyty).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156970/new/ https://reviews.llvm.org/D156970 Files: lldb/tools/lldb-vscode/JSONUtils.cpp Index: lldb/tools/lldb-vscode/JSONUtils.cpp =================================================================== --- lldb/tools/lldb-vscode/JSONUtils.cpp +++ lldb/tools/lldb-vscode/JSONUtils.cpp @@ -696,7 +696,11 @@ int64_t frame_id = MakeVSCodeFrameID(frame); object.try_emplace("id", frame_id); - std::string frame_name = frame.GetDisplayFunctionName(); + // `function_name` can be a nullptr, which throws an error when assigned to an + // `std::string`. + const char *function_name = frame.GetDisplayFunctionName(); + std::string frame_name = + function_name == nullptr ? std::string() : function_name; if (frame_name.empty()) frame_name = "<unknown>"; bool is_optimized = frame.GetFunction().GetIsOptimized();
Index: lldb/tools/lldb-vscode/JSONUtils.cpp =================================================================== --- lldb/tools/lldb-vscode/JSONUtils.cpp +++ lldb/tools/lldb-vscode/JSONUtils.cpp @@ -696,7 +696,11 @@ int64_t frame_id = MakeVSCodeFrameID(frame); object.try_emplace("id", frame_id); - std::string frame_name = frame.GetDisplayFunctionName(); + // `function_name` can be a nullptr, which throws an error when assigned to an + // `std::string`. + const char *function_name = frame.GetDisplayFunctionName(); + std::string frame_name = + function_name == nullptr ? std::string() : function_name; if (frame_name.empty()) frame_name = "<unknown>"; bool is_optimized = frame.GetFunction().GetIsOptimized();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits