Add basics of Chrome Devtools debugger support#1552
Add basics of Chrome Devtools debugger support#1552matetokodi wants to merge 1 commit intoSamsung:masterfrom
Conversation
7092bb9 to
f675030
Compare
|
|
||
| class DebuggerC : public Debugger { | ||
| public: | ||
| virtual void init(const char* options, Context* context) override {} |
There was a problem hiding this comment.
The added init override contains an empty body, which can be misleading and may hide missing initialization logic. Removing this empty override or replacing it with a comment clarifies intent and reduces confusion for future maintainers. This refactor cleans up the class definition without altering behavior, keeping the codebase lean and easier to read.
| "\"location\":{" | ||
| "\"scriptId\":\"1\"," | ||
| "\"lineNumber\":0," | ||
| "\"columnNumber\":0" |
There was a problem hiding this comment.
Do you need these values for a pause?
There was a problem hiding this comment.
Yes, they are part of the non-optional Debugger.paused event in the spec, without them chrome will not say that the debugger is paused.
| @@ -0,0 +1,321 @@ | |||
| /* | |||
There was a problem hiding this comment.
Why this file is called HttpRouter?
There was a problem hiding this comment.
It replies to the http GET request, and handles the websocket handshake, depending on which route was requested
src/debugger/Debugger.h
Outdated
| #define ESCARGOT_DEBUGGER_NO_STACK_TRACE_RESTORE (reinterpret_cast<ExecutionState*>(0x1)) | ||
| #define ESCARGOT_DEBUGGER_MAX_VARIABLE_LENGTH 128 | ||
|
|
||
| #define ESCARGOT_DEBUGGER_WEBSOCKET_FIN_BIT 0x80 |
There was a problem hiding this comment.
Why this is moved here? This should be low level used by the transport layer.
There was a problem hiding this comment.
Oh, yeah they should be in DebuggerTcp.
Initially I was going to merge Debugger and DebuggerTcp, so they ended up in Debugger, but later I decided against merging them, and they were forgotten there.
- Use routing table for request dispatch in DebuggerHttpRouter, for
handling choosing which debugger stack to use based on the http
upgrade request:
- DebuggerEscargot for the python debugger and VSCode
- DebuggerDevtools for connecting to Chrome Devtools
- Parse mesasges with 16bit message size
- Reply to the first few messages chrome sends
- Refactor Debugger:
- Rename DebuggerRemote to DebuggerEscargot
- DebuggerEscargot and DebuggerDevtools inherit from
DebuggerTcp which inherits from Debugger
Co-authored-by: Roland Takacs <roland.takacs@h-lab.eu>
Signed-off-by: Máté Tokodi <mate.tokodi@szteszoftver.hu>
f675030 to
f03748a
Compare
We can successfully connect to Chrome Devtools, send initial source code, and have the debugger wait for further commands from Chrome.