Public release release-e47f9c27bbeb
Source commit: e47f9c27bbebe6759f6b6fe7b12fd00bb20d116d Public tree identity: sha256:4c1af1dfd67d3f2b5088531ea8727b11124b013d2251a4d5088f51a6424c0196
This commit is contained in:
parent
3a4d4fa7ae
commit
9223c54939
30 changed files with 4195 additions and 434 deletions
|
|
@ -64,6 +64,7 @@ struct LaunchCompletion {
|
|||
state: AdapterState,
|
||||
local_runtime_session: Option<LocalRuntimeSession>,
|
||||
breakpoint_revision: u64,
|
||||
observation_diagnostics: Vec<String>,
|
||||
}
|
||||
|
||||
pub(crate) fn run_adapter() -> Result<()> {
|
||||
|
|
@ -108,6 +109,9 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
if let Some(session) = completion.local_runtime_session {
|
||||
_local_runtime_session = Some(session);
|
||||
}
|
||||
for diagnostic in completion.observation_diagnostics {
|
||||
writer.output("stderr", format!("{diagnostic}\n"))?;
|
||||
}
|
||||
runtime_started = true;
|
||||
if state.breakpoints_installed {
|
||||
emit_verified_breakpoints(&mut writer, &state)?;
|
||||
|
|
@ -252,7 +256,12 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
revision,
|
||||
result,
|
||||
} => {
|
||||
if generation == runtime_generation && revision == state.breakpoint_revision {
|
||||
if breakpoint_update_is_current(
|
||||
generation,
|
||||
runtime_generation,
|
||||
revision,
|
||||
state.breakpoint_revision,
|
||||
) {
|
||||
match result {
|
||||
Ok(()) => {
|
||||
state.breakpoints_installed = true;
|
||||
|
|
@ -478,6 +487,7 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
state: completed_state,
|
||||
local_runtime_session: None,
|
||||
breakpoint_revision,
|
||||
observation_diagnostics: Vec::new(),
|
||||
}
|
||||
})
|
||||
.map_err(|error| format!("services runtime attach failed: {error:#}"))
|
||||
|
|
@ -486,6 +496,8 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
RuntimeBackend::LocalServices => {
|
||||
run_local_services_runtime(&completed_state)
|
||||
.map(|(record, session)| {
|
||||
let observation_diagnostics =
|
||||
runtime_observation_diagnostics(&record);
|
||||
completed_state.apply_runtime_record(record);
|
||||
let breakpoint_revision =
|
||||
completed_state.breakpoint_revision;
|
||||
|
|
@ -493,6 +505,7 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
state: completed_state,
|
||||
local_runtime_session: Some(session),
|
||||
breakpoint_revision,
|
||||
observation_diagnostics,
|
||||
}
|
||||
})
|
||||
.map_err(|error| {
|
||||
|
|
@ -502,6 +515,8 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
RuntimeBackend::LiveServices => {
|
||||
run_live_services_runtime(&completed_state)
|
||||
.map(|record| {
|
||||
let observation_diagnostics =
|
||||
runtime_observation_diagnostics(&record);
|
||||
completed_state.apply_runtime_record(record);
|
||||
let breakpoint_revision =
|
||||
completed_state.breakpoint_revision;
|
||||
|
|
@ -509,6 +524,7 @@ pub(crate) fn run_adapter() -> Result<()> {
|
|||
state: completed_state,
|
||||
local_runtime_session: None,
|
||||
breakpoint_revision,
|
||||
observation_diagnostics,
|
||||
}
|
||||
})
|
||||
.map_err(|error| {
|
||||
|
|
@ -1051,6 +1067,29 @@ fn spawn_runtime_observer(
|
|||
});
|
||||
}
|
||||
|
||||
pub(crate) fn breakpoint_update_is_current(
|
||||
update_generation: u64,
|
||||
runtime_generation: u64,
|
||||
update_revision: u64,
|
||||
current_revision: u64,
|
||||
) -> bool {
|
||||
update_generation == runtime_generation && update_revision == current_revision
|
||||
}
|
||||
|
||||
fn runtime_observation_diagnostics(
|
||||
record: &crate::virtual_model::RuntimeLaunchRecord,
|
||||
) -> Vec<String> {
|
||||
record
|
||||
.node_report
|
||||
.get("observation_diagnostics")
|
||||
.and_then(Value::as_array)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(Value::as_str)
|
||||
.map(str::to_owned)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn emit_verified_breakpoints(writer: &mut DapWriter, state: &AdapterState) -> Result<()> {
|
||||
if !state.breakpoints_installed {
|
||||
return Ok(());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue