Skip to content

Commit

Permalink
Use the error HR for the exception code for debug attach/detech fatal…
Browse files Browse the repository at this point in the history
… error
  • Loading branch information
curtisman committed Aug 29, 2016
1 parent 60fe018 commit ef065f4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/Common/Exceptions/ReportError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ _NOINLINE void FromDOM_NoScriptScope_fatal_error()
ReportFatalException(NULL, E_UNEXPECTED, EnterScript_FromDOM_NoScriptScope, scenario);
}

_NOINLINE void Debugger_AttachDetach_fatal_error()
_NOINLINE void Debugger_AttachDetach_fatal_error(HRESULT hr)
{
int scenario = 5;
ReportFatalException(NULL, E_UNEXPECTED, Fatal_Debugger_AttachDetach_Failure, scenario);
ReportFatalException(NULL, hr, Fatal_Debugger_AttachDetach_Failure, scenario);
}

_NOINLINE void EntryExitRecord_Corrupted_fatal_error()
Expand Down
2 changes: 1 addition & 1 deletion lib/Common/Exceptions/ReportError.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void LargeHeapBlock_Metadata_Corrupted(
#endif

void FromDOM_NoScriptScope_fatal_error();
void Debugger_AttachDetach_fatal_error();
void Debugger_AttachDetach_fatal_error(HRESULT hr);

#ifndef DISABLE_SEH
// RtlReportException is available on Vista and up, but we cannot use it for OOB release.
Expand Down
2 changes: 1 addition & 1 deletion lib/Common/Exceptions/Throw.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,4 @@ namespace Js {
catch (ex) \
{

#define DEBUGGER_ATTACHDETACH_FATAL_ERROR_IF_FAILED(hr) if (hr != S_OK) Debugger_AttachDetach_fatal_error();
#define DEBUGGER_ATTACHDETACH_FATAL_ERROR_IF_FAILED(hr) if (hr != S_OK) Debugger_AttachDetach_fatal_error(hr);
10 changes: 6 additions & 4 deletions lib/Jsrt/JsrtDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ CHAKRA_API JsDiagStartDebugging(
debugContext->SetHostDebugContext(jsrtDebugManager);
}

if (FAILED(scriptContext->OnDebuggerAttached()))
HRESULT hr;
if (FAILED(hr = scriptContext->OnDebuggerAttached()))
{
Debugger_AttachDetach_fatal_error(); // Inconsistent state, we can't continue from here
Debugger_AttachDetach_fatal_error(hr); // Inconsistent state, we can't continue from here
return JsErrorFatal;
}

Expand Down Expand Up @@ -129,9 +130,10 @@ CHAKRA_API JsDiagStopDebugging(
{
Assert(scriptContext->IsScriptContextInDebugMode());

if (FAILED(scriptContext->OnDebuggerDetached()))
HRESULT hr;
if (FAILED(hr = scriptContext->OnDebuggerDetached()))
{
Debugger_AttachDetach_fatal_error(); // Inconsistent state, we can't continue from here
Debugger_AttachDetach_fatal_error(hr); // Inconsistent state, we can't continue from here
return JsErrorFatal;
}

Expand Down

0 comments on commit ef065f4

Please sign in to comment.