Prettified the debug output
This commit is contained in:
parent
53929b5dfe
commit
4c43e9290f
2 changed files with 10 additions and 2 deletions
|
@ -669,7 +669,7 @@ impl JVM {
|
|||
|
||||
//println!("{} locals: {:?}", " ".repeat(frame_index), frame.locals);
|
||||
println!("{} stack: {:?}", " ".repeat(frame_index), frame.operand_stack);
|
||||
println!("{}{:25}.{:15}:{:<10}{instruction:?}\n", " ".repeat(frame_index), class.get_classname().unwrap(), method.name, frame.instruction_pointer);
|
||||
println!("{}{}.{}:{:<10}{instruction:?}\n", " ".repeat(frame_index), class.get_classname().unwrap(), method.name, frame.instruction_pointer);
|
||||
|
||||
match instruction {
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use core::fmt::Debug;
|
||||
use crate::accessmasks::MethodAccessFlag;
|
||||
use crate::classfile::{ AttributeData, JavaClassFile };
|
||||
use crate::heap_area::{ ObjectReference, FieldValue };
|
||||
|
@ -19,12 +20,19 @@ pub enum StackValue {
|
|||
Empty(),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct OperandStack {
|
||||
stack: Box<[StackValue]>,
|
||||
depth: u16,
|
||||
}
|
||||
|
||||
impl Debug for OperandStack {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_list()
|
||||
.entries(self.stack.iter().take(self.depth as usize))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
PushError(String),
|
||||
|
|
Loading…
Reference in a new issue