mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-26 19:03:27 +00:00
Fix debug target path in OSDK
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5d9868964b
commit
18b11ec193
@ -2,17 +2,17 @@
|
||||
|
||||
use crate::{
|
||||
cli::DebugArgs,
|
||||
commands::util::{bin_file_name, profile_name_adapter},
|
||||
util::get_target_directory,
|
||||
commands::util::bin_file_name,
|
||||
util::{get_current_crate_info, get_target_directory},
|
||||
};
|
||||
use std::process::Command;
|
||||
|
||||
pub fn execute_debug_command(profile: &str, args: &DebugArgs) {
|
||||
pub fn execute_debug_command(_profile: &str, args: &DebugArgs) {
|
||||
let remote = &args.remote;
|
||||
|
||||
let file_path = get_target_directory()
|
||||
.join("x86_64-unknown-none")
|
||||
.join(profile_name_adapter(profile))
|
||||
.join("osdk")
|
||||
.join(get_current_crate_info().name)
|
||||
.join(bin_file_name());
|
||||
println!("Debugging {}", file_path.display());
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name": "Debug Asterinas(#PROFILE#)",
|
||||
"type": "lldb",
|
||||
"request": "custom",
|
||||
"targetCreateCommands": ["target create ${workspaceFolder}/target/x86_64-unknown-none/#PROFILE#/#BIN_NAME#"],
|
||||
"targetCreateCommands": ["target create ${workspaceFolder}/target/osdk/#CRATE_NAME#/#BIN_NAME#"],
|
||||
"processCreateCommands": ["gdb-remote #ADDR_PORT#"]
|
||||
}
|
||||
]
|
||||
|
@ -56,17 +56,17 @@ pub fn execute_run_command(config: &Config, gdb_server_args: &GdbServerArgs) {
|
||||
config.run.qemu.args = splitted.join(" ");
|
||||
|
||||
// Ensure debug info added when debugging in the release profile.
|
||||
if config.run.build.profile == "release" {
|
||||
if config.run.build.profile.contains("release") {
|
||||
config
|
||||
.run
|
||||
.build
|
||||
.override_configs
|
||||
.push("profile.release.debug=true".to_owned());
|
||||
.push(format!("profile.{}.debug=true", config.run.build.profile));
|
||||
}
|
||||
}
|
||||
let _vsc_launch_file = gdb_server_args.vsc_launch_file.then(|| {
|
||||
vsc::check_gdb_config(gdb_server_args);
|
||||
let profile = super::util::profile_name_adapter(&config.build.profile);
|
||||
let profile = super::util::profile_name_adapter(&config.run.build.profile);
|
||||
vsc::VscLaunchConfig::new(profile, &gdb_server_args.gdb_server_addr)
|
||||
});
|
||||
|
||||
@ -124,7 +124,11 @@ mod gdb {
|
||||
}
|
||||
|
||||
mod vsc {
|
||||
use crate::{cli::GdbServerArgs, commands::util::bin_file_name, util::get_cargo_metadata};
|
||||
use crate::{
|
||||
cli::GdbServerArgs,
|
||||
commands::util::bin_file_name,
|
||||
util::{get_cargo_metadata, get_current_crate_info},
|
||||
};
|
||||
use serde_json::{from_str, Value};
|
||||
use std::{
|
||||
fs::{read_to_string, write as write_file},
|
||||
@ -242,6 +246,7 @@ mod vsc {
|
||||
) -> Result<(), std::io::Error> {
|
||||
let contents = include_str!("launch.json.template")
|
||||
.replace("#PROFILE#", profile)
|
||||
.replace("#CRATE_NAME#", &get_current_crate_info().name)
|
||||
.replace("#BIN_NAME#", &bin_file_name())
|
||||
.replace(
|
||||
"#ADDR_PORT#",
|
||||
|
Reference in New Issue
Block a user