Skip to content

Add HostCommands for resuming and stepping debugger#44080

Closed
motiz88 wants to merge 3 commits into
facebook:mainfrom
motiz88:export-D56098083
Closed

Add HostCommands for resuming and stepping debugger#44080
motiz88 wants to merge 3 commits into
facebook:mainfrom
motiz88:export-D56098083

Conversation

@motiz88
Copy link
Copy Markdown
Contributor

@motiz88 motiz88 commented Apr 15, 2024

Summary:

Design

Adds a new public HostTarget::sendCommand method, enabling integrators to send simple imperative commands to the target.

As an implementation detail, the commands are translated internally to CDP and sent over a dedicated HostTargetSession (encapsulated in HostCommandSender). Any response from the underlying Agent is ignored.

From the caller's perspective, these commands don't occur in the context of a session at all, and from the frontend's perspective, only the effects of the commands (if any) are seen.

Use case

HostCommands are specifically useful when we want to resume/step execution in response to a UI action. The commands map directly to the Debugger.resume and Debugger.stepOver CDP methods.

NOTE: This is inspired by Chrome/V8's existing support for multiple concurrent CDP sessions. Any CDP client can successfully send Debugger.resume and Debugger.stepOver (without even subscribing to debugger events using Debugger.enable) and affect the state of other ongoing debugging sessions.

Changelog: [Internal]

Differential Revision: D56098083

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Apr 15, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56098083

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Apr 15, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,385,263 -2
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,760,251 -11
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 99d0c54
Branch: main

motiz88 added 3 commits April 15, 2024 07:08
…sage (facebook#44078)

Summary:

Changelog: [Internal]

Adds stub support for the [`Overlay.setPausedInDebuggerMessage`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Overlay#method-setPausedInDebuggerMessage) CDP method to `HostAgent` in the Fusebox backend, and propagates it into the Android and iOS integrations through `HostTargetDelegate`.

We take care to call `HostTargetDelegate::onSetPausedInDebuggerMessage()` a final time with a null `message` parameter, regardless of whether the client has actually sent the corresponding CDP message. Since multiple clients might be connected concurrently, we only send the `null` message when the *last* client which has requested a non-null message has disconnected.

Differential Revision: D56068444
…ebook#44079)

Summary:

Changelog: [Internal]

Implements an unstyled, non-interactive version of the "paused in debugger" in-app overlay in Fusebox on Android, based on the event introduced in D56068444. The implementation in `DevSupportManagerBase` is shared across Bridge and Bridgeless.

In upcoming diffs in this stack, we'll add interactive features (namely "resume" and "step over" buttons, like in Chrome) and improve the visual styling of this overlay.

Differential Revision: D56068445
Summary:

## Design

Adds a new public `HostTarget::sendCommand` method, enabling integrators to send simple imperative commands to the target.

As an implementation detail, the commands are translated internally to CDP and sent over a dedicated `HostTargetSession` (encapsulated in `HostCommandSender`). Any response from the underlying Agent is ignored.

From the caller's perspective, these commands don't occur in the context of a session at all, and from the frontend's perspective, only the *effects* of the commands (if any) are seen.

## Use case

HostCommands are specifically useful when we want to resume/step execution in response to a UI action. The commands map directly to the `Debugger.resume` and `Debugger.stepOver` CDP methods.

NOTE: This is inspired by Chrome/V8's existing support for multiple concurrent CDP sessions. Any CDP client can successfully send `Debugger.resume` and `Debugger.stepOver` (without even subscribing to debugger events using `Debugger.enable`) and affect the state of other ongoing debugging sessions.

Changelog: [Internal]

Differential Revision: D56098083
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56098083

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 17, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 58ddd74.

@github-actions
Copy link
Copy Markdown

This pull request was successfully merged by @motiz88 in 58ddd74.

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants