Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
a7052ac7
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a7052ac7
编写于
6月 16, 2022
作者:
T
Thays Grazia
提交者:
GitHub
6月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)
上级
205b7fff
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
64 deletion
+29
-64
src/libraries/sendtohelix-wasm.targets
src/libraries/sendtohelix-wasm.targets
+1
-0
src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs
src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs
+2
-1
src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxExecutionContext.cs
...gger/BrowserDebugProxy/Firefox/FirefoxExecutionContext.cs
+1
-1
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
+25
-62
未找到文件。
src/libraries/sendtohelix-wasm.targets
浏览文件 @
a7052ac7
...
...
@@ -3,6 +3,7 @@
<_workItemTimeout Condition="'$(Scenario)' == 'BuildWasmApps' and '$(_workItemTimeout)' == ''">01:30:00</_workItemTimeout>
<_workItemTimeout Condition="'$(NeedsToBuildWasmAppsOnHelix)' == 'true'">01:00:00</_workItemTimeout>
<_workItemTimeout Condition="'$(Scenario)' == 'WasmDebuggerTests'">01:00:00</_workItemTimeout>
<_workItemTimeout Condition="'$(Scenario)' == 'WasmDebuggerTests' and '$(BrowserHost)' == 'windows'">01:30:00</_workItemTimeout>
<_workItemTimeout Condition="'$(Scenario)' == 'WasmTestOnBrowser' and '$(BrowserHost)' == 'windows'">00:45:00</_workItemTimeout>
<IsWasmDebuggerTests Condition="'$(Scenario)' == 'WasmDebuggerTests'">true</IsWasmDebuggerTests>
...
...
src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs
浏览文件 @
a7052ac7
...
...
@@ -401,11 +401,12 @@ internal enum PauseOnExceptionsKind
internal
class
ExecutionContext
{
public
ExecutionContext
(
MonoSDBHelper
sdbAgent
,
int
id
,
object
auxData
)
public
ExecutionContext
(
MonoSDBHelper
sdbAgent
,
int
id
,
object
auxData
,
PauseOnExceptionsKind
pauseOnExceptions
)
{
Id
=
id
;
AuxData
=
auxData
;
SdbAgent
=
sdbAgent
;
PauseOnExceptions
=
pauseOnExceptions
;
}
public
string
DebugId
{
get
;
set
;
}
...
...
src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxExecutionContext.cs
浏览文件 @
a7052ac7
...
...
@@ -14,7 +14,7 @@ internal sealed class FirefoxExecutionContext : ExecutionContext
public
string
?
GlobalName
{
get
;
set
;
}
public
Result
LastDebuggerAgentBufferReceived
{
get
;
set
;
}
public
FirefoxExecutionContext
(
MonoSDBHelper
sdbAgent
,
int
id
,
string
actorName
)
:
base
(
sdbAgent
,
id
,
actorName
)
public
FirefoxExecutionContext
(
MonoSDBHelper
sdbAgent
,
int
id
,
string
actorName
)
:
base
(
sdbAgent
,
id
,
actorName
,
PauseOnExceptionsKind
.
Unset
)
{
ActorName
=
actorName
;
}
...
...
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
浏览文件 @
a7052ac7
...
...
@@ -21,14 +21,14 @@ internal class MonoProxy : DevToolsProxy
private
IList
<
string
>
urlSymbolServerList
;
private
HashSet
<
SessionId
>
sessions
=
new
HashSet
<
SessionId
>();
protected
Dictionary
<
SessionId
,
ExecutionContext
>
contexts
=
new
Dictionary
<
SessionId
,
ExecutionContext
>();
private
const
string
sPauseOnUncaught
=
"pause_on_uncaught"
;
private
const
string
sPauseOnCaught
=
"pause_on_caught"
;
public
static
HttpClient
HttpClient
=>
new
HttpClient
();
// index of the runtime in a same JS page/process
public
int
RuntimeId
{
get
;
private
init
;
}
public
bool
JustMyCode
{
get
;
private
set
;
}
private
PauseOnExceptionsKind
_defaultPauseOnExceptions
{
get
;
set
;
}
protected
readonly
ProxyOptions
_options
;
public
MonoProxy
(
ILogger
logger
,
IList
<
string
>
urlSymbolServerList
,
int
runtimeId
=
0
,
string
loggerId
=
""
,
ProxyOptions
options
=
null
)
:
base
(
logger
,
loggerId
)
...
...
@@ -36,6 +36,7 @@ public MonoProxy(ILogger logger, IList<string> urlSymbolServerList, int runtimeI
this
.
urlSymbolServerList
=
urlSymbolServerList
??
new
List
<
string
>();
RuntimeId
=
runtimeId
;
_options
=
options
;
_defaultPauseOnExceptions
=
PauseOnExceptionsKind
.
Unset
;
}
internal
ExecutionContext
GetContext
(
SessionId
sessionId
)
...
...
@@ -160,55 +161,18 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par
bool
?
is_default
=
aux_data
[
"isDefault"
]?.
Value
<
bool
>();
if
(
is_default
==
true
)
{
await
OnDefaultContext
(
sessionId
,
new
ExecutionContext
(
new
MonoSDBHelper
(
this
,
logger
,
sessionId
),
id
,
aux_data
),
token
);
await
OnDefaultContext
(
sessionId
,
new
ExecutionContext
(
new
MonoSDBHelper
(
this
,
logger
,
sessionId
),
id
,
aux_data
,
_defaultPauseOnExceptions
),
token
);
}
}
return
true
;
}
case
"Runtime.exceptionThrown"
:
{
// Don't process events from sessions we aren't tracking
if
(!
contexts
.
TryGetValue
(
sessionId
,
out
ExecutionContext
context
))
return
false
;
if
(!
context
.
IsRuntimeReady
)
{
string
exceptionError
=
args
?[
"exceptionDetails"
]?[
"exception"
]?[
"value"
]?.
Value
<
string
>();
if
(
exceptionError
==
sPauseOnUncaught
||
exceptionError
==
sPauseOnCaught
)
return
true
;
}
break
;
}
case
"Debugger.paused"
:
{
// Don't process events from sessions we aren't tracking
if
(!
contexts
.
TryGetValue
(
sessionId
,
out
ExecutionContext
context
))
if
(!
contexts
.
ContainsKey
(
sessionId
))
return
false
;
if
(!
context
.
IsRuntimeReady
)
{
string
reason
=
args
?[
"reason"
]?.
Value
<
string
>();
if
(
reason
==
"exception"
)
{
string
exceptionError
=
args
?[
"data"
]?[
"value"
]?.
Value
<
string
>();
if
(
exceptionError
==
sPauseOnUncaught
)
{
await
SendResume
(
sessionId
,
token
);
if
(
context
.
PauseOnExceptions
==
PauseOnExceptionsKind
.
Unset
)
context
.
PauseOnExceptions
=
PauseOnExceptionsKind
.
Uncaught
;
return
true
;
}
if
(
exceptionError
==
sPauseOnCaught
)
{
await
SendResume
(
sessionId
,
token
);
context
.
PauseOnExceptions
=
PauseOnExceptionsKind
.
All
;
return
true
;
}
}
}
//TODO figure out how to stich out more frames and, in particular what happens when real wasm is on the stack
string
top_func
=
args
?[
"callFrames"
]?[
0
]?[
"functionName"
]?.
Value
<
string
>();
switch
(
top_func
)
{
...
...
@@ -291,6 +255,13 @@ protected async Task<bool> IsRuntimeAlreadyReadyAlready(SessionId sessionId, Can
Result
res
=
await
SendMonoCommand
(
sessionId
,
MonoCommands
.
IsRuntimeReady
(
RuntimeId
),
token
);
return
res
.
Value
?[
"result"
]?[
"value"
]?.
Value
<
bool
>()
??
false
;
}
private
static
PauseOnExceptionsKind
GetPauseOnExceptionsStatusFromString
(
string
state
)
{
PauseOnExceptionsKind
pauseOnException
;
if
(
Enum
.
TryParse
(
state
,
true
,
out
pauseOnException
))
return
pauseOnException
;
return
PauseOnExceptionsKind
.
Unset
;
}
protected
override
async
Task
<
bool
>
AcceptCommand
(
MessageId
id
,
JObject
parms
,
CancellationToken
token
)
{
...
...
@@ -302,7 +273,16 @@ protected override async Task<bool> AcceptCommand(MessageId id, JObject parms, C
await
AttachToTarget
(
id
,
token
);
if
(!
contexts
.
TryGetValue
(
id
,
out
ExecutionContext
context
))
{
if
(
method
==
"Debugger.setPauseOnExceptions"
)
{
string
state
=
args
[
"state"
].
Value
<
string
>();
var
pauseOnException
=
GetPauseOnExceptionsStatusFromString
(
state
);
if
(
pauseOnException
!=
PauseOnExceptionsKind
.
Unset
)
_defaultPauseOnExceptions
=
pauseOnException
;
}
return
false
;
}
switch
(
method
)
{
...
...
@@ -513,13 +493,9 @@ protected override async Task<bool> AcceptCommand(MessageId id, JObject parms, C
case
"Debugger.setPauseOnExceptions"
:
{
string
state
=
args
[
"state"
].
Value
<
string
>();
context
.
PauseOnExceptions
=
state
switch
{
"all"
=>
PauseOnExceptionsKind
.
All
,
"uncaught"
=>
PauseOnExceptionsKind
.
Uncaught
,
"none"
=>
PauseOnExceptionsKind
.
None
,
_
=>
PauseOnExceptionsKind
.
Unset
};
var
pauseOnException
=
GetPauseOnExceptionsStatusFromString
(
state
);
if
(
pauseOnException
!=
PauseOnExceptionsKind
.
Unset
)
context
.
PauseOnExceptions
=
pauseOnException
;
if
(
context
.
IsRuntimeReady
)
await
context
.
SdbAgent
.
EnableExceptions
(
context
.
PauseOnExceptions
,
token
);
...
...
@@ -1784,23 +1760,10 @@ private async Task AttachToTarget(SessionId sessionId, CancellationToken token)
// see https://github.com/mono/mono/issues/19549 for background
if
(
sessions
.
Add
(
sessionId
))
{
string
checkUncaughtExceptions
=
string
.
Empty
;
string
checkCaughtExceptions
=
string
.
Empty
;
//we only need this check if it's a non-vs debugging
if
(
sessionId
==
SessionId
.
Null
)
{
if
(!
contexts
.
TryGetValue
(
sessionId
,
out
ExecutionContext
context
)
||
context
.
PauseOnExceptions
==
PauseOnExceptionsKind
.
Unset
)
{
checkUncaughtExceptions
=
$"throw \"
{
sPauseOnUncaught
}
\";"
;
checkCaughtExceptions
=
$"try
{{
throw
\
"{sPauseOnCaught}\";}} catch {{}}"
;
}
}
await
SendMonoCommand
(
sessionId
,
new
MonoCommands
(
"globalThis.dotnetDebugger = true"
),
token
);
Result
res
=
await
SendCommand
(
sessionId
,
"Page.addScriptToEvaluateOnNewDocument"
,
JObject
.
FromObject
(
new
{
source
=
$"globalThis.dotnetDebugger = true; delete navigator.constructor.prototype.webdriver;
{
checkCaughtExceptions
}
{
checkUncaughtExceptions
}
"
}),
JObject
.
FromObject
(
new
{
source
=
$"globalThis.dotnetDebugger = true; delete navigator.constructor.prototype.webdriver;"
}),
token
);
if
(
sessionId
!=
SessionId
.
Null
&&
!
res
.
IsOk
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录