-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb-dap] Refactoring IOStream into Transport handler. #130026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
c340c38
138d4ca
9fdcba9
9090a31
40d149d
7d9eeb1
564cfc4
025f802
972028b
2694f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,12 @@ | |
| #include "FunctionBreakpoint.h" | ||
| #include "Handler/RequestHandler.h" | ||
| #include "Handler/ResponseHandler.h" | ||
| #include "IOStream.h" | ||
| #include "InstructionBreakpoint.h" | ||
| #include "OutputRedirector.h" | ||
| #include "ProgressEvent.h" | ||
| #include "Protocol.h" | ||
| #include "SourceBreakpoint.h" | ||
| #include "Transport.h" | ||
| #include "lldb/API/SBBroadcaster.h" | ||
| #include "lldb/API/SBCommandInterpreter.h" | ||
| #include "lldb/API/SBDebugger.h" | ||
|
|
@@ -39,7 +40,6 @@ | |
| #include "llvm/Support/Error.h" | ||
| #include "llvm/Support/JSON.h" | ||
| #include "llvm/Support/Threading.h" | ||
| #include <map> | ||
| #include <memory> | ||
| #include <mutex> | ||
| #include <optional> | ||
|
|
@@ -145,11 +145,10 @@ struct SendEventRequestHandler : public lldb::SBCommandPluginInterface { | |
| }; | ||
|
|
||
| struct DAP { | ||
| llvm::StringRef client_name; | ||
| llvm::StringRef debug_adapter_path; | ||
| std::ofstream *log; | ||
| InputStream input; | ||
| OutputStream output; | ||
| llvm::StringRef client_name; | ||
| Transport &transport; | ||
| lldb::SBFile in; | ||
| OutputRedirector out; | ||
| OutputRedirector err; | ||
|
|
@@ -210,12 +209,33 @@ struct DAP { | |
| // will contain that expression. | ||
| std::string last_nonempty_var_expression; | ||
|
|
||
| DAP(llvm::StringRef client_name, llvm::StringRef path, std::ofstream *log, | ||
| lldb::IOObjectSP input, lldb::IOObjectSP output, ReplMode repl_mode, | ||
| std::vector<std::string> pre_init_commands); | ||
| /// Creates a new DAP sessions. | ||
| /// | ||
| /// \param[in] path | ||
| /// Path to the lldb-dap binary. | ||
| /// \param[in] log | ||
| /// Log file stream, if configured. | ||
| /// \param[in] default_repl_mode | ||
| /// Default repl mode behavior, as configured by the binary. | ||
| /// \param[in] pre_init_commands | ||
| /// LLDB commands to execute as soon as the debugger instance is allocaed. | ||
| /// \param[in] client_name | ||
| /// Debug session client name, for example 'stdin/stdout' or 'client_1'. | ||
|
||
| /// \param[in] transport | ||
| /// Transport for this debug session. | ||
| DAP(llvm::StringRef path, std::ofstream *log, | ||
| const ReplMode default_repl_mode, | ||
| const std::vector<std::string> &pre_init_commands, | ||
| llvm::StringRef client_name, Transport &transport); | ||
|
|
||
| ~DAP(); | ||
|
|
||
| /// DAP is not copyable. | ||
| /// @{ | ||
| DAP(const DAP &rhs) = delete; | ||
| void operator=(const DAP &rhs) = delete; | ||
| /// @} | ||
|
|
||
| ExceptionBreakpoint *GetExceptionBreakpoint(const std::string &filter); | ||
| ExceptionBreakpoint *GetExceptionBreakpoint(const lldb::break_id_t bp_id); | ||
|
|
||
|
|
@@ -233,8 +253,6 @@ struct DAP { | |
| // the "out" stream. | ||
| void SendJSON(const llvm::json::Value &json); | ||
|
|
||
| std::string ReadJSON(); | ||
|
|
||
| void SendOutput(OutputType o, const llvm::StringRef output); | ||
|
|
||
| void SendProgressEvent(uint64_t progress_id, const char *message, | ||
|
|
@@ -307,8 +325,7 @@ struct DAP { | |
| /// listeing for its breakpoint events. | ||
| void SetTarget(const lldb::SBTarget target); | ||
|
|
||
| PacketStatus GetNextObject(llvm::json::Object &object); | ||
| bool HandleObject(const llvm::json::Object &object); | ||
| bool HandleObject(const protocol::Message &M); | ||
|
|
||
| /// Disconnect the DAP session. | ||
| lldb::SBError Disconnect(); | ||
|
|
@@ -382,12 +399,6 @@ struct DAP { | |
| InstructionBreakpoint *GetInstructionBreakpoint(const lldb::break_id_t bp_id); | ||
|
|
||
| InstructionBreakpoint *GetInstructionBPFromStopReason(lldb::SBThread &thread); | ||
|
|
||
| private: | ||
| // Send the JSON in "json_str" to the "out" stream. Correctly send the | ||
| // "Content-Length:" field followed by the length, followed by the raw | ||
| // JSON bytes. | ||
| void SendJSON(const std::string &json_str); | ||
| }; | ||
|
|
||
| } // namespace lldb_dap | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.