1
Fork 0

Add missing Debuginfo to PDB debug file on windows.

Set Arg0 and CommandLineArgs in MCTargetoptions so LLVM outputs correct CL and CMD in LF_DEBUGINFO instead of empty/invalid values.
This commit is contained in:
Florian Schmiderer 2023-07-03 13:11:27 +02:00
parent f91c53d738
commit 4cdc633301
16 changed files with 117 additions and 1 deletions

View file

@ -279,6 +279,12 @@ pub struct Config {
/// Registry of diagnostics codes.
pub registry: Registry,
/// All commandline args used to invoke the compiler, with @file args fully expanded.
/// This will only be used within debug info, e.g. in the pdb file on windows
/// This is mainly useful for other tools that reads that debuginfo to figure out
/// how to call the compiler with the same arguments.
pub expanded_args: Vec<String>,
}
// JUSTIFICATION: before session exists, only config
@ -317,6 +323,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
config.make_codegen_backend,
registry.clone(),
config.ice_file,
config.expanded_args,
);
if let Some(parse_sess_created) = config.parse_sess_created {

View file

@ -68,6 +68,7 @@ fn mk_session(handler: &mut EarlyErrorHandler, matches: getopts::Matches) -> (Se
None,
"",
None,
Default::default(),
);
(sess, cfg)
}

View file

@ -71,6 +71,7 @@ pub fn create_session(
>,
descriptions: Registry,
ice_file: Option<PathBuf>,
expanded_args: Vec<String>,
) -> (Session, Box<dyn CodegenBackend>) {
let codegen_backend = if let Some(make_codegen_backend) = make_codegen_backend {
make_codegen_backend(&sopts)
@ -113,6 +114,7 @@ pub fn create_session(
target_override,
rustc_version_str().unwrap_or("unknown"),
ice_file,
expanded_args,
);
codegen_backend.init(&sess);