File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -475,6 +475,31 @@ impl<'a> Linker for MsvcLinker<'a> {
475
475
// This will cause the Microsoft linker to generate a PDB file
476
476
// from the CodeView line tables in the object files.
477
477
self . cmd . arg ( "/DEBUG" ) ;
478
+
479
+ // This will cause the Microsoft linker to embed .natvis info into the the PDB file
480
+ let sysroot = self . sess . sysroot ( ) ;
481
+ let natvis_dir_path = sysroot. join ( "lib\\ rustlib\\ etc" ) ;
482
+ if let Ok ( natvis_dir) = fs:: read_dir ( & natvis_dir_path) {
483
+ for entry in natvis_dir {
484
+ match entry {
485
+ Ok ( entry) => {
486
+ let path = entry. path ( ) ;
487
+ if let Some ( ext) = path. extension ( ) {
488
+ if ext == OsStr :: new ( "natvis" ) {
489
+ if let Some ( natvis_path_str) = path. to_str ( ) {
490
+ self . cmd . arg ( & format ! ( "/NATVIS:{}" , natvis_path_str) ) ;
491
+ } else {
492
+ self . sess . warn ( & format ! ( "natvis path not unicode: {:?}" , path) ) ;
493
+ }
494
+ }
495
+ }
496
+ } ,
497
+ Err ( err) => {
498
+ self . sess . warn ( & format ! ( "error enumerating natvis directory: {}" , err) ) ;
499
+ } ,
500
+ }
501
+ }
502
+ }
478
503
}
479
504
480
505
// Currently the compiler doesn't use `dllexport` (an LLVM attribute) to
You can’t perform that action at this time.
0 commit comments