mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Always provide /PDB option to linker if generating debug info.
radlink by default places the .PDB file in the working directory, even if /OUT says to place it elsewhere, unlike link.exe, which places it next to the executable by default. So, if compiling using -debug, we generate a PDB path even if -pdb-name wasn't used to override it.
This commit is contained in:
+12
-4
@@ -2066,10 +2066,6 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bc->pdb_filepath.len > 0) {
|
|
||||||
bc->build_paths[BuildPath_PDB] = path_from_string(ha, bc->pdb_filepath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((bc->command_kind & Command__does_build) && (!bc->ignore_microsoft_magic)) {
|
if ((bc->command_kind & Command__does_build) && (!bc->ignore_microsoft_magic)) {
|
||||||
// NOTE(ic): It would be nice to extend this so that we could specify the Visual Studio version that we want instead of defaulting to the latest.
|
// NOTE(ic): It would be nice to extend this so that we could specify the Visual Studio version that we want instead of defaulting to the latest.
|
||||||
Find_Result find_result = find_visual_studio_and_windows_sdk();
|
Find_Result find_result = find_visual_studio_and_windows_sdk();
|
||||||
@@ -2268,6 +2264,18 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
bc->build_paths[BuildPath_Output] = output_path;
|
bc->build_paths[BuildPath_Output] = output_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (build_context.metrics.os == TargetOs_windows && build_context.ODIN_DEBUG) {
|
||||||
|
if (bc->pdb_filepath.len > 0) {
|
||||||
|
bc->build_paths[BuildPath_PDB] = path_from_string(ha, bc->pdb_filepath);
|
||||||
|
} else {
|
||||||
|
Path pdb_path;
|
||||||
|
pdb_path.basename = copy_string(ha, bc->build_paths[BuildPath_Output].basename);
|
||||||
|
pdb_path.name = copy_string(ha, bc->build_paths[BuildPath_Output].name);
|
||||||
|
pdb_path.ext = copy_string(ha, STR_LIT("pdb"));
|
||||||
|
bc->build_paths[BuildPath_PDB] = pdb_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do we have an extension? We might not if the output filename was supplied.
|
// Do we have an extension? We might not if the output filename was supplied.
|
||||||
if (bc->build_paths[BuildPath_Output].ext.len == 0) {
|
if (bc->build_paths[BuildPath_Output].ext.len == 0) {
|
||||||
if (build_context.metrics.os == TargetOs_windows || is_arch_wasm() || build_context.build_mode != BuildMode_Executable) {
|
if (build_context.metrics.os == TargetOs_windows || is_arch_wasm() || build_context.build_mode != BuildMode_Executable) {
|
||||||
|
|||||||
+1
-1
@@ -281,7 +281,7 @@ try_cross_linking:;
|
|||||||
link_settings = gb_string_append_fmt(link_settings, " /ENTRY:mainCRTStartup");
|
link_settings = gb_string_append_fmt(link_settings, " /ENTRY:mainCRTStartup");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (build_context.pdb_filepath != "") {
|
if (build_context.build_paths[BuildPath_PDB].name != "") {
|
||||||
String pdb_path = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_PDB]);
|
String pdb_path = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_PDB]);
|
||||||
link_settings = gb_string_append_fmt(link_settings, " /PDB:\"%.*s\"", LIT(pdb_path));
|
link_settings = gb_string_append_fmt(link_settings, " /PDB:\"%.*s\"", LIT(pdb_path));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user