Easier way to choose which example program to debug
This commit is contained in:
parent
beb3a75cf2
commit
90dbe285d6
3
build.rs
3
build.rs
|
|
@ -9,13 +9,14 @@ fn main() {
|
||||||
Command::new("ld")
|
Command::new("ld")
|
||||||
.args(&[assembly_obj_path, "-o", assembly_exe_path])
|
.args(&[assembly_obj_path, "-o", assembly_exe_path])
|
||||||
.spawn().expect("linking failed");
|
.spawn().expect("linking failed");
|
||||||
|
println!("cargo:rustc-env=ASM_PROG_PATH={}", assembly_exe_path);
|
||||||
println!("cargo:rerun-if-changed=src/prog.nasm");
|
println!("cargo:rerun-if-changed=src/prog.nasm");
|
||||||
|
|
||||||
let c_exe_path = &format!("{}/cprog", std::env::var("OUT_DIR").unwrap());
|
let c_exe_path = &format!("{}/cprog", std::env::var("OUT_DIR").unwrap());
|
||||||
Command::new("gcc")
|
Command::new("gcc")
|
||||||
.args(&["-o", c_exe_path, "src/prog.c"])
|
.args(&["-o", c_exe_path, "src/prog.c"])
|
||||||
.spawn().expect("C program compilation failed");
|
.spawn().expect("C program compilation failed");
|
||||||
|
println!("cargo:rustc-env=C_PROG_PATH={}", c_exe_path);
|
||||||
println!("cargo:rerun-if-changed=src/prog.c");
|
println!("cargo:rerun-if-changed=src/prog.c");
|
||||||
|
|
||||||
println!("cargo:rustc-env=TEST_PROG_PATH={}", assembly_exe_path);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ fn breakpoint_fun(child_pid: Pid) -> ExitCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let child_exec_path = CString::new(env!("TEST_PROG_PATH")).unwrap();
|
let child_exec_path = CString::new(env!("ASM_PROG_PATH")).unwrap();
|
||||||
|
|
||||||
match unsafe { fork() } {
|
match unsafe { fork() } {
|
||||||
Ok(ForkResult::Child) => child::starti(child_exec_path),
|
Ok(ForkResult::Child) => child::starti(child_exec_path),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue