Browse Source

fixed some of the warnings in Hook

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5200 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
21ab4678c0
  1. 18
      src/AddIns/Misc/Profiler/Hook/Profiler.cpp
  2. 4
      src/AddIns/Misc/Profiler/Hook/Profiler.h

18
src/AddIns/Misc/Profiler/Hook/Profiler.cpp

@ -610,21 +610,21 @@ STDMETHODIMP CProfiler::ExceptionCatcherLeave()
STDMETHODIMP CProfiler::JITCompilationStarted(FunctionID functionID, BOOL /*fIsSafeToBlock*/) STDMETHODIMP CProfiler::JITCompilationStarted(FunctionID functionID, BOOL /*fIsSafeToBlock*/)
{ {
WCHAR *name; WCHAR *name;
int nameId = MapFunction(functionID, (const WCHAR **)(&name)); int nameId = (int)MapFunction(functionID, (const WCHAR **)(&name));
for (int i = 0; i < CONSOLE_GROUP_LENGTH; i++) { for (int i = 0; i < CONSOLE_GROUP_LENGTH; i++) {
if (wcsstr(consoleGroupList[i], name) != nullptr) if (wcsstr(consoleGroupList[i], name) != nullptr)
Rewrite(functionID, 0x1, nameId, name); Rewrite(functionID, 0x1, nameId);
} }
for (int i = 0; i < WINFORMS_GROUP_LENGTH; i++) { for (int i = 0; i < WINFORMS_GROUP_LENGTH; i++) {
if (wcsstr(winFormsGroupList[i], name) != nullptr) if (wcsstr(winFormsGroupList[i], name) != nullptr)
Rewrite(functionID, 0x2, nameId, name); Rewrite(functionID, 0x2, nameId);
} }
for (int i = 0; i < WPF_GROUP_LENGTH; i++) { for (int i = 0; i < WPF_GROUP_LENGTH; i++) {
if (wcsstr(wpfGroupList[i], name) != nullptr) if (wcsstr(wpfGroupList[i], name) != nullptr)
Rewrite(functionID, 0x3, nameId, name); Rewrite(functionID, 0x3, nameId);
} }
return S_OK; return S_OK;
@ -647,7 +647,7 @@ const ULONG TINY_HEADER_SIZE = 0x1; /* 1 byte */
const ULONG MAX_CODE_SIZE_TINY = 0x40; /* 64 bytes */ const ULONG MAX_CODE_SIZE_TINY = 0x40; /* 64 bytes */
const WORD DEFAULT_MAX_STACK = 0x8; /* default stack depth in slots */ const WORD DEFAULT_MAX_STACK = 0x8; /* default stack depth in slots */
void CProfiler::Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name) void CProfiler::Rewrite(FunctionID functionID, int type, int nameId)
{ {
ModuleID moduleID; ModuleID moduleID;
mdToken token; mdToken token;
@ -717,7 +717,7 @@ void CProfiler::Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name
newLength = TINY_HEADER_SIZE; newLength = TINY_HEADER_SIZE;
SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId, name); SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId);
// copy old code // copy old code
memcpy(&codeBuf[newLength], memcpy(&codeBuf[newLength],
@ -734,7 +734,7 @@ void CProfiler::Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name
LogString(L"is tiny but exceeds!"); LogString(L"is tiny but exceeds!");
ConvertToFat((byte *)codeBuf, &newLength); ConvertToFat((byte *)codeBuf, &newLength);
SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId, name); SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId);
// copy old code // copy old code
memcpy(&codeBuf[newLength], &header[TINY_HEADER_SIZE], length - TINY_HEADER_SIZE); memcpy(&codeBuf[newLength], &header[TINY_HEADER_SIZE], length - TINY_HEADER_SIZE);
@ -756,7 +756,7 @@ void CProfiler::Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name
int diff = newLength; int diff = newLength;
// insert new code // insert new code
SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId, name); SetInjectionCode(metaData, codeBuf, &newLength, activateCall, loggerCall, deactivateCall, type, nameId);
diff = newLength - diff; diff = newLength - diff;
@ -783,7 +783,7 @@ void CProfiler::Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name
void CProfiler::SetInjectionCode(IMetaDataImport *metaData, byte *buffer, int *size, void CProfiler::SetInjectionCode(IMetaDataImport *metaData, byte *buffer, int *size,
mdMethodDef activateCall, mdMethodDef loggerCall, mdMethodDef deactivateCall, mdMethodDef activateCall, mdMethodDef loggerCall, mdMethodDef deactivateCall,
int type, int nameId, WCHAR *name) int type, int nameId)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;

4
src/AddIns/Misc/Profiler/Hook/Profiler.h

@ -134,10 +134,10 @@ private:
// function to set up our event mask // function to set up our event mask
HRESULT SetEventMask(); HRESULT SetEventMask();
void Rewrite(FunctionID functionID, int type, int nameId, WCHAR *name); void Rewrite(FunctionID functionID, int type, int nameId);
void ConvertToFat(byte *target, int *size); void ConvertToFat(byte *target, int *size);
void FixSEHSections(const COR_ILMETHOD_SECT *sections, int offset); void FixSEHSections(const COR_ILMETHOD_SECT *sections, int offset);
void SetInjectionCode(IMetaDataImport *, byte *buffer, int *size, mdMethodDef activateCall, mdMethodDef loggerCall, mdMethodDef deactivateCall, int type, int nameId, WCHAR *name); void SetInjectionCode(IMetaDataImport *, byte *buffer, int *size, mdMethodDef activateCall, mdMethodDef loggerCall, mdMethodDef deactivateCall, int type, int nameId);
bool CreateMethod(IMetaDataEmit *, const WCHAR *, PCCOR_SIGNATURE, mdMethodDef *, mdToken); bool CreateMethod(IMetaDataEmit *, const WCHAR *, PCCOR_SIGNATURE, mdMethodDef *, mdToken);
int InitializeCommunication(); int InitializeCommunication();
}; };

Loading…
Cancel
Save