jvmti_rs/wrapper/objects/
jstack_info.rs1use crate::{sys::*, objects::*, builder::*};
2
3#[derive(Clone)]
4pub struct JStackInfo<'a> {
5 internal: jvmtiStackInfo,
6
7 pub thread: JThreadID<'a>,
8 pub state: i32,
9 pub frame_buffer: Vec<JFrameInfo<'a>>,
10}
11
12#[repr(C)]
13#[derive(Debug, Copy, Clone)]
14pub struct JFrameInfo<'a> {
15 internal: jvmtiFrameInfo,
16
17 pub method: JMethodID<'a>,
18 pub location: jlocation,
19}
20
21impl<'a> From<jvmtiStackInfo> for JStackInfo<'a> {
22 fn from(stack_info: jvmtiStackInfo) -> Self {
23 let builder: MutObjectArrayBuilder<jvmtiFrameInfo> = MutObjectArrayBuilder::create(stack_info.frame_count, stack_info.frame_buffer);
24 let frame_buffer: Vec<JFrameInfo<'a>> = builder.build();
25 return JStackInfo {
26 internal: stack_info,
27
28 thread: stack_info.thread.into(),
29 state: stack_info.state,
30 frame_buffer,
31 };
32 }
33}
34
35impl<'a> ::std::ops::Deref for JStackInfo<'a> {
36 type Target = jvmtiStackInfo;
37
38 fn deref(&self) -> &Self::Target {
39 &self.internal
40 }
41}
42
43impl<'a> From<jvmtiFrameInfo> for JFrameInfo<'a> {
44 fn from(frame_info: jvmtiFrameInfo) -> Self {
45 return JFrameInfo {
46 internal: frame_info,
47
48 method: frame_info.method.into(),
49 location: frame_info.location,
50 };
51 }
52}
53
54impl<'a> ::std::ops::Deref for JFrameInfo<'a> {
55 type Target = jvmtiFrameInfo;
56
57 fn deref(&self) -> &Self::Target {
58 &self.internal
59 }
60}