MileStone 7, All required parts done
This commit is contained in:
parent
e82503703a
commit
f944d66c93
@ -34,6 +34,10 @@ fn parse_address(addr: &str) -> Option<usize> {
|
|||||||
usize::from_str_radix(addr_without_0x, 16).ok()
|
usize::from_str_radix(addr_without_0x, 16).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_lineno(lineno: &str) -> Option<usize> {
|
||||||
|
usize::from_str_radix(lineno, 10).ok()
|
||||||
|
}
|
||||||
|
|
||||||
impl Debugger {
|
impl Debugger {
|
||||||
/// Initializes the debugger.
|
/// Initializes the debugger.
|
||||||
pub fn new(target: &str) -> Debugger {
|
pub fn new(target: &str) -> Debugger {
|
||||||
@ -48,7 +52,7 @@ impl Debugger {
|
|||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
debug_data.print();
|
// debug_data.print();
|
||||||
|
|
||||||
let history_path = format!("{}/.deet_history", std::env::var("HOME").unwrap());
|
let history_path = format!("{}/.deet_history", std::env::var("HOME").unwrap());
|
||||||
let mut readline = Editor::<()>::new();
|
let mut readline = Editor::<()>::new();
|
||||||
@ -118,7 +122,8 @@ impl Debugger {
|
|||||||
.inferior
|
.inferior
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.write_byte(target_addr, orig_byte).unwrap();
|
.write_byte(target_addr, orig_byte)
|
||||||
|
.unwrap();
|
||||||
assert_eq!(break_0xcc, 0xcc);
|
assert_eq!(break_0xcc, 0xcc);
|
||||||
self.inferior
|
self.inferior
|
||||||
.as_mut()
|
.as_mut()
|
||||||
@ -235,6 +240,33 @@ impl Debugger {
|
|||||||
} else {
|
} else {
|
||||||
eprintln!("Unable to parse breakpoint \"{}\"", arg_string);
|
eprintln!("Unable to parse breakpoint \"{}\"", arg_string);
|
||||||
}
|
}
|
||||||
|
} else if let Some(line_no) = parse_lineno(arg_str) {
|
||||||
|
if let Some(addr) = self.debug_data.get_addr_for_line(None, line_no) {
|
||||||
|
println!(
|
||||||
|
"Set breakpoint {} at {}({:#x})",
|
||||||
|
self.breakpoint_vec.len(),
|
||||||
|
arg_string,
|
||||||
|
addr
|
||||||
|
);
|
||||||
|
self.breakpoint_vec.push(addr);
|
||||||
|
self._install_breakpoint(addr);
|
||||||
|
} else {
|
||||||
|
eprintln!("Unable to parse breakpoint \"{}\"", arg_string);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let Some(addr) = self.debug_data.get_addr_for_function(None, &arg_string)
|
||||||
|
{
|
||||||
|
println!(
|
||||||
|
"Set breakpoint {} at {}({:#x})",
|
||||||
|
self.breakpoint_vec.len(),
|
||||||
|
arg_string,
|
||||||
|
addr
|
||||||
|
);
|
||||||
|
self.breakpoint_vec.push(addr);
|
||||||
|
self._install_breakpoint(addr);
|
||||||
|
} else {
|
||||||
|
eprintln!("Unable to parse breakpoint \"{}\"", arg_string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user