Index: lld/trunk/COFF/Config.h =================================================================== --- lld/trunk/COFF/Config.h +++ lld/trunk/COFF/Config.h @@ -164,7 +164,6 @@ bool AppContainer = false; // This is for debugging. - bool DebugPdb = false; bool DumpPdb = false; }; Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -834,7 +834,6 @@ if (Args.hasArg(OPT_nosymtab)) Config->WriteSymtab = false; Config->DumpPdb = Args.hasArg(OPT_dumppdb); - Config->DebugPdb = Args.hasArg(OPT_debugpdb); Config->MapFile = getMapFile(Args); Index: lld/trunk/COFF/Options.td =================================================================== --- lld/trunk/COFF/Options.td +++ lld/trunk/COFF/Options.td @@ -102,7 +102,6 @@ def msvclto : F<"msvclto">; // Flags for debugging -def debugpdb : F<"debugpdb">; def dumppdb : Joined<["/", "-"], "dumppdb">; def lldmap : F<"lldmap">; def lldmap_file : Joined<["/", "-"], "lldmap:">; Index: lld/trunk/COFF/Writer.cpp =================================================================== --- lld/trunk/COFF/Writer.cpp +++ lld/trunk/COFF/Writer.cpp @@ -258,7 +258,7 @@ sortExceptionTable(); writeBuildId(); - if (!Config->PDBPath.empty()) { + if (!Config->PDBPath.empty() && Config->Debug) { const llvm::codeview::DebugInfo *DI = nullptr; if (Config->DebugTypes & static_cast(coff::DebugType::CV)) DI = BuildId->DI; Index: lld/trunk/test/COFF/invalid-debug-type.test =================================================================== --- lld/trunk/test/COFF/invalid-debug-type.test +++ lld/trunk/test/COFF/invalid-debug-type.test @@ -1,5 +1,5 @@ # RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj # RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj # RUN: lld-link /debug /debugtype:invalid /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \ -# RUN: /debugpdb %t1.obj %t2.obj +# RUN: %t1.obj %t2.obj Index: lld/trunk/test/COFF/pdb-none.test =================================================================== --- lld/trunk/test/COFF/pdb-none.test +++ lld/trunk/test/COFF/pdb-none.test @@ -1,7 +1,7 @@ # RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj # RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj # RUN: lld-link /debug /debugtype:pdata /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \ -# RUN: /debugpdb %t1.obj %t2.obj +# RUN: %t1.obj %t2.obj # RUN: llvm-pdbdump pdb2yaml -pdb-stream %t.pdb | FileCheck %s Index: lld/trunk/test/COFF/pdb-options.test =================================================================== --- lld/trunk/test/COFF/pdb-options.test +++ lld/trunk/test/COFF/pdb-options.test @@ -0,0 +1,20 @@ +# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj +# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj + +; If /DEBUG is not specified, /pdb is ignored. +# RUN: lld-link /pdb:%t.pdb /entry:main /nodefaultlib %t1.obj %t2.obj +# RUN: not ls %t.pdb + +; If /DEBUG and /pdb are specified, it uses the specified name. +# RUN: lld-link /DEBUG /pdb:%t.pdb /entry:main /nodefaultlib %t1.obj %t2.obj +# RUN: ls %t.pdb +# RUN: rm %t.pdb + +; If /DEBUG is specified but not /pdb, it uses a default name in the current +; directory. This is a bit hacky since but we need to be IN our test specific +; temporary directory when we run this command or we can't test this +# RUN: cd %T +# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t1.obj %t2.obj +# RUN: ls %t1.pdb +# RUN: rm %t* +# RUN: cd %T/.. Index: lld/trunk/test/COFF/pdb.test =================================================================== --- lld/trunk/test/COFF/pdb.test +++ lld/trunk/test/COFF/pdb.test @@ -1,7 +1,7 @@ # RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj # RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj # RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \ -# RUN: /debugpdb %t1.obj %t2.obj +# RUN: %t1.obj %t2.obj # RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \ # RUN: -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s