@@ -183,7 +183,7 @@ pub trait Linker {
183183 fn optimize ( & mut self ) ;
184184 fn pgo_gen ( & mut self ) ;
185185 fn control_flow_guard ( & mut self ) ;
186- fn debuginfo ( & mut self , strip : Strip ) ;
186+ fn debuginfo ( & mut self , strip : Strip , debugger_visualizers : & [ PathBuf ] ) ;
187187 fn no_crt_objects ( & mut self ) ;
188188 fn no_default_libraries ( & mut self ) ;
189189 fn export_symbols ( & mut self , tmpdir : & Path , crate_type : CrateType , symbols : & [ String ] ) ;
@@ -611,7 +611,7 @@ impl<'a> Linker for GccLinker<'a> {
611611
612612 fn control_flow_guard ( & mut self ) { }
613613
614- fn debuginfo ( & mut self , strip : Strip ) {
614+ fn debuginfo ( & mut self , strip : Strip , _ : & [ PathBuf ] ) {
615615 // MacOS linker doesn't support stripping symbols directly anymore.
616616 if self . sess . target . is_like_osx {
617617 return ;
@@ -915,7 +915,7 @@ impl<'a> Linker for MsvcLinker<'a> {
915915 self . cmd . arg ( "/guard:cf" ) ;
916916 }
917917
918- fn debuginfo ( & mut self , strip : Strip ) {
918+ fn debuginfo ( & mut self , strip : Strip , debugger_visualizers : & [ PathBuf ] ) {
919919 match strip {
920920 Strip :: None => {
921921 // This will cause the Microsoft linker to generate a PDB file
@@ -942,6 +942,13 @@ impl<'a> Linker for MsvcLinker<'a> {
942942 }
943943 }
944944 }
945+
946+ // This will cause the Microsoft linker to embed .natvis info for all crates into the PDB file
947+ for path in debugger_visualizers {
948+ let mut arg = OsString :: from ( "/NATVIS:" ) ;
949+ arg. push ( path) ;
950+ self . cmd . arg ( arg) ;
951+ }
945952 }
946953 Strip :: Debuginfo | Strip :: Symbols => {
947954 self . cmd . arg ( "/DEBUG:NONE" ) ;
@@ -1124,7 +1131,7 @@ impl<'a> Linker for EmLinker<'a> {
11241131
11251132 fn control_flow_guard ( & mut self ) { }
11261133
1127- fn debuginfo ( & mut self , _strip : Strip ) {
1134+ fn debuginfo ( & mut self , _strip : Strip , _ : & [ PathBuf ] ) {
11281135 // Preserve names or generate source maps depending on debug info
11291136 self . cmd . arg ( match self . sess . opts . debuginfo {
11301137 DebugInfo :: None => "-g0" ,
@@ -1315,7 +1322,7 @@ impl<'a> Linker for WasmLd<'a> {
13151322
13161323 fn pgo_gen ( & mut self ) { }
13171324
1318- fn debuginfo ( & mut self , strip : Strip ) {
1325+ fn debuginfo ( & mut self , strip : Strip , _ : & [ PathBuf ] ) {
13191326 match strip {
13201327 Strip :: None => { }
13211328 Strip :: Debuginfo => {
@@ -1450,7 +1457,7 @@ impl<'a> Linker for L4Bender<'a> {
14501457
14511458 fn pgo_gen ( & mut self ) { }
14521459
1453- fn debuginfo ( & mut self , strip : Strip ) {
1460+ fn debuginfo ( & mut self , strip : Strip , _ : & [ PathBuf ] ) {
14541461 match strip {
14551462 Strip :: None => { }
14561463 Strip :: Debuginfo => {
@@ -1600,7 +1607,7 @@ impl<'a> Linker for PtxLinker<'a> {
16001607 self . cmd . arg ( "-L" ) . arg ( path) ;
16011608 }
16021609
1603- fn debuginfo ( & mut self , _strip : Strip ) {
1610+ fn debuginfo ( & mut self , _strip : Strip , _ : & [ PathBuf ] ) {
16041611 self . cmd . arg ( "--debug" ) ;
16051612 }
16061613
@@ -1699,7 +1706,7 @@ impl<'a> Linker for BpfLinker<'a> {
16991706 self . cmd . arg ( "-L" ) . arg ( path) ;
17001707 }
17011708
1702- fn debuginfo ( & mut self , _strip : Strip ) {
1709+ fn debuginfo ( & mut self , _strip : Strip , _ : & [ PathBuf ] ) {
17031710 self . cmd . arg ( "--debug" ) ;
17041711 }
17051712
0 commit comments