Skip to content

Commit

Permalink
[WIP] Debug macos.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoolioh committed Aug 19, 2024
1 parent d6b83f3 commit cc31874
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions builder/build/arch/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,38 @@ pub fn fix_rpath(lib_path: &str) {
}

pub fn strip_libraries(lib_path: &str) {
Command::new("objcopy")
.arg("--remove-section")
.arg(".llvmbc")
.arg(lib_path.to_owned() + "/libdatadog_profiling.a")
.spawn()
.expect("failed to remove llvm section");

Command::new("objcopy")
.arg("--only-keep-debug")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.arg(lib_path.to_owned() + "/libdatadog_profiling.debug")
.spawn()
.expect("failed to create debug file");
let output = Command::new("ls")
.arg("-lh")
.arg(lib_path)
.output();


let static_lib = lib_path.to_owned() + "/libdatadog_profiling.a";
println!("{:?}", static_lib);

// Command::new("objcopy")
// .arg("--remove-section")
// .arg(".llvmbc")
// .arg(static_lib)
// .spawn()
// .expect("failed to remove llvm section");

// Command::new("objcopy")
// .arg("--only-keep-debug")
// .arg(lib_path.to_owned() + "/libdatadog_profiling.dylib")
// .arg(lib_path.to_owned() + "/libdatadog_profiling.debug")
// .spawn()
// .expect("failed to create debug file");

Command::new("strip")
.arg("-S")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.arg(lib_path.to_owned() + "/libdatadog_profiling.dylib")
.spawn()
.expect("failed to strip the library");

Command::new("objcopy")
.arg("--add-gnu-debuglink=".to_string() + lib_path + "/libdatadog_profiling.debug")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.spawn()
.expect("failed to create debug file");
// Command::new("objcopy")
// .arg("--add-gnu-debuglink=".to_string() + lib_path + "/libdatadog_profiling.debug")
// .arg(lib_path.to_owned() + "/libdatadog_profiling.dylib")
// .spawn()
// .expect("failed to create debug file");
}

0 comments on commit cc31874

Please sign in to comment.