38 #include <ntdll/ldr.h> 39 #include <ntdll/rtl.h> 42 #include <internal/module.h> 113 PCOMMON_BODY_HEADER chdr = (PCOMMON_BODY_HEADER)
body;
177 UserModuleListHead = &Ldr->InLoadOrderModuleList;
179 Entry = UserModuleListHead->Flink;
180 while (
Entry != UserModuleListHead)
185 DPRINT((0,
"FullName: %S, BaseName: %S, Length: %ld, EntryPoint: %x, BaseAddress: %x\n", Module->
FullDllName.
Buffer,
206 PDIRECTORY_OBJECT pd;
211 current = (*pNameSpaceRoot)->head.Flink;
212 while (
current!=(&((*pNameSpaceRoot)->head)))
215 DPRINT((0,
"Scanning %S\n",current_obj->Name.Buffer));
216 if (
_wcsicmp(current_obj->Name.Buffer,
L"Modules")==0)
219 DPRINT((0,
"Found it %x\n",pd));
245 DPRINT((0,
"FullName: %S, BaseName: %S, Length: %ld, EntryPoint: %x\n",
current->FullName.Buffer,
259 current_entry = current_entry->
Flink;
301 DPRINT((0,
"IsModuleLoaded(%s)\n",
p));
313 DPRINT((0,
"module %S is loaded!\n",pd->
name));
338 pStr =
strstr(pExp,pFind);
344 LPSTR pOldStr = pStr;
349 for(;(*pStr!=0x0a && *pStr!=0x0d);)*
p++=*pStr++;
395 for(
i=0;
i<8 &&
p[
i]!=0 &&
p[
i]!=
' ';
i++)
397 if(
p[
i]>=
'0' &&
p[
i]<=
'9')
402 else if(
p[
i]>=
'A' &&
p[
i]<=
'F')
407 else if(
p[
i]>=
'a' &&
p[
i]<=
'f')
431 *ppPtrToSymbol += 11;
446 DPRINT((0,
"ValidityCheckSymbols()\n"));
454 DPRINT((0,
"ValidityCheckSymbols(): symbols are %s\n",bRet?
"VALID":
"NOT VALID"));
475 DPRINT((0,
"pd: %x\n", pd));
512 DPRINT((0,
"FindModuleFromAddress()\n"));
525 DPRINT((0,
"FindModuleFromAddress(): found %S\n",pd->
name));
544 DPRINT((0,
"FindModuleFromAddress()\n"));
547 DPRINT((0,
"Can't convert module name.\n"));
560 DPRINT((0,
"FindModuleByName(): found %S\n",pd->
name));
579 DPRINT((0,
"FindModuleSymbols()\n"));
582 DPRINT((0,
"Can't convert module name in FindModuleSymbols.\n"));
602 static char temp3[256];
604 ULONG ulCurrentValue=0;
607 ULONG ulMinValue = -1;
618 DPRINT((0,
"In ScanExportsByAddress:\n"));
621 DPRINT((0,
"pSymbols: %x\n", pSymbols));
628 DPRINT((0,
"looking up symbols\n"));
639 DPRINT((0,
"ScanExportsByAddress(): found symbols for module %S @ %x \n",pdTemp->
name,(
ULONG)pSymbols));
643 pStr = (
LPSTR)((
ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
648 DPRINT((0,
"ScanExportsByAddress(): pSym = %x is not a valid pointer\n",(
ULONG)pSym));
652 DPRINT((0,
"ScanExportsByAddress(): pSym = %x\n",pSym));
653 DPRINT((0,
"ScanExportsByAddress(): pStr = %x\n",pStr));
654 DPRINT((0,
"ScanExportsByAddress(): pShdr = %x\n",pShdr));
656 DPRINT((0,
"ScanExportsByAddress(): %S has %u symbols\n",pSymbols->name,pSymbols->ulSizeOfGlobals/
sizeof(
IMAGE_SYMBOL)));
660 while(pSym < pSymEnd)
662 if(((pSym->Type == 0
x0) || (pSym->Type == 0x20) ) &&
664 (pSym->SectionNumber > 0 ))
670 DPRINT((0,
"ScanExportsByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(
ULONG)pShdrThis));
674 DPRINT((0,
"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(
ULONG)pShdrThis));
680 ulCurrAddr = ((
ULONG)pdTemp->
BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
681 DPRINT((0,
"ScanExportsByAddress(): CurrAddr [1] = %x\n",ulCurrAddr));
683 if(ulCurrAddr<=ulValue && ulCurrAddr>ulAddr)
690 pSym += pSym->NumberOfAuxSymbols + 1;
693 if( pFoundSym->N.Name.Short ){
694 pName = pFoundSym->N.ShortName;
698 ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings);
699 pName = pStr+pFoundSym->N.Name.Long;
702 DPRINT((0,
"ScanExportsByAddress(): pName = %x is not a valid pointer\n",
pName));
712 }
while((pd = pd->
next));
728 if(ulValue>=ulCurrentValue && (ulValue-ulCurrentValue)<ulMinValue)
731 ulMinValue = ulValue-ulCurrentValue;
732 pSymbolName = pStartOfLine;
741 while(*
p!=0 && *
p!=0x0a && *
p!=0x0d)
p++;
748 for(
i=0;pSymbolName[
i]!=0 && pSymbolName[
i]!=0x0a && pSymbolName[
i]!=0x0d;
i++)
776 static char temp4[256];
780 DPRINT((0,
"FindFunctionByAddress(): symbols for %S @ %x \n",pSymbols->
name,(
ULONG)pSymbols));
783 DPRINT((0,
"looking up symbol\n"));
794 DPRINT((0,
"FindFunctionByAddress(): ulValue %x\n",ulValue));
798 DPRINT((0,
"FindFunctionByAddress(): address matches %S\n",(
ULONG)pdTemp->
name));
801 DPRINT((0,
"found symbols for module %S\n",pdTemp->
name));
804 pStr = (
LPSTR)((
ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
809 DPRINT((0,
"FindFunctionByAddress(): pSym = %x is not a valid pointer\n",(
ULONG)pSym));
812 DPRINT((0,
"pSym = %x\n",pSym));
813 DPRINT((0,
"pStr = %x\n",pStr));
814 DPRINT((0,
"pShdr = %x\n",pShdr));
816 while( pSym < pSymEnd )
819 if(( (pSym->Type == 0x20) &&
820 (pSym->SectionNumber > 0 )))
825 DPRINT((0,
"FindFunctionByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(
ULONG)pShdrThis));
829 DPRINT((0,
"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(
ULONG)pShdrThis));
835 ulCurrAddr = ((
ULONG)pdTemp->
BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
836 DPRINT((0,
"FindFunctionByAddress(): CurrAddr [1] = %x\n",ulCurrAddr));
837 DPRINT((0,
"%x ", ulCurrAddr));
839 if(ulCurrAddr<=ulValue && ulCurrAddr>
start)
845 else if(ulCurrAddr>=ulValue && ulCurrAddr<
end)
852 pSym += pSym->NumberOfAuxSymbols + 1;
870 if(pFoundSym->N.Name.Short){
877 ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings);
878 pName = pStr+pFoundSym->N.Name.Long;
881 DPRINT((0,
"FindFunctionByAddress(): pName = %x is not a valid pointer\n",
pName));
964 DPRINT((0,
"FindFunctionInModuleByName(%s)\n",szFunctionname));
965 DPRINT((0,
"FindFunctionInModuleByName(): mod size = %x\n",pd->
size));
966 DPRINT((0,
"FindFunctionInModuleByName(): module is %S\n",pd->
name));
973 DPRINT((0,
"FindFunctionInModuleByName(): found symbol table for %S\n",pSymbols->
name));
979 while( pSym < pSymEnd )
985 if(((pSym->Type == 0
x0) || (pSym->Type == 0x20) ) &&
987 (pSym->SectionNumber > 0 ))
995 DPRINT((0,
"FindFunctionInModuleByName(): %s @ %x\n",szFunctionname,
start));
997 if(pSym->N.Name.Short){
999 DPRINT((0,
"FindFunctionInModuleByName: %.8s\n", pSym->N.ShortName));
1000 pName = pSym->N.ShortName;
1003 DPRINT((0,
"FindFunctionInModuleByName(): symbol was in symbol table, start: %x\n",
start));
1008 pName = pStr+pSym->N.Name.Long;
1009 DPRINT((0,
"FindFunctionInModuleByName: %s\n",
pName));
1012 DPRINT((0,
"FindFunctionInModuleByName(): symbol was in string table, start: %x\n",
start));
1019 pSym += pSym->NumberOfAuxSymbols + 1;
1033 ULONG ulTypeNumber = 0;
1035 DPRINT((0,
"ExtractTypeNumber(%s)\n",
p));
1043 ulTypeNumber <<= 16;
1055 return ulTypeNumber;
1066 LPSTR pStr,
pName,pTypeNumber,pTypeDefIncluded,pNameTemp;
1068 int nOffset=0,nNextOffset=0,nLen;
1069 static char szAccumulatedName[2048];
1070 ULONG ulCurrentTypeNumber,ulCurrentFileNumber=0;
1071 static char szCurrentPath[256];
1075 *szAccumulatedName = 0;
1081 DPRINT((0,
"FindTypeDefinitionForCombinedTypes()\n"));
1090 nOffset += nNextOffset;
1096 if(
pName[nLen-1]!=
'/')
1098 ulCurrentFileNumber++;
1102 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): changing source file %s\n",szCurrentPath));
1106 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): changing source file %s\n",
pName));
1121 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): %s\n",
pName));
1134 szAccumulatedName[
PICE_strlen(szAccumulatedName)-1]=0;
1147 pNameTemp = szAccumulatedName;
1151 if((pTypeDefIncluded =
PICE_strchr(pNameTemp,
'=')) && pNameTemp[nLen+1]==
'G')
1153 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): symbol includes type definition (%s)\n",pNameTemp));
1154 pTypeNumber = pNameTemp+nLen+1;
1157 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): type-number %x\n",ulCurrentTypeNumber));
1158 if(ulCurrentTypeNumber == ulTypeNumber)
1160 DPRINT((0,
"FindTypeDefinitionForCombinedTypes(): typenumber %x matches!\n",ulCurrentTypeNumber));
1165 *szAccumulatedName = 0;
1185 int nOffset=0,nNextOffset=0,strLen;
1186 static char szAccumulatedName[2048];
1187 ULONG ulCurrentTypeNumber,ulCurrentFileNumber=0;
1189 static char szCurrentPath[256];
1192 DPRINT((0,
"FindTypeDefinition(%u,%u)\n",ulTypeNumber,ulFileNumber));
1194 *szAccumulatedName = 0;
1207 nOffset += nNextOffset;
1213 if(
pName[strLen-1]!=
'/')
1215 ulCurrentFileNumber++;
1219 DPRINT((0,
"FindTypeDefinition()1: cha %s, %u\n",szCurrentPath, ulCurrentFileNumber));
1223 DPRINT((0,
"FindTypeDefinition(): cha %s, %u\n",
pName, ulCurrentFileNumber));
1239 DPRINT((0,
"FindTypeDefinition(): pre type definition %s\n",
pName));
1246 DPRINT((0,
"FindTypeDefinition(): [1] accum. %s\n",szAccumulatedName));
1251 DPRINT((0,
"FindTypeDefinition(): [2] accum. %s\n",szAccumulatedName));
1253 szAccumulatedName[
PICE_strlen(szAccumulatedName)-1]=0;
1257 DPRINT((0,
"FindTypeDefinition(): [3] accum. %s, pname: %s\n",szAccumulatedName,
pName));
1266 pTypeString = szAccumulatedName;
1269 if(pTypeSymbol && (*(pTypeSymbol+1)==
't' || *(pTypeSymbol+1)==
'T'))
1273 DPRINT((0,
"FindTypeDefinition(): ulCurrType: %u, LSYM is type %s\n",ulCurrentTypeNumber,
pName));
1274 if(ulCurrentTypeNumber == ulTypeNumber)
1276 DPRINT((0,
"FindTypeDefinition(): type definition %s\n",pTypeString));
1280 *szAccumulatedName=0;
1298 static char temp[1024];
1303 while(*
p!=0 && *
p!=
c)
1323 int nOffset=0,nNextOffset=0;
1325 static char szCurrentFunction[256];
1326 static char szCurrentPath[256];
1327 LPSTR pFunctionName;
1329 ULONG ulTypeNumber,ulCurrentFileNumber=0;
1331 ULONG ulNumLocalVars=0;
1333 DPRINT((0,
"FindLocalsByAddress()\n"));
1336 DPRINT((0,
"FindLocalsByAddress(): pFunctionName = %s\n",pFunctionName));
1350 DPRINT((0,
"FindLocalsByAddress(): %x %x %x %x %x\n",
1360 nOffset += nNextOffset;
1366 if(
pName[strLen-1]!=
'/')
1368 ulCurrentFileNumber++;
1372 DPRINT((0,
"changing source file1 %s, %u\n",szCurrentPath,ulCurrentFileNumber));
1376 DPRINT((0,
"changing source file %s, %u\n",
pName,ulCurrentFileNumber));
1389 if(szCurrentFunction[0] &&
PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1393 DPRINT((0,
"type number = %u\n",ulTypeNumber));
1396 DPRINT((0,
"pTypedef: %x\n", pTypedef));
1409 if(szCurrentFunction[0] &&
PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1413 DPRINT((0,
"type number = %x\n",ulTypeNumber));
1426 if(szCurrentFunction[0] &&
PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1430 DPRINT((0,
"type number = %x\n",ulTypeNumber));
1450 szCurrentFunction[
len]=0;
1451 DPRINT((0,
"function %s\n",szCurrentFunction));
1455 DPRINT((0,
"END of function %s\n",szCurrentFunction));
1456 szCurrentFunction[0]=0;
1482 int nOffset=0,nNextOffset=0;
1484 static char szCurrentFunction[256];
1485 static char szCurrentPath[256];
1486 static char szWantedPath[256];
1487 LPSTR pFunctionName;
1494 DPRINT((0,
"FindSourceLineForAddress: for function: %s\n", pFunctionName));
1500 DPRINT((0,
"FindSourceLineForAddress: pSymbols %x\n", pSymbols));
1524 nOffset += nNextOffset;
1543 DPRINT((0,
"changing sub source file %s\n",
pName));
1559 DPRINT((0,
"END of function %s\n",szCurrentFunction));
1561 szCurrentFunction[0]=0;
1575 szCurrentFunction[
len]=0;
1577 DPRINT((0,
"function %s\n",szCurrentFunction));
1584 if(szCurrentFunction[0] &&
PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1591 DPRINT((0,
"source file must be %s\n",szWantedPath));
1592 bFirstOccurence =
FALSE;
1594 DPRINT((0,
"wanted %s, current: %s\n",szWantedPath, szCurrentPath));
1611 *pulLineNumber = pStab->
n_desc;
1647 *ppSrcStart = pSrcLine;
1654 while(*pSrcLine!=0 && *pSrcLine!=0x0a && *pSrcLine!=0x0d)
1666 DPRINT((0,
"src file descriptor found, but contains no source\n"));
1681 DPRINT((0,
"FindSourceLineForAddress: exit 1\n"));
1695 int nOffset=0,nNextOffset=0;
1697 static char szCurrentFunction[256];
1698 static char szCurrentPath[256];
1699 ULONG strLen,
addr,ulMinValue=0xFFFFFFFF;
1702 DPRINT((0,
"FindAddressForSourceLine(%u,%s,%x)\n",ulLineNumber,pFilename,(
ULONG)pMod));
1720 nOffset += nNextOffset;
1726 if(
pName[strLen-1]!=
'/')
1731 DPRINT((0,
"changing source file %s\n",szCurrentPath));
1751 if(pStab->
n_desc>=ulLineNumber && (pStab->
n_desc-ulLineNumber)<=ulMinValue)
1753 ulMinValue = pStab->
n_desc-ulLineNumber;
1755 DPRINT((0,
"code source line number #%u for offset %x in function @ %s)\n",pStab->
n_desc,pStab->
n_value,szCurrentFunction));
1772 szCurrentFunction[
len]=0;
1773 DPRINT((0,
"function %s\n",szCurrentFunction));
1777 DPRINT((0,
"END of function %s\n",szCurrentFunction));
1778 szCurrentFunction[0]=0;
1799 DPRINT((0,
"ListSymbolStartingAt(): ulOffsetToGlobals = %x ulSizeofGlobals = %x\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
1802 pStr = (
LPSTR)((
ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
1807 while( pSym < pSymEnd )
1811 if(((pSym->Type == 0
x0) || (pSym->Type == 0x20) ) &&
1813 (pSym->SectionNumber > 0 ))
1816 ULONG section_flags;
1819 DPRINT((0,
"ListSymbolStartingAt(): pShdr[%x] = %x\n",pSym->SectionNumber,(
ULONG)pShdrThis));
1823 DPRINT((0,
"ListSymbolStartingAt(): pShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(
ULONG)pShdrThis));
1826 section_flags = pShdrThis->Characteristics;
1832 if(pSym->N.Name.Short){
1837 ASSERT(pSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings);
1838 pName = pStr+pSym->N.Name.Long;
1841 DPRINT((0,
"ListSymbolStartingAt(): pName = %x is not a valid pointer\n",
pName));
1847 if((pSym+pSym->NumberOfAuxSymbols+1)<(pSymEnd))
1848 return (
index+pSym->NumberOfAuxSymbols+1);
1850 index += pSym->NumberOfAuxSymbols + 1;
1851 pSym += pSym->NumberOfAuxSymbols + 1;
1947 DPRINT((0,
"success reading system map!\n"));
1952 DbgPrint(
"error reading ntoskrnl map!\n");
2000 DPRINT((0,
"Can't convert module name.\n"));
2003 DPRINT((0,
"LoadSymbols: filename %s, tempstr %S, conv: %d\n",
filename, tempstr, conv));
2008 DPRINT((0,
"LoadSymbols: hf: %x, file: %S\n",hf, tempstr));
2014 DPRINT((0,
"hf = %x\n",hf));
2022 DPRINT((0,
"pSymbols = %x\n",pSymbols));
2029 DPRINT((0,
"LoadSymbols(): success reading symbols!\n"));
2030 DPRINT((0,
"LoadSymbols(): pSymbols->magic = %X\n",pSymbols->magic));
2037 DPRINT((0,
"magic = %X\n",pSymbols->magic));
2038 DPRINT((0,
"name = %S\n",pSymbols->name));
2039 DPRINT((0,
"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader));
2040 DPRINT((0,
"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
2041 DPRINT((0,
"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings));
2042 DPRINT((0,
"ulOffsetToStabs,ulSizeOfStabs = %X,%X\n",pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs));
2043 DPRINT((0,
"ulOffsetToStabsStrings,ulSizeOfStabsStrings = %X,%X\n",pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings));
2044 DPRINT((0,
"ulOffsetToSrcFiles,ulNumberOfSrcFiles = %X,%X\n",pSymbols->ulOffsetToSrcFiles,pSymbols->ulNumberOfSrcFiles));
2045 DPRINT((0,
"pICE: symbols loaded for module \"%S\" @ %x\n",pSymbols->name,pSymbols));
2050 DPRINT((0,
"LoadSymbols(): freeing %x\n",pSymbols));
2119 LPSTR pConfig,pConfigEnd,pTemp;
2132 DPRINT((0,
"hf = %x\n",hf));
2140 DPRINT((0,
"pConfig = %x\n",pConfig));
2147 pConfigEnd = pConfig +
len;
2149 while(pConfig<pConfigEnd)
2152 while(*pConfig==
' ' && pConfig<pConfigEnd)
2157 while(*pConfig!=0 && *pConfig!=0x0a && *pConfig!=0x0d && pConfig<pConfigEnd)
2158 *pTemp++ = *pConfig++;
2162 while((*pConfig==0x0a || *pConfig==0x0d) && pConfig<pConfigEnd)
2173 if(!bIgnoreBootParams)
2187 else if(*
temp ==
'+')
2194 DPRINT((0,
"pICE: eTerminalMode = TERMINAL_MODE_VGA_TEXT\n"));
2199 DPRINT((0,
"pICE: eTerminalMode = TERMINAL_MODE_HERCULES_GRAPHICS\n"));
2204 DPRINT((0,
"pICE: eTerminalMode = TERMINAL_MODE_SERIAL\n"));
2209 DPRINT((0,
"pICE: found option, but no value\n"));
2213 else if(*
temp ==
'#')
2215 DPRINT((0,
"comment out\n"));
2220 DPRINT((0,
"Load symbols from file %s\n",
temp));
2222 DPRINT((0,
"Load symbols from file %s, pSymbols: %x\n",
temp, pSymbols));
2244 DPRINT((0,
"invalid line [%u] in config!\n",
line));
2260 DPRINT((0,
"pICE: config file not found! No symbols loaded.\n"));
2261 DPRINT((0,
"pICE: Please make sure to create a file \\systemroot\\symbols\\pice.conf\n"));
2262 DPRINT((0,
"pICE: if you want to have symbols for any module loaded.\n"));
2295 int nOffset=0,nNextOffset=0,nLen,strLen;
2298 static char SymbolName[1024];
2299 static char szCurrentPath[256];
2300 ULONG ulCurrentFileNumber=0;
2301 LPSTR pTypeDefIncluded;
2330 nOffset += nNextOffset;
2337 if(
pName[strLen-1]!=
'/')
2339 ulCurrentFileNumber++;
2343 DPRINT((0,
"changing source file %s\n",szCurrentPath));
2364 SymbolName[nLen] = 0;
2370 DPRINT((0,
"type number = %x, from %s\n",ulTypeNumber,
pName));
2371 *pulTypeNumber = ulTypeNumber;
2378 *pulFileNumber = ulCurrentFileNumber;
2379 DPRINT((0,
"file = %x\n",ulCurrentFileNumber));
2382 DPRINT((0,
"symbol includes type definition (%s)\n",pTypeDefIncluded));
2414 static char temp[1024];
2417 DPRINT((1,
"ExtractTypeName(%s)\n",
p));
2438 LONG lMinus = 1,lBase;
2441 DPRINT((0,
"ExtractNumber(): %s\n",
p));
2445 DPRINT((1,
"ExtractNumber(): [1] invalid page %x hit!\n",
p));
2457 DPRINT((1,
"ExtractNumber(): [2] invalid page %x hit!\n",
p));
2468 DPRINT((1,
"ExtractNumber(): [3] invalid page %x hit!\n",
p));
2479 DPRINT((1,
"ExtractNumber(): [4] invalid page %x hit!\n",
p));
2484 return (lNumber*lMinus);
2493 ULONG index_typenumber,type_number;
2497 DPRINT((1,
"ExtractArray(%s)\n",
p));
2527 pvr->
type = type_number;
2543 static char member_name[128];
2544 LONG bit_offset,bit_size,type_number,byte_size;
2546 LPSTR pTypeDef,pEqual;
2548 DPRINT((1,
"ExtractStructMembers(): %s\n",
p));
2559 DPRINT((1,
"ExtractStructMembers(): member_name = %s\n",member_name));
2566 DPRINT((1,
"ExtractStructMembers(): type_number = %x\n",type_number));
2580 DPRINT((1,
"ExtractStructMembers(): member is array\n"));
2593 DPRINT((1,
"ExtractStructMembers(): member is ptr\n"));
2596 DPRINT((1,
"ExtractStructMembers(): type_number = %x\n",type_number));
2601 DPRINT((1,
"ExtractStructMembers(): member is union\n"));
2602 while(*
p!=
';' && *(
p+1)!=
';' && *
p!=0)
p++;
2612 DPRINT((1,
"ExtractStructMembers(): bit_offset = %x\n",bit_offset));
2619 DPRINT((1,
"ExtractStructMembers(): bit_size = %x\n",bit_size));
2625 byte_size = (bit_size+1)/8;
2645 DPRINT((1,
"ExtractStructMembers(): member %s type %x bit_offset %x bit_size%x\n",member_name,type_number,bit_offset,bit_size));
2650 DPRINT((1,
"ExtractStructMembers(): pTypedef= %s\n",pTypeDef));
2657 DPRINT((1,
"ExtractStructMembers(): type_number = %x\n",type_number));
2675 LPSTR pTypeDef,pTypeName,pTypeBase,pSemiColon,pStructMembers;
2678 LONG lLowerRange,lUpperRange,lDelta;
2679 static char type_def[2048];
2681 DPRINT((1,
"EvaluateSymbol(%s)\n",pToken));
2685 DPRINT((1,
"EvaluateSymbol(%s) pvr->value = %x pvr->type = %x\n",pToken,pvr->
value,pvr->
type));
2692 pTypeDef = type_def;
2696 DPRINT((1,
"%s %s\n",pTypeName,pToken));
2720 DPRINT((1,
"%x is a self reference\n",pvr->
type));
2727 lDelta = lUpperRange-lLowerRange;
2728 DPRINT((1,
"bounds %x-%x range %x\n",lLowerRange,lUpperRange,lDelta));
2735 ulBytes = (ulBits+1)/8;
2738 DPRINT((1,
"# of bytes = %x\n",ulBytes));
2779 DPRINT((1,
"%x struct size = %x\n",pvr->
type,lLowerRange));
2790 pStructMembers = pTypeBase;
2803 DPRINT((1,
"EvaluateSymbol(): no type name\n"));
2837 DPRINT((1,
"EvaluateSymbol(): ptr is now %s\n",pStructMembers));
2839 while(*pStructMembers!=
';')
2858 DPRINT((1,
"DEFAULT %x, base: %c\n",pvr->
type, *pTypeBase));
2892 char SymbolToken[128];
2896 DPRINT((1,
"SymbolToken = %s\n",SymbolToken));
int PICE_close(HANDLE hFile)
PICE_SYMBOLFILE_HEADER * LoadSymbols(LPSTR filename)
BOOLEAN EvaluateSymbol(PVRET pvr, LPSTR pToken)
PDEBUG_MODULE IsModuleLoaded(LPSTR p)
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber, LPSTR pFilename, PDEBUG_MODULE pMod, PULONG pValue)
ULONG ExtractTypeNumber(LPSTR p)
PDIRECTORY_OBJECT * pNameSpaceRoot
BOOLEAN ScanExportLine(LPSTR p, PULONG ulValue, LPSTR *ppPtrToSymbol)
PICE_SYMBOLFILE_HEADER * apSymbols[32]
LONG ExtractNumber(LPSTR p)
PDEBUG_MODULE pCurrentMod
void Evaluate(PICE_SYMBOLFILE_HEADER *pSymbols, LPSTR p)
char * strstr(char *String1, char *String2)
PDEBUG_MODULE FindModuleFromAddress(ULONG addr)
int PICE_sprintf(char *buf, const char *fmt,...)
USHORT PICE_strlen(const char *s)
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
BOOLEAN ValidityCheckSymbols(PICE_SYMBOLFILE_HEADER *pSymbols)
PVOID HEADER_TO_BODY(POBJECT_HEADER obj)
char * PICE_strchr(char *s, char c)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
LPSTR FindTypeDefinitionForCombinedTypes(PICE_SYMBOLFILE_HEADER *pSymbols, ULONG ulTypeNumber, ULONG ulFileNumber)
BOOLEAN LoadSymbolsFromConfig(BOOLEAN bIgnoreBootParams)
struct _DEBUG_MODULE_ * next
char * PICE_strtok(char *szInputString)
BOOLEAN ListDriverModules(void)
void ExtractToken(LPSTR pStringToken)
void Print(USHORT Window, LPSTR p)
PVRET ExtractStructMembers(PVRET pvr, LPSTR p)
INT WINAPI PICE_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar)
char * PICE_strcpy(char *s1, char *s2)
BOOLEAN FindGlobalStabSymbol(LPSTR pExpression, PULONG pValue, PULONG pulTypeNumber, PULONG pulFileNumber)
LPSTR FindFunctionByAddress(ULONG ulValue, PULONG pulstart, PULONG pulend)
struct _STAB_ENTRY STAB_ENTRY
PICE_SYMBOLFILE_HEADER * pCurrentSymbols
#define DEBUG_MODULE_NAME_LEN
PICE_SYMBOLFILE_HEADER * pSymbols
LOCAL_VARIABLE local_vars[512]
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
char * PICE_strncpy(char *s1, char *s2, int len)
void * PICE_malloc(size_t numBytes, BOOLEAN fromPaged)
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
POBJECT FindDriverObjectDirectory(void)
BOOLEAN ReadHex(LPSTR p, PULONG pValue)
ETERMINALMODE eTerminalMode
struct _STAB_ENTRY * PSTAB_ENTRY
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
LPSTR ExtractTypeName(LPSTR p)
PLOCAL_VARIABLE FindLocalsByAddress(ULONG addr)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
TCHAR szCurrentFile[MAX_PATH]
VOID FreeModuleList(PDEBUG_MODULE pm)
BOOLEAN SanityCheckExports(void)
BOOLEAN Symbol(PVRET pvr)
LPSTR FindTypeDefinition(PICE_SYMBOLFILE_HEADER *pSymbols, ULONG ulTypeNumber, ULONG ulFileNumber)
struct _IMAGE_SYMBOL IMAGE_SYMBOL
struct _LIST_ENTRY * Flink
BOOLEAN IsRangeValid(ULONG Addr, ULONG Length)
char * PICE_strcat(char *s1, char *s2)
PEPROCESS NTAPI IoGetCurrentProcess(VOID)
BOOLEAN ConvertTokenToHex(LPSTR p, PULONG pValue)
struct task_struct * current
PDEBUG_MODULE pdebug_module_head
long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes)
GLenum const GLvoid * addr
LPSTR TruncateString(LPSTR p, char c)
POBJECT_HEADER BODY_TO_HEADER(PVOID body)
#define ExAllocatePool(type, size)
#define IMAGE_SCN_CNT_CODE
void CopyWideToAnsi(LPSTR pAnsi, PWSTR pWide)
BOOLEAN ListUserModules(PPEB peb)
BOOLEAN BuildModuleList(void)
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
BOOLEAN LoadExports(void)
BOOLEAN InitModuleList(PDEBUG_MODULE *ppmodule, ULONG len)
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
LPSTR FindSourceLineForAddress(ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
HANDLE PICE_open(LPCWSTR lpPathName, int iReadWrite)
BOOLEAN ScanExports(const char *pFind, PULONG pValue)
UNICODE_STRING FullDllName
UNICODE_STRING BaseDllName
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
struct _PICE_SYMBOLFILE_SOURCE PICE_SYMBOLFILE_SOURCE
BOOLEAN ReloadSymbols(void)
PDEBUG_MODULE FindModuleByName(LPSTR modname)
BOOLEAN Expression(PVRET pvr)
ULONG PICE_fnncmp(char *s1, char *s2, ULONG len)
ULONG PICE_fncmp(char *s1, char *s2)
_In_z_ PCWSTR _In_ ULONG ulType
ULONG StrLenUpToWhiteChar(LPSTR p, LPSTR WhiteChars)
WCHAR * PICE_wcscpy(WCHAR *str1, const WCHAR *str2)
WCHAR name[DEBUG_MODULE_NAME_LEN]
int strcmp(const char *String1, const char *String2)
BOOLEAN ScanExportsByAddress(LPSTR *pFind, ULONG ulValue)
PDEBUG_MODULE pdebug_module_tail
GLuint GLuint GLsizei GLenum type
size_t PICE_len(HANDLE hFile)
ULONG ListSymbolStartingAt(PDEBUG_MODULE pMod, PICE_SYMBOLFILE_HEADER *pSymbols, ULONG index, LPSTR pOutput)
LIST_ENTRY * pModuleListHead
BOOLEAN ExtractArray(PVRET pvr, LPSTR p)
struct _DEBUG_MODULE_ * PDEBUG_MODULE
#define IMAGE_SYM_CLASS_STATIC
base of all file and directory entries
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
void PICE_memset(void *p, unsigned char c, int sz)
#define IMAGE_SYM_CLASS_EXTERNAL
BOOLEAN IsAddressValid(ULONG address)
PICE_SYMBOLFILE_HEADER * FindModuleSymbolsByModuleName(LPSTR modname)
ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pd)
ULONG PICE_strcmpi(char *s1, char *s2)
VRET vrStructMembers[1024]
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL