-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cider Dap - Variables displaying #2357
base: main
Are you sure you want to change the base?
Conversation
- adjusted create_stopped in main.rs - added methods in adapter.rs to print variables and cells
sending breakpoints to debugger, need to create method to remove them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very exciting! Left some notes, on a bunch of things. Please request a re-review when you're ready
|
||
//let thread2 = &adapter.create_thread(String::from("Thread 1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete if we don't need
// server.send_event(Event::Thread(ThreadEventBody { | ||
// reason: types::ThreadEventReason::Started, | ||
// thread_id: thread2.id, | ||
// }))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete if we don't need
@@ -354,7 +351,7 @@ fn run_server<R: Read, W: Write>( | |||
let rsp = req.success(ResponseBody::Scopes(ScopesResponse { | |||
scopes: adapter.get_scopes(frame_id), | |||
})); | |||
info!(logger, "responded with {rsp:?}"); | |||
//info!(logger, "responded with {rsp:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete or uncomment
@@ -77,6 +86,7 @@ pub struct Debugger<C: AsRef<Context> + Clone> { | |||
program_context: C, | |||
debugging_context: DebuggingContext, | |||
_source_map: Option<SourceMap>, | |||
is_running: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment for how this field is used with respect to the debugger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell it isn't actually used anywhere?
@@ -175,6 +198,28 @@ impl<C: AsRef<Context> + Clone> Debugger<C> { | |||
.collect_vec(); | |||
self.manipulate_breakpoint(Command::Delete(parsed_bp_ids)); | |||
} | |||
|
|||
pub fn cont(&mut self) -> StoppedReason { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you point out this should really return a result type. If you don't want to
handle that at least unwrap the error from self.do_continue
rather than
dropping it on the floor
// component idx -> global cell idx | ||
self.interpreter.env().iter_cmpt_cells(cmp_idx) | ||
} | ||
pub fn get_components( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some documentation here and with the above method
self.stack_frames.clone() | ||
} | ||
|
||
pub fn clone_stack(&self) -> Vec<StackFrame> { | ||
/// creates call stack where each frame is a component | ||
fn create_stack(&mut self) -> Vec<StackFrame> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing as the only place you call this drops the return, I think this method
doesn't actually need to return anything
let frames = components.map(|(idx, comp)| { | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I love a good iterator, I think this would be more clear as a for
loop
which directly pushes the frame onto stack_frames
rather than relying on the
iterator being consumed by extends
indexed_variables: None, | ||
memory_reference: None, | ||
.map(|(nam, val)| { | ||
let valu = match val.as_option() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than a match you should be able to do something like
val.as_option().map(|x| x.val().to_u64().unwrap()).unwrap_or_default()
let mut out_vec = vec![]; | ||
let cell_names = self.debugger.get_cells(); | ||
let component = self.frames_to_cmpts.get(&frame).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're going to use get(...).unwrap()
might as well use direct indexing
let component = self.frames_to_cmpts.get(&frame).unwrap(); | |
let component = self.frames_to_cmpts[&frame]; |
bad branch name (oops)
This branch adds the following functionality to the VSCode Cider debugger: