ReactOS  0.4.14-dev-57-g333b8f1
symbols.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _LOCAL_VARIABLE
 
struct  _DEBUG_MODULE_SYMBOL_
 
struct  _DEBUG_MODULE_
 

Macros

#define KERNEL_START   (0xc0000000)
 

Typedefs

typedef struct _LOCAL_VARIABLE LOCAL_VARIABLE
 
typedef struct _LOCAL_VARIABLEPLOCAL_VARIABLE
 
typedef struct _DEBUG_MODULE_ DEBUG_MODULE
 
typedef struct _DEBUG_MODULE_PDEBUG_MODULE
 

Functions

BOOLEAN InitFakeKernelModule (void)
 
BOOLEAN LoadExports (void)
 
BOOLEAN SanityCheckExports (void)
 
void UnloadExports (void)
 
BOOLEAN ScanExports (const char *pFind, PULONG pValue)
 
BOOLEAN ScanExportsByAddress (LPSTR *pFind, ULONG ulValue)
 
PICE_SYMBOLFILE_HEADERLoadSymbols (LPSTR filename)
 
BOOLEAN LoadSymbolsFromConfig (BOOLEAN bIgnoreBootParams)
 
void UnloadSymbols (void)
 
BOOLEAN ReloadSymbols (void)
 
LPSTR FindFunctionByAddress (ULONG ulValue, PULONG pulstart, PULONG pulend)
 
LPSTR FindSourceLineForAddress (ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
 
PLOCAL_VARIABLE FindLocalsByAddress (ULONG addr)
 
ULONG FindFunctionInModuleByName (LPSTR szFunctionname, PDEBUG_MODULE pMod)
 
PICE_SYMBOLFILE_HEADERFindModuleSymbolsByModuleName (LPSTR modname)
 
BOOLEAN FindAddressForSourceLine (ULONG ulLineNumber, LPSTR pFilename, PDEBUG_MODULE pMod, PULONG pValue)
 
ULONG ConvertDecimalToUlong (LPSTR p)
 
PDEBUG_MODULE FindModuleFromAddress (ULONG addr)
 
PICE_SYMBOLFILE_HEADERFindModuleSymbols (ULONG addr)
 
ULONG ListSymbolStartingAt (PDEBUG_MODULE pMod, PICE_SYMBOLFILE_HEADER *pSymbols, ULONG index, LPSTR pOutput)
 
PDEBUG_MODULE FindModuleByName (LPSTR modname)
 
void Evaluate (PICE_SYMBOLFILE_HEADER *pSymbols, LPSTR p)
 
LONG ExtractNumber (LPSTR p)
 
LPSTR ExtractTypeName (LPSTR p)
 
PDEBUG_MODULE IsModuleLoaded (LPSTR p)
 

Variables

PICE_SYMBOLFILE_HEADERapSymbols [32]
 

Macro Definition Documentation

◆ KERNEL_START

#define KERNEL_START   (0xc0000000)

Definition at line 87 of file symbols.h.

Typedef Documentation

◆ DEBUG_MODULE

◆ LOCAL_VARIABLE

◆ PDEBUG_MODULE

◆ PLOCAL_VARIABLE

Function Documentation

◆ ConvertDecimalToUlong()

ULONG ConvertDecimalToUlong ( LPSTR  p)

◆ Evaluate()

void Evaluate ( PICE_SYMBOLFILE_HEADER pSymbols,
LPSTR  p 
)

Definition at line 2918 of file symbols.c.

2919 {
2920  ULONG i;
2921 
2922  PICE_memset(&vr,0,sizeof(vr));
2923  vr.pSymbols = pSymbols;
2924 
2925  pExpression = p;
2926  ulIndex=0;
2928  if(Expression(&vr))
2929  {
2930  DPRINT((1,"\nOK!\n"));
2931  DPRINT((1,"value = %x type = %x\n",vr.value,vr.type));
2932  if(vr.bStructType)
2933  {
2934  PICE_sprintf(tempSym,"struct %s %s @ %x\n",vr.type_name,p,vr.address);
2936  for(i=0;i<ulNumStructMembers;i++)
2937  {
2938  if(vrStructMembers[i].bArrayType)
2939  {
2940  PICE_sprintf(tempSym,"[%.8X %.8X] %s %s[%u]\n",
2942  vrStructMembers[i].size/8,
2943  vrStructMembers[i].type_name,
2945  vrStructMembers[i].size/8);
2946  }
2947  else if(vrStructMembers[i].bPtrType)
2948  {
2949  PICE_sprintf(tempSym,"[%.8X %.8X] %s* %s -> %x (%u)\n",
2951  vrStructMembers[i].size/8,
2952  vrStructMembers[i].type_name,
2956  }
2957  else
2958  {
2959  PICE_sprintf(tempSym,"[%.8X %.8X] %s %s = %x (%u)\n",
2961  vrStructMembers[i].size/8,
2962  vrStructMembers[i].type_name,
2966  }
2968  }
2969  }
2970  else if(vr.bArrayType)
2971  {
2972  Print(OUTPUT_WINDOW,"array\n");
2973  }
2974  else
2975  {
2976  PICE_sprintf(tempSym,"%s %s @ %x = %x (%u)\n",vr.type_name,p,vr.address,vr.value,vr.value);
2978  }
2979  }
2980  else
2981  {
2982  DPRINT((1,"\nERROR: code %x\n",vr.error));
2983  }
2984 }
ULONG ulNumStructMembers
Definition: symbols.c:96
char tempSym[1024]
Definition: symbols.c:58
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
VRET vr
Definition: symbols.c:94
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
Definition: glfuncs.h:248
PICE_SYMBOLFILE_HEADER * pSymbols
Definition: symbols.c:89
BOOLEAN bStructType
Definition: symbols.c:87
void DPRINT(...)
Definition: polytest.cpp:61
GLsizeiptr size
Definition: glext.h:5919
BOOLEAN bArrayType
Definition: symbols.c:88
GLuint address
Definition: glext.h:9393
ULONG type
Definition: symbols.c:78
char type_name[256]
Definition: symbols.c:85
ULONG error
Definition: symbols.c:80
ULONG value
Definition: symbols.c:77
ULONG ulIndex
Definition: symbols.c:92
ULONG address
Definition: symbols.c:83
LPSTR pExpression
Definition: symbols.c:93
BOOLEAN Expression(PVRET pvr)
Definition: symbols.c:2906
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
void PICE_memset(void *p, unsigned char c, int sz)
Definition: utils.c:228
VRET vrStructMembers[1024]
Definition: symbols.c:95

Referenced by COMMAND_PROTOTYPE().

◆ ExtractNumber()

LONG ExtractNumber ( LPSTR  p)

Definition at line 2436 of file symbols.c.

2437 {
2438  LONG lMinus = 1,lBase;
2439  ULONG lNumber = 0;
2440 
2441  DPRINT((0,"ExtractNumber(): %s\n",p));
2442 
2443  if(!IsAddressValid((ULONG)p) )
2444  {
2445  DPRINT((1,"ExtractNumber(): [1] invalid page %x hit!\n",p));
2446  return 0;
2447  }
2448 
2449  if(*p == '-')
2450  {
2451  lMinus = -1;
2452  p++;
2453  }
2454 
2455  if(!IsAddressValid((ULONG)p) )
2456  {
2457  DPRINT((1,"ExtractNumber(): [2] invalid page %x hit!\n",p));
2458  return 0;
2459  }
2460 
2461  if(*p != '0') // non-octal -> decimal number
2462  lBase = 10;
2463  else
2464  lBase = 8;
2465 
2466  if(!IsAddressValid((ULONG)p) )
2467  {
2468  DPRINT((1,"ExtractNumber(): [3] invalid page %x hit!\n",p));
2469  return 0;
2470  }
2471 
2472  while(PICE_isdigit(*p))
2473  {
2474  lNumber *= lBase;
2475  lNumber += *p-'0';
2476  p++;
2477  if(!IsAddressValid((ULONG)p) )
2478  {
2479  DPRINT((1,"ExtractNumber(): [4] invalid page %x hit!\n",p));
2480  return 0;
2481  }
2482  }
2483 
2484  return (lNumber*lMinus);
2485 }
int PICE_isdigit(int c)
Definition: utils.c:337
long LONG
Definition: pedump.c:60
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611

Referenced by ConvertTokenToLineNumber(), EvaluateSymbol(), ExtractArray(), ExtractStructMembers(), and ExtractTypeNumber().

◆ ExtractTypeName()

LPSTR ExtractTypeName ( LPSTR  p)

Definition at line 2412 of file symbols.c.

2413 {
2414  static char temp[1024];
2415  ULONG i;
2416 
2417  DPRINT((1,"ExtractTypeName(%s)\n",p));
2418 
2419  for(i=0;IsAddressValid((ULONG)p) && *p!=0 && *p!=':';i++,p++)
2420  temp[i] = *p;
2421 
2422  if(!IsAddressValid((ULONG)p) )
2423  {
2424  DPRINT((1,"hit invalid page %x!\n",(ULONG)p));
2425  }
2426 
2427  temp[i]=0;
2428 
2429  return temp;
2430 }
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
Definition: glfuncs.h:248
void DPRINT(...)
Definition: polytest.cpp:61
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611

Referenced by EvaluateSymbol(), ExtractArray(), and ExtractStructMembers().

◆ FindAddressForSourceLine()

BOOLEAN FindAddressForSourceLine ( ULONG  ulLineNumber,
LPSTR  pFilename,
PDEBUG_MODULE  pMod,
PULONG  pValue 
)

Definition at line 1689 of file symbols.c.

1690 {
1691  ULONG i;
1692  PSTAB_ENTRY pStab;
1693  LPSTR pStr,pName;
1694  int nStabLen;
1695  int nOffset=0,nNextOffset=0;
1696  PICE_SYMBOLFILE_HEADER* pSymbols;
1697  static char szCurrentFunction[256];
1698  static char szCurrentPath[256];
1699  ULONG strLen,addr,ulMinValue=0xFFFFFFFF;
1700  BOOLEAN bFound = FALSE;
1701 
1702  DPRINT((0,"FindAddressForSourceLine(%u,%s,%x)\n",ulLineNumber,pFilename,(ULONG)pMod));
1703 
1704  addr = (ULONG)pMod->BaseAddress;
1705 
1706  pSymbols = FindModuleSymbols(addr);
1707  if(pSymbols)
1708  {
1709  pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs);
1710  nStabLen = pSymbols->ulSizeOfStabs;
1711  pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings);
1712 
1713  for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++)
1714  {
1715  pName = &pStr[pStab->n_strx + nOffset];
1716 
1717  switch(pStab->n_type)
1718  {
1719  case N_UNDF:
1720  nOffset += nNextOffset;
1721  nNextOffset = pStab->n_value;
1722  break;
1723  case N_SO:
1724  if((strLen = PICE_strlen(pName)))
1725  {
1726  if(pName[strLen-1]!='/')
1727  {
1728  if(PICE_strlen(szCurrentPath))
1729  {
1730  PICE_strcat(szCurrentPath,pName);
1731  DPRINT((0,"changing source file %s\n",szCurrentPath));
1732  }
1733  else
1734  {
1735  DPRINT((0,"changing source file %s\n",pName));
1736  PICE_strcpy(szCurrentPath,pName);
1737  }
1738  }
1739  else
1740  PICE_strcpy(szCurrentPath,pName);
1741  }
1742  else
1743  {
1744  szCurrentPath[0]=0;
1745  }
1746  break;
1747  case N_SLINE:
1748  // if we're in the function we're looking for
1749  if(PICE_strcmpi(pFilename,szCurrentPath)==0)
1750  {
1751  if(pStab->n_desc>=ulLineNumber && (pStab->n_desc-ulLineNumber)<=ulMinValue)
1752  {
1753  ulMinValue = pStab->n_desc-ulLineNumber;
1754 
1755  DPRINT((0,"code source line number #%u for offset %x in function @ %s)\n",pStab->n_desc,pStab->n_value,szCurrentFunction));
1756  addr = FindFunctionInModuleByName(szCurrentFunction,pMod);
1757  if(addr)
1758  {
1759  *pValue = addr + pStab->n_value;
1760  bFound = TRUE;
1761  }
1762  }
1763  }
1764  break;
1765  case N_FUN:
1766  if(PICE_strlen(pName))
1767  {
1768  ULONG len;
1769 
1771  PICE_strncpy(szCurrentFunction,pName,len);
1772  szCurrentFunction[len]=0;
1773  DPRINT((0,"function %s\n",szCurrentFunction));
1774  }
1775  else
1776  {
1777  DPRINT((0,"END of function %s\n",szCurrentFunction));
1778  szCurrentFunction[0]=0;
1779  }
1780  break;
1781  }
1782  pStab++;
1783  }
1784  }
1785  return bFound;
1786 }
#define TRUE
Definition: types.h:120
unsigned short n_desc
Definition: shared.h:97
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
char * LPSTR
Definition: xmlstorage.h:182
unsigned long n_value
Definition: shared.h:98
#define N_FUN
Definition: stabs.c:95
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
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
Definition: glfuncs.h:248
struct _STAB_ENTRY STAB_ENTRY
unsigned char BOOLEAN
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
char * PICE_strncpy(char *s1, char *s2, int len)
Definition: utils.c:286
void DPRINT(...)
Definition: polytest.cpp:61
#define N_UNDF
Definition: stabs.c:88
struct _STAB_ENTRY * PSTAB_ENTRY
static LPSTR pName
Definition: security.c:75
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
#define N_SLINE
Definition: stabs.c:103
ULONG ulOffsetToStabsStrings
Definition: shared.h:88
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long n_strx
Definition: shared.h:94
GLenum GLsizei len
Definition: glext.h:6722
Definition: shared.h:92
#define N_SO
Definition: stabs.c:105
ULONG StrLenUpToWhiteChar(LPSTR p, LPSTR WhiteChars)
Definition: parse.c:3816
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
unsigned char n_type
Definition: shared.h:95
ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pd)
Definition: symbols.c:955
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387

Referenced by ConvertTokenToLineNumber().

◆ FindFunctionByAddress()

LPSTR FindFunctionByAddress ( ULONG  ulValue,
PULONG  pulstart,
PULONG  pulend 
)

Definition at line 767 of file symbols.c.

768 {
769  PIMAGE_SYMBOL pSym, pSymEnd, pFoundSym;
770  LPSTR pStr;
771  PIMAGE_SECTION_HEADER pShdr;
772  PDEBUG_MODULE pd;
773  PDEBUG_MODULE pdTemp;
774  PICE_SYMBOLFILE_HEADER* pSymbols;
775  ULONG start,end;
776  static char temp4[256];
777  LPSTR pName;
778 
779  pSymbols = FindModuleSymbols(ulValue);
780  DPRINT((0,"FindFunctionByAddress(): symbols for %S @ %x \n",pSymbols->name,(ULONG)pSymbols));
781  if(pSymbols && pdebug_module_head)
782  {
783  DPRINT((0,"looking up symbol\n"));
784  pd = pdebug_module_head;
785  do
786  {
787  ASSERT(pd->size);
788  pdTemp = pd;
789 
790  //initial values for start and end.
791  start = (ULONG)pdTemp->BaseAddress;
792  end = start+pdTemp->size;
793 
794  DPRINT((0,"FindFunctionByAddress(): ulValue %x\n",ulValue));
795 
796  if(ulValue>=start && ulValue<end)
797  {
798  DPRINT((0,"FindFunctionByAddress(): address matches %S\n",(ULONG)pdTemp->name));
799  if(PICE_wcsicmp(pdTemp->name,pSymbols->name) == 0)
800  {
801  DPRINT((0,"found symbols for module %S\n",pdTemp->name));
802  pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
803  pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
804  pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
805  pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
806 
807  if(!IsRangeValid((ULONG)pSym,sizeof(IMAGE_SYMBOL) ) ) //should we actually check all the symbols here?
808  {
809  DPRINT((0,"FindFunctionByAddress(): pSym = %x is not a valid pointer\n",(ULONG)pSym));
810  return FALSE;
811  }
812  DPRINT((0,"pSym = %x\n",pSym));
813  DPRINT((0,"pStr = %x\n",pStr));
814  DPRINT((0,"pShdr = %x\n",pShdr));
815 
816  while( pSym < pSymEnd )
817  {
818  //symbol is a function is it's type is 0x20, and section>0
819  if(( (pSym->Type == 0x20) &&
820  (pSym->SectionNumber > 0 )))
821  {
822  ULONG ulCurrAddr;
823  PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1);
824 
825  DPRINT((0,"FindFunctionByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis));
826 
827  if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) )
828  {
829  DPRINT((0,"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis));
830  return FALSE;
831  }
832  //to get address in the memory we base address of the module and
833  //add offset of the section and then add offset of the symbol from
834  //the begining of the section
835  ulCurrAddr = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
836  DPRINT((0,"FindFunctionByAddress(): CurrAddr [1] = %x\n",ulCurrAddr));
837  DPRINT((0,"%x ", ulCurrAddr));
838 
839  if(ulCurrAddr<=ulValue && ulCurrAddr>start)
840  {
841  start = ulCurrAddr;
842  pFoundSym = pSym;
843  //DPRINT((0,"FindFunctionByAddress(): CANDIDATE for start %x\n",start));
844  }
845  else if(ulCurrAddr>=ulValue && ulCurrAddr<end)
846  {
847  end = ulCurrAddr;
848  //DPRINT((0,"FindFunctionByAddress(): CANDIDATE for end %x\n",end));
849  }
850  }
851  //skip the auxiliary symbols and get the next symbol
852  pSym += pSym->NumberOfAuxSymbols + 1;
853  }
854  //we went through all the symbols for this module
855  //now start should point to the start of the function and
856  //end to the start of the next (or end of section)
857  if(pulstart)
858  *pulstart = start;
859 
860  if(pulend){
861  //just in case there is more than one code section
862  PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pFoundSym->SectionNumber-1);
863  if( end > (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData ){
864  DPRINT((0,"Hmm: end=%d, end of section: %d\n", end, (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData));
865  end = (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData;
866  }
867  *pulend = end;
868  }
869 
870  if(pFoundSym->N.Name.Short){
871  //name is in the header. it's not zero terminated. have to copy.
872  PICE_sprintf(temp4,"%.8s", pFoundSym->N.ShortName);
873  pName = temp4;
874  DPRINT((0,"Function name: %S!%.8s",pdTemp->name,pName));
875  }
876  else{
877  ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
878  pName = pStr+pFoundSym->N.Name.Long;
879  if(!IsAddressValid((ULONG)pName))
880  {
881  DPRINT((0,"FindFunctionByAddress(): pName = %x is not a valid pointer\n",pName));
882  return NULL;
883  }
884  DPRINT((0,"Function name: %S!%s",pdTemp->name,pName));
885  }
886  return pName;
887  }
888  }
889  }while((pd = pd->next) != pdebug_module_tail);
890  }
891  return NULL;
892 }
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
Definition: utils.c:504
GLuint GLuint end
Definition: gl.h:1545
char * LPSTR
Definition: xmlstorage.h:182
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
smooth NULL
Definition: ftsmooth.c:416
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: shared.h:83
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
struct _IMAGE_SYMBOL IMAGE_SYMBOL
static LPSTR pName
Definition: security.c:75
BOOLEAN IsRangeValid(ULONG Addr, ULONG Length)
Definition: utils.c:735
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
GLuint start
Definition: gl.h:1545
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45
ULONG ulSizeOfGlobalsStrings
Definition: shared.h:86
ULONG ulOffsetToGlobalsStrings
Definition: shared.h:86
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:241

Referenced by COMMAND_PROTOTYPE(), FindLocalsByAddress(), FindSourceLineForAddress(), IntelStackWalk(), ListSWBreakpoints(), UnassembleOneLineUp(), and UnassembleOnePageUp().

◆ FindFunctionInModuleByName()

ULONG FindFunctionInModuleByName ( LPSTR  szFunctionname,
PDEBUG_MODULE  pMod 
)

Definition at line 955 of file symbols.c.

956 {
957  ULONG i,addr;
958  PICE_SYMBOLFILE_HEADER* pSymbols=NULL;
959  PIMAGE_SYMBOL pSym, pSymEnd;
960  LPSTR pStr;
961  PIMAGE_SECTION_HEADER pShdr;
962 
963  ENTER_FUNC();
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));
967 
968  addr = (ULONG)pd->BaseAddress;
969 
970  pSymbols = FindModuleSymbols(addr);
971  if(pSymbols)
972  {
973  DPRINT((0,"FindFunctionInModuleByName(): found symbol table for %S\n",pSymbols->name));
974  pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
975  pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
976  pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
977  pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
978 
979  while( pSym < pSymEnd )
980  {
981  //symbol is a function is it's type is 0x20, storage class is external and section>0
982  //if(( (pSym->Type == 0x20) && (pSym->StorageClass==IMAGE_SYM_CLASS_EXTERNAL) &&
983  // (pSym->SectionNumber > 0 )))
984 
985  if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) &&
986  ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) || (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)) &&
987  (pSym->SectionNumber > 0 ))
988 
989  {
990  ULONG start;
991  LPSTR pName;
992  PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1);
993 
994  start = ((ULONG)pd->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
995  DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",szFunctionname,start));
996 
997  if(pSym->N.Name.Short){ //if name is stored in the structure
998  //name may be not zero terminated but 8 characters max
999  DPRINT((0,"FindFunctionInModuleByName: %.8s\n", pSym->N.ShortName));
1000  pName = pSym->N.ShortName; //name is in the header
1001  if((PICE_fnncmp(pName,szFunctionname, 8) == 0) && start)
1002  {
1003  DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table, start: %x\n", start));
1004  LEAVE_FUNC();
1005  return start;
1006  }
1007  }else{
1008  pName = pStr+pSym->N.Name.Long;
1009  DPRINT((0,"FindFunctionInModuleByName: %s\n", pName));
1010  if((PICE_fncmp(pName,szFunctionname) == 0) && start)
1011  {
1012  DPRINT((0,"FindFunctionInModuleByName(): symbol was in string table, start: %x\n", start));
1013  LEAVE_FUNC();
1014  return start;
1015  }
1016  }
1017  }
1018  //skip the auxiliary symbols and get the next symbol
1019  pSym += pSym->NumberOfAuxSymbols + 1;
1020  }
1021  }
1022  LEAVE_FUNC();
1023  return 0;
1024 }
GLint x0
Definition: linetemp.h:95
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
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
Definition: glfuncs.h:248
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
smooth NULL
Definition: ftsmooth.c:416
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: shared.h:83
void DPRINT(...)
Definition: polytest.cpp:61
static LPSTR pName
Definition: security.c:75
GLenum const GLvoid * addr
Definition: glext.h:9621
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
GLuint start
Definition: gl.h:1545
ULONG PICE_fnncmp(char *s1, char *s2, ULONG len)
Definition: utils.c:465
ULONG PICE_fncmp(char *s1, char *s2)
Definition: utils.c:434
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
ULONG ulOffsetToGlobalsStrings
Definition: shared.h:86
#define IMAGE_SYM_CLASS_STATIC
Definition: winnt_old.h:783
#define IMAGE_SYM_CLASS_EXTERNAL
Definition: compat.h:138
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:241

Referenced by ConvertTokenToSymbol(), FindAddressForSourceLine(), FindGlobalStabSymbol(), RevirtualizeBreakpointsForModule(), and TryToInstallVirtualSWBreakpoints().

◆ FindLocalsByAddress()

PLOCAL_VARIABLE FindLocalsByAddress ( ULONG  addr)

Definition at line 1317 of file symbols.c.

1318 {
1319  ULONG i;
1320  PSTAB_ENTRY pStab;
1321  LPSTR pStr,pName;
1322  int nStabLen;
1323  int nOffset=0,nNextOffset=0;
1324  PICE_SYMBOLFILE_HEADER* pSymbols;
1325  static char szCurrentFunction[256];
1326  static char szCurrentPath[256];
1327  LPSTR pFunctionName;
1328  ULONG start,end,strLen;
1329  ULONG ulTypeNumber,ulCurrentFileNumber=0;
1330  LPSTR pTypedef;
1331  ULONG ulNumLocalVars=0;
1332 
1333  DPRINT((0,"FindLocalsByAddress()\n"));
1334 
1335  pFunctionName = FindFunctionByAddress(addr,&start,&end);
1336  DPRINT((0,"FindLocalsByAddress(): pFunctionName = %s\n",pFunctionName));
1337  if(pFunctionName)
1338  {
1339  pSymbols = FindModuleSymbols(addr);
1340  if(pSymbols)
1341  {
1342  pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs);
1343  nStabLen = pSymbols->ulSizeOfStabs;
1344  pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings);
1345 
1346  for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++)
1347  {
1348  pName = &pStr[pStab->n_strx + nOffset];
1349 
1350  DPRINT((0,"FindLocalsByAddress(): %x %x %x %x %x\n",
1351  pStab->n_strx,
1352  pStab->n_type,
1353  pStab->n_other,
1354  pStab->n_desc,
1355  pStab->n_value));
1356 
1357  switch(pStab->n_type)
1358  {
1359  case N_UNDF:
1360  nOffset += nNextOffset;
1361  nNextOffset = pStab->n_value;
1362  break;
1363  case N_SO:
1364  if((strLen = PICE_strlen(pName)))
1365  {
1366  if(pName[strLen-1]!='/')
1367  {
1368  ulCurrentFileNumber++;
1369  if(PICE_strlen(szCurrentPath))
1370  {
1371  PICE_strcat(szCurrentPath,pName);
1372  DPRINT((0,"changing source file1 %s, %u\n",szCurrentPath,ulCurrentFileNumber));
1373  }
1374  else
1375  {
1376  DPRINT((0,"changing source file %s, %u\n",pName,ulCurrentFileNumber));
1377  }
1378  }
1379  else
1380  PICE_strcpy(szCurrentPath,pName);
1381  }
1382  else
1383  {
1384  szCurrentPath[0]=0;
1385  }
1386  break;
1387  case N_LSYM:
1388  // if we're in the function we're looking for
1389  if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1390  {
1391  DPRINT((0,"local variable1 %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName));
1392  ulTypeNumber = ExtractTypeNumber(pName);
1393  DPRINT((0,"type number = %u\n",ulTypeNumber));
1394  if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber)))
1395  {
1396  DPRINT((0,"pTypedef: %x\n", pTypedef));
1397  PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':'));
1398  PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':'));
1399  local_vars[ulNumLocalVars].value = (CurrentEBP+pStab->n_value);
1400  local_vars[ulNumLocalVars].offset = pStab->n_value;
1401  local_vars[ulNumLocalVars].line = pStab->n_desc;
1402  local_vars[ulNumLocalVars].bRegister = FALSE;
1403  ulNumLocalVars++;
1404  }
1405  }
1406  break;
1407  case N_PSYM:
1408  // if we're in the function we're looking for
1409  if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1410  {
1411  DPRINT((0,"parameter variable %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName));
1412  ulTypeNumber = ExtractTypeNumber(pName);
1413  DPRINT((0,"type number = %x\n",ulTypeNumber));
1414  if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber)))
1415  {
1416  PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':'));
1417  PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':'));
1418  local_vars[ulNumLocalVars].value = (CurrentEBP+pStab->n_value);
1419  local_vars[ulNumLocalVars].offset = pStab->n_value;
1420  ulNumLocalVars++;
1421  }
1422  }
1423  break;
1424  case N_RSYM:
1425  // if we're in the function we're looking for
1426  if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1427  {
1428  DPRINT((0,"local variable2 %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName));
1429  ulTypeNumber = ExtractTypeNumber(pName);
1430  DPRINT((0,"type number = %x\n",ulTypeNumber));
1431  if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber)))
1432  {
1433  PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':'));
1434  PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':'));
1435  local_vars[ulNumLocalVars].value = (LocalRegs[pStab->n_value]);
1436  local_vars[ulNumLocalVars].offset = pStab->n_value;
1437  local_vars[ulNumLocalVars].line = pStab->n_desc;
1438  local_vars[ulNumLocalVars].bRegister = TRUE;
1439  ulNumLocalVars++;
1440  }
1441  }
1442  break;
1443  case N_FUN:
1444  if(PICE_strlen(pName))
1445  {
1446  ULONG len;
1447 
1449  PICE_strncpy(szCurrentFunction,pName,len);
1450  szCurrentFunction[len]=0;
1451  DPRINT((0,"function %s\n",szCurrentFunction));
1452  }
1453  else
1454  {
1455  DPRINT((0,"END of function %s\n",szCurrentFunction));
1456  szCurrentFunction[0]=0;
1457  if(ulNumLocalVars)
1458  {
1459  *local_vars[ulNumLocalVars].name = 0;
1460  return local_vars;
1461  }
1462  }
1463  break;
1464  }
1465  pStab++;
1466  }
1467  }
1468  }
1469  return NULL;
1470 }
#define TRUE
Definition: types.h:120
unsigned short n_desc
Definition: shared.h:97
ULONG ExtractTypeNumber(LPSTR p)
Definition: symbols.c:1030
PULONG LocalRegs[]
Definition: symbols.c:61
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
GLuint GLuint end
Definition: gl.h:1545
ULONG offset
Definition: symbols.h:36
char * LPSTR
Definition: xmlstorage.h:182
unsigned long n_value
Definition: shared.h:98
#define N_FUN
Definition: stabs.c:95
#define N_PSYM
Definition: stabs.c:110
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
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
Definition: glfuncs.h:248
LPSTR FindFunctionByAddress(ULONG ulValue, PULONG pulstart, PULONG pulend)
Definition: symbols.c:767
struct _STAB_ENTRY STAB_ENTRY
LOCAL_VARIABLE local_vars[512]
Definition: symbols.c:51
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
char * PICE_strncpy(char *s1, char *s2, int len)
Definition: utils.c:286
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define N_LSYM
Definition: stabs.c:107
#define N_UNDF
Definition: stabs.c:88
struct _STAB_ENTRY * PSTAB_ENTRY
LPSTR FindTypeDefinition(PICE_SYMBOLFILE_HEADER *pSymbols, ULONG ulTypeNumber, ULONG ulFileNumber)
Definition: symbols.c:1179
unsigned char n_other
Definition: shared.h:96
static LPSTR pName
Definition: security.c:75
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
char name[64]
Definition: symbols.h:35
ULONG ulOffsetToStabsStrings
Definition: shared.h:88
ULONG value
Definition: symbols.h:36
GLenum const GLvoid * addr
Definition: glext.h:9621
#define N_RSYM
Definition: stabs.c:102
LPSTR TruncateString(LPSTR p, char c)
Definition: symbols.c:1296
unsigned long n_strx
Definition: shared.h:94
GLenum GLsizei len
Definition: glext.h:6722
BOOLEAN bRegister
Definition: symbols.h:37
Definition: shared.h:92
#define N_SO
Definition: stabs.c:105
GLuint start
Definition: gl.h:1545
ULONG CurrentEBP
Definition: shell.c:115
ULONG PICE_fncmp(char *s1, char *s2)
Definition: utils.c:434
Definition: name.c:36
ULONG StrLenUpToWhiteChar(LPSTR p, LPSTR WhiteChars)
Definition: parse.c:3816
unsigned int ULONG
Definition: retypes.h:1
unsigned char n_type
Definition: shared.h:95
ULONG line
Definition: symbols.h:36

Referenced by COMMAND_PROTOTYPE().

◆ FindModuleByName()

PDEBUG_MODULE FindModuleByName ( LPSTR  modname)

Definition at line 539 of file symbols.c.

540 {
541  PDEBUG_MODULE pd;
542  WCHAR tempstr[DEBUG_MODULE_NAME_LEN];
543 
544  DPRINT((0,"FindModuleFromAddress()\n"));
545  if( !PICE_MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) )
546  {
547  DPRINT((0,"Can't convert module name.\n"));
548  return NULL;
549  }
550 
551  if(BuildModuleList())
552  {
553  pd = pdebug_module_head;
554  do
555  {
556  if(pd->size)
557  {
558  if(PICE_wcsicmp(tempstr,pd->name) == 0)
559  {
560  DPRINT((0,"FindModuleByName(): found %S\n",pd->name));
561  return pd;
562  }
563  }
564  }while((pd = pd->next) != pdebug_module_tail);
565  }
566 
567  return NULL;
568 }
#define CP_ACP
Definition: compat.h:99
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
Definition: utils.c:504
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
INT WINAPI PICE_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar)
Definition: utils.c:2335
#define DEBUG_MODULE_NAME_LEN
Definition: shared.h:79
smooth NULL
Definition: ftsmooth.c:416
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45

◆ FindModuleFromAddress()

PDEBUG_MODULE FindModuleFromAddress ( ULONG  addr)

Definition at line 507 of file symbols.c.

508 {
509  PDEBUG_MODULE pd;
510  ULONG start,end;
511 
512  DPRINT((0,"FindModuleFromAddress()\n"));
513  if(BuildModuleList())
514  {
515  pd = pdebug_module_head;
516  do
517  {
518  if(pd->size)
519  {
520  start = (ULONG)pd->BaseAddress;
521  end = start + pd->size;
522  DPRINT((0,"FindModuleFromAddress(): %S %x-%x\n",pd->name,start,end));
523  if(addr>=start && addr<end)
524  {
525  DPRINT((0,"FindModuleFromAddress(): found %S\n",pd->name));
526  return pd;
527  }
528  }
529  }while((pd = pd->next)!=pdebug_module_tail);
530  }
531 
532  return NULL;
533 }
GLuint GLuint end
Definition: gl.h:1545
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
smooth NULL
Definition: ftsmooth.c:416
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
GLenum const GLvoid * addr
Definition: glext.h:9621
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
GLuint start
Definition: gl.h:1545
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45

Referenced by COMMAND_PROTOTYPE(), and ListSWBreakpoints().

◆ FindModuleSymbols()

PICE_SYMBOLFILE_HEADER* FindModuleSymbols ( ULONG  addr)

Definition at line 463 of file symbols.c.

464 {
465  ULONG start,end,i;
467 
468  DPRINT((0,"FindModuleSymbols(%x)\n",addr));
469  if(BuildModuleList())
470  {
471  i=0;
472  pd = pdebug_module_head;
473  do
474  {
475  DPRINT((0,"pd: %x\n", pd));
476  if(pd->size)
477  {
478  start = (ULONG)pd->BaseAddress;
479  end = start + pd->size;
480  DPRINT((0,"FindModuleSymbols(): %S %x-%x\n",pd->name,start,end));
481  if(addr>=start && addr<end)
482  {
483  DPRINT((0,"FindModuleSymbols(): address matches %S %x-%x\n",pd->name,start,end));
484  for(i=0;i<ulNumSymbolsLoaded;i++)
485  {
486  DPRINT((0,"%S -", apSymbols[i]->name ));
487  if(PICE_wcsicmp(pd->name,apSymbols[i]->name) == 0)
488  {
490  return apSymbols[i];
491  else
492  return NULL;
493  }
494  }
495  }
496  }
497  }while((pd = pd->next) != pdebug_module_tail);
498  }
499 
500  return NULL;
501 }
ULONG ulNumSymbolsLoaded
Definition: symbols.c:54
PICE_SYMBOLFILE_HEADER * apSymbols[32]
Definition: symbols.c:53
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
Definition: utils.c:504
BOOLEAN ValidityCheckSymbols(PICE_SYMBOLFILE_HEADER *pSymbols)
Definition: symbols.c:442
GLuint GLuint end
Definition: gl.h:1545
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: shared.h:83
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
GLenum const GLvoid * addr
Definition: glext.h:9621
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
GLuint start
Definition: gl.h:1545
Definition: name.c:36
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45

Referenced by COMMAND_PROTOTYPE(), FindAddressForSourceLine(), FindFunctionByAddress(), FindFunctionInModuleByName(), FindGlobalStabSymbol(), FindLocalsByAddress(), FindSourceLineForAddress(), and ScanExportsByAddress().

◆ FindModuleSymbolsByModuleName()

PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName ( LPSTR  modname)

Definition at line 574 of file symbols.c.

575 {
576  ULONG i;
577  WCHAR tempstr[DEBUG_MODULE_NAME_LEN];
578 
579  DPRINT((0,"FindModuleSymbols()\n"));
580  if( !PICE_MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) )
581  {
582  DPRINT((0,"Can't convert module name in FindModuleSymbols.\n"));
583  return NULL;
584  }
585 
586  for(i=0;i<ulNumSymbolsLoaded;i++)
587  {
588  if(PICE_wcsicmp(tempstr,apSymbols[i]->name) == 0)
589  return apSymbols[i];
590  }
591 
592  return NULL;
593 }
ULONG ulNumSymbolsLoaded
Definition: symbols.c:54
PICE_SYMBOLFILE_HEADER * apSymbols[32]
Definition: symbols.c:53
#define CP_ACP
Definition: compat.h:99
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
Definition: utils.c:504
INT WINAPI PICE_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar)
Definition: utils.c:2335
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
Definition: glfuncs.h:248
#define DEBUG_MODULE_NAME_LEN
Definition: shared.h:79
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1

◆ FindSourceLineForAddress()

LPSTR FindSourceLineForAddress ( ULONG  addr,
PULONG  pulLineNumber,
LPSTR ppSrcStart,
LPSTR ppSrcEnd,
LPSTR ppFilename 
)

Definition at line 1476 of file symbols.c.

1477 {
1478  ULONG i; // index for walking through STABS
1479  PSTAB_ENTRY pStab; // pointer to STABS
1480  LPSTR pStr,pName; // pointer to STAB strings and current STAB string
1481  int nStabLen; // length of STAB section in bytes
1482  int nOffset=0,nNextOffset=0; // offset and next offset in string table
1483  PICE_SYMBOLFILE_HEADER* pSymbols; // pointer to module's STAB symbol table
1484  static char szCurrentFunction[256];
1485  static char szCurrentPath[256];
1486  static char szWantedPath[256];
1487  LPSTR pFunctionName; // name of function that brackets the current address
1488  ULONG start,end,strLen,ulMinValue=0xFFFFFFFF;
1489  LPSTR pSrcLine=NULL;
1490  BOOLEAN bFirstOccurence = TRUE;
1491 
1492  // lookup the functions name and start-end (external symbols)
1493  pFunctionName = FindFunctionByAddress(addr,&start,&end);
1494  DPRINT((0,"FindSourceLineForAddress: for function: %s\n", pFunctionName));
1495 
1496  if(pFunctionName)
1497  {
1498  // lookup the modules symbol table (STABS)
1499  pSymbols = FindModuleSymbols(addr);
1500  DPRINT((0,"FindSourceLineForAddress: pSymbols %x\n", pSymbols));
1501  if(pSymbols)
1502  {
1503  DPRINT((0,"FindSourceLineForAddress: pSymbols->ulNumberOfSrcFiles %x\n", pSymbols->ulNumberOfSrcFiles));
1504  // no source files so we don't need to lookup anything
1505  if(!pSymbols->ulNumberOfSrcFiles)
1506  return NULL;
1507 
1508  // prepare STABS access
1509  pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs);
1510  nStabLen = pSymbols->ulSizeOfStabs;
1511  pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings);
1512 
1513  // walk over all STABS
1514  for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++)
1515  {
1516  // the name string corresponding to the STAB
1517  pName = &pStr[pStab->n_strx + nOffset];
1518 
1519  // switch STAB type
1520  switch(pStab->n_type)
1521  {
1522  // change offset of name strings
1523  case N_UNDF:
1524  nOffset += nNextOffset;
1525  nNextOffset = pStab->n_value;
1526  break;
1527  // source file change
1528  case N_SO:
1529  DPRINT((0,"changing source file %s\n",pName));
1530  // if filename has a length record it
1531  if((strLen = PICE_strlen(pName)))
1532  {
1533  PICE_strcpy(szCurrentPath,pName);
1534  }
1535  // else empty filename
1536  else
1537  {
1538  szCurrentPath[0]=0;
1539  }
1540  break;
1541  // sub-source file change
1542  case N_SOL:
1543  DPRINT((0,"changing sub source file %s\n",pName));
1544  // if filename has a length record it
1545  if((strLen = PICE_strlen(pName)))
1546  {
1547  PICE_strcpy(szCurrentPath,pName);
1548  }
1549  // else empty filename
1550  else
1551  {
1552  szCurrentPath[0]=0;
1553  }
1554  break;
1555  // a function symbol
1556  case N_FUN:
1557  if(!PICE_strlen(pName))
1558  {// it's the end of a function
1559  DPRINT((0,"END of function %s\n",szCurrentFunction));
1560 
1561  szCurrentFunction[0]=0;
1562 
1563  // in case we haven't had a zero delta match we return from here
1564  if(pSrcLine)
1565  return pSrcLine;
1566 
1567  break;
1568  }
1569  else
1570  {// if it has a length it's the start of a function
1571  ULONG len;
1572  // extract the name only, the type string is of no use here
1574  PICE_strncpy(szCurrentFunction,pName,len);
1575  szCurrentFunction[len]=0;
1576 
1577  DPRINT((0,"function %s\n",szCurrentFunction));
1578  }
1579  //intentional fall through
1580 
1581  // line number
1582  case N_SLINE:
1583  // if we're in the function we're looking for
1584  if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0)
1585  {
1586  DPRINT((0,"cslnum#%u for addr.%x (fn @ %x) ulMinVal=%x ulDelta=%x\n",pStab->n_desc,start+pStab->n_value,start,ulMinValue,(addr-(start+pStab->n_value))));
1587 
1588  if(bFirstOccurence)
1589  {
1590  PICE_strcpy(szWantedPath,szCurrentPath);
1591  DPRINT((0,"source file must be %s\n",szWantedPath));
1592  bFirstOccurence = FALSE;
1593  }
1594  DPRINT((0,"wanted %s, current: %s\n",szWantedPath, szCurrentPath));
1595  // we might have a match if our address is greater than the one in the STAB
1596  // and we're lower or equal than minimum value
1597  if(addr>=start+pStab->n_value &&
1598  (addr-(start+pStab->n_value))<=ulMinValue &&
1599  PICE_strcmpi(szWantedPath,szCurrentPath)==0 )
1600  {
1601  ULONG j;
1603 
1604  DPRINT((0,"code source line number #%u for addr. %x found!\n",pStab->n_desc,start+pStab->n_value));
1605 
1606  // compute new minimum
1607  ulMinValue = addr-(start+pStab->n_value);
1608 
1609  // if we have a pointer for storage of line number, store it
1610  if(pulLineNumber)
1611  *pulLineNumber = pStab->n_desc;
1612 
1613  // NB: should put this somewhere else so that it's not done all the time
1614  // if we have source files at all
1615  DPRINT((0,"%u source files @ %x\n",pSymbols->ulNumberOfSrcFiles,pSrc));
1616 
1617  // for all source files in this module
1618  for(j=0;j<pSymbols->ulNumberOfSrcFiles;j++)
1619  {
1620  LPSTR pSlash;
1621  ULONG currlen, fnamelen;
1622 
1623  currlen = PICE_strlen( szCurrentPath );
1624  fnamelen = PICE_strlen( pSrc->filename );
1625  pSlash = pSrc->filename + fnamelen - currlen;
1626 
1627  //DPRINT((0,"pSlash: %s, szCurrentPath: %s\n", pSlash, szCurrentPath));
1628  // if base name matches current path we have found the correct source file
1629  if(PICE_strcmpi(pSlash,szCurrentPath)==0)
1630  {
1631  // the linenumber
1632  ULONG k = pStab->n_desc;
1633 
1634  DPRINT((0,"found src file %s @ %x\n",pSrc->filename,pSrc));
1635 
1636  // store the pointer to the filename
1637  if(ppFilename)
1638  *ppFilename = pSrc->filename;
1639 
1640  if(pSrc->ulOffsetToNext > sizeof(PICE_SYMBOLFILE_SOURCE))
1641  {
1642  // get a pointer to the source file (right after the file header)
1643  pSrcLine = (LPSTR)((ULONG)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE));
1644 
1645  // store the source start and end address
1646  if(ppSrcStart)
1647  *ppSrcStart = pSrcLine;
1648  if(ppSrcEnd)
1649  *ppSrcEnd = pSrcLine+pSrc->ulOffsetToNext-sizeof(PICE_SYMBOLFILE_SOURCE);
1650 
1651  // goto to the right line
1652  while(--k)
1653  {
1654  while(*pSrcLine!=0 && *pSrcLine!=0x0a && *pSrcLine!=0x0d)
1655  pSrcLine++;
1656  if(!IsAddressValid((ULONG)pSrcLine))
1657  return NULL;
1658  pSrcLine++;
1659  }
1660 
1661  if(ulMinValue == 0)
1662  return pSrcLine;
1663  }
1664  else
1665  {
1666  DPRINT((0,"src file descriptor found, but contains no source\n"));
1667  }
1668 
1669  break;
1670  }
1671  (ULONG)pSrc += pSrc->ulOffsetToNext;
1672  }
1673  }
1674  }
1675  break;
1676  }
1677  pStab++;
1678  }
1679  }
1680  }
1681  DPRINT((0,"FindSourceLineForAddress: exit 1\n"));
1682  return NULL;
1683 }
#define TRUE
Definition: types.h:120
unsigned short n_desc
Definition: shared.h:97
ULONG ulOffsetToSrcFiles
Definition: shared.h:89
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
ULONG ulNumberOfSrcFiles
Definition: shared.h:89
GLuint GLuint end
Definition: gl.h:1545
char * LPSTR
Definition: xmlstorage.h:182
unsigned long n_value
Definition: shared.h:98
#define N_FUN
Definition: stabs.c:95
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
#define N_SOL
Definition: stabs.c:109
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
Definition: glfuncs.h:248
LPSTR FindFunctionByAddress(ULONG ulValue, PULONG pulstart, PULONG pulend)
Definition: symbols.c:767
struct _STAB_ENTRY STAB_ENTRY
char filename[256]
Definition: shared.h:103
unsigned char BOOLEAN
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
char * PICE_strncpy(char *s1, char *s2, int len)
Definition: utils.c:286
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define N_UNDF
Definition: stabs.c:88
struct _STAB_ENTRY * PSTAB_ENTRY
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
Definition: glfuncs.h:250
static LPSTR pName
Definition: security.c:75
#define N_SLINE
Definition: stabs.c:103
ULONG ulOffsetToStabsStrings
Definition: shared.h:88
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long n_strx
Definition: shared.h:94
GLenum GLsizei len
Definition: glext.h:6722
Definition: shared.h:92
#define N_SO
Definition: stabs.c:105
GLuint start
Definition: gl.h:1545
struct _PICE_SYMBOLFILE_SOURCE PICE_SYMBOLFILE_SOURCE
ULONG PICE_fncmp(char *s1, char *s2)
Definition: utils.c:434
ULONG StrLenUpToWhiteChar(LPSTR p, LPSTR WhiteChars)
Definition: parse.c:3816
unsigned int ULONG
Definition: retypes.h:1
LOCAL int currlen
Definition: rock.c:98
unsigned char n_type
Definition: shared.h:95
int k
Definition: mpi.c:3369
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387

Referenced by COMMAND_PROTOTYPE(), and RealIsr().

◆ InitFakeKernelModule()

BOOLEAN InitFakeKernelModule ( void  )

◆ IsModuleLoaded()

PDEBUG_MODULE IsModuleLoaded ( LPSTR  p)

Definition at line 296 of file symbols.c.

297 {
298  PDEBUG_MODULE pd;
299 
300  ENTER_FUNC();
301  DPRINT((0,"IsModuleLoaded(%s)\n",p));
302 
303  if(BuildModuleList())
304  {
305  pd = pdebug_module_head;
306  do
307  {
309  DPRINT((0,"module (%x) %S\n",pd->size,pd->name));
310  CopyWideToAnsi(temp,pd->name);
311  if(pd->size && PICE_strcmpi(p,temp) == 0)
312  {
313  DPRINT((0,"module %S is loaded!\n",pd->name));
314  LEAVE_FUNC();
315  return pd;
316  }
317  }while((pd = pd->next)!=pdebug_module_tail);
318  }
319  LEAVE_FUNC();
320  return NULL;
321 }
#define LEAVE_FUNC()
Definition: debug.h:43
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
#define DEBUG_MODULE_NAME_LEN
Definition: shared.h:79
smooth NULL
Definition: ftsmooth.c:416
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
void CopyWideToAnsi(LPSTR pAnsi, PWSTR pWide)
Definition: utils.c:591
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
static calc_node_t temp
Definition: rpn_ieee.c:38
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
#define ENTER_FUNC()
Definition: debug.h:42
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45
GLfloat GLfloat p
Definition: glext.h:8902
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387

Referenced by COMMAND_PROTOTYPE(), ConvertTokenToSymbol(), and TryToInstallVirtualSWBreakpoints().

◆ ListSymbolStartingAt()

ULONG ListSymbolStartingAt ( PDEBUG_MODULE  pMod,
PICE_SYMBOLFILE_HEADER pSymbols,
ULONG  index,
LPSTR  pOutput 
)

Definition at line 1792 of file symbols.c.

1793 {
1794  PIMAGE_SYMBOL pSym, pSymEnd;
1795  LPSTR pStr;
1796  PIMAGE_SECTION_HEADER pShdr;
1797 
1798  DPRINT((0,"ListSymbolStartingAt(%x,%u)\n",(ULONG)pSymbols,index));
1799  DPRINT((0,"ListSymbolStartingAt(): ulOffsetToGlobals = %x ulSizeofGlobals = %x\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
1800  pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
1801  pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
1802  pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
1803  pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
1804 
1805  pSym += index;
1806 
1807  while( pSym < pSymEnd )
1808  {
1809  LPSTR pName;
1810 
1811  if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) &&
1812  ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) /*|| (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)*/) &&
1813  (pSym->SectionNumber > 0 ))
1814  {
1815  PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1);
1816  ULONG section_flags;
1817  ULONG start;
1818 
1819  DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis));
1820 
1821  if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) )
1822  {
1823  DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis));
1824  return FALSE;
1825  }
1826  section_flags = pShdrThis->Characteristics;
1827  //to get address in the memory we base address of the module and
1828  //add offset of the section and then add offset of the symbol from
1829  //the begining of the section
1830 
1831  start = ((ULONG)pMod->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
1832  if(pSym->N.Name.Short){
1833  //name is in the header. it's not zero terminated. have to copy.
1834  PICE_sprintf(pOutput,"%.8X (%s) %.8s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pSym->N.ShortName);
1835  }
1836  else{
1837  ASSERT(pSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
1838  pName = pStr+pSym->N.Name.Long;
1839  if(!IsAddressValid((ULONG)pName))
1840  {
1841  DPRINT((0,"ListSymbolStartingAt(): pName = %x is not a valid pointer\n",pName));
1842  return 0;
1843  }
1844  PICE_sprintf(pOutput,"%.8X (%s) %s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pName);
1845  }
1846 
1847  if((pSym+pSym->NumberOfAuxSymbols+1)<(pSymEnd))
1848  return (index+pSym->NumberOfAuxSymbols+1);
1849  }
1850  index += pSym->NumberOfAuxSymbols + 1;
1851  pSym += pSym->NumberOfAuxSymbols + 1;
1852  }
1853  return 0;
1854 }
GLint x0
Definition: linetemp.h:95
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
char * LPSTR
Definition: xmlstorage.h:182
void DPRINT(...)
Definition: polytest.cpp:61
GLuint index
Definition: glext.h:6031
static LPSTR pName
Definition: security.c:75
BOOLEAN IsRangeValid(ULONG Addr, ULONG Length)
Definition: utils.c:735
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define index(s, c)
Definition: various.h:29
#define IMAGE_SCN_CNT_CODE
Definition: ntimage.h:230
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
GLuint start
Definition: gl.h:1545
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
ULONG ulSizeOfGlobalsStrings
Definition: shared.h:86
ULONG ulOffsetToGlobalsStrings
Definition: shared.h:86
#define IMAGE_SYM_CLASS_EXTERNAL
Definition: compat.h:138
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:241

Referenced by COMMAND_PROTOTYPE().

◆ LoadExports()

BOOLEAN LoadExports ( void  )

Definition at line 1909 of file symbols.c.

1910 {
1911  HANDLE hf;
1912  BOOLEAN bResult = TRUE;
1913 
1914  ENTER_FUNC();
1915 
1916  Print(OUTPUT_WINDOW,"pICE: loading exports...\n");
1917  hf = PICE_open(L"\\SystemRoot\\symbols\\ntoskrnl.map",OF_READ);
1918  /*
1919  if(hf)
1920  {
1921  Print(OUTPUT_WINDOW,"pICE: no System.map in /boot\n");
1922  hf = PICE_open("/System.map",OF_READ);
1923  }
1924  */
1925 
1926  if(hf)
1927  {
1928  //mm_segment_t oldfs;
1929  size_t len;
1930 
1931  len = PICE_len(hf);
1932  if(len)
1933  {
1934  DPRINT((0,"file len = %d\n",len));
1935 
1936  pExports = PICE_malloc(len+1,NONPAGEDPOOL); // maybe make pool setting an option
1937 
1938  DPRINT((0,"pExports = %x\n",pExports));
1939 
1940  if(pExports)
1941  {
1942  //oldfs = get_fs(); set_fs(KERNEL_DS);
1943  ulExportLen = len;
1944  ((PUCHAR)pExports)[len]=0;
1945  if(len == PICE_read(hf,pExports,len))
1946  {
1947  DPRINT((0,"success reading system map!\n"));
1948  PICE_sprintf(tempSym,"pICE: ntoskrnl.sym @ %x (size %x)\n",pExports,len);
1950  }
1951  else
1952  DbgPrint("error reading ntoskrnl map!\n");
1953  //set_fs(oldfs);
1954  }
1955  }
1956  PICE_close(hf);
1957  }
1958  else
1959  {
1960  Print(OUTPUT_WINDOW,"pICE: no ntoskrnl.sys \n");
1961  Print(OUTPUT_WINDOW,"pICE: could not load exports...\n");
1962  bResult = FALSE;
1963  }
1964 
1965  LEAVE_FUNC();
1966 
1967  return bResult;
1968 }
int PICE_close(HANDLE hFile)
Definition: utils.c:2300
#define TRUE
Definition: types.h:120
#define OF_READ
Definition: winbase.h:116
#define DbgPrint
Definition: loader.c:25
char tempSym[1024]
Definition: symbols.c:58
unsigned char * PUCHAR
Definition: retypes.h:3
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define LEAVE_FUNC()
Definition: debug.h:43
#define NONPAGEDPOOL
Definition: utils.h:306
ULONG ulExportLen
Definition: symbols.c:49
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
unsigned char BOOLEAN
void * PICE_malloc(size_t numBytes, BOOLEAN fromPaged)
Definition: utils.c:2212
void DPRINT(...)
Definition: polytest.cpp:61
long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes)
Definition: utils.c:2228
static const WCHAR L[]
Definition: oid.c:1250
PVOID pExports
Definition: symbols.c:48
GLenum GLsizei len
Definition: glext.h:6722
HANDLE PICE_open(LPCWSTR lpPathName, int iReadWrite)
Definition: utils.c:2250
#define ENTER_FUNC()
Definition: debug.h:42
size_t PICE_len(HANDLE hFile)
Definition: utils.c:2310

Referenced by InitPICE().

◆ LoadSymbols()

PICE_SYMBOLFILE_HEADER* LoadSymbols ( LPSTR  filename)

Definition at line 1990 of file symbols.c.

1991 {
1992  HANDLE hf;
1993  PICE_SYMBOLFILE_HEADER* pSymbols=NULL;
1994  WCHAR tempstr[256];
1995  int conv;
1996  ENTER_FUNC();
1997 
1998  if( !( conv = PICE_MultiByteToWideChar(CP_ACP, NULL, filename, -1, tempstr, 256 ) ) )
1999  {
2000  DPRINT((0,"Can't convert module name.\n"));
2001  return NULL;
2002  }
2003  DPRINT((0,"LoadSymbols: filename %s, tempstr %S, conv: %d\n", filename, tempstr, conv));
2004 
2006  {
2007  hf = PICE_open(tempstr,OF_READ);
2008  DPRINT((0,"LoadSymbols: hf: %x, file: %S\n",hf, tempstr));
2009  if(hf)
2010  {
2011  //mm_segment_t oldfs;
2012  size_t len;
2013 
2014  DPRINT((0,"hf = %x\n",hf));
2015 
2016  len = PICE_len(hf);
2017  DPRINT((0,"file len = %d\n",len));
2018 
2019  if(len)
2020  {
2021  pSymbols = PICE_malloc(len+1,NONPAGEDPOOL); // maybe make pool setting an option
2022  DPRINT((0,"pSymbols = %x\n",pSymbols));
2023 
2024  if(pSymbols)
2025  {
2026  //oldfs = get_fs(); set_fs(KERNEL_DS);
2027  if(len == PICE_read(hf,(PVOID)pSymbols,len))
2028  {
2029  DPRINT((0,"LoadSymbols(): success reading symbols!\n"));
2030  DPRINT((0,"LoadSymbols(): pSymbols->magic = %X\n",pSymbols->magic));
2031  }
2032  //set_fs(oldfs);
2033 
2034 
2035  if(pSymbols->magic == PICE_MAGIC)
2036  {
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));
2046  apSymbols[ulNumSymbolsLoaded++]=pSymbols;
2047  }
2048  else
2049  {
2050  DPRINT((0,"LoadSymbols(): freeing %x\n",pSymbols));
2051  DPRINT((0,"pICE: symbols file \"%s\" corrupt\n",filename));
2052  PICE_free(pSymbols);
2053  }
2054  }
2055 
2056  }
2057  PICE_close(hf);
2058  }
2059  else
2060  {
2061  DPRINT((0,"pICE: could not load symbols for %s...\n",filename));
2062  }
2063  }
2064 
2065  LEAVE_FUNC();
2066 
2067  return pSymbols;
2068 }
int PICE_close(HANDLE hFile)
Definition: utils.c:2300
#define OF_READ
Definition: winbase.h:116
ULONG ulNumSymbolsLoaded
Definition: symbols.c:54
PICE_SYMBOLFILE_HEADER * apSymbols[32]
Definition: symbols.c:53
#define DIM(name)
Definition: retypes.h:51
#define CP_ACP
Definition: compat.h:99
#define PICE_MAGIC
Definition: shared.h:77
#define LEAVE_FUNC()
Definition: debug.h:43
const char * filename
Definition: ioapi.h:135
#define NONPAGEDPOOL
Definition: utils.h:306
INT WINAPI PICE_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar)
Definition: utils.c:2335
smooth NULL
Definition: ftsmooth.c:416
void * PICE_malloc(size_t numBytes, BOOLEAN fromPaged)
Definition: utils.c:2212
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
void PICE_free(void *p)
Definition: utils.c:2222
long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes)
Definition: utils.c:2228
GLenum GLsizei len
Definition: glext.h:6722
HANDLE PICE_open(LPCWSTR lpPathName, int iReadWrite)
Definition: utils.c:2250
#define ENTER_FUNC()
Definition: debug.h:42
size_t PICE_len(HANDLE hFile)
Definition: utils.c:2310

Referenced by LoadSymbolsFromConfig().

◆ LoadSymbolsFromConfig()

BOOLEAN LoadSymbolsFromConfig ( BOOLEAN  bIgnoreBootParams)

Definition at line 2116 of file symbols.c.

2117 {
2118  HANDLE hf;
2119  LPSTR pConfig,pConfigEnd,pTemp;
2120  char temp[256];
2121  ULONG line = 1;
2122  BOOLEAN bResult = FALSE;
2123 
2124  ENTER_FUNC();
2125 
2126  hf = PICE_open(L"\\SystemRoot\\symbols\\pice.cfg",OF_READ);
2127  if(hf)
2128  {
2129  //mm_segment_t oldfs;
2130  size_t len;
2131 
2132  DPRINT((0,"hf = %x\n",hf));
2133 
2134  len = PICE_len(hf);
2135  DPRINT((0,"file len = %d\n",len));
2136 
2137  if(len)
2138  {
2139  pConfig = PICE_malloc(len+1,NONPAGEDPOOL); // maybe make pool setting an option
2140  DPRINT((0,"pConfig = %x\n",pConfig));
2141  //oldfs = get_fs(); set_fs(KERNEL_DS);
2142 
2143  if(len == PICE_read(hf,(PVOID)pConfig,len))
2144  {
2145  //set_fs(oldfs);
2146 
2147  pConfigEnd = pConfig + len;
2148 
2149  while(pConfig<pConfigEnd)
2150  {
2151  // skip leading spaces
2152  while(*pConfig==' ' && pConfig<pConfigEnd)
2153  pConfig++;
2154  // get ptr to temporary
2155  pTemp = temp;
2156  // fill in temporary with symbol path
2157  while(*pConfig!=0 && *pConfig!=0x0a && *pConfig!=0x0d && pConfig<pConfigEnd)
2158  *pTemp++ = *pConfig++;
2159  // finish up symbol path string
2160  *pTemp = 0;
2161  // skip any line ends
2162  while((*pConfig==0x0a || *pConfig==0x0d) && pConfig<pConfigEnd)
2163  pConfig++;
2164 
2165  // finally try to load the symbols
2166  if(PICE_strlen(temp))
2167  {
2168  PICE_SYMBOLFILE_HEADER *pSymbols;
2169 
2170  // boot parameter
2171  if(*temp == '!')
2172  {
2173  if(!bIgnoreBootParams)
2174  {
2176  {
2178  DPRINT((0,"pICE: boot params = %s\n",szBootParams));
2179  }
2180  else
2181  {
2182  DPRINT((0,"pICE: boot params already exist! ignoring...\n",szBootParams));
2183  }
2184  }
2185  }
2186  // options
2187  else if(*temp == '+')
2188  {
2189  if(PICE_strlen(temp)>1)
2190  {
2191  if(PICE_strcmpi(temp,"+vga")==0)
2192  {
2194  DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_VGA_TEXT\n"));
2195  }
2196  else if(PICE_strcmpi(temp,"+hercules")==0)
2197  {
2199  DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_HERCULES_GRAPHICS\n"));
2200  }
2201  else if(PICE_strcmpi(temp,"+serial")==0)
2202  {
2204  DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_SERIAL\n"));
2205  }
2206  }
2207  else
2208  {
2209  DPRINT((0,"pICE: found option, but no value\n"));
2210  }
2211  }
2212  // comment
2213  else if(*temp == '#')
2214  {
2215  DPRINT((0,"comment out\n"));
2216  }
2217  // symbol file name/path
2218  else
2219  {
2220  DPRINT((0,"Load symbols from file %s\n", temp));
2221  pSymbols = LoadSymbols(temp);
2222  DPRINT((0,"Load symbols from file %s, pSymbols: %x\n", temp, pSymbols));
2223  if(pSymbols)
2224  {
2225  PICE_SYMBOLFILE_SOURCE* pSrc;
2226  LPSTR p;
2227 
2228  pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pSymbols + pSymbols->ulOffsetToSrcFiles);
2229  pCurrentSymbols = pSymbols;
2230  p = strrchr(pSrc->filename,'\\');
2231  if(p)
2232  {
2234  }
2235  else
2236  {
2238  }
2239  }
2240  }
2241  }
2242  else
2243  {
2244  DPRINT((0,"invalid line [%u] in config!\n",line));
2245  }
2246  line++;
2247  }
2248  }
2249  else
2250  {
2251  //set_fs(oldfs);
2252  }
2253  }
2254 
2255  PICE_close(hf);
2256  bResult = TRUE;
2257  }
2258  else
2259  {
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"));
2263  }
2264 
2265  LEAVE_FUNC();
2266 
2267  return bResult;
2268 }
int PICE_close(HANDLE hFile)
Definition: utils.c:2300
PICE_SYMBOLFILE_HEADER * LoadSymbols(LPSTR filename)
Definition: symbols.c:1990
#define TRUE
Definition: types.h:120
#define OF_READ
Definition: winbase.h:116
ULONG ulOffsetToSrcFiles
Definition: shared.h:89
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
#define LEAVE_FUNC()
Definition: debug.h:43
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
char * LPSTR
Definition: xmlstorage.h:182
#define NONPAGEDPOOL
Definition: utils.h:306
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
PICE_SYMBOLFILE_HEADER * pCurrentSymbols
Definition: parse.c:60
char filename[256]
Definition: shared.h:103
unsigned char BOOLEAN
void * PICE_malloc(size_t numBytes, BOOLEAN fromPaged)
Definition: utils.c:2212
Definition: parser.c:48
void DPRINT(...)
Definition: polytest.cpp:61
ETERMINALMODE eTerminalMode
Definition: hardware.c:56
TCHAR szCurrentFile[MAX_PATH]
Definition: mplay32.c:29
long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes)
Definition: utils.c:2228
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
HANDLE PICE_open(LPCWSTR lpPathName, int iReadWrite)
Definition: utils.c:2250
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
GLfloat GLfloat p
Definition: glext.h:8902
size_t PICE_len(HANDLE hFile)
Definition: utils.c:2310
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387
char szBootParams[1024]
Definition: init.c:41

Referenced by InitPICE(), and ReloadSymbols().

◆ ReloadSymbols()

BOOLEAN ReloadSymbols ( void  )

Definition at line 2074 of file symbols.c.

2075 {
2076  BOOLEAN bResult;
2077 
2078  ENTER_FUNC();
2079 
2080  UnloadSymbols();
2081 
2082  bResult = LoadSymbolsFromConfig(TRUE);
2083 
2084  LEAVE_FUNC();
2085 
2086  return bResult;
2087 }
#define TRUE
Definition: types.h:120
#define LEAVE_FUNC()
Definition: debug.h:43
BOOLEAN LoadSymbolsFromConfig(BOOLEAN bIgnoreBootParams)
Definition: symbols.c:2116
unsigned char BOOLEAN
#define ENTER_FUNC()
Definition: debug.h:42
void UnloadSymbols()
Definition: symbols.c:2093

Referenced by pice_ioctl().

◆ SanityCheckExports()

BOOLEAN SanityCheckExports ( void  )

Definition at line 1860 of file symbols.c.

1861 {
1862  BOOLEAN bResult = FALSE;
1863  ULONG i,ulValue,incr;
1864 
1865  Print(OUTPUT_WINDOW,"pICE: sanity-checking exports...\n");
1866  return TRUE;
1867  /* fix later!!! do we really need to cross reference two kinds of symbolic info?
1868  if(fake_kernel_module.nsyms && fake_kernel_module.syms)
1869  {
1870  incr = (fake_kernel_module.nsyms/4);
1871  if(!incr)incr = 1;
1872  for(i=0;i<fake_kernel_module.nsyms;i+=incr)
1873  {
1874  if(ScanExports((char*)fake_kernel_module.syms[i].name,&ulValue) )
1875  {
1876  if(!(i%25))
1877  {
1878  ClrLine(wWindow[OUTPUT_WINDOW].y + wWindow[OUTPUT_WINDOW].usCurY);
1879  PICE_sprintf(tempSym,"pICE: sanity-checking exports %u/%u",
1880  i,
1881  fake_kernel_module.nsyms);
1882  PutChar(tempSym,1,wWindow[OUTPUT_WINDOW].y + wWindow[OUTPUT_WINDOW].usCurY);
1883  }
1884 
1885  if(fake_kernel_module.syms[i].value != ulValue)
1886  {
1887  PICE_sprintf(tempSym,"pICE: %s doesn't match (%.8X != %.8X)\n",
1888  fake_kernel_module.syms[i].name,
1889  fake_kernel_module.syms[i].value,
1890  ulValue);
1891  Print(OUTPUT_WINDOW,tempSym);
1892 
1893  return FALSE;
1894  }
1895  }
1896  }
1897 
1898  bResult = TRUE;
1899  }
1900 
1901  return bResult;
1902  */
1903 }
#define TRUE
Definition: types.h:120
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
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
Definition: glfuncs.h:248
unsigned char BOOLEAN
unsigned int ULONG
Definition: retypes.h:1

Referenced by InitPICE().

◆ ScanExports()

BOOLEAN ScanExports ( const char pFind,
PULONG  pValue 
)

Definition at line 327 of file symbols.c.

328 {
329  char temp[256];
330  LPSTR pStr=NULL;
331  LPSTR pExp = pExports;
332  BOOLEAN bResult = FALSE;
333 
334  ENTER_FUNC();
335  DPRINT((0,"ScanExports pValue: %x\n", pValue));
336 nomatch:
337  if(pExports)
338  pStr = strstr(pExp,pFind);
339 
340  if(pStr)
341  {
342  LPSTR p;
343  ULONG state;
344  LPSTR pOldStr = pStr;
345 
346  for(;(*pStr!=0x0a && *pStr!=0x0d) && (ULONG)pStr>=(ULONG)pExports;pStr--);
347  pStr++;
348  p = temp;
349  for(;(*pStr!=0x0a && *pStr!=0x0d);)*p++=*pStr++;
350  *p=0;
351  p = (LPSTR) PICE_strtok(temp," ");
352  state=0;
353  while(p)
354  {
355  switch(state)
356  {
357  case 0:
358  ConvertTokenToHex(p,pValue);
359  break;
360  case 1:
361  break;
362  case 2:
363  if(strcmp(p,pFind)!=0)
364  {
365  DPRINT((0,"Not: %s\n", p));
366  pExp = pOldStr+1;
367  goto nomatch;
368  }
369  state = -1;
370  bResult = TRUE;
371  DPRINT((0,"%s @ %x\n",pFind,*pValue));
372  goto exit;
373  break;
374  }
375  state++;
376  p = (char*) PICE_strtok(NULL," ");
377  }
378  }
379 exit:
380  DPRINT((0,"%s %x @ %x\n",pFind,pValue,*pValue));
381 
382  LEAVE_FUNC();
383 
384  return bResult;
385 }
#define TRUE
Definition: types.h:120
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
char * PICE_strtok(char *szInputString)
Definition: parse.c:3310
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN ConvertTokenToHex(LPSTR p, PULONG pValue)
Definition: parse.c:3346
PVOID pExports
Definition: symbols.c:48
static int state
Definition: maze.c:121
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ENTER_FUNC()
Definition: debug.h:42
void exit(int exitcode)
Definition: _exit.c:33
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ConvertTokenToSymbol(), InitPICE(), InstallPrintkHook(), and RevirtualizeBreakpointsForModule().

◆ ScanExportsByAddress()

BOOLEAN ScanExportsByAddress ( LPSTR pFind,
ULONG  ulValue 
)

Definition at line 599 of file symbols.c.

600 {
601  char temp[256];
602  static char temp3[256];
603  LPSTR p,pStartOfLine,pSymbolName=NULL;
604  ULONG ulCurrentValue=0;
605  BOOLEAN bResult = FALSE;
606  PDEBUG_MODULE pd;
607  ULONG ulMinValue = -1;
608  PIMAGE_SYMBOL pSym,pSymEnd; //running pointer to symbols and end of sym talbe
609  PIMAGE_SYMBOL pFoundSym = NULL; //current best symbol match
610  ULONG ulAddr = 0x0; //address of the best match
611  LPSTR pStr;
612  PIMAGE_SECTION_HEADER pShdr;
613  PICE_SYMBOLFILE_HEADER* pSymbols;
614  ULONG ulSectionSize;
615  LPSTR pName;
616 
617  ENTER_FUNC();
618  DPRINT((0,"In ScanExportsByAddress:\n"));
619 
620  pSymbols = FindModuleSymbols(ulValue);
621  DPRINT((0,"pSymbols: %x\n", pSymbols));
622 
623  if(BuildModuleList()){
624  if(pSymbols && pdebug_module_head)
625  {
626  PDEBUG_MODULE pdTemp;
627 
628  DPRINT((0,"looking up symbols\n"));
629  pd = pdebug_module_head;
630  do
631  {
632  if(pd->size){
633  pdTemp = pd;
634 
635  if(ulValue>=((ULONG)pdTemp->BaseAddress) && ulValue<((ULONG)pdTemp+pdTemp->size))
636  {
637  if(PICE_wcsicmp(pdTemp->name,pSymbols->name) == 0)
638  {
639  DPRINT((0,"ScanExportsByAddress(): found symbols for module %S @ %x \n",pdTemp->name,(ULONG)pSymbols));
640 
641  pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
642  pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
643  pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
644  pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
645 
646  if(!IsRangeValid((ULONG)pSym,sizeof(IMAGE_SYMBOL) ) ) //should we actually check all the symbols here?
647  {
648  DPRINT((0,"ScanExportsByAddress(): pSym = %x is not a valid pointer\n",(ULONG)pSym));
649  return FALSE;
650  }
651 
652  DPRINT((0,"ScanExportsByAddress(): pSym = %x\n",pSym));
653  DPRINT((0,"ScanExportsByAddress(): pStr = %x\n",pStr));
654  DPRINT((0,"ScanExportsByAddress(): pShdr = %x\n",pShdr));
655 
656  DPRINT((0,"ScanExportsByAddress(): %S has %u symbols\n",pSymbols->name,pSymbols->ulSizeOfGlobals/sizeof(IMAGE_SYMBOL)));
657 
658  /* go through all the global symbols and find the one with
659  the largest address which is less than ulValue */
660  while(pSym < pSymEnd)
661  { //it seems only 0x0 and 0x20 are used for type and External or Static storage classes
662  if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) &&
663  ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) || (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)) &&
664  (pSym->SectionNumber > 0 ))
665  {
666  ULONG ulCurrAddr;
667  PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1);
668 
669 
670  DPRINT((0,"ScanExportsByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis));
671 
672  if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) )
673  {
674  DPRINT((0,"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis));
675  return FALSE;
676  }
677  //to get address in the memory we base address of the module and
678  //add offset of the section and then add offset of the symbol from
679  //the begining of the section
680  ulCurrAddr = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
681  DPRINT((0,"ScanExportsByAddress(): CurrAddr [1] = %x\n",ulCurrAddr));
682 
683  if(ulCurrAddr<=ulValue && ulCurrAddr>ulAddr)
684  {
685  ulAddr = ulCurrAddr;
686  pFoundSym = pSym;
687  }
688  }
689  //skip the auxiliary symbols and get the next symbol
690  pSym += pSym->NumberOfAuxSymbols + 1;
691  }
692  *pFind = temp3;
693  if( pFoundSym->N.Name.Short ){
694  pName = pFoundSym->N.ShortName; //name is in the header
695  PICE_sprintf(temp3,"%S!%.8s",pdTemp->name,pName); //if name is in the header it may be nonzero terminated
696  }
697  else{
698  ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
699  pName = pStr+pFoundSym->N.Name.Long;
700  if(!IsAddressValid((ULONG)pName))
701  {
702  DPRINT((0,"ScanExportsByAddress(): pName = %x is not a valid pointer\n",pName));
703  return FALSE;
704  }
705  PICE_sprintf(temp3,"%S!%s",pdTemp->name,pName);
706  }
707  DPRINT((0,"ScanExportsByAddress(): pName = %x\n",(ULONG)pName));
708  return TRUE;
709  }
710  }
711  }
712  }while((pd = pd->next));
713  }
714  }
715  // if haven't found in the symbols try ntoskrnl exports. (note: check that this is needed since we
716  // already checked ntoskrnl coff symbol table)
717  if(pExports && ulValue >= KERNEL_START && ulValue < kernel_end)
718  {
719  p = pExports;
720  // while we bound in System.map
721  while(p<((LPSTR)pExports+ulExportLen))
722  {
723  // make a temp ptr to the line we can change
724  pStartOfLine = p;
725  // will read the hex value and return a pointer to the symbol name
726  if(ScanExportLine(p,&ulCurrentValue,&pStartOfLine))
727  {
728  if(ulValue>=ulCurrentValue && (ulValue-ulCurrentValue)<ulMinValue)
729  {
730  // save away our info for later
731  ulMinValue = ulValue-ulCurrentValue;
732  pSymbolName = pStartOfLine;
733  bResult = TRUE;
734  *pFind = temp3;
735  if(ulMinValue==0)
736  break;
737  }
738  }
739  // increment pointer to next line
740  p = pStartOfLine;
741  while(*p!=0 && *p!=0x0a && *p!=0x0d)p++;
742  p++;
743  }
744  if(bResult)
745  {
746  int i;
747  // copy symbol name to temp string
748  for(i=0;pSymbolName[i]!=0 && pSymbolName[i]!=0x0a && pSymbolName[i]!=0x0d;i++)
749  temp[i] = pSymbolName[i];
750  temp[i] = 0;
751  // decide if we need to append an offset
752  if(ulMinValue)
753  PICE_sprintf(temp3,"ntoskrnl!%s+%.8X",temp,ulMinValue);
754  else
755  PICE_sprintf(temp3,"ntoskrnl!%s",temp);
756  }
757  }
758 
759  LEAVE_FUNC();
760  return bResult;
761 }
#define TRUE
Definition: types.h:120
#define KERNEL_START
Definition: symbols.h:87
BOOLEAN ScanExportLine(LPSTR p, PULONG ulValue, LPSTR *ppPtrToSymbol)
Definition: symbols.c:424
GLint x0
Definition: linetemp.h:95
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
ULONG PICE_wcsicmp(WCHAR *s1, WCHAR *s2)
Definition: utils.c:504
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
ULONG ulExportLen
Definition: symbols.c:49
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
Definition: glfuncs.h:248
unsigned char BOOLEAN
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
smooth NULL
Definition: ftsmooth.c:416
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: shared.h:83
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
struct _IMAGE_SYMBOL IMAGE_SYMBOL
static LPSTR pName
Definition: security.c:75
BOOLEAN IsRangeValid(ULONG Addr, ULONG Length)
Definition: utils.c:735
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
PVOID pExports
Definition: symbols.c:48
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
ULONG kernel_end
Definition: symbols.c:56
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
static calc_node_t temp
Definition: rpn_ieee.c:38
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
#define ENTER_FUNC()
Definition: debug.h:42
GLfloat GLfloat p
Definition: glext.h:8902
ULONG ulSizeOfGlobalsStrings
Definition: shared.h:86
ULONG ulOffsetToGlobalsStrings
Definition: shared.h:86
#define IMAGE_SYM_CLASS_STATIC
Definition: winnt_old.h:783
#define IMAGE_SYM_CLASS_EXTERNAL
Definition: compat.h:138
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:241

Referenced by COMMAND_PROTOTYPE(), Disassembler(), ListSWBreakpoints(), OutputIdtEntry(), RealIsr(), and RevirtualizeBreakpointsForModule().

◆ UnloadExports()

void UnloadExports ( void  )

Definition at line 1974 of file symbols.c.

1975 {
1976  ENTER_FUNC();
1977  if(pExports)
1978  {
1979  DPRINT((0,"freeing %x\n",pExports));
1981  pExports = NULL;
1982  }
1983  LEAVE_FUNC();
1984 }
#define LEAVE_FUNC()
Definition: debug.h:43
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
void PICE_free(void *p)
Definition: utils.c:2222
PVOID pExports
Definition: symbols.c:48
#define ENTER_FUNC()
Definition: debug.h:42

Referenced by CleanUpPICE(), and InitPICE().

◆ UnloadSymbols()

void UnloadSymbols ( void  )

Definition at line 2093 of file symbols.c.

2094 {
2095  ULONG i;
2096 
2097  ENTER_FUNC();
2098 
2099  if(ulNumSymbolsLoaded)
2100  {
2101  for(i=0;i<ulNumSymbolsLoaded;i++)
2102  {
2103  DPRINT((0,"freeing [%u] %x\n",i,apSymbols[i]));
2104  PICE_free(apSymbols[i]);
2105  apSymbols[i] = NULL;
2106  }
2107  ulNumSymbolsLoaded = 0;
2108  }
2109  LEAVE_FUNC();
2110 }
ULONG ulNumSymbolsLoaded
Definition: symbols.c:54
PICE_SYMBOLFILE_HEADER * apSymbols[32]
Definition: symbols.c:53
#define LEAVE_FUNC()
Definition: debug.h:43
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
void PICE_free(void *p)
Definition: utils.c:2222
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42

Referenced by CleanUpPICE(), InitPICE(), pice_ioctl(), and ReloadSymbols().

Variable Documentation

◆ apSymbols