Initial commit.

This commit is contained in:
2019-07-01 14:33:21 +02:00
parent 92a04d779e
commit baa2e0279d
1624 changed files with 3204958 additions and 0 deletions
@@ -0,0 +1,16 @@
#pragma once
#include "../il2cpp-blob.h"
namespace il2cpp
{
namespace utils
{
class BlobReader
{
public:
// internal
static int GetConstantValueFromBlob(Il2CppTypeEnum type, const char *blob, void *value);
};
} /* utils */
} /* il2cpp */
@@ -0,0 +1,92 @@
#pragma once
#include "il2cpp-class-internals.h"
struct Il2CppSequencePoint;
struct Il2CppSequencePointExecutionContext;
struct Il2CppThreadUnwindState;
typedef void(*DebugInfoInitialization)();
typedef void(*ThreadCallback)(void*, uintptr_t);
#ifdef __cplusplus
#include <stdint.h>
#include "os/Thread.h"
#include "os/ThreadLocalValue.h"
namespace il2cpp
{
namespace utils
{
class Debugger
{
public:
static void RegisterSequencePointCheck(volatile uint32_t* check);
static void RegisterMetadata(const Il2CppDebuggerMetadataRegistration *data);
static void SetAgentOptions(const char* options);
static void Init();
static void Start();
static void StartDebuggerThread();
static void PushExecutionContext(Il2CppSequencePointExecutionContext* executionContext);
static void PopExecutionContext();
typedef void(*OnBreakPointHitCallback) (Il2CppSequencePoint* sequencePoint);
typedef void (*OnPausePointHitCallback) ();
static void RegisterCallbacks(OnBreakPointHitCallback breakCallback, OnPausePointHitCallback pauseCallback);
static Il2CppThreadUnwindState* GetThreadStatePointer();
static void SaveThreadContext(Il2CppThreadUnwindState* context, int frameCountAdjust);
static void FreeThreadContext(Il2CppThreadUnwindState* context);
static void OnBreakPointHit(Il2CppSequencePoint *sequencePoint);
static void OnPausePointHit();
static bool IsGlobalBreakpointActive();
static bool GetIsDebuggerAttached();
static void SetIsDebuggerAttached(bool attached);
static bool IsDebuggerThread(os::Thread* thread);
static void AllocateThreadLocalData();
static void FreeThreadLocalData();
static Il2CppSequencePoint* GetSequencePoint(size_t id);
static Il2CppSequencePoint* GetSequencePoints(void* *iter);
static Il2CppSequencePoint* GetSequencePoints(const MethodInfo* method, void**iter);
static void HandleException(Il2CppException *exc, Il2CppSequencePoint *sequencePoint);
static const char** GetTypeSourceFiles(const Il2CppClass *klass, int& count);
static void UserBreak();
static bool IsLoggingEnabled();
static void Log(int level, Il2CppString *category, Il2CppString *message);
static bool IsSequencePointActive(Il2CppSequencePoint *seqPoint);
static bool IsPausePointActive();
static const MethodInfo* GetSequencePointMethod(Il2CppSequencePoint *seqPoint);
static void CheckSequencePoint(Il2CppSequencePointExecutionContext* executionContext, size_t seqPointId);
static void CheckPausePoint();
static void GetMethodExecutionContextInfo(const MethodInfo* method, uint32_t* executionContextInfoCount, const Il2CppMethodExecutionContextInfo **executionContextInfo, const Il2CppMethodHeaderInfo **headerInfo, const Il2CppMethodScope **scopes);
private:
static os::ThreadLocalValue s_IsGlobalBreakpointActive;
static void InitializeMethodToSequencePointMap();
static void InitializeTypeSourceFileMap();
};
}
}
#endif //__cplusplus
typedef struct Il2CppSequencePointExecutionContext
{
const MethodInfo* method;
void** thisArg;
void** params;
void** locals;
size_t currentSequencePoint;
#ifdef __cplusplus
Il2CppSequencePointExecutionContext(const MethodInfo* method, void** thisArg, void** params, void** locals);
~Il2CppSequencePointExecutionContext();
#endif //__cplusplus
} Il2CppSequencePointExecutionContext;
typedef struct Il2CppThreadUnwindState
{
Il2CppSequencePointExecutionContext** executionContexts;
uint32_t frameCount;
uint32_t frameCapacity;
} Il2CppThreadUnwindState;
@@ -0,0 +1,24 @@
#pragma once
#include "il2cpp-api-types.h"
#include "il2cpp-vm-support.h"
#include "os/Mutex.h"
#include <map>
namespace il2cpp
{
namespace utils
{
typedef std::map<Il2CppMethodPointer, const VmMethod*> NativeDelegateMap;
class NativeDelegateMethodCache
{
public:
static const VmMethod* GetNativeDelegate(Il2CppMethodPointer nativeFunctionPointer);
static void AddNativeDelegate(Il2CppMethodPointer nativeFunctionPointer, const VmMethod* managedMethodInfo);
private:
static il2cpp::os::FastMutex m_CacheMutex;
static NativeDelegateMap m_NativeDelegateMethods;
};
} // namespace utils
} // namespace il2cpp
@@ -0,0 +1,20 @@
#pragma once
#include <stdint.h>
#include <vector>
#include "il2cpp-vm-support.h"
namespace il2cpp
{
namespace utils
{
class NativeSymbol
{
public:
#if IL2CPP_ENABLE_NATIVE_STACKTRACES
static void RegisterMethods(const std::vector<MethodDefinitionKey>& managedMethods);
static const VmMethod* GetMethodFromNativeSymbol(Il2CppMethodPointer nativeMethod);
#endif
};
} /* namespace vm */
} /* namespace mono */
@@ -0,0 +1,36 @@
#pragma once
#include "il2cpp-config.h"
#include <string>
namespace il2cpp
{
namespace utils
{
class LIBIL2CPP_CODEGEN_API VmStringUtils
{
public:
static Il2CppChar Utf16ToLower(Il2CppChar c);
static bool CaseSensitiveEquals(Il2CppString* left, const char* right);
static bool CaseSensitiveEquals(const char* left, const char* right);
static bool CaseInsensitiveEquals(Il2CppString* left, const char* right);
static bool CaseInsensitiveEquals(const char* left, const char* right);
struct CaseSensitiveComparer
{
bool operator()(const std::string& left, const std::string& right) const;
bool operator()(const std::string& left, const char* right) const;
bool operator()(const char* left, const std::string& right) const;
bool operator()(const char* left, const char* right) const;
};
struct CaseInsensitiveComparer
{
bool operator()(const std::string& left, const std::string& right) const;
bool operator()(const std::string& left, const char* right) const;
bool operator()(const char* left, const std::string& right) const;
bool operator()(const char* left, const char* right) const;
};
};
} // namespace utils
} // namespace il2cpp