================
@@ -11,71 +11,289 @@
#include "Protocol/ProtocolRequests.h"
#include "Protocol/ProtocolTypes.h"
#include "RequestHandler.h"
+#include "SBAPIExtras.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBThread.h"
+#include "lldb/API/SBThreadCollection.h"
+#include "lldb/API/SBValue.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/BranchProbability.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/JSON.h"
+#include "llvm/Support/raw_ostream.h"
+#include <string>
+using namespace llvm;
+using namespace lldb_dap;
using namespace lldb_dap::protocol;
-namespace lldb_dap {
+namespace {
-/// Retrieves the details of the exception that caused this event to be raised.
-///
-/// Clients should only call this request if the corresponding capability
-/// `supportsExceptionInfoRequest` is true.
-llvm::Expected<ExceptionInfoResponseBody>
-ExceptionInfoRequestHandler::Run(const ExceptionInfoArguments &args) const {
+// See `InstrumentationRuntimeUBSan::RetrieveReportData`.
+struct UBSanReport {
+ std::string description;
+ std::string summary;
+ std::string filename;
+ uint32_t column = LLDB_INVALID_COLUMN_NUMBER;
+ uint32_t line = LLDB_INVALID_LINE_NUMBER;
+ lldb::addr_t memory = LLDB_INVALID_ADDRESS;
+ lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
+ std::vector<lldb::user_id_t> trace;
+};
- lldb::SBThread thread = dap.GetLLDBThread(args.threadId);
- if (!thread.IsValid())
- return llvm::make_error<DAPError>(
- llvm::formatv("Invalid thread id: {}", args.threadId).str());
+// See `InstrumentationRuntimeMainThreadChecker::RetrieveReportData`.
+struct MainThreadCheckerReport {
+ std::string description;
+ std::string api_name;
+ std::string class_name;
+ std::string selector;
+ lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
+ std::vector<lldb::addr_t> trace;
+};
+
+// FIXME: Support TSan, ASan, BoundsSafety formatting.
+
+using RuntimeInstrumentReport =
+ std::variant<UBSanReport, MainThreadCheckerReport>;
+
+static bool fromJSON(const json::Value ¶ms, UBSanReport &report,
+ json::Path path) {
+ json::ObjectMapper O(params, path);
+ return O.mapOptional("description", report.description) &&
+ O.mapOptional("summary", report.summary) &&
+ O.mapOptional("filename", report.filename) &&
+ O.mapOptional("col", report.column) &&
+ O.mapOptional("line", report.line) &&
+ O.mapOptional("memory_address", report.memory);
+}
+
+static bool fromJSON(const json::Value ¶ms, MainThreadCheckerReport
&report,
+ json::Path path) {
+ json::ObjectMapper O(params, path);
+ return O.mapOptional("description", report.description) &&
+ O.mapOptional("api_name", report.api_name) &&
+ O.mapOptional("class_name", report.class_name) &&
+ O.mapOptional("selector", report.selector);
+}
+
+static bool fromJSON(const json::Value ¶ms, RuntimeInstrumentReport
&report,
----------------
DrSergei wrote:
Do we really need to mark all functions as static, if we already use anonymous
namespace
https://github.com/llvm/llvm-project/pull/176465
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits