Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a2c4623b
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a2c4623b
编写于
9月 30, 2015
作者:
J
Jared Parsons
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5600 from TyOverby/5534-debug-portable
Add PDB format option to /debug flag
上级
89b92055
0b6f595c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
40 deletion
+67
-40
src/Compilers/CSharp/Portable/CommandLine/CommandLineParser.cs
...ompilers/CSharp/Portable/CommandLine/CommandLineParser.cs
+17
-20
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
+20
-0
src/Compilers/VisualBasic/Portable/CommandLine/CommandLineParser.vb
...ers/VisualBasic/Portable/CommandLine/CommandLineParser.vb
+12
-19
src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb
...ompilers/VisualBasic/Test/CommandLine/CommandLineTests.vb
+18
-1
未找到文件。
src/Compilers/CSharp/Portable/CommandLine/CommandLineParser.cs
浏览文件 @
a2c4623b
...
...
@@ -59,6 +59,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
bool
concurrentBuild
=
true
;
bool
deterministic
=
false
;
// TODO(5431): Enable deterministic mode by default
bool
emitPdb
=
false
;
DebugInformationFormat
debugInformationFormat
=
DebugInformationFormat
.
Pdb
;
bool
debugPlus
=
false
;
string
pdbPath
=
null
;
bool
noStdLib
=
false
;
...
...
@@ -516,11 +517,22 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
if
(
value
.
IsEmpty
())
{
AddDiagnostic
(
diagnostics
,
ErrorCode
.
ERR_SwitchNeedsString
,
MessageID
.
IDS_Text
.
Localize
(),
name
);
continue
;
}
else
if
(!
string
.
Equals
(
value
,
"full"
,
StringComparison
.
OrdinalIgnoreCase
)
&&
!
string
.
Equals
(
value
,
"pdbonly"
,
StringComparison
.
OrdinalIgnoreCase
))
{
AddDiagnostic
(
diagnostics
,
ErrorCode
.
ERR_BadDebugType
,
value
);
switch
(
value
.
ToLower
())
{
case
"full"
:
case
"pdbonly"
:
debugInformationFormat
=
DebugInformationFormat
.
Pdb
;
break
;
case
"portable"
:
debugInformationFormat
=
DebugInformationFormat
.
PortablePdb
;
break
;
case
"embedded"
:
debugInformationFormat
=
DebugInformationFormat
.
Embedded
;
break
;
default
:
AddDiagnostic
(
diagnostics
,
ErrorCode
.
ERR_BadDebugType
,
value
);
break
;
}
}
continue
;
...
...
@@ -1053,21 +1065,6 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
var
parsedFeatures
=
CompilerOptionParseUtilities
.
ParseFeatures
(
features
);
var
debugInfoFormat
=
DebugInformationFormat
.
Pdb
;
string
pdbFormatStr
;
if
(
emitPdb
&&
parsedFeatures
.
TryGetValue
(
"pdb"
,
out
pdbFormatStr
))
{
if
(
pdbFormatStr
==
"portable"
)
{
debugInfoFormat
=
DebugInformationFormat
.
PortablePdb
;
}
else
if
(
pdbFormatStr
==
"embedded"
)
{
debugInfoFormat
=
DebugInformationFormat
.
Embedded
;
emitPdb
=
false
;
}
}
string
compilationName
;
GetCompilationAndModuleNames
(
diagnostics
,
outputKind
,
sourceFiles
,
sourceFilesSpecified
,
moduleAssemblyName
,
ref
outputFileName
,
ref
moduleName
,
out
compilationName
);
...
...
@@ -1116,7 +1113,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
var
emitOptions
=
new
EmitOptions
(
metadataOnly
:
false
,
debugInformationFormat
:
debugInfoFormat
,
debugInformationFormat
:
debugInfo
rmation
Format
,
pdbFilePath
:
null
,
// to be determined later
outputNameOverride
:
null
,
// to be determined later
baseAddress
:
baseAddress
,
...
...
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
浏览文件 @
a2c4623b
...
...
@@ -1177,42 +1177,62 @@ public void Debug()
var
parsedArgs
=
DefaultParse
(
new
[]
{
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug-"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug+"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
true
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug+"
,
"/debug-"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:full"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:FULL"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:pdbonly"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:portable"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
PortablePdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:embedded"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Embedded
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:PDBONLY"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:full"
,
"/debug:pdbonly"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
Assert
.
Equal
(
false
,
parsedArgs
.
CompilationOptions
.
DebugPlusMode
);
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
);
parsedArgs
=
DefaultParse
(
new
[]
{
"/debug:pdbonly"
,
"/debug:full"
,
"a.cs"
},
_baseDirectory
);
parsedArgs
.
Errors
.
Verify
();
...
...
src/Compilers/VisualBasic/Portable/CommandLine/CommandLineParser.vb
浏览文件 @
a2c4623b
...
...
@@ -90,6 +90,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim
concurrentBuild
As
Boolean
=
True
Dim
deterministic
As
Boolean
=
False
Dim
emitPdb
As
Boolean
Dim
debugInformationFormat
As
DebugInformationFormat
=
DebugInformationFormat
.
Pdb
Dim
noStdLib
As
Boolean
=
False
Dim
utf8output
As
Boolean
=
False
Dim
outputFileName
As
String
=
Nothing
...
...
@@ -581,16 +582,19 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Continue
For
Case
"debug"
' parse only for backwards compat
value
=
RemoveQuotesAndSlashes
(
value
)
If
value
IsNot
Nothing
Then
If
String
.
IsNullOrEmpty
(
value
)
Then
AddDiagnostic
(
diagnostics
,
ERRID
.
ERR_ArgumentRequired
,
"debug"
,
":pdbonly|full"
)
ElseIf
Not
String
.
Equals
(
value
,
"full"
,
StringComparison
.
OrdinalIgnoreCase
)
AndAlso
Not
String
.
Equals
(
value
,
"pdbonly"
,
StringComparison
.
OrdinalIgnoreCase
)
Then
AddDiagnostic
(
diagnostics
,
ERRID
.
ERR_InvalidSwitchValue
,
"debug"
,
value
)
End
If
Select
Case
value
.
ToLower
()
Case
"full"
,
"pdbonly"
debugInformationFormat
=
DebugInformationFormat
.
Pdb
Case
"portable"
debugInformationFormat
=
DebugInformationFormat
.
PortablePdb
Case
"embedded"
debugInformationFormat
=
DebugInformationFormat
.
Embedded
Case
Else
AddDiagnostic
(
diagnostics
,
ERRID
.
ERR_InvalidSwitchValue
,
"debug"
,
value
)
End
Select
End
If
emitPdb
=
True
...
...
@@ -1160,17 +1164,6 @@ lVbRuntimePlus:
Dim
parsedFeatures
=
CompilerOptionParseUtilities
.
ParseFeatures
(
features
)
Dim
debugInfoFormat
=
DebugInformationFormat
.
Pdb
Dim
pdbFormatStr
As
String
=
Nothing
If
emitPdb
AndAlso
parsedFeatures
.
TryGetValue
(
"pdb"
,
pdbFormatStr
)
Then
If
StringComparer
.
Ordinal
.
Equals
(
pdbFormatStr
,
"portable"
)
Then
debugInfoFormat
=
DebugInformationFormat
.
PortablePdb
ElseIf
StringComparer
.
Ordinal
.
Equals
(
pdbFormatStr
,
"embedded"
)
Then
debugInfoFormat
=
DebugInformationFormat
.
Embedded
emitPdb
=
False
End
If
End
If
Dim
compilationName
As
String
=
Nothing
GetCompilationAndModuleNames
(
diagnostics
,
outputKind
,
sourceFiles
,
moduleAssemblyName
,
outputFileName
,
moduleName
,
compilationName
)
...
...
@@ -1223,7 +1216,7 @@ lVbRuntimePlus:
Dim
emitOptions
=
New
EmitOptions
(
metadataOnly
:
=
False
,
debugInformationFormat
:
=
debugInfoFormat
,
debugInformationFormat
:
=
debugInfo
rmation
Format
,
pdbFilePath
:
=
Nothing
,
' to be determined later
outputNameOverride
:
=
Nothing
,
' to be determined later
fileAlignment
:
=
fileAlignment
,
...
...
src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb
浏览文件 @
a2c4623b
...
...
@@ -2199,30 +2199,47 @@ a.vb
parsedArgs
=
DefaultParse
({
"/debug-"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug+"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug+"
,
"/debug-"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:full"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:FULL"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:pdbonly"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:portable"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
PortablePdb
)
parsedArgs
=
DefaultParse
({
"/debug:embedded"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Embedded
)
parsedArgs
=
DefaultParse
({
"/debug:PDBONLY"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:full"
,
"/debug:pdbonly"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
Assert
.
Equal
(
parsedArgs
.
EmitOptions
.
DebugInformationFormat
,
DebugInformationFormat
.
Pdb
)
parsedArgs
=
DefaultParse
({
"/debug:pdbonly"
,
"/debug:full"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
()
...
...
@@ -2245,7 +2262,7 @@ a.vb
Assert
.
Equal
(
DebugInformationFormat
.
Pdb
,
parsedArgs
.
EmitOptions
.
DebugInformationFormat
)
parsedArgs
=
DefaultParse
({
"/debug:"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
(
Diagnostic
(
ERRID
.
ERR_
ArgumentRequired
).
WithArguments
(
"debug"
,
":pdbonly|full
"
))
parsedArgs
.
Errors
.
Verify
(
Diagnostic
(
ERRID
.
ERR_
InvalidSwitchValue
).
WithArguments
(
"debug"
,
"
"
))
parsedArgs
=
DefaultParse
({
"/debug:+"
,
"a.vb"
},
_baseDirectory
)
parsedArgs
.
Errors
.
Verify
(
Diagnostic
(
ERRID
.
ERR_InvalidSwitchValue
).
WithArguments
(
"debug"
,
"+"
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录