mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +00:00
Some fixes for the expression evaluator:
Evaluate static symbols Evaulate local symbols Still has bugs locating type definitions, at least for pointer types There also seems to be a bug matching up lines of source with the correct instruction addresses svn path=/trunk/; revision=2690
This commit is contained in:
parent
48e308623c
commit
5126871fcf
1 changed files with 192 additions and 170 deletions
|
@ -817,8 +817,8 @@ LPSTR FindFunctionByAddress(ULONG ulValue,PULONG pulstart,PULONG pulend)
|
||||||
|
|
||||||
while( pSym < pSymEnd )
|
while( pSym < pSymEnd )
|
||||||
{
|
{
|
||||||
//symbol is a function is it's type is 0x20, storage class is external and section>0
|
//symbol is a function is it's type is 0x20, and section>0
|
||||||
if(( (pSym->Type == 0x20) && (pSym->StorageClass==IMAGE_SYM_CLASS_EXTERNAL) &&
|
if(( (pSym->Type == 0x20) &&
|
||||||
(pSym->SectionNumber > 0 )))
|
(pSym->SectionNumber > 0 )))
|
||||||
{
|
{
|
||||||
ULONG ulCurrAddr;
|
ULONG ulCurrAddr;
|
||||||
|
@ -1035,7 +1035,9 @@ ULONG ExtractTypeNumber(LPSTR p)
|
||||||
ULONG ulTypeNumber = 0;
|
ULONG ulTypeNumber = 0;
|
||||||
|
|
||||||
DPRINT((0,"ExtractTypeNumber(%s)\n",p));
|
DPRINT((0,"ExtractTypeNumber(%s)\n",p));
|
||||||
|
|
||||||
pTypeNumber = PICE_strchr(p,'(');
|
pTypeNumber = PICE_strchr(p,'(');
|
||||||
|
|
||||||
if(pTypeNumber)
|
if(pTypeNumber)
|
||||||
{
|
{
|
||||||
pTypeNumber++;
|
pTypeNumber++;
|
||||||
|
@ -2356,6 +2358,8 @@ BOOLEAN FindGlobalStabSymbol(LPSTR pExpression,PULONG pValue,PULONG pulTypeNumbe
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case N_GSYM:
|
case N_GSYM:
|
||||||
|
case N_LSYM:
|
||||||
|
case N_PSYM:
|
||||||
// symbol-name:type-identifier type-number =
|
// symbol-name:type-identifier type-number =
|
||||||
nLen = StrLenUpToWhiteChar(pName,":");
|
nLen = StrLenUpToWhiteChar(pName,":");
|
||||||
PICE_strncpy(SymbolName,pName,nLen);
|
PICE_strncpy(SymbolName,pName,nLen);
|
||||||
|
@ -2365,10 +2369,13 @@ BOOLEAN FindGlobalStabSymbol(LPSTR pExpression,PULONG pValue,PULONG pulTypeNumbe
|
||||||
DPRINT((0,"global symbol %s\n",pName));
|
DPRINT((0,"global symbol %s\n",pName));
|
||||||
// extract type-number from stab
|
// extract type-number from stab
|
||||||
ulTypeNumber = ExtractTypeNumber(pName);
|
ulTypeNumber = ExtractTypeNumber(pName);
|
||||||
DPRINT((0,"type number = %x\n",ulTypeNumber));
|
DPRINT((0,"type number = %x, from %s\n",ulTypeNumber, pName));
|
||||||
*pulTypeNumber = ulTypeNumber;
|
*pulTypeNumber = ulTypeNumber;
|
||||||
// look for symbols address in external symbols
|
// look for symbols address in external symbols
|
||||||
*pValue = FindFunctionInModuleByName(SymbolName,pCurrentMod);
|
if( pStab->n_type == N_LSYM || pStab->n_type == N_PSYM )
|
||||||
|
*pValue = CurrentEBP + pStab->n_value;
|
||||||
|
else *pValue = FindFunctionInModuleByName(SymbolName,pCurrentMod);
|
||||||
|
|
||||||
DPRINT((0,"value = %x\n",*pValue));
|
DPRINT((0,"value = %x\n",*pValue));
|
||||||
*pulFileNumber = ulCurrentFileNumber;
|
*pulFileNumber = ulCurrentFileNumber;
|
||||||
DPRINT((0,"file = %x\n",ulCurrentFileNumber));
|
DPRINT((0,"file = %x\n",ulCurrentFileNumber));
|
||||||
|
@ -2682,7 +2689,6 @@ BOOLEAN EvaluateSymbol(PVRET pvr,LPSTR pToken)
|
||||||
{
|
{
|
||||||
if(!(pTypeDef = FindTypeDefinition(pvr->pSymbols,pvr->type,pvr->file)))
|
if(!(pTypeDef = FindTypeDefinition(pvr->pSymbols,pvr->type,pvr->file)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PICE_strcpy(type_def,pTypeDef);
|
PICE_strcpy(type_def,pTypeDef);
|
||||||
|
|
||||||
pTypeDef = type_def;
|
pTypeDef = type_def;
|
||||||
|
@ -2851,7 +2857,23 @@ BOOLEAN EvaluateSymbol(PVRET pvr,LPSTR pToken)
|
||||||
bDone = TRUE; // meanwhile
|
bDone = TRUE; // meanwhile
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINT((0,"DEFAULT %x\n",pvr->type));
|
DPRINT((0,"DEFAULT %x, base: %c\n",pvr->type, *pTypeBase));
|
||||||
|
pvr->address = pvr->value;
|
||||||
|
if(IsRangeValid(pvr->value,ulBytes))
|
||||||
|
{
|
||||||
|
switch(ulBytes)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
pvr->value = *(PUCHAR)pvr->value;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pvr->value = *(PUSHORT)pvr->value;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
pvr->value = *(PULONG)pvr->value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
bDone = TRUE;
|
bDone = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue