Skip to content

Commit

Permalink
issue/146: ELF file support in debugger repl
Browse files Browse the repository at this point in the history
  • Loading branch information
morganthomas committed Apr 10, 2024
1 parent 3fcc93b commit 1b9034a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions basic/src/bin/valida.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ impl Context<'_> {
last_fp_size_: 0,
};

let rom = match ProgramROM::from_file(&args.program) {
Ok(contents) => contents,
Err(e) => panic!("Failure to load file: {}. {}", &args.program, e),
};
let Program { code, data } = load_executable_file(
fs::read(&args.program)
.expect(format!("Failed to read executable file: {}", &args.program).as_str()),
);

context.machine_.program_mut().set_program_rom(&rom);
context.machine_.program_mut().set_program_rom(&code);
context.machine_.static_data_mut().load(data);
context.machine_.cpu_mut().fp = args.stack_height;
context.machine_.cpu_mut().save_register_state();

Expand Down

0 comments on commit 1b9034a

Please sign in to comment.