[Lldb-commits] [lldb] [lldb-dap] Migrate disassemble request to structured handler (PR #140482)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon May 19 09:04:45 PDT 2025
================
@@ -782,4 +785,89 @@ bool fromJSON(const llvm::json::Value &Params, InstructionBreakpoint &IB,
O.mapOptional("mode", IB.mode);
}
+bool fromJSON(const llvm::json::Value &Params,
+ DisassembledInstruction::PresentationHint &PH,
+ llvm::json::Path P) {
+ auto rawHint = Params.getAsString();
+ if (!rawHint) {
+ P.report("expected a string");
+ return false;
+ }
+ std::optional<DisassembledInstruction::PresentationHint> hint =
+ StringSwitch<std::optional<DisassembledInstruction::PresentationHint>>(
+ *rawHint)
+ .Case("normal", DisassembledInstruction::
+ eDisassembledInstructionPresentationHintNormal)
+ .Case("invalid", DisassembledInstruction::
+ eDisassembledInstructionPresentationHintInvalid)
+ .Default(std::nullopt);
+ if (!hint) {
+ P.report("unexpected value");
+ return false;
+ }
+ PH = *hint;
+ return true;
+}
+
+llvm::json::Value toJSON(const DisassembledInstruction::PresentationHint &PH) {
+ switch (PH) {
+ case DisassembledInstruction::eDisassembledInstructionPresentationHintNormal:
+ return "normal";
+ case DisassembledInstruction::eDisassembledInstructionPresentationHintInvalid:
+ return "invalid";
+ }
+ llvm_unreachable("unhandled presentation hint.");
+}
+
+bool fromJSON(const llvm::json::Value &Params, DisassembledInstruction &DI,
+ llvm::json::Path P) {
+ std::optional<llvm::StringRef> raw_address =
----------------
ashgti wrote:
I think that may run into issues with the c++ type system since the type is just a typedef like `typedef uint64_t addr_t;` I think c++ doesn't make a distinction between other `uint64_t` types and `addr_t`. I could be wrong on that though, but that may be an an issue with generalizing this to much.
https://github.com/llvm/llvm-project/pull/140482
More information about the lldb-commits
mailing list