Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8a60a86b
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,发现更多精彩内容 >>
提交
8a60a86b
编写于
4月 02, 2015
作者:
T
Tomas Matousek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid opening PDB writer on existing PDB file
上级
54346555
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
14 deletion
+15
-14
src/Compilers/Core/Desktop/CommandLine/CommonCompiler.CompilerEmitStreamProvider.cs
.../CommandLine/CommonCompiler.CompilerEmitStreamProvider.cs
+2
-4
src/Compilers/Core/Desktop/CommandLine/CommonCompiler.cs
src/Compilers/Core/Desktop/CommandLine/CommonCompiler.cs
+2
-2
src/Compilers/Core/Portable/Compilation/Compilation.cs
src/Compilers/Core/Portable/Compilation/Compilation.cs
+4
-3
src/Compilers/Core/Portable/PEWriter/PdbWriter.cs
src/Compilers/Core/Portable/PEWriter/PdbWriter.cs
+7
-5
未找到文件。
src/Compilers/Core/Desktop/CommandLine/CommonCompiler.CompilerEmitStreamProvider.cs
浏览文件 @
8a60a86b
...
...
@@ -20,15 +20,13 @@ private sealed class CompilerEmitStreamProvider : Compilation.EmitStreamProvider
private
readonly
CommonCompiler
_compiler
;
private
readonly
string
_filePath
;
private
readonly
bool
_streamCreatedByNativePdbWriter
;
private
Stream
_lazyStream
;
internal
CompilerEmitStreamProvider
(
CommonCompiler
compiler
,
string
filePath
,
bool
streamCreatedByNativePdbWriter
)
internal
CompilerEmitStreamProvider
(
CommonCompiler
compiler
,
string
filePath
)
{
_compiler
=
compiler
;
_filePath
=
filePath
;
_streamCreatedByNativePdbWriter
=
streamCreatedByNativePdbWriter
;
_lazyStream
=
s_uninitialized
;
}
...
...
@@ -45,7 +43,7 @@ public override Stream GetStream(DiagnosticBag diagnostics)
{
if
(
_lazyStream
==
s_uninitialized
)
{
_lazyStream
=
_streamCreatedByNativePdbWriter
?
null
:
OpenFile
(
_filePath
,
diagnostics
);
_lazyStream
=
OpenFile
(
_filePath
,
diagnostics
);
}
return
_lazyStream
;
...
...
src/Compilers/Core/Desktop/CommandLine/CommonCompiler.cs
浏览文件 @
8a60a86b
...
...
@@ -416,8 +416,8 @@ private int RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, Cancellat
WithOutputNameOverride
(
outputName
).
WithPdbFilePath
(
finalPdbFilePath
);
using
(
var
peStreamProvider
=
new
CompilerEmitStreamProvider
(
this
,
finalOutputPath
,
streamCreatedByNativePdbWriter
:
false
))
using
(
var
pdbStreamProviderOpt
=
Arguments
.
EmitPdb
?
new
CompilerEmitStreamProvider
(
this
,
final
OutputPath
,
streamCreatedByNativePdbWriter
:
true
)
:
null
)
using
(
var
peStreamProvider
=
new
CompilerEmitStreamProvider
(
this
,
finalOutputPath
))
using
(
var
pdbStreamProviderOpt
=
Arguments
.
EmitPdb
?
new
CompilerEmitStreamProvider
(
this
,
final
PdbFilePath
)
:
null
)
{
emitResult
=
compilation
.
Emit
(
peStreamProvider
,
...
...
src/Compilers/Core/Portable/Compilation/Compilation.cs
浏览文件 @
8a60a86b
...
...
@@ -1641,6 +1641,7 @@ private static EmitResult ToEmitResultAndFree(DiagnosticBag diagnostics, bool su
pdbStream
=
pdbStreamProvider
.
GetStream
(
diagnostics
);
if
(
pdbStream
==
null
)
{
Debug
.
Assert
(
diagnostics
.
HasAnyErrors
());
return
null
;
}
...
...
@@ -1648,8 +1649,8 @@ private static EmitResult ToEmitResultAndFree(DiagnosticBag diagnostics, bool su
// Native PDB writer is able to update an existing stream.
// It checks for length to determine whether the given stream has existing data to be updated,
// or whether it should start writing PDB data from scratch. Thus if not writing to a seekable empty stream
,
//
let's
create an in-memory temp stream for the PDB writer and copy all data to the actual stream at once at the end.
// or whether it should start writing PDB data from scratch. Thus if not writing to a seekable empty stream,
//
we have to
create an in-memory temp stream for the PDB writer and copy all data to the actual stream at once at the end.
if
(!
retStream
.
CanSeek
||
retStream
.
Length
!=
0
)
{
retStream
=
pdbTempStream
=
new
MemoryStream
();
...
...
@@ -1725,7 +1726,7 @@ private static EmitResult ToEmitResultAndFree(DiagnosticBag diagnostics, bool su
{
// Note: Native PDB writer may operate on the underlying stream during disposal.
// So close it here before we read data from the underlying stream.
nativePdbWriter
.
WritePdbToOutput
();
nativePdbWriter
?
.
WritePdbToOutput
();
pdbTempStream
.
Position
=
0
;
pdbTempStream
.
CopyTo
(
pdbStream
);
...
...
src/Compilers/Core/Portable/PEWriter/PdbWriter.cs
浏览文件 @
8a60a86b
...
...
@@ -75,8 +75,7 @@ public void Dispose()
}
/// <summary>
/// Close the PDB writer and write the contents to the stream provided by <see cref="_streamProvider"/>
/// or file name specified by <see cref="_fileName"/> value if no stream has been provided.
/// Close the PDB writer and write the PDB data to the stream provided by <see cref="_streamProvider"/>.
/// </summary>
public
void
WritePdbToOutput
()
{
...
...
@@ -559,14 +558,17 @@ private static Type GetCorSymWriterSxSType()
public
void
SetMetadataEmitter
(
MetadataWriter
metadataWriter
)
{
Stream
stream
Opt
=
_streamProvider
();
Stream
stream
=
_streamProvider
()
??
new
System
.
IO
.
MemoryStream
();
try
{
var
instance
=
(
ISymUnmanagedWriter2
)(
_symWriterFactory
!=
null
?
_symWriterFactory
()
:
Activator
.
CreateInstance
(
GetCorSymWriterSxSType
()));
var
comStream
=
(
streamOpt
!=
null
)
?
new
ComStreamWrapper
(
streamOpt
)
:
null
;
instance
.
Initialize
(
new
PdbMetadataWrapper
(
metadataWriter
),
_fileName
,
comStream
,
fullBuild
:
true
);
// Important: If the stream is not specified or if it is non-empty the SymWriter appends data to it (provided it contains valid PDB)
// and the resulting PDB has Age = existing_age + 1.
Debug
.
Assert
(
stream
.
Length
==
0
);
instance
.
Initialize
(
new
PdbMetadataWrapper
(
metadataWriter
),
_fileName
,
new
ComStreamWrapper
(
stream
),
fullBuild
:
true
);
_metadataWriter
=
metadataWriter
;
_symWriter
=
instance
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录