dap: implement threads request
This commit is contained in:
parent
5f3e806341
commit
7d2d4ed4a8
2 changed files with 22 additions and 0 deletions
|
@ -42,6 +42,7 @@ pub async fn main() -> Result<()> {
|
|||
|
||||
println!("configurationDone: {:?}", client.configuration_done().await);
|
||||
println!("stopped: {:?}", client.wait_for_stopped().await);
|
||||
println!("threads: {:#?}", client.threads().await);
|
||||
println!("stack trace: {:#?}", client.stack_trace(1).await);
|
||||
|
||||
let mut _in = String::new();
|
||||
|
|
|
@ -148,6 +148,19 @@ struct StackTraceResponseBody {
|
|||
stack_frames: Vec<StackFrame>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Thread {
|
||||
id: usize,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ThreadsResponseBody {
|
||||
threads: Vec<Thread>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Client {
|
||||
id: usize,
|
||||
|
@ -349,4 +362,12 @@ impl Client {
|
|||
|
||||
Ok((body.stack_frames, body.total_frames))
|
||||
}
|
||||
|
||||
pub async fn threads(&mut self) -> Result<Vec<Thread>> {
|
||||
let response = self.request("threads".to_owned(), None).await?;
|
||||
|
||||
let body: ThreadsResponseBody = from_value(response.body.unwrap()).unwrap();
|
||||
|
||||
Ok(body.threads)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue