mirror of
https://github.com/HyperDbg/HyperDbg.git
synced 2026-07-10 01:29:59 +00:00
commit
5462d69dd1
20 changed files with 2476 additions and 1131 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.17.0.0] - 2025-11-10
|
||||
New release of the HyperDbg Debugger. All credit for this release goes to [@xmaple555](https://github.com/xmaple555).
|
||||
|
||||
### Added
|
||||
- Added 1D and 2D arrays (multidimensional arrays) in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#multidimensional-array))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
|
||||
- Added compound assignments in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#compound-assignment))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
|
||||
- Added multiple assignments in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#multiple-assignment))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
|
||||
|
||||
### Changed
|
||||
- Fix bugs for interpreting 'db_pa, 'dd_pa', 'eb_pa', and 'ed_pa' keywords in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations#keywords))([link](https://github.com/HyperDbg/HyperDbg/pull/507))
|
||||
- Fix variable types in the script engine ([link](https://github.com/HyperDbg/HyperDbg/commit/43b0245fa11b5c73ce4cd21d8b8787b86a05f89d))
|
||||
- Fix and update array index for boolean expressions in the script engine ([link](https://github.com/HyperDbg/HyperDbg/commit/ba2cec3c12c3ff45ddc0004051884983ff62a0b3))
|
||||
|
||||
## [0.16.0.0] - 2025-09-08
|
||||
New release of the HyperDbg Debugger.
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ object ScriptConstantTypes {
|
|||
|
||||
object ScriptEvalFunc {
|
||||
object ScriptOperators extends ChiselEnum {
|
||||
val sFuncUndefined, sFuncInc, sFuncDec, sFuncReference, sFuncDereference, sFuncOr, sFuncXor, sFuncAnd, sFuncAsr, sFuncAsl, sFuncAdd, sFuncSub, sFuncMul, sFuncDiv, sFuncMod, sFuncGt, sFuncLt, sFuncEgt, sFuncElt, sFuncEqual, sFuncNeq, sFuncJmp, sFuncJz, sFuncJnz, sFuncMov, sFuncStart_of_do_while, sFuncStart_of_do_while_commands, sFuncEnd_of_do_while, sFuncStart_of_for, sFuncFor_inc_dec, sFuncStart_of_for_ommands, sFuncEnd_of_if, sFuncIgnore_lvalue, sFuncPush, sFuncPop, sFuncCall, sFuncRet, sFuncPrint, sFuncFormats, sFuncEvent_enable, sFuncEvent_disable, sFuncEvent_clear, sFuncTest_statement, sFuncSpinlock_lock, sFuncSpinlock_unlock, sFuncEvent_sc, sFuncMicrosleep, sFuncPrintf, sFuncPause, sFuncFlush, sFuncEvent_trace_step, sFuncEvent_trace_step_in, sFuncEvent_trace_step_out, sFuncEvent_trace_instrumentation_step, sFuncEvent_trace_instrumentation_step_in, sFuncRdtsc, sFuncRdtscp, sFuncSpinlock_lock_custom_wait, sFuncEvent_inject, sFuncPoi, sFuncDb, sFuncDd, sFuncDw, sFuncDq, sFuncNeg, sFuncHi, sFuncLow, sFuncNot, sFuncCheck_address, sFuncDisassemble_len, sFuncDisassemble_len32, sFuncDisassemble_len64, sFuncInterlocked_increment, sFuncInterlocked_decrement, sFuncPhysical_to_virtual, sFuncVirtual_to_physical, sFuncPoi_pa, sFuncHi_pa, sFuncLow_pa, sFuncDb_pa, sFuncDd_pa, sFuncDw_pa, sFuncDq_pa, sFuncEd, sFuncEb, sFuncEq, sFuncInterlocked_exchange, sFuncInterlocked_exchange_add, sFuncEb_pa, sFuncEd_pa, sFuncEq_pa, sFuncInterlocked_compare_exchange, sFuncStrlen, sFuncStrcmp, sFuncMemcmp, sFuncStrncmp, sFuncWcslen, sFuncWcscmp, sFuncEvent_inject_error_code, sFuncMemcpy, sFuncMemcpy_pa, sFuncWcsncmp = Value
|
||||
val sFuncUndefined, sFuncInc, sFuncDec, sFuncReference, sFuncOr, sFuncXor, sFuncAnd, sFuncAsr, sFuncAsl, sFuncAdd, sFuncSub, sFuncMul, sFuncDiv, sFuncMod, sFuncGt, sFuncLt, sFuncEgt, sFuncElt, sFuncEqual, sFuncNeq, sFuncJmp, sFuncJz, sFuncJnz, sFuncMov, sFuncStart_of_do_while, sFuncStart_of_do_while_commands, sFuncEnd_of_do_while, sFuncStart_of_for, sFuncFor_inc_dec, sFuncStart_of_for_ommands, sFuncEnd_of_if, sFuncIgnore_lvalue, sFuncPush, sFuncPop, sFuncCall, sFuncRet, sFuncPrint, sFuncFormats, sFuncEvent_enable, sFuncEvent_disable, sFuncEvent_clear, sFuncTest_statement, sFuncSpinlock_lock, sFuncSpinlock_unlock, sFuncEvent_sc, sFuncMicrosleep, sFuncPrintf, sFuncPause, sFuncFlush, sFuncEvent_trace_step, sFuncEvent_trace_step_in, sFuncEvent_trace_step_out, sFuncEvent_trace_instrumentation_step, sFuncEvent_trace_instrumentation_step_in, sFuncRdtsc, sFuncRdtscp, sFuncSpinlock_lock_custom_wait, sFuncEvent_inject, sFuncPoi, sFuncDb, sFuncDd, sFuncDw, sFuncDq, sFuncNeg, sFuncHi, sFuncLow, sFuncNot, sFuncCheck_address, sFuncDisassemble_len, sFuncDisassemble_len32, sFuncDisassemble_len64, sFuncInterlocked_increment, sFuncInterlocked_decrement, sFuncPhysical_to_virtual, sFuncVirtual_to_physical, sFuncPoi_pa, sFuncHi_pa, sFuncLow_pa, sFuncDb_pa, sFuncDd_pa, sFuncDw_pa, sFuncDq_pa, sFuncEd, sFuncEb, sFuncEq, sFuncInterlocked_exchange, sFuncInterlocked_exchange_add, sFuncEb_pa, sFuncEd_pa, sFuncEq_pa, sFuncInterlocked_compare_exchange, sFuncStrlen, sFuncStrcmp, sFuncMemcmp, sFuncStrncmp, sFuncWcslen, sFuncWcscmp, sFuncEvent_inject_error_code, sFuncMemcpy, sFuncMemcpy_pa, sFuncWcsncmp = Value
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
//////////////////////////////////////////////////
|
||||
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 16
|
||||
#define VERSION_MINOR 17
|
||||
#define VERSION_PATCH 0
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ typedef struct ACTION_BUFFER {
|
|||
#define SYMBOL_STACK_INDEX_TYPE 15
|
||||
#define SYMBOL_STACK_BASE_INDEX_TYPE 16
|
||||
#define SYMBOL_RETURN_VALUE_TYPE 17
|
||||
#define SYMBOL_REFERENCE_LOCAL_ID_TYPE 18
|
||||
#define SYMBOL_REFERENCE_TEMP_TYPE 19
|
||||
#define SYMBOL_DEREFERENCE_LOCAL_ID_TYPE 20
|
||||
#define SYMBOL_DEREFERENCE_TEMP_TYPE 21
|
||||
|
||||
static const char *const SymbolTypeNames[] = {
|
||||
"SYMBOL_UNDEFINED",
|
||||
|
|
@ -77,7 +81,11 @@ static const char *const SymbolTypeNames[] = {
|
|||
"SYMBOL_FUNCTION_PARAMETER_TYPE",
|
||||
"SYMBOL_STACK_INDEX_TYPE",
|
||||
"SYMBOL_STACK_BASE_INDEX_TYPE",
|
||||
"SYMBOL_RETURN_VALUE_TYPE"
|
||||
"SYMBOL_RETURN_VALUE_TYPE",
|
||||
"SYMBOL_REFERENCE_LOCAL_ID_TYPE",
|
||||
"SYMBOL_REFERENCE_TEMP_TYPE",
|
||||
"SYMBOL_DEREFERENCE_LOCAL_ID_TYPE",
|
||||
"SYMBOL_DEREFERENCE_TEMP_TYPE"
|
||||
};
|
||||
|
||||
#define SYMBOL_MEM_VALID_CHECK_MASK (1 << 31)
|
||||
|
|
@ -90,111 +98,109 @@ static const char *const SymbolTypeNames[] = {
|
|||
#define FUNC_INC 1
|
||||
#define FUNC_DEC 2
|
||||
#define FUNC_REFERENCE 3
|
||||
#define FUNC_DEREFERENCE 4
|
||||
#define FUNC_OR 5
|
||||
#define FUNC_XOR 6
|
||||
#define FUNC_AND 7
|
||||
#define FUNC_ASR 8
|
||||
#define FUNC_ASL 9
|
||||
#define FUNC_ADD 10
|
||||
#define FUNC_SUB 11
|
||||
#define FUNC_MUL 12
|
||||
#define FUNC_DIV 13
|
||||
#define FUNC_MOD 14
|
||||
#define FUNC_GT 15
|
||||
#define FUNC_LT 16
|
||||
#define FUNC_EGT 17
|
||||
#define FUNC_ELT 18
|
||||
#define FUNC_EQUAL 19
|
||||
#define FUNC_NEQ 20
|
||||
#define FUNC_JMP 21
|
||||
#define FUNC_JZ 22
|
||||
#define FUNC_JNZ 23
|
||||
#define FUNC_MOV 24
|
||||
#define FUNC_START_OF_DO_WHILE 25
|
||||
#define FUNC_START_OF_DO_WHILE_COMMANDS 26
|
||||
#define FUNC_END_OF_DO_WHILE 27
|
||||
#define FUNC_START_OF_FOR 28
|
||||
#define FUNC_FOR_INC_DEC 29
|
||||
#define FUNC_START_OF_FOR_OMMANDS 30
|
||||
#define FUNC_END_OF_IF 31
|
||||
#define FUNC_IGNORE_LVALUE 32
|
||||
#define FUNC_PUSH 33
|
||||
#define FUNC_POP 34
|
||||
#define FUNC_CALL 35
|
||||
#define FUNC_RET 36
|
||||
#define FUNC_PRINT 37
|
||||
#define FUNC_FORMATS 38
|
||||
#define FUNC_EVENT_ENABLE 39
|
||||
#define FUNC_EVENT_DISABLE 40
|
||||
#define FUNC_EVENT_CLEAR 41
|
||||
#define FUNC_TEST_STATEMENT 42
|
||||
#define FUNC_SPINLOCK_LOCK 43
|
||||
#define FUNC_SPINLOCK_UNLOCK 44
|
||||
#define FUNC_EVENT_SC 45
|
||||
#define FUNC_MICROSLEEP 46
|
||||
#define FUNC_PRINTF 47
|
||||
#define FUNC_PAUSE 48
|
||||
#define FUNC_FLUSH 49
|
||||
#define FUNC_EVENT_TRACE_STEP 50
|
||||
#define FUNC_EVENT_TRACE_STEP_IN 51
|
||||
#define FUNC_EVENT_TRACE_STEP_OUT 52
|
||||
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP 53
|
||||
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP_IN 54
|
||||
#define FUNC_RDTSC 55
|
||||
#define FUNC_RDTSCP 56
|
||||
#define FUNC_SPINLOCK_LOCK_CUSTOM_WAIT 57
|
||||
#define FUNC_EVENT_INJECT 58
|
||||
#define FUNC_POI 59
|
||||
#define FUNC_DB 60
|
||||
#define FUNC_DD 61
|
||||
#define FUNC_DW 62
|
||||
#define FUNC_DQ 63
|
||||
#define FUNC_NEG 64
|
||||
#define FUNC_HI 65
|
||||
#define FUNC_LOW 66
|
||||
#define FUNC_NOT 67
|
||||
#define FUNC_CHECK_ADDRESS 68
|
||||
#define FUNC_DISASSEMBLE_LEN 69
|
||||
#define FUNC_DISASSEMBLE_LEN32 70
|
||||
#define FUNC_DISASSEMBLE_LEN64 71
|
||||
#define FUNC_INTERLOCKED_INCREMENT 72
|
||||
#define FUNC_INTERLOCKED_DECREMENT 73
|
||||
#define FUNC_PHYSICAL_TO_VIRTUAL 74
|
||||
#define FUNC_VIRTUAL_TO_PHYSICAL 75
|
||||
#define FUNC_POI_PA 76
|
||||
#define FUNC_HI_PA 77
|
||||
#define FUNC_LOW_PA 78
|
||||
#define FUNC_DB_PA 79
|
||||
#define FUNC_DD_PA 80
|
||||
#define FUNC_DW_PA 81
|
||||
#define FUNC_DQ_PA 82
|
||||
#define FUNC_ED 83
|
||||
#define FUNC_EB 84
|
||||
#define FUNC_EQ 85
|
||||
#define FUNC_INTERLOCKED_EXCHANGE 86
|
||||
#define FUNC_INTERLOCKED_EXCHANGE_ADD 87
|
||||
#define FUNC_EB_PA 88
|
||||
#define FUNC_ED_PA 89
|
||||
#define FUNC_EQ_PA 90
|
||||
#define FUNC_INTERLOCKED_COMPARE_EXCHANGE 91
|
||||
#define FUNC_STRLEN 92
|
||||
#define FUNC_STRCMP 93
|
||||
#define FUNC_MEMCMP 94
|
||||
#define FUNC_STRNCMP 95
|
||||
#define FUNC_WCSLEN 96
|
||||
#define FUNC_WCSCMP 97
|
||||
#define FUNC_EVENT_INJECT_ERROR_CODE 98
|
||||
#define FUNC_MEMCPY 99
|
||||
#define FUNC_MEMCPY_PA 100
|
||||
#define FUNC_WCSNCMP 101
|
||||
#define FUNC_OR 4
|
||||
#define FUNC_XOR 5
|
||||
#define FUNC_AND 6
|
||||
#define FUNC_ASR 7
|
||||
#define FUNC_ASL 8
|
||||
#define FUNC_ADD 9
|
||||
#define FUNC_SUB 10
|
||||
#define FUNC_MUL 11
|
||||
#define FUNC_DIV 12
|
||||
#define FUNC_MOD 13
|
||||
#define FUNC_GT 14
|
||||
#define FUNC_LT 15
|
||||
#define FUNC_EGT 16
|
||||
#define FUNC_ELT 17
|
||||
#define FUNC_EQUAL 18
|
||||
#define FUNC_NEQ 19
|
||||
#define FUNC_JMP 20
|
||||
#define FUNC_JZ 21
|
||||
#define FUNC_JNZ 22
|
||||
#define FUNC_MOV 23
|
||||
#define FUNC_START_OF_DO_WHILE 24
|
||||
#define FUNC_START_OF_DO_WHILE_COMMANDS 25
|
||||
#define FUNC_END_OF_DO_WHILE 26
|
||||
#define FUNC_START_OF_FOR 27
|
||||
#define FUNC_FOR_INC_DEC 28
|
||||
#define FUNC_START_OF_FOR_OMMANDS 29
|
||||
#define FUNC_END_OF_IF 30
|
||||
#define FUNC_IGNORE_LVALUE 31
|
||||
#define FUNC_PUSH 32
|
||||
#define FUNC_POP 33
|
||||
#define FUNC_CALL 34
|
||||
#define FUNC_RET 35
|
||||
#define FUNC_PRINT 36
|
||||
#define FUNC_FORMATS 37
|
||||
#define FUNC_EVENT_ENABLE 38
|
||||
#define FUNC_EVENT_DISABLE 39
|
||||
#define FUNC_EVENT_CLEAR 40
|
||||
#define FUNC_TEST_STATEMENT 41
|
||||
#define FUNC_SPINLOCK_LOCK 42
|
||||
#define FUNC_SPINLOCK_UNLOCK 43
|
||||
#define FUNC_EVENT_SC 44
|
||||
#define FUNC_MICROSLEEP 45
|
||||
#define FUNC_PRINTF 46
|
||||
#define FUNC_PAUSE 47
|
||||
#define FUNC_FLUSH 48
|
||||
#define FUNC_EVENT_TRACE_STEP 49
|
||||
#define FUNC_EVENT_TRACE_STEP_IN 50
|
||||
#define FUNC_EVENT_TRACE_STEP_OUT 51
|
||||
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP 52
|
||||
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP_IN 53
|
||||
#define FUNC_RDTSC 54
|
||||
#define FUNC_RDTSCP 55
|
||||
#define FUNC_SPINLOCK_LOCK_CUSTOM_WAIT 56
|
||||
#define FUNC_EVENT_INJECT 57
|
||||
#define FUNC_POI 58
|
||||
#define FUNC_DB 59
|
||||
#define FUNC_DD 60
|
||||
#define FUNC_DW 61
|
||||
#define FUNC_DQ 62
|
||||
#define FUNC_NEG 63
|
||||
#define FUNC_HI 64
|
||||
#define FUNC_LOW 65
|
||||
#define FUNC_NOT 66
|
||||
#define FUNC_CHECK_ADDRESS 67
|
||||
#define FUNC_DISASSEMBLE_LEN 68
|
||||
#define FUNC_DISASSEMBLE_LEN32 69
|
||||
#define FUNC_DISASSEMBLE_LEN64 70
|
||||
#define FUNC_INTERLOCKED_INCREMENT 71
|
||||
#define FUNC_INTERLOCKED_DECREMENT 72
|
||||
#define FUNC_PHYSICAL_TO_VIRTUAL 73
|
||||
#define FUNC_VIRTUAL_TO_PHYSICAL 74
|
||||
#define FUNC_POI_PA 75
|
||||
#define FUNC_HI_PA 76
|
||||
#define FUNC_LOW_PA 77
|
||||
#define FUNC_DB_PA 78
|
||||
#define FUNC_DD_PA 79
|
||||
#define FUNC_DW_PA 80
|
||||
#define FUNC_DQ_PA 81
|
||||
#define FUNC_ED 82
|
||||
#define FUNC_EB 83
|
||||
#define FUNC_EQ 84
|
||||
#define FUNC_INTERLOCKED_EXCHANGE 85
|
||||
#define FUNC_INTERLOCKED_EXCHANGE_ADD 86
|
||||
#define FUNC_EB_PA 87
|
||||
#define FUNC_ED_PA 88
|
||||
#define FUNC_EQ_PA 89
|
||||
#define FUNC_INTERLOCKED_COMPARE_EXCHANGE 90
|
||||
#define FUNC_STRLEN 91
|
||||
#define FUNC_STRCMP 92
|
||||
#define FUNC_MEMCMP 93
|
||||
#define FUNC_STRNCMP 94
|
||||
#define FUNC_WCSLEN 95
|
||||
#define FUNC_WCSCMP 96
|
||||
#define FUNC_EVENT_INJECT_ERROR_CODE 97
|
||||
#define FUNC_MEMCPY 98
|
||||
#define FUNC_MEMCPY_PA 99
|
||||
#define FUNC_WCSNCMP 100
|
||||
|
||||
static const char *const FunctionNames[] = {
|
||||
"FUNC_UNDEFINED",
|
||||
"FUNC_INC",
|
||||
"FUNC_DEC",
|
||||
"FUNC_REFERENCE",
|
||||
"FUNC_DEREFERENCE",
|
||||
"FUNC_OR",
|
||||
"FUNC_XOR",
|
||||
"FUNC_AND",
|
||||
|
|
|
|||
|
|
@ -49,10 +49,11 @@ NewUnknownToken()
|
|||
// Init fields
|
||||
//
|
||||
strcpy(Token->Value, "");
|
||||
Token->Type = UNKNOWN;
|
||||
Token->Len = 0;
|
||||
Token->MaxLen = TOKEN_VALUE_MAX_LEN;
|
||||
Token->VariableType = 0;
|
||||
Token->Type = UNKNOWN;
|
||||
Token->Len = 0;
|
||||
Token->MaxLen = TOKEN_VALUE_MAX_LEN;
|
||||
Token->VariableType = (VARIABLE_TYPE *)VARIABLE_TYPE_LONG;
|
||||
Token->VariableMemoryIdx = 0;
|
||||
|
||||
return Token;
|
||||
}
|
||||
|
|
@ -76,12 +77,13 @@ NewToken(SCRIPT_ENGINE_TOKEN_TYPE Type, char * Value)
|
|||
//
|
||||
// Init fields
|
||||
//
|
||||
unsigned int Len = (unsigned int)strlen(Value);
|
||||
Token->Type = Type;
|
||||
Token->Len = Len;
|
||||
Token->MaxLen = Len;
|
||||
Token->Value = (char *)calloc(Token->MaxLen + 1, sizeof(char));
|
||||
Token->VariableType = 0;
|
||||
unsigned int Len = (unsigned int)strlen(Value);
|
||||
Token->Type = Type;
|
||||
Token->Len = Len;
|
||||
Token->MaxLen = Len;
|
||||
Token->Value = (char *)calloc(Token->MaxLen + 1, sizeof(char));
|
||||
Token->VariableType = (VARIABLE_TYPE *)VARIABLE_TYPE_LONG;
|
||||
Token->VariableMemoryIdx = 0;
|
||||
|
||||
if (Token->Value == NULL)
|
||||
{
|
||||
|
|
@ -212,6 +214,9 @@ PrintToken(PSCRIPT_ENGINE_TOKEN Token)
|
|||
case FUNCTION_PARAMETER_ID:
|
||||
printf(" FUNCTION_PARAMETER_ID>\n");
|
||||
break;
|
||||
case DEFERENCE_TEMP:
|
||||
printf(" DEFERENCE_TEMP>\n");
|
||||
break;
|
||||
default:
|
||||
printf(" ERROR>\n");
|
||||
break;
|
||||
|
|
@ -513,6 +518,22 @@ Top(PSCRIPT_ENGINE_TOKEN_LIST TokenList)
|
|||
return *ReadAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param TokenList Index
|
||||
* @return Token
|
||||
*/
|
||||
PSCRIPT_ENGINE_TOKEN
|
||||
TopIndexed(PSCRIPT_ENGINE_TOKEN_LIST TokenList, int Index)
|
||||
{
|
||||
uintptr_t Head = (uintptr_t)TokenList->Head;
|
||||
uintptr_t Pointer = (uintptr_t)TokenList->Pointer - 1 - Index;
|
||||
PSCRIPT_ENGINE_TOKEN * ReadAddr = (PSCRIPT_ENGINE_TOKEN *)(Head + Pointer * sizeof(PSCRIPT_ENGINE_TOKEN));
|
||||
|
||||
return *ReadAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether input char belongs to hexadecimal digit-set or not
|
||||
*
|
||||
|
|
@ -656,7 +677,7 @@ void
|
|||
FreeTemp(PSCRIPT_ENGINE_TOKEN Temp)
|
||||
{
|
||||
int id = (int)DecimalToInt(Temp->Value);
|
||||
if (Temp->Type == TEMP)
|
||||
if (Temp->Type == TEMP || Temp->Type == DEFERENCE_TEMP)
|
||||
{
|
||||
CurrentUserDefinedFunction->TempMap[id] = 0;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -366,6 +366,16 @@ GetToken(char * c, char * str)
|
|||
Token->Type = SPECIAL_TOKEN;
|
||||
*c = sgetc(str);
|
||||
return Token;
|
||||
case '[':
|
||||
strcpy(Token->Value, "[");
|
||||
Token->Type = SPECIAL_TOKEN;
|
||||
*c = sgetc(str);
|
||||
return Token;
|
||||
case ']':
|
||||
strcpy(Token->Value, "]");
|
||||
Token->Type = SPECIAL_TOKEN;
|
||||
*c = sgetc(str);
|
||||
return Token;
|
||||
case '|':
|
||||
*c = sgetc(str);
|
||||
if (*c == '|')
|
||||
|
|
@ -508,7 +518,8 @@ GetToken(char * c, char * str)
|
|||
{
|
||||
if (GetGlobalIdentifierVal(Token) != -1)
|
||||
{
|
||||
Token->Type = GLOBAL_ID;
|
||||
Token->Type = GLOBAL_ID;
|
||||
Token->VariableType = GetGlobalIdentifierVariableType(Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -708,7 +719,7 @@ GetToken(char * c, char * str)
|
|||
AppendByte(Token, *c);
|
||||
|
||||
*c = sgetc(str);
|
||||
if (IsHex(*c) || *c == '`')
|
||||
if (IsHex(*c) || *c == '`' || *c == '_')
|
||||
{
|
||||
// Nothing
|
||||
}
|
||||
|
|
@ -779,7 +790,8 @@ GetToken(char * c, char * str)
|
|||
}
|
||||
else if (GetLocalIdentifierVal(Token) != -1)
|
||||
{
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->VariableType = GetLocalIdentifierVariableType(Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -841,12 +853,14 @@ GetToken(char * c, char * str)
|
|||
}
|
||||
else if (GetLocalIdentifierVal(Token) != -1)
|
||||
{
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->VariableType = GetLocalIdentifierVariableType(Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
Token->Type = LOCAL_UNRESOLVED_ID;
|
||||
}
|
||||
Token->VariableType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -914,7 +928,8 @@ GetToken(char * c, char * str)
|
|||
}
|
||||
else if (GetLocalIdentifierVal(Token) != -1)
|
||||
{
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->Type = LOCAL_ID;
|
||||
Token->VariableType = GetLocalIdentifierVariableType(Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -163,3 +163,19 @@ HandleType(PSCRIPT_ENGINE_TOKEN_LIST PtokenStack)
|
|||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
VARIABLE_TYPE *
|
||||
GetCommonVariableType(VARIABLE_TYPE * Ty1, VARIABLE_TYPE * Ty2)
|
||||
{
|
||||
//if (Ty1->Kind == TY_ARRAY)
|
||||
//{
|
||||
// return Ty1;
|
||||
//}
|
||||
|
||||
//if (Ty2->Kind == TY_ARRAY)
|
||||
//{
|
||||
// return Ty2;
|
||||
//}
|
||||
|
||||
return VARIABLE_TYPE_LONG;
|
||||
}
|
||||
|
|
@ -60,6 +60,7 @@ typedef enum _SCRIPT_ENGINE_TOKEN_TYPE
|
|||
FUNCTION_ID,
|
||||
FUNCTION_PARAMETER_ID,
|
||||
SCRIPT_VARIABLE_TYPE,
|
||||
DEFERENCE_TEMP,
|
||||
UNKNOWN
|
||||
} SCRIPT_ENGINE_TOKEN_TYPE;
|
||||
|
||||
|
|
@ -72,7 +73,8 @@ typedef struct _SCRIPT_ENGINE_TOKEN
|
|||
char * Value;
|
||||
unsigned int Len;
|
||||
unsigned int MaxLen;
|
||||
unsigned long long VariableType;
|
||||
VARIABLE_TYPE * VariableType;
|
||||
unsigned long long VariableMemoryIdx;
|
||||
} SCRIPT_ENGINE_TOKEN, *PSCRIPT_ENGINE_TOKEN;
|
||||
|
||||
/**
|
||||
|
|
@ -115,6 +117,12 @@ NewTemp(PSCRIPT_ENGINE_ERROR_TYPE);
|
|||
void
|
||||
FreeTemp(PSCRIPT_ENGINE_ERROR_TYPE);
|
||||
|
||||
VARIABLE_TYPE *
|
||||
HandleType(PSCRIPT_ENGINE_TOKEN_LIST PtokenStack);
|
||||
|
||||
VARIABLE_TYPE *
|
||||
GetCommonVariableType(VARIABLE_TYPE * Ty1, VARIABLE_TYPE * Ty2);
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// SCRIPT_ENGINE_TOKEN_LIST related functions //
|
||||
////////////////////////////////////////////////////
|
||||
|
|
@ -137,6 +145,9 @@ Pop(PSCRIPT_ENGINE_TOKEN_LIST TokenList);
|
|||
PSCRIPT_ENGINE_TOKEN
|
||||
Top(PSCRIPT_ENGINE_TOKEN_LIST TokenList);
|
||||
|
||||
PSCRIPT_ENGINE_TOKEN
|
||||
TopIndexed(PSCRIPT_ENGINE_TOKEN_LIST TokenList, int Index);
|
||||
|
||||
char
|
||||
IsNoneTerminal(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
#pragma once
|
||||
#ifndef PARSE_TABLE_H
|
||||
#define PARSE_TABLE_H
|
||||
#define RULES_COUNT 246
|
||||
#define TERMINAL_COUNT 119
|
||||
#define NONETERMINAL_COUNT 49
|
||||
#define RULES_COUNT 271
|
||||
#define TERMINAL_COUNT 121
|
||||
#define NONETERMINAL_COUNT 63
|
||||
#define START_VARIABLE "S"
|
||||
#define MAX_RHS_LEN 15
|
||||
#define KEYWORD_LIST_LENGTH 109
|
||||
#define OPERATORS_ONE_OPERAND_LIST_LENGTH 4
|
||||
#define OPERATORS_ONE_OPERAND_LIST_LENGTH 3
|
||||
#define OPERATORS_TWO_OPERAND_LIST_LENGTH 16
|
||||
#define REGISTER_MAP_LIST_LENGTH 120
|
||||
#define PSEUDO_REGISTER_MAP_LIST_LENGTH 16
|
||||
#define SCRIPT_VARIABLE_TYPE_LIST_LENGTH 10
|
||||
#define ASSIGNMENT_OPERATOR_LIST_LENGTH 10
|
||||
#define SEMANTIC_RULES_MAP_LIST_LENGTH 155
|
||||
#define SEMANTIC_RULES_MAP_LIST_LENGTH 154
|
||||
#define THREEOPFUNC1_LENGTH 1
|
||||
#define THREEOPFUNC2_LENGTH 3
|
||||
#define TWOOPFUNC1_LENGTH 8
|
||||
|
|
@ -60,11 +60,11 @@ extern const SYMBOL_MAP PseudoRegisterMapList[];
|
|||
extern const char* ScriptVariableTypeList[];
|
||||
|
||||
|
||||
#define LALR_RULES_COUNT 103
|
||||
#define LALR_TERMINAL_COUNT 76
|
||||
#define LALR_NONTERMINAL_COUNT 22
|
||||
#define LALR_RULES_COUNT 109
|
||||
#define LALR_TERMINAL_COUNT 78
|
||||
#define LALR_NONTERMINAL_COUNT 26
|
||||
#define LALR_MAX_RHS_LEN 9
|
||||
#define LALR_STATE_COUNT 298
|
||||
#define LALR_STATE_COUNT 307
|
||||
extern const struct _SCRIPT_ENGINE_TOKEN LalrLhs[RULES_COUNT];
|
||||
extern const struct _SCRIPT_ENGINE_TOKEN LalrRhs[RULES_COUNT][MAX_RHS_LEN];
|
||||
extern const unsigned int LalrRhsSize[RULES_COUNT];
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@
|
|||
#include "SDK/HyperDbgSdk.h"
|
||||
#include "SDK/imports/user/HyperDbgSymImports.h"
|
||||
#include "SDK/headers/HardwareDebugger.h"
|
||||
#include "type.h"
|
||||
#include "common.h"
|
||||
#include "scanner.h"
|
||||
#include "globals.h"
|
||||
#include "../include/SDK/headers/ScriptEngineCommonDefinitions.h"
|
||||
#include "script-engine.h"
|
||||
#include "parse-table.h"
|
||||
#include "type.h"
|
||||
#include "hardware.h"
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -90,23 +90,29 @@ SemanticRuleToInt(char * str);
|
|||
char *
|
||||
HandleError(PSCRIPT_ENGINE_ERROR_TYPE Error, char * str);
|
||||
|
||||
int
|
||||
NewGlobalIdentifier(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
|
||||
int
|
||||
GetGlobalIdentifierVal(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
|
||||
VOID
|
||||
SetGlobalIdentifierVariableType(PSCRIPT_ENGINE_TOKEN Token, VARIABLE_TYPE * VariableType);
|
||||
|
||||
VARIABLE_TYPE *
|
||||
GetGlobalIdentifierVariableType(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
||||
unsigned long long
|
||||
NewLocalIdentifier(PSCRIPT_ENGINE_TOKEN PTOKEN, unsigned int VariableSize);
|
||||
|
||||
int
|
||||
GetLocalIdentifierVal(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
|
||||
int
|
||||
NewGlobalIdentifier(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
VOID
|
||||
SetLocalIdentifierVariableType(PSCRIPT_ENGINE_TOKEN Token, VARIABLE_TYPE * VariableType);
|
||||
|
||||
int
|
||||
NewLocalIdentifier(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
|
||||
int
|
||||
LalrGetRhsSize(int RuleId);
|
||||
|
||||
BOOL
|
||||
LalrIsOperandType(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
VARIABLE_TYPE *
|
||||
GetLocalIdentifierVariableType(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
||||
int
|
||||
NewFunctionParameterIdentifier(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
|
@ -114,6 +120,12 @@ NewFunctionParameterIdentifier(PSCRIPT_ENGINE_TOKEN Token);
|
|||
int
|
||||
GetFunctionParameterIdentifier(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
||||
int
|
||||
LalrGetRhsSize(int RuleId);
|
||||
|
||||
BOOL
|
||||
LalrIsOperandType(PSCRIPT_ENGINE_TOKEN PTOKEN);
|
||||
|
||||
PUSER_DEFINED_FUNCTION_NODE
|
||||
GetUserDefinedFunctionNode(PSCRIPT_ENGINE_TOKEN Token);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ typedef enum
|
|||
|
||||
typedef struct VARIABLE_TYPE
|
||||
{
|
||||
VARIABLE_TYPE_KIND Kind;
|
||||
int Size; // sizeof() value
|
||||
int Align; // alignment
|
||||
BOOLEAN IsUnsigned;
|
||||
VARIABLE_TYPE_KIND Kind;
|
||||
int Size; // sizeof() value
|
||||
int Align; // alignment
|
||||
BOOLEAN IsUnsigned;
|
||||
struct VARIABLE_TYPE * Base;
|
||||
int ArrayLen;
|
||||
} VARIABLE_TYPE;
|
||||
|
||||
extern VARIABLE_TYPE * VARIABLE_TYPE_UNKNOWN;
|
||||
|
|
@ -51,6 +53,4 @@ extern VARIABLE_TYPE * VARIABLE_TYPE_FLOAT;
|
|||
extern VARIABLE_TYPE * VARIABLE_TYPE_DOUBLE;
|
||||
extern VARIABLE_TYPE * VARIABLE_TYPE_LDOUBLE;
|
||||
|
||||
VARIABLE_TYPE *
|
||||
HandleType(PSCRIPT_ENGINE_TOKEN_LIST PtokenStack);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -99,7 +99,11 @@ E12->( BE )
|
|||
E12->_register @PUSH
|
||||
E12->_global_id @PUSH
|
||||
E12->_local_id @PUSH
|
||||
E12->_function_parameter_id @PUSH
|
||||
E12->_function_parameter_id @PUSH
|
||||
|
||||
E12->ARRAY1
|
||||
|
||||
|
||||
|
||||
# numbers
|
||||
E12->_hex @PUSH
|
||||
|
|
@ -108,6 +112,7 @@ E12->_octal @PUSH
|
|||
E12->_binary @PUSH
|
||||
E12->_pseudo_register @PUSH
|
||||
|
||||
|
||||
E12->E13 ( VA2 ) @END_OF_CALLING_USER_DEFINED_FUNCTION_WITH_RETURNING_VALUE
|
||||
E13->_function_id @PUSH
|
||||
|
||||
|
|
@ -123,4 +128,11 @@ StringNumber->EXP
|
|||
StringNumber->STRING
|
||||
|
||||
WstringNumber->EXP
|
||||
WstringNumber->WSTRING
|
||||
WstringNumber->WSTRING
|
||||
|
||||
|
||||
ARRAY1->ARRAY2 ARRAY3 ARRAY4 @ARRAY_INDEX_READ
|
||||
ARRAY2->_local_id @PUSH
|
||||
ARRAY3->[ EXP ] @ARRAY_DIM_NUMBER
|
||||
ARRAY4->ARRAY3 ARRAY4
|
||||
ARRAY4->eps
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
.VarArgFunc1->printf
|
||||
|
||||
.OperatorsTwoOperand->or xor and asr asl add sub mul div mod gt lt egt elt equal neq
|
||||
.OperatorsOneOperand->inc dec reference dereference
|
||||
.OperatorsOneOperand->inc dec reference
|
||||
|
||||
.AssignmentOperator->add_assignment sub_assignment mul_assignment div_assignment mod_assignment asl_assignment asr_assignment and_assignment xor_assignment or_assignment
|
||||
|
||||
|
|
@ -83,6 +83,7 @@ STATEMENT2->break @BREAK ;
|
|||
STATEMENT2->continue @CONTINUE ;
|
||||
STATEMENT2->VARIABLE_TYPE1 VARIABLE_TYPE2 L_VALUE = EXPRESSION MULTIPLE_ASSIGNMENT ;
|
||||
STATEMENT2->return RETURN ;
|
||||
|
||||
RETURN->eps @RETURN_OF_USER_DEFINED_FUNCTION_WITHOUT_VALUE
|
||||
RETURN->EXPRESSION @RETURN_OF_USER_DEFINED_FUNCTION_WITH_VALUE
|
||||
|
||||
|
|
@ -90,11 +91,35 @@ RETURN->EXPRESSION @RETURN_OF_USER_DEFINED_FUNCTION_WITH_VALUE
|
|||
VARIABLE_TYPE1->@PUSH _script_variable_type
|
||||
|
||||
VARIABLE_TYPE2->VARIABLE_TYPE1 VARIABLE_TYPE2
|
||||
VARIABLE_TYPE2->* @DECLARE_POINTER_TYPE
|
||||
VARIABLE_TYPE2->eps
|
||||
|
||||
VARIABLE_TYPE3->VARIABLE_TYPE1 VARIABLE_TYPE2 L_VALUE VARIABLE_TYPE4
|
||||
VARIABLE_TYPE4->= EXPRESSION MULTIPLE_ASSIGNMENT ;
|
||||
|
||||
VARIABLE_TYPE4->@ARRAY_L_VALUE ARRAY_DIMS = ARRAY_INIT @ARRAY_DECLARITION ;
|
||||
|
||||
ARRAY_DIMS->[ CONST_NUMBER @ARRAY_DIM_NUMBER ] ARRAY_DIMS2
|
||||
ARRAY_DIMS2->ARRAY_DIMS
|
||||
ARRAY_DIMS2->eps
|
||||
|
||||
ARRAY_INIT->{ INIT_LIST } @ARRAY_LEFT_BRACKET
|
||||
|
||||
INIT_LIST->INIT_ITEM INIT_LIST_TAIL
|
||||
|
||||
INIT_ITEM->ARRAY_INIT
|
||||
INIT_ITEM->EXPRESSION
|
||||
|
||||
INIT_LIST_TAIL->, INIT_LIST_CONT
|
||||
INIT_LIST_TAIL->eps
|
||||
|
||||
INIT_LIST_CONT->INIT_ITEM INIT_LIST_TAIL
|
||||
INIT_LIST_CONT->eps
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# define function
|
||||
VARIABLE_TYPE4->@START_OF_USER_DEFINED_FUNCTION ( VARIABLE_TYPE5 ) { S2 @END_OF_USER_DEFINED_FUNCTION }
|
||||
|
||||
|
|
@ -103,7 +128,19 @@ VARIABLE_TYPE5->VARIABLE_TYPE1 VARIABLE_TYPE2 L_VALUE @FUNCTION_PARAMETER VARIAB
|
|||
VARIABLE_TYPE6->, VARIABLE_TYPE1 VARIABLE_TYPE2 L_VALUE @FUNCTION_PARAMETER VARIABLE_TYPE6
|
||||
VARIABLE_TYPE6->eps
|
||||
|
||||
ASSIGNMENT_STATEMENT->L_VALUE ASSIGNMENT_STATEMENT'
|
||||
ASSIGNMENT_STATEMENT->* L_VALUE = EXPRESSION @DEREFERENCE
|
||||
|
||||
ASSIGNMENT_STATEMENT->L_VALUE ARRAY_DIMS_WRITE_OPT ASSIGNMENT_STATEMENT'
|
||||
|
||||
ARRAY_DIMS_WRITE_OPT->ARRAY_DIMS_WRITE
|
||||
ARRAY_DIMS_WRITE_OPT->eps
|
||||
|
||||
ARRAY_DIMS_WRITE->[ EXPRESSION @ARRAY_DIM_NUMBER ] ARRAY_DIMS_WRITE2
|
||||
ARRAY_DIMS_WRITE2->ARRAY_DIMS_WRITE
|
||||
ARRAY_DIMS_WRITE2->eps @ARRAY_INDEX_WRITE
|
||||
|
||||
|
||||
|
||||
ASSIGNMENT_STATEMENT'->++ @INC
|
||||
ASSIGNMENT_STATEMENT'->-- @DEC
|
||||
ASSIGNMENT_STATEMENT'->= EXPRESSION MULTIPLE_ASSIGNMENT
|
||||
|
|
@ -118,6 +155,10 @@ ASSIGNMENT_STATEMENT'->&= EXPRESSION @AND_ASSIGNMENT
|
|||
ASSIGNMENT_STATEMENT'->^= EXPRESSION @XOR_ASSIGNMENT
|
||||
ASSIGNMENT_STATEMENT'->|= EXPRESSION @OR_ASSIGNMENT
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CALL_FUNC_STATEMENT->.OneOpFunc2 ( EXPRESSION @.OneOpFunc2 )
|
||||
CALL_FUNC_STATEMENT->.VarArgFunc1 ( STRING @VARGSTART VA @.VarArgFunc1 )
|
||||
CALL_FUNC_STATEMENT->.ZeroOpFunc1 ( @.ZeroOpFunc1 )
|
||||
|
|
@ -227,16 +268,28 @@ E12->.ThreeOpFunc4 ( WstringNumber , WstringNumber , EXPRESSION @.ThreeOpFunc4 )
|
|||
|
||||
E12->( EXPRESSION )
|
||||
|
||||
E12->L_VALUE
|
||||
E12->L_VALUE ARRAY_DIMS_READ_OPT
|
||||
E12->@PUSH _function_id ( VA2 ) @END_OF_CALLING_USER_DEFINED_FUNCTION_WITH_RETURNING_VALUE
|
||||
|
||||
ARRAY_DIMS_READ_OPT->ARRAY_DIMS_READ
|
||||
ARRAY_DIMS_READ_OPT->eps
|
||||
|
||||
ARRAY_DIMS_READ->[ EXPRESSION @ARRAY_DIM_NUMBER ] ARRAY_DIMS_READ2
|
||||
ARRAY_DIMS_READ2->ARRAY_DIMS_READ
|
||||
ARRAY_DIMS_READ2->eps @ARRAY_INDEX_READ
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# numbers
|
||||
E12->@PUSH _hex
|
||||
E12->@PUSH _decimal
|
||||
E12->@PUSH _octal
|
||||
E12->@PUSH _binary
|
||||
CONST_NUMBER->@PUSH _hex
|
||||
CONST_NUMBER->@PUSH _decimal
|
||||
CONST_NUMBER->@PUSH _octal
|
||||
CONST_NUMBER->@PUSH _binary
|
||||
|
||||
E12->CONST_NUMBER
|
||||
|
||||
E12->@PUSH _pseudo_register
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,10 @@ typedef struct ACTION_BUFFER {
|
|||
#define SYMBOL_STACK_INDEX_TYPE 15
|
||||
#define SYMBOL_STACK_BASE_INDEX_TYPE 16
|
||||
#define SYMBOL_RETURN_VALUE_TYPE 17
|
||||
#define SYMBOL_REFERENCE_LOCAL_ID_TYPE 18
|
||||
#define SYMBOL_REFERENCE_TEMP_TYPE 19
|
||||
#define SYMBOL_DEREFERENCE_LOCAL_ID_TYPE 20
|
||||
#define SYMBOL_DEREFERENCE_TEMP_TYPE 21
|
||||
|
||||
static const char *const SymbolTypeNames[] = {
|
||||
"SYMBOL_UNDEFINED",
|
||||
|
|
@ -184,7 +188,11 @@ static const char *const SymbolTypeNames[] = {
|
|||
"SYMBOL_FUNCTION_PARAMETER_TYPE",
|
||||
"SYMBOL_STACK_INDEX_TYPE",
|
||||
"SYMBOL_STACK_BASE_INDEX_TYPE",
|
||||
"SYMBOL_RETURN_VALUE_TYPE"
|
||||
"SYMBOL_RETURN_VALUE_TYPE",
|
||||
"SYMBOL_REFERENCE_LOCAL_ID_TYPE",
|
||||
"SYMBOL_REFERENCE_TEMP_TYPE",
|
||||
"SYMBOL_DEREFERENCE_LOCAL_ID_TYPE",
|
||||
"SYMBOL_DEREFERENCE_TEMP_TYPE"
|
||||
};
|
||||
|
||||
#define SYMBOL_MEM_VALID_CHECK_MASK (1 << 31)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class LALR1Parser:
|
|||
# maximum of "Right Hand Side(Rhs)" length
|
||||
self.MAXIMUM_RHS_LEN = 0
|
||||
|
||||
self.SPECIAL_TOKENS = ['%', '+', '++', '-', '--', "*", "/", "=", "==", "!=", ",", ";", "(", ")", "{", "}", "|", "||", ">>", ">=", "<<", "<=", "&", "&&", "^"]
|
||||
self.SPECIAL_TOKENS = ['%', '+', '++', '-', '--', "*", "/", "=", "==", "!=", ",", ";", "(", ")", "{", "}", "|", "||", ">>", ">=", "<<", "<=", "&", "&&", "^", "[", "]"]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class LL1Parser:
|
|||
|
||||
|
||||
self.SPECIAL_TOKENS = ['%', '+', '~', '++', '-', '--', "*", "/", "=", "==", "!=", ",", ";", "(", ")", "{", "}", "|", "||", ">>", ">=", "<<", "<=", "&", "&&", "^",
|
||||
"+=", "-=", "*=", "/=", "%=", "<<=", ">>=", "&=", "^=", "|=" ]
|
||||
"+=", "-=", "*=", "/=", "%=", "<<=", ">>=", "&=", "^=", "|=" , "[", "]"]
|
||||
|
||||
# INVALID rule indicator
|
||||
self.INVALID = 0x80000000
|
||||
|
|
|
|||
|
|
@ -150,6 +150,14 @@ GetValue(PGUEST_REGS GuestRegs,
|
|||
else
|
||||
return ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx + Symbol->Value];
|
||||
|
||||
case SYMBOL_REFERENCE_TEMP_TYPE:
|
||||
|
||||
return (UINT64)&ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx + Symbol->Value];
|
||||
|
||||
case SYMBOL_DEREFERENCE_TEMP_TYPE:
|
||||
|
||||
return *(UINT64 *)ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx + Symbol->Value];
|
||||
|
||||
case SYMBOL_FUNCTION_PARAMETER_ID_TYPE:
|
||||
|
||||
if (ReturnReference)
|
||||
|
|
@ -204,6 +212,10 @@ SetValue(PGUEST_REGS GuestRegs,
|
|||
ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx + Symbol->Value] = Value;
|
||||
return;
|
||||
|
||||
case SYMBOL_DEREFERENCE_TEMP_TYPE:
|
||||
*(UINT64 *)ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx + Symbol->Value] = Value;
|
||||
return;
|
||||
|
||||
case SYMBOL_FUNCTION_PARAMETER_ID_TYPE:
|
||||
ScriptGeneralRegisters->StackBuffer[ScriptGeneralRegisters->StackBaseIndx - 3 - Symbol->Value] = Value;
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue