mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
Scripts/Commands: Revert e18f7aa, re-add .debug asan outofbounds, move bodies to #ifdef
This commit is contained in:
@@ -81,6 +81,7 @@ public:
|
||||
static std::vector<ChatCommand> debugAsanCommandTable =
|
||||
{
|
||||
{ "memoryleak", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugMemoryLeak, "" },
|
||||
{ "outofbounds", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugOutOfBounds, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> debugCommandTable =
|
||||
{
|
||||
@@ -1704,10 +1705,23 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugOutOfBounds(ChatHandler* handler, CommandArgs* /*args*/)
|
||||
{
|
||||
#ifdef ASAN
|
||||
uint8 stack_array[10] = {};
|
||||
int size = 10;
|
||||
|
||||
handler->PSendSysMessage("Triggered an array out of bounds read at address %p, value %u", stack_array + size, stack_array[size]);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugMemoryLeak(ChatHandler* handler)
|
||||
{
|
||||
#ifdef ASAN
|
||||
uint8* leak = new uint8();
|
||||
handler->PSendSysMessage("Leaked 1 uint8 object at address %p", leak);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user