Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7fe84de7
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,发现更多精彩内容 >>
未验证
提交
7fe84de7
编写于
1月 23, 2019
作者:
T
Tomáš Matoušek
提交者:
GitHub
1月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Trim sequence point column numbers greater than 0xffff. (#32688)
Fixes
https://github.com/dotnet/roslyn/issues/20118
上级
0e5a7612
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
162 addition
and
23 deletion
+162
-23
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
+124
-0
src/Compilers/Core/Portable/CodeGen/RawSequencePoint.cs
src/Compilers/Core/Portable/CodeGen/RawSequencePoint.cs
+1
-1
src/Compilers/Core/Portable/CodeGen/SequencePointList.cs
src/Compilers/Core/Portable/CodeGen/SequencePointList.cs
+28
-15
src/Compilers/Core/Portable/PEWriter/SequencePoint.cs
src/Compilers/Core/Portable/PEWriter/SequencePoint.cs
+8
-6
src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs
.../Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
浏览文件 @
7fe84de7
...
...
@@ -526,6 +526,130 @@ public void CustomDebugEntryPoint_Errors()
Diagnostic
(
ErrorCode
.
ERR_DebugEntryPointNotSourceMethodDefinition
));
}
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
ConditionalSkipReason
.
NativePdbRequiresDesktop
)]
[
WorkItem
(
768862
,
"https://devdiv.visualstudio.com/DevDiv/_workitems/edit/768862"
)]
public
void
TestLargeLineDelta
()
{
var
verbatim
=
string
.
Join
(
"\r\n"
,
Enumerable
.
Repeat
(
"x"
,
1000
));
var
source
=
$@"
class C
{{
public
static
void
Main
()
=>
System
.
Console
.
WriteLine
(
@""
{
verbatim
}
""
);
}}
"
;
var
c
=
CreateCompilationWithMscorlib40AndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
c
.
VerifyPdb
(
"C.Main"
,
@"
<symbols>
<files>
<file id=""1"" name="""" language=""C#"" />
</files>
<methods>
<method containingType=""C"" name=""Main"">
<customDebugInfo>
<using>
<namespace usingCount=""0"" />
</using>
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" startLine=""2"" startColumn=""40"" endLine=""1001"" endColumn=""4"" document=""1"" />
</sequencePoints>
</method>
</methods>
</symbols>
"
,
format
:
DebugInformationFormat
.
PortablePdb
);
// Native PDBs only support spans with line delta <= 127 (7 bit)
// https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h#L4621
c
.
VerifyPdb
(
"C.Main"
,
@"
<symbols>
<files>
<file id=""1"" name="""" language=""C#"" />
</files>
<methods>
<method containingType=""C"" name=""Main"">
<customDebugInfo>
<using>
<namespace usingCount=""0"" />
</using>
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" startLine=""2"" startColumn=""40"" endLine=""129"" endColumn=""4"" document=""1"" />
</sequencePoints>
</method>
</methods>
</symbols>
"
,
format
:
DebugInformationFormat
.
Pdb
);
}
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
ConditionalSkipReason
.
NativePdbRequiresDesktop
)]
[
WorkItem
(
20118
,
"https://github.com/dotnet/roslyn/issues/20118"
)]
public
void
TestLargeStartAndEndColumn_SameLine
()
{
var
spaces
=
new
string
(
' '
,
0x10000
);
var
source
=
$@"
class C
{{
public
static
void
Main
()
=>
{
spaces
}
System
.
Console
.
WriteLine
(
""
{
spaces
}
""
);
}}
"
;
var
c
=
CreateCompilationWithMscorlib40AndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
c
.
VerifyPdb
(
"C.Main"
,
@"
<symbols>
<files>
<file id=""1"" name="""" language=""C#"" />
</files>
<methods>
<method containingType=""C"" name=""Main"">
<customDebugInfo>
<using>
<namespace usingCount=""0"" />
</using>
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" startLine=""5"" startColumn=""65533"" endLine=""5"" endColumn=""65534"" document=""1"" />
</sequencePoints>
</method>
</methods>
</symbols>
"
);
}
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
ConditionalSkipReason
.
NativePdbRequiresDesktop
)]
[
WorkItem
(
20118
,
"https://github.com/dotnet/roslyn/issues/20118"
)]
public
void
TestLargeStartAndEndColumn_DifferentLine
()
{
var
spaces
=
new
string
(
' '
,
0x10000
);
var
source
=
$@"
class C
{{
public
static
void
Main
()
=>
{
spaces
}
System
.
Console
.
WriteLine
(
""
{
spaces
}
""
);
}}
"
;
var
c
=
CreateCompilationWithMscorlib40AndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
c
.
VerifyPdb
(
"C.Main"
,
@"
<symbols>
<files>
<file id=""1"" name="""" language=""C#"" />
</files>
<methods>
<method containingType=""C"" name=""Main"">
<customDebugInfo>
<using>
<namespace usingCount=""0"" />
</using>
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" startLine=""5"" startColumn=""65534"" endLine=""6"" endColumn=""65534"" document=""1"" />
</sequencePoints>
</method>
</methods>
</symbols>
"
);
}
#
endregion
#
region
Method
Bodies
...
...
src/Compilers/Core/Portable/CodeGen/RawSequencePoint.cs
浏览文件 @
7fe84de7
...
...
@@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.CodeGen
/// Represents a sequence point before translation by #line/ExternalSource directives.
/// </summary>
[
DebuggerDisplay
(
"{GetDebuggerDisplay(),nq}"
)]
internal
struct
RawSequencePoint
internal
readonly
struct
RawSequencePoint
{
internal
readonly
SyntaxTree
SyntaxTree
;
internal
readonly
int
ILMarker
;
...
...
src/Compilers/Core/Portable/CodeGen/SequencePointList.cs
浏览文件 @
7fe84de7
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Text
;
using
Microsoft.CodeAnalysis.PooledObjects
;
using
Microsoft.CodeAnalysis.Text
;
using
Roslyn.Utilities
;
using
Cci
=
Microsoft
.
Cci
;
namespace
Microsoft.CodeAnalysis.CodeGen
{
...
...
@@ -22,8 +16,6 @@ namespace Microsoft.CodeAnalysis.CodeGen
/// </summary>
internal
class
SequencePointList
{
internal
const
int
HiddenSequencePointLine
=
0xFEEFEE
;
private
readonly
SyntaxTree
_tree
;
private
readonly
OffsetAndSpan
[]
_points
;
private
SequencePointList
_next
;
// Linked list of all points.
...
...
@@ -142,7 +134,7 @@ private static OffsetAndSpan[] GetSubArray(ArrayBuilder<RawSequencePoint> seqPoi
// a hidden sequence point.
bool
isHidden
=
span
==
RawSequencePoint
.
HiddenSequencePointSpan
;
FileLinePositionSpan
fileLinePositionSpan
=
default
(
FileLinePositionSpan
)
;
FileLinePositionSpan
fileLinePositionSpan
=
default
;
if
(!
isHidden
)
{
fileLinePositionSpan
=
currentTree
.
GetMappedLineSpanAndVisibility
(
span
,
out
isHidden
);
...
...
@@ -161,9 +153,9 @@ private static OffsetAndSpan[] GetSubArray(ArrayBuilder<RawSequencePoint> seqPoi
builder
.
Add
(
new
Cci
.
SequencePoint
(
lastDebugDocument
,
offset
:
offsetAndSpan
.
Offset
,
startLine
:
HiddenSequencePoint
Line
,
startLine
:
Cci
.
SequencePoint
.
Hidden
Line
,
startColumn
:
0
,
endLine
:
HiddenSequencePoint
Line
,
endLine
:
Cci
.
SequencePoint
.
Hidden
Line
,
endColumn
:
0
));
}
}
...
...
@@ -178,13 +170,34 @@ private static OffsetAndSpan[] GetSubArray(ArrayBuilder<RawSequencePoint> seqPoi
if
(
lastDebugDocument
!=
null
)
{
int
startLine
=
(
fileLinePositionSpan
.
StartLinePosition
.
Line
==
-
1
)
?
0
:
fileLinePositionSpan
.
StartLinePosition
.
Line
+
1
;
int
endLine
=
(
fileLinePositionSpan
.
EndLinePosition
.
Line
==
-
1
)
?
0
:
fileLinePositionSpan
.
EndLinePosition
.
Line
+
1
;
int
startColumn
=
fileLinePositionSpan
.
StartLinePosition
.
Character
+
1
;
int
endColumn
=
fileLinePositionSpan
.
EndLinePosition
.
Character
+
1
;
// Trim column number if necessary.
// Column must be in range [0, 0xffff) and end column must be greater than start column if on the same line.
// The Portable PDB specifies 0x10000, but System.Reflection.Metadata reader has an off-by-one error.
// Windows PDBs allow the same range.
const
int
MaxColumn
=
ushort
.
MaxValue
-
1
;
if
(
startColumn
>
MaxColumn
)
{
startColumn
=
(
startLine
==
endLine
)
?
MaxColumn
-
1
:
MaxColumn
;
}
if
(
endColumn
>
MaxColumn
)
{
endColumn
=
MaxColumn
;
}
builder
.
Add
(
new
Cci
.
SequencePoint
(
lastDebugDocument
,
offset
:
offsetAndSpan
.
Offset
,
startLine
:
(
fileLinePositionSpan
.
StartLinePosition
.
Line
==
-
1
)
?
0
:
fileLinePositionSpan
.
StartLinePosition
.
Line
+
1
,
startColumn
:
fileLinePositionSpan
.
StartLinePosition
.
Character
+
1
,
endLine
:
(
fileLinePositionSpan
.
EndLinePosition
.
Line
==
-
1
)
?
0
:
fileLinePositionSpan
.
EndLinePosition
.
Line
+
1
,
endColumn
:
fileLinePositionSpan
.
EndLinePosition
.
Character
+
1
startLine
:
startLine
,
startColumn
:
(
ushort
)
startColumn
,
endLine
:
endLine
,
endColumn
:
(
ushort
)
endColumn
));
}
}
...
...
src/Compilers/Core/Portable/PEWriter/SequencePoint.cs
浏览文件 @
7fe84de7
...
...
@@ -8,22 +8,24 @@ namespace Microsoft.Cci
{
[
SuppressMessage
(
"Performance"
,
"CA1067"
,
Justification
=
"Equality not actually implemented"
)]
[
DebuggerDisplay
(
"{"
+
nameof
(
GetDebuggerDisplay
)
+
"(),nq}"
)]
internal
struct
SequencePoint
internal
readonly
struct
SequencePoint
{
public
const
int
HiddenLine
=
0xfeefee
;
public
readonly
int
Offset
;
public
readonly
int
StartLine
;
public
readonly
int
StartColumn
;
public
readonly
int
EndLine
;
public
readonly
int
EndColumn
;
public
readonly
ushort
StartColumn
;
public
readonly
ushort
EndColumn
;
public
readonly
DebugSourceDocument
Document
;
public
SequencePoint
(
DebugSourceDocument
document
,
int
offset
,
int
startLine
,
in
t
startColumn
,
ushor
t
startColumn
,
int
endLine
,
in
t
endColumn
)
ushor
t
endColumn
)
{
Debug
.
Assert
(
document
!=
null
);
...
...
@@ -35,7 +37,7 @@ internal struct SequencePoint
Document
=
document
;
}
public
bool
IsHidden
=>
StartLine
==
0xfeefe
e
;
public
bool
IsHidden
=>
StartLine
==
HiddenLin
e
;
public
override
int
GetHashCode
()
{
...
...
src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs
浏览文件 @
7fe84de7
...
...
@@ -758,7 +758,7 @@ internal static uint GetOffset(int methodToken, ISymUnmanagedReader symReader, i
{
var
sequencePoints
=
symMethod
.
GetSequencePoints
();
ilOffset
=
atLineNumber
<
0
?
sequencePoints
.
Where
(
sp
=>
sp
.
StartLine
!=
SequencePointList
.
HiddenSequencePoint
Line
).
Select
(
sp
=>
sp
.
Offset
).
FirstOrDefault
()
?
sequencePoints
.
Where
(
sp
=>
sp
.
StartLine
!=
Cci
.
SequencePoint
.
Hidden
Line
).
Select
(
sp
=>
sp
.
Offset
).
FirstOrDefault
()
:
sequencePoints
.
First
(
sp
=>
sp
.
StartLine
==
atLineNumber
).
Offset
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录