Skip to content
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 changes #1768

Merged
merged 5 commits into from
Nov 14, 2023
Merged

Cider-dap changes #1768

merged 5 commits into from
Nov 14, 2023

Conversation

eliascxstro
Copy link
Contributor

main.rs

  • Implemented the SetBreakpoints, SetExecptionBreakpoints, and Threads requests from the Debug Adapter Protocol.

adapter.rs

  • Added the fields breakpoints, break_count, and threads to the MyAdapter struct.
  • Implemented the function set_breakpoint which returns a vector of Breakpoints for the SetBreakpoints request.
  • Implemented the function get_threads which returns the threads field for the Threads request.
  • Created the struct Counter which makes IDs for each breakpoint, starting at 0.

The debugger now runs!

@eliascxstro eliascxstro added the C: Interpreter / Cider Calyx Interpreter & Debugger label Nov 9, 2023
@eliascxstro eliascxstro self-assigned this Nov 9, 2023
Copy link
Collaborator

@EclecticGriffin EclecticGriffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good on the whole! I left some minor notes. You'll need to run cargo fmt on the files (cargo fmt --all should do the trick)

use std::fs::File;
pub struct MyAdapter {
#[allow(dead_code)]
file: File,
// Other fields of the struct
breakpoints: Vec<(Source, i64)>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment for breakpoints and threads to mark that it is a placeholder?

Comment on lines 34 to 45
let breakpoint = Breakpoint {
id: self.break_count.increment().into(),
verified: true,
message: None,
source: Some(path.clone()),
line: None,
column: None,
end_line: None,
end_column: None,
instruction_reference: None,
offset: None,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be useful to abstract this into our own constructor. Something like make_breakpoint which takes the relevant args that we use.

}

//Return threads
pub fn get_threads(&self) -> Vec<Thread> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this something like clone_threads since I would normally expect a get method to return a reference, but we need the owned vec for the return message (which is silly but hey that's a problem for another day)

pub fn new() -> Self {
Counter { value: 0 }
}
//Inc the counter, return the OLD value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a doc-string (i.e. ///)


#[allow(dead_code)] // remove this later
#[derive(thiserror::Error, Debug)]
pub enum MyAdapterError {
pub enum MyAdapterError{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is gonna make the formatter angry

@eliascxstro eliascxstro merged commit a93c510 into master Nov 14, 2023
5 checks passed
@eliascxstro eliascxstro deleted the beta branch November 14, 2023 03:08
rachitnigam pushed a commit that referenced this pull request Feb 16, 2024
* Cleaned up UnhandledCommandError

* Added the SetBreakPoints command to the debugger

* Added SetExceptionBreakpoints

* Cleaned up code and added threads command, debugger now runs

* PR revisions

---------

Co-authored-by: root <root@EliasSP>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Interpreter / Cider Calyx Interpreter & Debugger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants