debugger: Add memory view (#33955)
This is mostly setting up the UI for now; I expect it to be the biggest chunk of work. Release Notes: - debugger: Added memory view --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me> Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com> Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
a2f5c47e2d
commit
6673c7cd4c
18 changed files with 1732 additions and 71 deletions
|
@ -1,16 +1,17 @@
|
|||
pub(crate) mod breakpoint_list;
|
||||
pub(crate) mod console;
|
||||
pub(crate) mod loaded_source_list;
|
||||
pub(crate) mod memory_view;
|
||||
pub(crate) mod module_list;
|
||||
pub mod stack_frame_list;
|
||||
pub mod variable_list;
|
||||
|
||||
use std::{any::Any, ops::ControlFlow, path::PathBuf, sync::Arc, time::Duration};
|
||||
|
||||
use crate::{
|
||||
ToggleExpandItem,
|
||||
new_process_modal::resolve_path,
|
||||
persistence::{self, DebuggerPaneItem, SerializedLayout},
|
||||
session::running::memory_view::MemoryView,
|
||||
};
|
||||
|
||||
use super::DebugPanelItemEvent;
|
||||
|
@ -81,6 +82,7 @@ pub struct RunningState {
|
|||
_schedule_serialize: Option<Task<()>>,
|
||||
pub(crate) scenario: Option<DebugScenario>,
|
||||
pub(crate) scenario_context: Option<DebugScenarioContext>,
|
||||
memory_view: Entity<MemoryView>,
|
||||
}
|
||||
|
||||
impl RunningState {
|
||||
|
@ -676,14 +678,36 @@ impl RunningState {
|
|||
let session_id = session.read(cx).session_id();
|
||||
let weak_state = cx.weak_entity();
|
||||
let stack_frame_list = cx.new(|cx| {
|
||||
StackFrameList::new(workspace.clone(), session.clone(), weak_state, window, cx)
|
||||
StackFrameList::new(
|
||||
workspace.clone(),
|
||||
session.clone(),
|
||||
weak_state.clone(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
});
|
||||
|
||||
let debug_terminal =
|
||||
parent_terminal.unwrap_or_else(|| cx.new(|cx| DebugTerminal::empty(window, cx)));
|
||||
|
||||
let variable_list =
|
||||
cx.new(|cx| VariableList::new(session.clone(), stack_frame_list.clone(), window, cx));
|
||||
let memory_view = cx.new(|cx| {
|
||||
MemoryView::new(
|
||||
session.clone(),
|
||||
workspace.clone(),
|
||||
stack_frame_list.downgrade(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
});
|
||||
let variable_list = cx.new(|cx| {
|
||||
VariableList::new(
|
||||
session.clone(),
|
||||
stack_frame_list.clone(),
|
||||
memory_view.clone(),
|
||||
weak_state.clone(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
});
|
||||
|
||||
let module_list = cx.new(|cx| ModuleList::new(session.clone(), workspace.clone(), cx));
|
||||
|
||||
|
@ -795,6 +819,7 @@ impl RunningState {
|
|||
&breakpoint_list,
|
||||
&loaded_source_list,
|
||||
&debug_terminal,
|
||||
&memory_view,
|
||||
&mut pane_close_subscriptions,
|
||||
window,
|
||||
cx,
|
||||
|
@ -823,6 +848,7 @@ impl RunningState {
|
|||
let active_pane = panes.first_pane();
|
||||
|
||||
Self {
|
||||
memory_view,
|
||||
session,
|
||||
workspace,
|
||||
focus_handle,
|
||||
|
@ -1234,6 +1260,12 @@ impl RunningState {
|
|||
item_kind,
|
||||
cx,
|
||||
)),
|
||||
DebuggerPaneItem::MemoryView => Box::new(SubView::new(
|
||||
self.memory_view.focus_handle(cx),
|
||||
self.memory_view.clone().into(),
|
||||
item_kind,
|
||||
cx,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1418,7 +1450,14 @@ impl RunningState {
|
|||
&self.module_list
|
||||
}
|
||||
|
||||
pub(crate) fn activate_item(&self, item: DebuggerPaneItem, window: &mut Window, cx: &mut App) {
|
||||
pub(crate) fn activate_item(
|
||||
&mut self,
|
||||
item: DebuggerPaneItem,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
self.ensure_pane_item(item, window, cx);
|
||||
|
||||
let (variable_list_position, pane) = self
|
||||
.panes
|
||||
.panes()
|
||||
|
@ -1430,9 +1469,10 @@ impl RunningState {
|
|||
.map(|view| (view, pane))
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
pane.update(cx, |this, cx| {
|
||||
this.activate_item(variable_list_position, true, true, window, cx);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue