forked from facebook/buck2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ServerConnection and outer request handling
Summary: This adds sort of the main outer loop of the debug-attach command. It sets up the ServerConnection (that manages the global debugger value) and then routes messages to/from the inner debugger server and encodes/decodes them as appropriate. Reviewed By: krallin Differential Revision: D43941377 fbshipit-source-id: 9349c2e97b30dee5d99157c283bc2a8290659a04
- Loading branch information
1 parent
eb186b3
commit 7208896
Showing
5 changed files
with
215 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under both the MIT license found in the | ||
* LICENSE-MIT file in the root directory of this source tree and the Apache | ||
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory | ||
* of this source tree. | ||
*/ | ||
|
||
use std::sync::Arc; | ||
|
||
use buck2_core::fs::project::ProjectRoot; | ||
use buck2_events::dispatch::EventDispatcher; | ||
use debugserver_types as dap; | ||
use tokio::sync::mpsc; | ||
|
||
use crate::starlark_debug::run::ToClientMessage; | ||
use crate::starlark_debug::BuckStarlarkDebuggerHandle; | ||
|
||
/// The buck starlark debugger server. Most of the work is managed by the single-threaded server state. | ||
/// | ||
/// There will be several references to the BuckStarlarkDebuggerServer instance and it will forward messages | ||
/// along to the state. | ||
#[derive(Debug)] | ||
pub(crate) struct BuckStarlarkDebuggerServer {} | ||
|
||
impl BuckStarlarkDebuggerServer { | ||
pub(crate) fn new( | ||
_to_client: mpsc::UnboundedSender<ToClientMessage>, | ||
_project_root: ProjectRoot, | ||
) -> Self { | ||
Self {} | ||
} | ||
pub(crate) fn new_handle( | ||
self: &Arc<Self>, | ||
_events: EventDispatcher, | ||
) -> Option<BuckStarlarkDebuggerHandle> { | ||
unimplemented!("coming soon") | ||
} | ||
|
||
/// Called to forward along requests from the DAP client. | ||
pub(crate) fn send_request(&self, _req: dap::Request) -> anyhow::Result<()> { | ||
unimplemented!("coming soon") | ||
} | ||
|
||
/// Called when the DAP client has disconnected. | ||
pub(crate) fn detach(&self) -> anyhow::Result<()> { | ||
Ok(()) | ||
} | ||
} |