MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / read_from

Method read_from

debugger/src/event.rs:21–91  ·  view source on GitHub ↗
(source: Bytes)

Source from the content-addressed store, hash-verified

19
20impl EventStream {
21 pub fn read_from(source: Bytes) -> Event {
22 let mut reader = Reader::new();
23 assert!(source.len() > 0);
24 let event = match source.get(0) {
25 b'B' => {
26 let mut i = 1;
27 let reason = match source.get(i) {
28 b'B' => crate::Reason::Breakpoint,
29 b'P' => crate::Reason::Panic,
30 b'F' => {
31 i += 1;
32 match source.get(i) {
33 b'{' => crate::Reason::FutureEnter,
34 b'}' => crate::Reason::FutureExit,
35 other => panic!("Unknown reason, got {other:?}"),
36 }
37 }
38 other => panic!("Unknown reason, got {other:?}"),
39 };
40 i += 1;
41 reader.set_source(source, i);
42 let breakpoint_id = reader.read_int().unwrap() as u32;
43 let thread_id = reader.read_int().unwrap();
44 let frame_id = reader.read_int().unwrap();
45 let locals = reader.read_values();
46 Event::Breakpoint {
47 breakpoint_id,
48 thread_id,
49 frame_id,
50 reason,
51 locals,
52 }
53 }
54 b'F' => {
55 reader.set_source(source, 1);
56 let breakpoint_id = reader.read_int().unwrap() as u32;
57 let thread_id = reader.read_int().unwrap();
58 let frame_id = reader.read_int().unwrap();
59 let stack_pointer = reader.read_int().unwrap();
60 let function_name = reader.read_string().unwrap();
61 let arguments = reader.read_values();
62 Event::FunctionCall {
63 breakpoint_id,
64 thread_id,
65 frame_id,
66 stack_pointer,
67 function_name,
68 arguments,
69 }
70 }
71 b'R' => {
72 reader.set_source(source, 1);
73 let breakpoint_id = reader.read_int().unwrap() as u32;
74 let thread_id = reader.read_int().unwrap();
75 let frame_id = reader.read_int().unwrap();
76 let function_name = reader.read_string().unwrap();
77 let mut values = reader.read_values();
78 let (name, return_value) = values.remove(0);

Callers

nothing calls this directly

Calls 5

set_sourceMethod · 0.80
read_intMethod · 0.80
read_valuesMethod · 0.80
getMethod · 0.45
read_stringMethod · 0.45

Tested by

no test coverage detected