COM_METHOD CordbProcess::GetContainingObject(CORDB_ADDRESS interiorPointer, ICorDebugObjectValue** ppContainingObject)
{
+ if (!ppContainingObject)
+ return E_POINTER;
+
HRESULT hr = S_OK;
// TODO, databp, I don't know what I am doing, NO_LOCK doesn't sound right
PUBLIC_API_NO_LOCK_BEGIN(this);
+ *ppContainingObject = nullptr;
+
RSLockHolder ch(this->GetStopGoLock());
DebuggerIPCEvent event;
event.GetContainer.interiorPointer = CORDB_ADDRESS_TO_PTR(interiorPointer);
- HRESULT hr = this->SendIPCEvent(&event, sizeof(DebuggerIPCEvent));
+ hr = this->SendIPCEvent(&event, sizeof(DebuggerIPCEvent));
hr = WORST_HR(hr, event.hr);
if (SUCCEEDED(hr))
{
_ASSERTE(event.type == DB_IPCE_GET_CONTAINER_RESULT);
CORDB_ADDRESS containerAddress = PTR_TO_CORDB_ADDRESS(event.GetContainerResult.answer);
- hr = this->GetObject(containerAddress, ppContainingObject);
+ if (containerAddress == 0)
+ {
+ hr = S_FALSE;
+ }
+ else
+ {
+ hr = this->GetObject(containerAddress, ppContainingObject);
+ }
}
PUBLIC_API_END(hr);
//
// Returns
// S_OK - on success
- //
- // TODO: What if the pointer is not an interior pointer?
- // TODO: What are all the possible error exit codes?
+ // S_FALSE - if the given interior pointer is not inside an object
+ // E_POINTER - ppContainingObject is NULL
//
HRESULT GetContainingObject([in] CORDB_ADDRESS interiorPointer, [out] ICorDebugObjectValue** ppContainingObject);
+ //
// Enable or disable the GC notification events. The GC notification events are turned off by default
// They will be delivered through ICorDebugManagedCallback4
//
// fEnable - true to enable the events, false to disable
//
// Returns
- // S_OK - on success
+ // S_OK - on success
+ //
HRESULT EnableGCNotificationEvents(BOOL fEnable);
}