Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Au <andrewau@microsoft.com>2017-06-16 02:04:41 +0300
committerAndrew Au <andrewau@microsoft.com>2017-06-16 02:04:41 +0300
commit98c8b4a802146172aa1955467c2fbe6bb3760b69 (patch)
tree8b66f1403783120093523271ebe4f16adea0ee38
parent34b00937c6c83185d3f3512df2b71d777263f3b4 (diff)
Refactoring
[tfs-changeset: 1661894]
-rw-r--r--src/Native/Runtime/Debug.h3
-rw-r--r--src/Native/Runtime/DebuggerHook.cpp44
2 files changed, 24 insertions, 23 deletions
diff --git a/src/Native/Runtime/Debug.h b/src/Native/Runtime/Debug.h
index 48156fc19..3ee84a7d3 100644
--- a/src/Native/Runtime/Debug.h
+++ b/src/Native/Runtime/Debug.h
@@ -25,6 +25,9 @@ struct GcProtectionMessage
uint64_t bufferAddress;
};
+/**
+ * This structure represents a request from the debugger to perform a GC protection related work.
+ */
struct GcProtectionRequest
{
DebuggerGcProtectionRequestKind kind;
diff --git a/src/Native/Runtime/DebuggerHook.cpp b/src/Native/Runtime/DebuggerHook.cpp
index 5c0708c41..87370dbaa 100644
--- a/src/Native/Runtime/DebuggerHook.cpp
+++ b/src/Native/Runtime/DebuggerHook.cpp
@@ -58,21 +58,27 @@ GVAL_IMPL_INIT(UInt32, g_numGcProtectionRequests, 0);
for (uint32_t i = 0; i < g_numGcProtectionRequests; i++)
{
- if (requests[i].kind == DebuggerGcProtectionRequestKind::EnsureConservativeReporting)
- {
- EnsureConservativeReporting(requests + i);
- }
- else if (requests[i].kind == DebuggerGcProtectionRequestKind::RemoveConservativeReporting)
- {
- RemoveConservativeReporting(requests + i);
- }
- else if (requests[i].kind == DebuggerGcProtectionRequestKind::EnsureHandle)
- {
- EnsureHandle(requests + i);
- }
- else if (requests[i].kind == DebuggerGcProtectionRequestKind::RemoveHandle)
+ GcProtectionRequest* request = requests + i;
+ switch(request->kind)
{
- RemoveHandle(requests + i);
+ case DebuggerGcProtectionRequestKind::EnsureConservativeReporting:
+ EnsureConservativeReporting(request);
+ break;
+
+ case DebuggerGcProtectionRequestKind::RemoveConservativeReporting:
+ RemoveConservativeReporting(request);
+ break;
+
+ case DebuggerGcProtectionRequestKind::EnsureHandle:
+ EnsureHandle(request);
+ break;
+
+ case DebuggerGcProtectionRequestKind::RemoveHandle:
+ RemoveHandle(request);
+ break;
+
+ default:
+ assert("Debugger is providing an invalid request kind." && false);
}
}
@@ -164,15 +170,7 @@ GVAL_IMPL_INIT(UInt32, g_numGcProtectionRequests, 0);
}
else
{
- int handleType;
- switch (request->type)
- {
- case 1: handleType = 2 /* == HNDTYPE_STRONG */; break;
- case 2: handleType = 1 /* == HNDTYPE_WEAK_LONG */; break;
- default:
- assert("Debugger is passing in a wrong handle type" && false);
- handleType = 2 /* == HNDTYPE_STRONG */;
- }
+ int handleType = (int)request->type;
void* handle = RedhawkGCInterface::CreateTypedHandle((void*)request->address, handleType);
s_debuggerOwnedHandles->handle = handle;
s_debuggerOwnedHandles->identifier = request->identifier;