Porting pice. Changed symbolic information handling.

svn path=/trunk/; revision=2494
This commit is contained in:
Eugene Ingerman
2002-01-08 20:44:18 +00:00
parent 8cb9f1dd16
commit 3a8ce6bf63
11 changed files with 611 additions and 710 deletions
+12 -7
View File
@@ -17,6 +17,7 @@ Environment:
Author:
Klaus P. Gerlicher
Reactos Port by Eugene Ingerman
Revision History:
@@ -242,7 +243,10 @@ void process_stabs(
PVOID pFile;
PICE_SYMBOLFILE_SOURCE pss;
file = CreateFile(SrcFileNames[i],O_RDONLY, 0, NULL, OPEN_EXISTING, 0, 0);
file = CreateFile(SrcFileNames[i],GENERIC_READ , 0, NULL, OPEN_EXISTING, 0, 0);
//printf("Trying To Open: %s, result: %x\n", SrcFileNames[i], file );
if( file == INVALID_HANDLE_VALUE ){
//let's try win format drive:/file
char srctmp[2048];
@@ -251,7 +255,8 @@ void process_stabs(
*(srctmp) = *(srctmp+2);
*(srctmp+1) = ':';
*(srctmp+2) = '/';
file = CreateFile(srctmp,O_RDONLY, 0, NULL, OPEN_EXISTING, 0, 0);
file = CreateFile(srctmp,GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
//printf("Trying To Open: %s, handle: %x\n", srctmp, file );
if( file == INVALID_HANDLE_VALUE )
printf("Can't open file: %s\n", srctmp );
}
@@ -261,23 +266,23 @@ void process_stabs(
//printf("LOADER: [%u] opened %s as FD %x\n",i,SrcFileNames[i],file);
len = SetFilePointer(file,0,NULL,FILE_END);
//printf("LOADER: length = %x\n",(int)len);
//printf("LOADER: length = %d\n",(int)len);
SetFilePointer(file,0,NULL,FILE_BEGIN);
strcpy(pss.filename,SrcFileNames[i]);
pss.ulOffsetToNext = len+sizeof(PICE_SYMBOLFILE_SOURCE);
pFile = malloc(len);
pFile = malloc(len+1);
//printf("LOADER: memory for file @ %x\n",pFile);
if(pFile)
{
//printf("LOADER: reading file...\n");
ReadFile(file,pFile,len,&wrote,NULL);
ReadFile(file,pFile,len+1,&wrote,NULL);
//printf("read: %d, error: %d\n", wrote, GetLastError());
WriteFile(fileout,&pss,sizeof(PICE_SYMBOLFILE_SOURCE),&wrote, NULL);
//printf("LOADER: writing file...\n");
WriteFile(fileout,pFile,len,&wrote, NULL);
//printf("LOADER: writing file...%d\n%s\n",wrote,pFile );
free(pFile);
}
+93 -91
View File
@@ -15,7 +15,7 @@ Environment:
LINUX 2.2.X
Kernel mode only
Author:
Author:
Klaus P. Gerlicher
@@ -45,10 +45,10 @@ ULONG OldInt3Handler=0;
SW_BP aSwBreakpoints[64]={{0,0,0,0},};
//*************************************************************************
// FindSwBp()
//
//*************************************************************************
//*************************************************************************
// FindSwBp()
//
//*************************************************************************
PSW_BP FindSwBp(ULONG ulAddress)
{
ULONG i;
@@ -62,10 +62,10 @@ PSW_BP FindSwBp(ULONG ulAddress)
return NULL;
}
//*************************************************************************
// FindEmptySwBpSlot()
//
//*************************************************************************
//*************************************************************************
// FindEmptySwBpSlot()
//
//*************************************************************************
PSW_BP FindEmptySwBpSlot(void)
{
ULONG i;
@@ -81,10 +81,10 @@ PSW_BP FindEmptySwBpSlot(void)
return NULL;
}
//*************************************************************************
// FindVirtualSwBp()
//
//*************************************************************************
//*************************************************************************
// FindVirtualSwBp()
//
//*************************************************************************
PSW_BP FindVirtualSwBp(LPSTR ModName,LPSTR szFunctionName)
{
ULONG i;
@@ -106,10 +106,10 @@ PSW_BP FindVirtualSwBp(LPSTR ModName,LPSTR szFunctionName)
return NULL;
}
//*************************************************************************
// IsSwBpAtAddressInstalled()
//
//*************************************************************************
//*************************************************************************
// IsSwBpAtAddressInstalled()
//
//*************************************************************************
BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress)
{
ULONG i;
@@ -126,10 +126,10 @@ BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress)
return FALSE;
}
//*************************************************************************
// IsSwBpAtAddress()
//
//*************************************************************************
//*************************************************************************
// IsSwBpAtAddress()
//
//*************************************************************************
BOOLEAN IsSwBpAtAddress(ULONG ulAddress)
{
ULONG i;
@@ -143,10 +143,10 @@ BOOLEAN IsSwBpAtAddress(ULONG ulAddress)
return FALSE;
}
//*************************************************************************
// NeedToReInstallSWBreakpoints()
//
//*************************************************************************
//*************************************************************************
// NeedToReInstallSWBreakpoints()
//
//*************************************************************************
BOOLEAN NeedToReInstallSWBreakpoints(ULONG ulAddress,BOOLEAN bUseAddress)
{
PSW_BP p;
@@ -190,10 +190,10 @@ BOOLEAN NeedToReInstallSWBreakpoints(ULONG ulAddress,BOOLEAN bUseAddress)
return bResult;
}
//*************************************************************************
// ReInstallSWBreakpoint()
//
//*************************************************************************
//*************************************************************************
// ReInstallSWBreakpoint()
//
//*************************************************************************
BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress)
{
PSW_BP p;
@@ -223,10 +223,10 @@ BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress)
}
//*************************************************************************
// InstallSWBreakpoint()
//
//*************************************************************************
//*************************************************************************
// InstallSWBreakpoint()
//
//*************************************************************************
BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpointCallback)(void))
{
PSW_BP p;
@@ -235,7 +235,7 @@ BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpoi
ENTER_FUNC();
DPRINT((0,"InstallSWBreakpoint()\n"));
// check if page is present
// check if page is present
// TODO: must also check if it's a writable page
if(IsAddressValid(ulAddress) )
{
@@ -278,10 +278,10 @@ BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpoi
return bResult;
}
//*************************************************************************
// InstallVirtualSWBreakpoint()
//
//*************************************************************************
//*************************************************************************
// InstallVirtualSWBreakpoint()
//
//*************************************************************************
BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR FunctionName)
{
PSW_BP p;
@@ -309,16 +309,16 @@ BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR FunctionName)
return bResult;
}
//*************************************************************************
// TryToInstallVirtualSWBreakpoints()
//
//*************************************************************************
//*************************************************************************
// TryToInstallVirtualSWBreakpoints()
//
//*************************************************************************
void TryToInstallVirtualSWBreakpoints(void)
{
ULONG i,ulAddress;
struct module* pMod;
PDEBUG_MODULE pMod;
PSW_BP p;
DPRINT((0,"TryToInstallVirtualSWBreakpoints()\n"));
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
@@ -363,11 +363,11 @@ void TryToInstallVirtualSWBreakpoints(void)
}
}
//*************************************************************************
// RemoveSWBreakpoint()
//
//*************************************************************************
// RemoveSWBreakpoint()
//
// removes breakpoint from breakpoint list
//*************************************************************************
//*************************************************************************
BOOLEAN RemoveSWBreakpoint(ULONG ulAddress)
{
PSW_BP p;
@@ -395,10 +395,10 @@ BOOLEAN RemoveSWBreakpoint(ULONG ulAddress)
}
//*************************************************************************
// DeInstallSWBreakpoint()
//
//*************************************************************************
//*************************************************************************
// DeInstallSWBreakpoint()
//
//*************************************************************************
BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress)
{
PSW_BP p;
@@ -425,10 +425,10 @@ BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress)
return bResult;
}
//*************************************************************************
// RemoveAllSWBreakpoints()
//
//*************************************************************************
//*************************************************************************
// RemoveAllSWBreakpoints()
//
//*************************************************************************
BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents)
{
PSW_BP p;
@@ -472,10 +472,10 @@ BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents)
return bResult;
}
//*************************************************************************
// IsPermanentSWBreakpoint()
//
//*************************************************************************
//*************************************************************************
// IsPermanentSWBreakpoint()
//
//*************************************************************************
PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress)
{
PSW_BP p;
@@ -487,7 +487,7 @@ PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress)
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(aSwBreakpoints[0]));i++)
{
p = &aSwBreakpoints[i];
if(p->ulAddress == ulAddress &&
if(p->ulAddress == ulAddress &&
p->bUsed == TRUE &&
p->bPermanent == TRUE)
{
@@ -501,16 +501,16 @@ PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress)
return NULL;
}
//*************************************************************************
// ListSWBreakpoints()
//
//*************************************************************************
//*************************************************************************
// ListSWBreakpoints()
//
//*************************************************************************
void ListSWBreakpoints(void)
{
PSW_BP p;
ULONG i;
LPSTR pSymbolName;
struct module* pMod;
PDEBUG_MODULE pMod;
ENTER_FUNC();
DPRINT((0,"ListSWBreakpoints()\n"));
@@ -518,12 +518,12 @@ void ListSWBreakpoints(void)
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
{
p = &aSwBreakpoints[i];
if(p->bUsed == TRUE && p->bVirtual == FALSE)
if(p->bUsed == TRUE && p->bVirtual == FALSE)
{
if((pSymbolName = FindFunctionByAddress(p->ulAddress,NULL,NULL)) )
{
pMod = FindModuleFromAddress(p->ulAddress);
PICE_sprintf(tempBp,"[%u] %.8X (%s!%s) %s\n",i,p->ulAddress,pMod->name,pSymbolName,p->bPermanent?"PERMANENT":"");
PICE_sprintf(tempBp,"[%u] %.8X (%S!%s) %s\n",i,p->ulAddress,pMod->name,pSymbolName,p->bPermanent?"PERMANENT":"");
}
else
{
@@ -544,21 +544,22 @@ void ListSWBreakpoints(void)
LEAVE_FUNC();
}
//*************************************************************************
// RevirtualizeBreakpointsForModule()
//
//*************************************************************************
void RevirtualizeBreakpointsForModule(struct module* pMod)
//*************************************************************************
// RevirtualizeBreakpointsForModule()
//
//*************************************************************************
void RevirtualizeBreakpointsForModule(PDEBUG_MODULE pMod)
{
ULONG i,start,end;
PSW_BP p;
char temp[DEBUG_MODULE_NAME_LEN];
DPRINT((0,"RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pMod));
if(IsRangeValid((ULONG)pMod,sizeof(struct module)) )
if(IsRangeValid((ULONG)pMod,sizeof(DEBUG_MODULE)) )
{
start = (ULONG)pMod;
end = (ULONG)pMod+pMod->size;
start = (ULONG)pMod->BaseAddress;
end = (ULONG)pMod->BaseAddress+pMod->size;
DPRINT((0,"RevirtualizeBreakpointsForModule(): module %x (%x-%x)\n",(ULONG)pMod,start,end));
// go through all breakpoints
@@ -593,7 +594,8 @@ void RevirtualizeBreakpointsForModule(struct module* pMod)
while(*pFind!='!')pFind++;
pFind++;
// remember the function and the module for reinstallation
PICE_strcpy(p->szModName,(LPSTR)pMod->name);
CopyWideToAnsi(temp,pMod->name);
PICE_strcpy(p->szModName,temp);
PICE_strcpy(p->szFunctionName,pFind);
DPRINT((0,"RevirtualizeBreakpointsForModule(): %s!%s\n",p->szModName,p->szFunctionName));
// if function name contains a '+' it's an offset
@@ -642,11 +644,11 @@ void RevirtualizeBreakpointsForModule(struct module* pMod)
}
}
//*************************************************************************
// NewInt3Handler()
//
//*************************************************************************
__asm__ ("
//*************************************************************************
// NewInt3Handler()
//
//*************************************************************************
__asm__ ("
NewInt3Handler:
pushl $" STR(REASON_INT3) "
// call debugger loop
@@ -654,10 +656,10 @@ NewInt3Handler:
");
//*************************************************************************
// InstallInt3Hook()
//
//*************************************************************************
//*************************************************************************
// InstallInt3Hook()
//
//*************************************************************************
void InstallInt3Hook(void)
{
ULONG LocalInt3Handler;
@@ -681,10 +683,10 @@ void InstallInt3Hook(void)
LEAVE_FUNC();
}
//*************************************************************************
// DeInstallInt3Hook()
//
//*************************************************************************
//*************************************************************************
// DeInstallInt3Hook()
//
//*************************************************************************
void DeInstallInt3Hook(void)
{
ENTER_FUNC();
@@ -701,4 +703,4 @@ void DeInstallInt3Hook(void)
DPRINT((0,"leave DeInstallInt3Hook()...\n"));
LEAVE_FUNC();
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ Environment:
LINUX 2.2.X
Kernel mode only
Author:
Author:
Klaus P. Gerlicher
@@ -55,7 +55,7 @@ void ListSWBreakpoints(void);
PSW_BP FindSwBp(ULONG ulAddress);
BOOLEAN IsSwBpAtAddress(ULONG ulAddress);
BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress);
void RevirtualizeBreakpointsForModule(struct module* pMod);
void RevirtualizeBreakpointsForModule(PDEBUG_MODULE pMod);
void InstallInt3Hook(void);
void DeInstallInt3Hook(void);
+212 -295
View File
@@ -61,7 +61,7 @@ extern unsigned long sys_call_table[];
BOOLEAN (*DisplayMemory)(PARGS) = DisplayMemoryDword;
char szCurrentFile[256]="";
struct module* pCurrentMod=NULL;
PDEBUG_MODULE pCurrentMod=NULL;
PICE_SYMBOLFILE_HEADER* pCurrentSymbols=NULL;
// suppresses passing on of function keys while stepping code
@@ -107,7 +107,7 @@ LPSTR LocalVarRegs[]=
"EAX",
"ECX",
"EDX",
"EBX",
"EBX",
"ESP",
"EBP",
"ESI",
@@ -239,10 +239,10 @@ CPUINFO CPUInfo[]={
{"DR3",&CurrentDR3},
{"DR6",&CurrentDR6},
{"DR7",&CurrentDR7},
{"EFLAGS",&CurrentEFL},
{"CR0",&CurrentCR0},
{"CR2",&CurrentCR2},
{"CR3",&CurrentCR3},
{"EFLAGS",&CurrentEFL},
{"CR0",&CurrentCR0},
{"CR2",&CurrentCR2},
{"CR3",&CurrentCR3},
{"",NULL},
};
@@ -313,7 +313,7 @@ void RepaintSource(void)
// disassembly from current address
PICE_memset(&Args,0,sizeof(ARGS));
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
Args.Count=0;
Unassemble(&Args);
@@ -343,7 +343,7 @@ void RepaintDesktop(void)
// disassembly from current address
PICE_memset(&Args,0,sizeof(ARGS));
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
Args.Count=0;
Unassemble(&Args);
@@ -435,7 +435,7 @@ COMMAND_PROTOTYPE(SingleStep)
}
else
{
// modify trace flag
// modify trace flag
CurrentEFL|=0x100; // set trace flag (TF)
bSingleStep=TRUE;
@@ -509,7 +509,7 @@ proceed_as_normal:
}
else
{
// modify trace flag
// modify trace flag
CurrentEFL|=0x100; // set trace flag (TF)
bSingleStep=TRUE;
@@ -560,13 +560,13 @@ COMMAND_PROTOTYPE(StepInto)
proceed_as_normal_into:
// modify trace flag
// modify trace flag
CurrentEFL|=0x100; // set trace flag (TF)
bSingleStep=TRUE;
bNotifyToExit=TRUE;
}
bStepInto = TRUE;
bStepping = TRUE;
@@ -580,102 +580,102 @@ proceed_as_normal_into:
// SetBreakpoint()
//
//*************************************************************************
COMMAND_PROTOTYPE(SetBreakpoint)
{
ULONG addr,addrorg;
USHORT segment;
if(pArgs->Count<=2)
{
COMMAND_PROTOTYPE(SetBreakpoint)
{
ULONG addr,addrorg;
USHORT segment;
if(pArgs->Count<=2)
{
if(pArgs->bNotTranslated[0]==FALSE)
{
if(gCurrentSelector)
{
addr=pArgs->Value[0];
addrorg=gCurrentOffset;
segment=gCurrentSelector;
}
else
{
addrorg=addr=pArgs->Value[0];
segment=CurrentCS;
}
if(gCurrentSelector)
{
addr=pArgs->Value[0];
addrorg=gCurrentOffset;
segment=gCurrentSelector;
}
else
{
addrorg=addr=pArgs->Value[0];
segment=CurrentCS;
}
if(InstallSWBreakpoint(GetLinearAddress(segment,addr),FALSE,NULL) )
{
PICE_sprintf(tempCmd,"BP #%u set to %.4X:%.8X\n",0,segment,addr);
PICE_sprintf(tempCmd,"BP #%u set to %.4X:%.8X\n",0,segment,addr);
}
else
{
PICE_sprintf(tempCmd,"BP #%u NOT set (either page not valid OR already used)\n",0);
PICE_sprintf(tempCmd,"BP #%u NOT set (either page not valid OR already used)\n",0);
}
Print(OUTPUT_WINDOW,tempCmd);
Print(OUTPUT_WINDOW,tempCmd);
}
else
{
if(InstallVirtualSWBreakpoint((LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]) )
{
PICE_sprintf(tempCmd,"BP #%u virtually set to %s!%s\n",0,(LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]);
PICE_sprintf(tempCmd,"BP #%u virtually set to %s!%s\n",0,(LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]);
}
else
{
PICE_sprintf(tempCmd,"BP #%u NOT set (maybe no symbols loaded)\n",0);
PICE_sprintf(tempCmd,"BP #%u NOT set (maybe no symbols loaded)\n",0);
}
Print(OUTPUT_WINDOW,tempCmd);
Print(OUTPUT_WINDOW,tempCmd);
}
RepaintSource();
}
return TRUE;
}
}
return TRUE;
}
//*************************************************************************
// ListBreakpoints()
//
//*************************************************************************
COMMAND_PROTOTYPE(ListBreakpoints)
{
ULONG i;
COMMAND_PROTOTYPE(ListBreakpoints)
{
ULONG i;
ListSWBreakpoints();
for(i=0;i<4;i++)
{
if(Bp[i].Used)
{
PICE_sprintf(tempCmd,"(%u) %s %.4X:%.8X(linear %.8X)\n",i,Bp[i].Active?"*":" ",Bp[i].Segment,Bp[i].Offset,Bp[i].LinearAddress);
Print(OUTPUT_WINDOW,tempCmd);
}
}
return TRUE;
}
for(i=0;i<4;i++)
{
if(Bp[i].Used)
{
PICE_sprintf(tempCmd,"(%u) %s %.4X:%.8X(linear %.8X)\n",i,Bp[i].Active?"*":" ",Bp[i].Segment,Bp[i].Offset,Bp[i].LinearAddress);
Print(OUTPUT_WINDOW,tempCmd);
}
}
return TRUE;
}
//*************************************************************************
// ClearBreakpoints()
//
//*************************************************************************
COMMAND_PROTOTYPE(ClearBreakpoints)
{
if(pArgs->Count)
{
if(pArgs->Value[0]<4)
{
Bp[pArgs->Value[0]].Used=Bp[pArgs->Value[0]].Active=FALSE;
}
COMMAND_PROTOTYPE(ClearBreakpoints)
{
if(pArgs->Count)
{
if(pArgs->Value[0]<4)
{
Bp[pArgs->Value[0]].Used=Bp[pArgs->Value[0]].Active=FALSE;
}
RepaintSource();
}
else
{
ULONG i;
}
else
{
ULONG i;
RemoveAllSWBreakpoints(FALSE);
for(i=0;i<4;i++)Bp[i].Used=Bp[i].Active=FALSE;
for(i=0;i<4;i++)Bp[i].Used=Bp[i].Active=FALSE;
RepaintSource();
}
return TRUE;
}
}
return TRUE;
}
//*************************************************************************
// LeaveIce()
@@ -683,7 +683,7 @@ COMMAND_PROTOTYPE(ClearBreakpoints)
//*************************************************************************
COMMAND_PROTOTYPE(LeaveIce)
{
// SetHardwareBreakPoints();
// SetHardwareBreakPoints();
bSingleStep=FALSE;
bNotifyToExit=TRUE;
@@ -705,7 +705,7 @@ COMMAND_PROTOTYPE(ShowGdt)
// get GDT register
__asm__ ("sgdt %0\n"
:"=m" (gdtr));
// info out
PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(gdtr[1]<<16)|(gdtr[0]>>16),gdtr[0]&0xFFFF);
Print(OUTPUT_WINDOW,tempCmd);
@@ -833,41 +833,41 @@ void OutputIdtEntry(PIDT pIdt,ULONG i)
// ShowIdt()
//
//*************************************************************************
COMMAND_PROTOTYPE(ShowIdt)
{
ULONG idtr[2];
USHORT i;
PIDT pIdt;
COMMAND_PROTOTYPE(ShowIdt)
{
ULONG idtr[2];
USHORT i;
PIDT pIdt;
ULONG addr=0;
ENTER_FUNC();
// get GDT register
// get GDT register
__asm__ ("sidt %0\n"
:"=m" (idtr));
// info out
PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(idtr[1]<<16)|(idtr[0]>>16),idtr[0]&0xFFFF);
Print(OUTPUT_WINDOW,tempCmd);
// info out
PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(idtr[1]<<16)|(idtr[0]>>16),idtr[0]&0xFFFF);
Print(OUTPUT_WINDOW,tempCmd);
WaitForKey();
// make pointer to GDT
pIdt=(PIDT)(((ULONG)(idtr[1]<<16))|((ULONG)(idtr[0]>>16)));
if(pArgs->Count==1)
{
addr=pArgs->Value[0];
addr&=(~0x7);
}
else if(pArgs->Count==0)
{
for(i=0;i<((idtr[0]&0xFFFF)>>3);i++)
{
// make pointer to GDT
pIdt=(PIDT)(((ULONG)(idtr[1]<<16))|((ULONG)(idtr[0]>>16)));
if(pArgs->Count==1)
{
addr=pArgs->Value[0];
addr&=(~0x7);
}
else if(pArgs->Count==0)
{
for(i=0;i<((idtr[0]&0xFFFF)>>3);i++)
{
OutputIdtEntry(pIdt,i);
if(WaitForKey()==FALSE)break;
}
}
if(WaitForKey()==FALSE)break;
}
}
LEAVE_FUNC();
return TRUE;
}
return TRUE;
}
//*************************************************************************
// ShowHelp()
@@ -901,7 +901,7 @@ COMMAND_PROTOTYPE(ShowHelp)
// ShowPageDirs()
//
//*************************************************************************
COMMAND_PROTOTYPE(ShowPageDirs)
COMMAND_PROTOTYPE(ShowPageDirs)
{
ULONG i;
PPAGEDIR pPageDir;
@@ -939,8 +939,8 @@ COMMAND_PROTOTYPE(ShowPageDirs)
{
PutStatusText("Linear Physical Attributes");
// there are 1024 page directories each mapping 1024*4k of address space
for(i=0;i<1024;i++)
{
for(i=0;i<1024;i++)
{
ULONG ulAddress = i<<22;
// from the mm_struct get pointer to page directory for this address
pPGD = pgd_offset(mm,ulAddress);
@@ -950,17 +950,17 @@ COMMAND_PROTOTYPE(ShowPageDirs)
// create a structurized pointer from PGD
pPageDir = (PPAGEDIR)pPGD;
PICE_sprintf(tempCmd,"%.8X-%.8X %.8X %s %s %s\n",
PICE_sprintf(tempCmd,"%.8X-%.8X %.8X %s %s %s\n",
ulAddress, ulAddress + 0x400000,
(pPageDir->PTBase<<12),
pPageDir->P?"P ":"NP",
pPageDir->RW?"RW":"R ",
pPageDir->US?"U":"S");
Print(OUTPUT_WINDOW,tempCmd);
(pPageDir->PTBase<<12),
pPageDir->P?"P ":"NP",
pPageDir->RW?"RW":"R ",
pPageDir->US?"U":"S");
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)break;
if(WaitForKey()==FALSE)break;
}
}
}
}
// one arg supplied -> show individual page
else if(pArgs->Count == 1)
@@ -979,11 +979,11 @@ COMMAND_PROTOTYPE(ShowPageDirs)
PutStatusText("Linear Physical Attributes");
PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (LARGE PAGE PTE @ %.8X)\n",
pArgs->Value[0],
(pPage->PTBase<<12)|(pArgs->Value[0]&0x7FFFFF),
pPage->P?"P ":"NP",
pPage->RW?"RW":"R ",
PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (LARGE PAGE PTE @ %.8X)\n",
pArgs->Value[0],
(pPage->PTBase<<12)|(pArgs->Value[0]&0x7FFFFF),
pPage->P?"P ":"NP",
pPage->RW?"RW":"R ",
pPage->US?"U":"S",
(ULONG)pPGD);
}
@@ -1002,39 +1002,39 @@ COMMAND_PROTOTYPE(ShowPageDirs)
PutStatusText("Linear Physical Attributes");
PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (PTE @ %.8X)\n",
pArgs->Value[0],
(pPage->PTBase<<12)|(pArgs->Value[0]&(PAGE_SIZE-1)),
(pPage->P==1)?"P ":"NP",
pPage->RW?"RW":"R ",
PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (PTE @ %.8X)\n",
pArgs->Value[0],
(pPage->PTBase<<12)|(pArgs->Value[0]&(PAGE_SIZE-1)),
(pPage->P==1)?"P ":"NP",
pPage->RW?"RW":"R ",
pPage->US?"U":"S",
(ULONG)pPTE);
(ULONG)pPTE);
}
}
Print(OUTPUT_WINDOW,tempCmd);
Print(OUTPUT_WINDOW,tempCmd);
}
else
{
PICE_sprintf(tempCmd,"page at %.8X not present.\n",pArgs->Value[0]);
Print(OUTPUT_WINDOW,tempCmd);
Print(OUTPUT_WINDOW,tempCmd);
}
}
}
return TRUE;
}
return TRUE;
}
//*************************************************************************
// ShowProcesses()
//
//*************************************************************************
COMMAND_PROTOTYPE(ShowProcesses)
{
COMMAND_PROTOTYPE(ShowProcesses)
{
struct task_struct* p;
struct task_struct* my_current = (struct task_struct*)0xFFFFE000;
ULONG i;
\
(ULONG)my_current &= ulRealStackPtr;
ENTER_FUNC();
@@ -1051,16 +1051,16 @@ COMMAND_PROTOTYPE(ShowProcesses)
for(i=0,p = my_current; (p = p->next_task) != my_current;i++)
{
DPRINT((0,"p = %x\n",p));
PICE_sprintf(tempCmd,"%-16.16s %-12x %x\n",(LPSTR)&(p->comm),(ULONG)p,p->pid);
Print(OUTPUT_WINDOW,tempCmd);
PICE_sprintf(tempCmd,"%-16.16s %-12x %x\n",(LPSTR)&(p->comm),(ULONG)p,p->pid);
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)
break;
}
break;
}
}
LEAVE_FUNC();
return TRUE;
}
return TRUE;
}
//*************************************************************************
// DisplayMemoryDword()
@@ -1347,7 +1347,7 @@ void DisplaySourceFile(LPSTR pSrcLine,LPSTR pSrcEnd,ULONG ulLineNumber,ULONG ulL
// goto end of current line
while(*pSrcLine!=0x0a && *pSrcLine!=0x0d)
pSrcLine++;
// skip over the line end
if(*pSrcLine == 0x0d)
pSrcLine++;
@@ -1381,7 +1381,7 @@ void DisplaySourceFile(LPSTR pSrcLine,LPSTR pSrcEnd,ULONG ulLineNumber,ULONG ulL
*pTemp++ = *pSrcLine++;
}
}
if(pSrcLine<pSrcEnd)
{
// skip over the line end
@@ -1501,7 +1501,7 @@ void UnassembleOneLineUp(void)
}
else
{
// max instruction length is 15 bytes
// max instruction length is 15 bytes
offset = 15;
}
@@ -1556,7 +1556,7 @@ void UnassembleOnePageUp(ULONG page)
}
else
{
// max instruction length is 15 bytes
// max instruction length is 15 bytes
offset = 15;
}
@@ -1648,7 +1648,7 @@ COMMAND_PROTOTYPE(Unassemble)
DisableScroll(SOURCE_WINDOW);
// if we're inside last disassembly range we only need to move to highlight
if(addr>=ulLastDisassStartAddress &&
if(addr>=ulLastDisassStartAddress &&
addr<ulLastDisassEndAddress )
{
addr=ulLastDisassStartAddress;
@@ -1678,20 +1678,9 @@ COMMAND_PROTOTYPE(Unassemble)
if(pCurrentMod)
{
ULONG mod_addr;
DPRINT((0,"Unassemble(): pCurrentMod->name = %s\n",pCurrentMod->name));
DPRINT((0,"Unassemble(): pCurrentMod->name = %S\n",pCurrentMod->name));
mod_addr = (ULONG)pCurrentMod->BaseAddress;
// in case we query for the kernel we need to use the fake kernel module
if(pCurrentMod == &fake_kernel_module)
{
mod_addr = KERNEL_START;
}
else
{
mod_addr = (ULONG)pCurrentMod;
}
mod_addr += sizeof(struct module);
pCurrentSymbols = FindModuleSymbols(mod_addr);
DPRINT((0,"Unassemble(): pCurrentSymbols = %x\n",(ULONG)pCurrentSymbols));
}
@@ -1718,7 +1707,7 @@ COMMAND_PROTOTYPE(Unassemble)
else
{
LPSTR p;
p = strrchr(pFilename,'/');
if(!p)
{
@@ -1777,7 +1766,7 @@ COMMAND_PROTOTYPE(Unassemble)
ulLastInvertedAddress = CurrentEIP;
}
// output segment:offset address
// output segment:offset address
PICE_sprintf(tempCmd,"%0.4X:%0.8X ",segment,addr);
Print(SOURCE_WINDOW,tempCmd);
@@ -1845,7 +1834,7 @@ COMMAND_PROTOTYPE(Unassemble)
{
HatchLine(wWindow[SOURCE_WINDOW].y+i);
}
// if breakpoint was installed before disassembly, put it back
if(bSWBpAtAddr)
{
@@ -1879,40 +1868,34 @@ COMMAND_PROTOTYPE(Unassemble)
//*************************************************************************
COMMAND_PROTOTYPE(ShowModules)
{
struct module *pMod;
PDEBUG_MODULE pMod;
DPRINT((0,"ShowModules()\n"));
if(pmodule_list)
if(BuildModuleList())
{
pMod = *pmodule_list;
pMod = pdebug_module_head;
do
{
if(pMod->size)
{
if(pMod == pCurrentMod)
{
PICE_sprintf(tempCmd,"%.8X - %.8X *%-32s (%6u symbols @ %.8X)\n",
(unsigned int)pMod,
(unsigned int) ((unsigned int)pMod+pMod->size),pMod->name,pMod->nsyms,pMod->syms);
PICE_sprintf(tempCmd,"%.8X - %.8X *%-32S\n",
(unsigned int)pMod->BaseAddress,
(unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size),pMod->name);
}
else
{
PICE_sprintf(tempCmd,"%.8X - %.8X %-32s (%6u symbols @ %.8X)\n",
(unsigned int)pMod,
(unsigned int) ((unsigned int)pMod+pMod->size),pMod->name,pMod->nsyms,pMod->syms);
PICE_sprintf(tempCmd,"%.8X - %.8X %-32S\n",
(unsigned int)pMod->BaseAddress,
(unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size),
pMod->name);
}
}
else
{
PICE_sprintf(tempCmd,"%.8X - %.8X vmlinux (%6u symbols @ %.8X)\n",
(unsigned int)pMod,
kernel_end,pMod->nsyms,pMod->syms);
}
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)
break;
}while((pMod = pMod->next));
break;
}while((pMod = pMod->next)!=pdebug_module_tail);
}
return TRUE;
}
@@ -1925,24 +1908,24 @@ LPSTR DecodeVmFlags(ULONG flags)
{
ULONG i;
/*
#define VM_READ 0x0001
#define VM_READ 0x0001
#define VM_WRITE 0x0002
#define VM_EXEC 0x0004
#define VM_SHARED 0x0008
#define VM_MAYREAD 0x0010
#define VM_MAYREAD 0x0010
#define VM_MAYWRITE 0x0020
#define VM_MAYEXEC 0x0040
#define VM_MAYSHARE 0x0080
#define VM_GROWSDOWN 0x0100
#define VM_GROWSDOWN 0x0100
#define VM_GROWSUP 0x0200
#define VM_SHM 0x0400
#define VM_DENYWRITE 0x0800
#define VM_SHM 0x0400
#define VM_DENYWRITE 0x0800
#define VM_EXECUTABLE 0x1000
#define VM_LOCKED 0x2000
#define VM_IO 0x4000
#define VM_IO 0x4000
#define VM_STACK_FLAGS 0x0177
*/
@@ -2014,7 +1997,7 @@ COMMAND_PROTOTYPE(ShowVirtualMemory)
DecodeVmFlags(vma->vm_flags),
filename);
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)break;
}
}
@@ -2071,7 +2054,7 @@ COMMAND_PROTOTYPE(SetSrcDisplay)
{
bShowSrc=bShowSrc?FALSE:TRUE;
PICE_memset(&Args,0,sizeof(ARGS));
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
Args.Count=0;
Unassemble(&Args);
@@ -2123,7 +2106,7 @@ COMMAND_PROTOTYPE(I3here)
return TRUE;
}
#ifndef LINUX
#ifndef LINUX
COMMAND_PROTOTYPE(I1here)
{
if(pArgs->Count==1)
@@ -2184,7 +2167,7 @@ COMMAND_PROTOTYPE(NextInstr)
// unassemble
DPRINT((0,"new CS:EIP %04.x:%.8X\n",CurrentCS,CurrentEIP));
PICE_memset(pArgs,0,sizeof(ARGS));
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
pArgs->Count=2;
pArgs->Value[0]=(ULONG)CurrentCS;
@@ -2286,7 +2269,7 @@ COMMAND_PROTOTYPE(SetCodeDisplay)
PICE_memset(&Args,0,sizeof(ARGS));
Args.Count=0;
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
Unassemble(&Args);
}
@@ -2296,7 +2279,7 @@ COMMAND_PROTOTYPE(SetCodeDisplay)
PICE_memset(&Args,0,sizeof(ARGS));
Args.Count=0;
// make unassembler refresh all again
// make unassembler refresh all again
ulLastDisassStartAddress=ulLastDisassEndAddress=0;
Unassemble(&Args);
}
@@ -2324,14 +2307,14 @@ ULONG i;
// WalkStack()
//
//*************************************************************************
COMMAND_PROTOTYPE(WalkStack)
{
if(!pArgs->Count)
{
IntelStackWalk(CurrentEIP,CurrentEBP,CurrentESP);
}
return TRUE;
COMMAND_PROTOTYPE(WalkStack)
{
if(!pArgs->Count)
{
IntelStackWalk(CurrentEIP,CurrentEBP,CurrentESP);
}
return TRUE;
}
//*************************************************************************
@@ -2482,7 +2465,7 @@ COMMAND_PROTOTYPE(UnassembleAtCurrentEip)
COMMAND_PROTOTYPE(SwitchTables)
{
ULONG i;
struct module* pMod;
PDEBUG_MODULE pMod;
DPRINT((0,"SwitchTables()\n"));
@@ -2494,9 +2477,9 @@ COMMAND_PROTOTYPE(SwitchTables)
if(apSymbols[i])
{
if(apSymbols[i] == pCurrentSymbols)
PICE_sprintf(tempCmd,"*%-32s @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
PICE_sprintf(tempCmd,"*%-32S @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
else
PICE_sprintf(tempCmd," %-32s @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
PICE_sprintf(tempCmd," %-32S @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)break;
}
@@ -2505,33 +2488,11 @@ COMMAND_PROTOTYPE(SwitchTables)
// 1 argument -> set new current symbols
else if(pArgs->Count == 1)
{
if(pmodule_list)
{
pCurrentSymbols = (PICE_SYMBOLFILE_HEADER*)pArgs->Value[0];
pMod = *pmodule_list;
do
{
if(pMod->size)
{
if(PICE_strcmpi((LPSTR)pMod->name,pCurrentSymbols->name)==0)
{
pCurrentMod = pMod;
break;
}
}
else
{
if(PICE_strcmpi((LPSTR)fake_kernel_module.name,pCurrentSymbols->name)==0)
{
pCurrentMod = &fake_kernel_module;
break;
}
}
}while((pMod = pMod->next));
}
PDEBUG_MODULE pTempMod;
pCurrentSymbols = (PICE_SYMBOLFILE_HEADER*)pArgs->Value[0];
pTempMod = IsModuleLoaded(pCurrentSymbols->name);
if( pTempMod )
pCurrentMod = pTempMod;
}
return TRUE;
@@ -2700,23 +2661,12 @@ COMMAND_PROTOTYPE(ShowSymbols)
// have current module ?
if(pCurrentMod)
{
DPRINT((0,"ShowSymbols(): full listing of symbols for %s\n",pCurrentMod->name));
// in case we query for the kernel we need to use the fake kernel module
if(pCurrentMod == &fake_kernel_module)
{
addr = KERNEL_START;
}
else
{
addr = (ULONG)pCurrentMod;
}
addr += sizeof(struct module);
DPRINT((0,"ShowSymbols(): full listing of symbols for %S\n",pCurrentMod->name));
addr = (ULONG)pCurrentMod->BaseAddress;
if((pSymbols = FindModuleSymbols(addr)) )
{
PICE_sprintf(tempCmd,"symbols for module \"%s\"\n",pCurrentMod->name);
PICE_sprintf(tempCmd,"symbols for module \"%S\"\n",pCurrentMod->name);
Print(OUTPUT_WINDOW,tempCmd);
index = 0;
@@ -2733,22 +2683,13 @@ COMMAND_PROTOTYPE(ShowSymbols)
{
if(pCurrentMod)
{
if(pCurrentMod == &fake_kernel_module)
{
addr = KERNEL_START;
}
else
{
addr = (ULONG)pCurrentMod;
}
addr += sizeof(struct module);
addr = (ULONG)pCurrentMod->BaseAddress;
if((pSymbols = FindModuleSymbols(addr)))
{
pSearchString = (LPSTR)pArgs->Value[0];
PICE_sprintf(tempCmd,"symbols for module \"%s\" (searching for \"%s\")\n",pCurrentMod->name,pSearchString);
PICE_sprintf(tempCmd,"symbols for module \"%S\" (searching for \"%s\")\n",pCurrentMod->name,pSearchString);
Print(OUTPUT_WINDOW,tempCmd);
if(pSearchString)
@@ -2775,7 +2716,7 @@ COMMAND_PROTOTYPE(ShowSymbols)
{
pSearchString[PICE_strlen(pSearchString)-1] = 0;
index = 0;
index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd);
if(index)
{
@@ -2792,8 +2733,6 @@ COMMAND_PROTOTYPE(ShowSymbols)
}while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd)));
}
}
}
}
}
@@ -2815,18 +2754,7 @@ COMMAND_PROTOTYPE(EvaluateExpression)
{
if(pCurrentMod)
{
// in case we query for the kernel we need to use the fake kernel module
if(pCurrentMod == &fake_kernel_module)
{
addr = KERNEL_START;
}
else
{
addr = (ULONG)pCurrentMod;
}
addr += sizeof(struct module);
addr = (ULONG)pCurrentMod->BaseAddress;
if( (pSymbols = FindModuleSymbols(addr) ) )
{
@@ -2857,7 +2785,7 @@ COMMAND_PROTOTYPE(SizeCodeWindow)
if(wWindow[SOURCE_WINDOW].cy != NewHeight)
{
wWindow[SOURCE_WINDOW].cy = NewHeight;
wWindow[OUTPUT_WINDOW].y = wWindow[SOURCE_WINDOW].y + wWindow[SOURCE_WINDOW].cy + 1;
wWindow[OUTPUT_WINDOW].y = wWindow[SOURCE_WINDOW].y + wWindow[SOURCE_WINDOW].cy + 1;
wWindow[OUTPUT_WINDOW].cy = TotalHeight - NewHeight;
RepaintDesktop();
@@ -2893,7 +2821,7 @@ COMMAND_PROTOTYPE(SizeDataWindow)
if(wWindow[DATA_WINDOW].cy != NewHeight)
{
wWindow[DATA_WINDOW].cy = NewHeight;
wWindow[SOURCE_WINDOW].y = wWindow[DATA_WINDOW].y + wWindow[DATA_WINDOW].cy + 1;
wWindow[SOURCE_WINDOW].y = wWindow[DATA_WINDOW].y + wWindow[DATA_WINDOW].cy + 1;
wWindow[SOURCE_WINDOW].cy = TotalHeight - NewHeight;
RepaintDesktop();
@@ -2987,7 +2915,7 @@ COMMAND_PROTOTYPE(ShowMappings)
pPTE = pte_offset(pPMD,address);
if(pPTE)
{
if(*(PULONG)pPTE & _PAGE_PRESENT)
if(*(PULONG)pPTE & _PAGE_PRESENT)
{
ULONG ulPte = *(PULONG)pPTE & 0xFFFFF000;
@@ -3002,7 +2930,7 @@ COMMAND_PROTOTYPE(ShowMappings)
}
}
}
// large page
// large page
else
{
address = (ulPageDir<<22);
@@ -3063,7 +2991,7 @@ COMMAND_PROTOTYPE(ShowPCI)
LPSTR pVendorName;
char temp[32];
BOOLEAN bShowAll = FALSE,bUseDev=TRUE,bUseBus=TRUE;
DPRINT((0,"ShowPCI()\n"));
@@ -3137,7 +3065,7 @@ COMMAND_PROTOTYPE(ShowPCI)
PICE_sprintf(tempCmd,"SubVendorId %.4X SubSystemId %.4X\n",pciConfig.SubVendorID,pciConfig.SubSystemID);
Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)goto CommonShowPCIExit;
if(bShowAll)
{
for(ulNumBaseAddresses=0,i=0;i<6;i++)
@@ -3521,26 +3449,12 @@ BOOLEAN ConvertTokenToSymbol(LPSTR pToken,PULONG pValue)
// now we have two pointers
pEx++;
DPRINT((0,"ConvertTokenToSymbol(): module = %s symbol = %s\n",p,pEx));
if(pmodule_list)
if( pModFound=IsModuleLoaded(p) )
{
struct module* pMod = *pmodule_list,*pModFound=NULL;
do
{
if(PICE_strcmpi(p,(LPSTR)pMod->name)==0)
{
DPRINT((0,"ConvertTokenToSymbol(): found the module\n"));
pModFound = pMod;
break;
}
}while((pMod = pMod->next));
if(pModFound)
{
if((*pValue = FindFunctionInModuleByName(pEx,pModFound)))
return TRUE;
}
if((*pValue = FindFunctionInModuleByName(pEx,pModFound)))
return TRUE;
}
}
else
{
@@ -3599,12 +3513,14 @@ BOOLEAN ConvertTokenToModuleAndName(LPSTR pToken,PULONG pulModuleName,PULONG pul
BOOLEAN ConvertTokenToModule(LPSTR p,PULONG pValue)
{
ULONG i;
char temp[DEBUG_MODULE_NAME_LEN];
for(i=0;i<DIM(apSymbols);i++)
{
if(apSymbols[i])
{
if(PICE_strcmpi(p,apSymbols[i]->name)==0)
CopyWideToAnsi(temp,apSymbols[i]->name);
if(PICE_strcmpi(p,temp)==0)
{
*pValue = (ULONG)apSymbols[i];
return TRUE;
@@ -3616,7 +3532,8 @@ BOOLEAN ConvertTokenToModule(LPSTR p,PULONG pValue)
{
if(apSymbols[i])
{
if(PICE_strncmpi(apSymbols[i]->name,p,PICE_strlen(p))==0)
CopyWideToAnsi(temp,apSymbols[i]->name);
if(PICE_strncmpi(temp,p,PICE_strlen(p))==0)
{
*pValue = (ULONG)apSymbols[i];
return TRUE;
@@ -3733,7 +3650,7 @@ BOOLEAN ConvertSizeToKeyword(LPSTR p,PULONG pValue)
count=StrLenUpToWhiteChar(p," ");
if(count > 1)
return FALSE;
switch(*p)
{
// BYTE
@@ -3778,7 +3695,7 @@ BOOLEAN ConvertTokenToSrcFile(LPSTR p,PULONG pValue)
if(pCurrentSymbols && pCurrentSymbols->ulNumberOfSrcFiles)
{
DPRINT((0,"ConvertTokenToSrcFile(): current symbols for %s\n",pCurrentSymbols->name));
DPRINT((0,"ConvertTokenToSrcFile(): current symbols for %S\n",pCurrentSymbols->name));
pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pCurrentSymbols + pCurrentSymbols->ulOffsetToSrcFiles);
@@ -3857,7 +3774,7 @@ BOOLEAN ConvertTokenToLineNumber(LPSTR p,PULONG pValue)
DPRINT((0,"ConvertTokenToLineNumber(): current file = %s\n",szCurrentFile));
if(pCurrentMod && PICE_strlen(szCurrentFile))
{
DPRINT((0,"ConvertTokenToLineNumber(): current file %s\n",pCurrentMod->name));
DPRINT((0,"ConvertTokenToLineNumber(): current file %S\n",pCurrentMod->name));
if(FindAddressForSourceLine(ulDecimal,szCurrentFile,pCurrentMod,pValue))
{
DPRINT((0,"ConvertTokenToLineNumber(): value = %x\n",*pValue));
@@ -3937,7 +3854,7 @@ void Parse(LPSTR pCmdLine,BOOLEAN bInvokedByFkey)
Print(OUTPUT_WINDOW,":");
goto CommonParseReturnPoint;
}
pToken = PICE_strtok( pCmdLine);
// get the args and convert them into numbers
i=0;
+2 -2
View File
@@ -15,7 +15,7 @@ Environment:
LINUX 2.2.X
Kernel mode only
Author:
Author:
Klaus P. Gerlicher
@@ -93,7 +93,7 @@ extern BOOLEAN bInt3Here;
extern BOOLEAN bStepping;
extern char szCurrentFile[256];
extern struct module* pCurrentMod;
extern PDEBUG_MODULE pCurrentMod;
extern PICE_SYMBOLFILE_HEADER* pCurrentSymbols;
extern LONG ulCurrentlyDisplayedLineNumber;
+245 -253
View File
@@ -15,6 +15,7 @@ Environment:
Author:
Klaus P. Gerlicher
Reactos Port by Eugene Ingerman
Revision History:
@@ -32,17 +33,8 @@ Copyright notice:
////
#include "remods.h"
#include "precomp.h"
#include <linux/elf.h>
#include "stab_gnu.h"
#include <asm/io.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <asm/delay.h>
#include <linux/ctype.h>
#include <ntdll/ldr.h>
#include <ntdll/rtl.h>
#include <internal/ps.h>
@@ -61,10 +53,7 @@ LOCAL_VARIABLE local_vars[512];
PICE_SYMBOLFILE_HEADER* apSymbols[32]={NULL,};
ULONG ulNumSymbolsLoaded=0;
ULONG kernel_end=0;
// artificial module structure if address is in kernel
struct module fake_kernel_module;
//ULONG kernel_end=0;
char tempSym[1024]; // temp buffer for output
@@ -121,7 +110,6 @@ VOID FreeModuleList( PDEBUG_MODULE pm )
while( pNext ){
pNext = pm->next;
RtlFreeUnicodeString( &(pm->name) );
ExFreePool( pm );
}
LEAVE_FUNC();
@@ -149,7 +137,6 @@ BOOLEAN InitModuleList( PDEBUG_MODULE *ppmodule, ULONG len )
pm->next = pNext;
pm->size = 0;
pm->BaseAddress = NULL;
RtlCreateUnicodeString(&(pm->name), L" \0");
//DbgPrint("len1: %d\n", pm->name.Length);
pNext = pm;
}
@@ -181,7 +168,8 @@ BOOLEAN ListUserModules( PPEB peb )
pdebug_module_tail->size = Module->SizeOfImage;
pdebug_module_tail->BaseAddress = Module->BaseAddress;
pdebug_module_tail->EntryPoint = Module->EntryPoint;
RtlCopyUnicodeString( &(pdebug_module_tail->name), &(Module->BaseDllName));
assert(Module->BaseDllName.Length<DEBUG_MODULE_NAME_LEN); //name length is limited
PICE_wcscpy( pdebug_module_tail->name, Module->BaseDllName.Buffer );
pdebug_module_tail = pdebug_module_tail->next;
Entry = Entry->Flink;
@@ -240,7 +228,7 @@ BOOLEAN ListDriverModules( void )
pdebug_module_tail->size = pm->Length;
pdebug_module_tail->BaseAddress = pm->Base;
pdebug_module_tail->EntryPoint = pm->EntryPoint;
RtlCopyUnicodeString( &(pdebug_module_tail->name), &(pm->BaseName));
PICE_wcscpy( pdebug_module_tail->name, pm->BaseName.Buffer);
pdebug_module_tail = pdebug_module_tail->next;
/*
@@ -280,6 +268,36 @@ BOOLEAN BuildModuleList( void )
return TRUE;
}
//*************************************************************************
// IsModuleLoaded()
//
//*************************************************************************
PDEBUG_MODULE IsModuleLoaded(LPSTR p)
{
PDEBUG_MODULE pd;
ENTER_FUNC();
DPRINT((0,"IsModuleLoaded(%s)\n",p));
if(BuildModuleList())
{
pd = pdebug_module_head;
do
{
char temp[DEBUG_MODULE_NAME_LEN];
DPRINT((0,"module (%x) %S\n",pd->size,pd->name));
CopyWideToAnsi(temp,pd->name);
if(pd->size && PICE_strcmp(p,temp) == 0)
{
DPRINT((0,"module %S is loaded!\n",pd->name));
LEAVE_FUNC();
return pd;
}
}while((pd = pd->next)!=pdebug_module_tail);
}
LEAVE_FUNC();
return NULL;
}
//*************************************************************************
// ScanExports()
@@ -441,7 +459,7 @@ PICE_SYMBOLFILE_HEADER* FindModuleSymbols(ULONG addr)
DPRINT((0,"FindModuleSymbols(): address matches %S %x-%x\n",pd->name,start,end));
for(i=0;i<ulNumSymbolsLoaded;i++)
{
if(PICE_wcsicmp(pd->name.Buffer,apSymbols[i]->name) == 0)
if(PICE_wcsicmp(pd->name,apSymbols[i]->name) == 0)
{
if(ValidityCheckSymbols(apSymbols[i]))
return apSymbols[i];
@@ -475,7 +493,7 @@ PDEBUG_MODULE FindModuleFromAddress(ULONG addr)
if(pd->size)
{
start = (ULONG)pd->BaseAddress;
end = start + pMod->size;
end = start + pd->size;
DPRINT((0,"FindModuleFromAddress(): %S %x-%x\n",pd->name,start,end));
if(addr>=start && addr<end)
{
@@ -496,10 +514,10 @@ PDEBUG_MODULE FindModuleFromAddress(ULONG addr)
PDEBUG_MODULE FindModuleByName(LPSTR modname)
{
PDEBUG_MODULE pd;
WCHAR tempstr[64];
WCHAR tempstr[DEBUG_MODULE_NAME_LEN];
DPRINT((0,"FindModuleFromAddress()\n"));
if( !MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, 64 ) )
if( !MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) )
{
DPRINT((0,"Can't convert module name.\n"));
return NULL;
@@ -512,7 +530,7 @@ PDEBUG_MODULE FindModuleByName(LPSTR modname)
{
if(pd->size)
{
if(PICE_wcsicmp(tempstr,pMod->name) == 0)
if(PICE_wcsicmp(tempstr,pd->name) == 0)
{
DPRINT((0,"FindModuleByName(): found %S\n",pd->name));
return pd;
@@ -531,10 +549,10 @@ PDEBUG_MODULE FindModuleByName(LPSTR modname)
PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName(LPSTR modname)
{
ULONG i;
WCHAR tempstr[64];
WCHAR tempstr[DEBUG_MODULE_NAME_LEN];
DPRINT((0,"FindModuleSymbols()\n"));
if( !MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, 64 ) )
if( !MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) )
{
DPRINT((0,"Can't convert module name in FindModuleSymbols.\n"));
return NULL;
@@ -558,7 +576,7 @@ BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue)
char temp[256];
static char temp3[256];
LPSTR p,pStartOfLine,pSymbolName=NULL;
ULONG ulCurrentValue=0,i;
ULONG ulCurrentValue=0;
BOOLEAN bResult = FALSE;
PDEBUG_MODULE pd;
ULONG ulMinValue = -1;
@@ -607,7 +625,7 @@ BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue)
DPRINT((0,"ScanExportsByAddress(): pStr = %x\n",pStr));
DPRINT((0,"ScanExportsByAddress(): pShdr = %x\n",pShdr));
DPRINT((0,"ScanExportsByAddress(): %s has %u symbols\n",pSymbols->name,pSymbols->ulSizeOfGlobals/sizeof(IMAGE_SYMBOL)));
DPRINT((0,"ScanExportsByAddress(): %S has %u symbols\n",pSymbols->name,pSymbols->ulSizeOfGlobals/sizeof(IMAGE_SYMBOL)));
/* go through all the global symbols and find the one with
the largest address which is less than ulValue */
@@ -651,7 +669,7 @@ BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue)
}
if( !(pFoundSym->Name.Short) ){
pName = pFoundSym->ShortName; //name is in the header
PICE_sprintf(temp3,"%s!%.8s",pdTemp->name,pName); //if name is in the header it may be nonzero terminated
PICE_sprintf(temp3,"%S!%.8s",pdTemp->name,pName); //if name is in the header it may be nonzero terminated
}
else{
assert(pFoundSym->Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
@@ -661,7 +679,7 @@ BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue)
DPRINT((0,"ScanExportsByAddress(): pName = %x is not a valid pointer\n",pName));
return FALSE;
}
PICE_sprintf(temp3,"%s!%s",pdTemp->name,pName);
PICE_sprintf(temp3,"%S!%s",pdTemp->name,pName);
}
DPRINT((0,"ScanExportsByAddress(): pName = %x\n",(ULONG)pName));
return TRUE;
@@ -722,115 +740,125 @@ BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue)
//*************************************************************************
LPSTR FindFunctionByAddress(ULONG ulValue,PULONG pulstart,PULONG pulend)
{
Elf32_Sym* pElfSym;
LPSTR pElfStr;
Elf32_Shdr* pElfShdr;
struct module *pMod;
struct module *pModTemp;
int i;
PIMAGE_SYMBOL pSym, pSymEnd;
LPSTR pStr;
PIMAGE_SECTION_HEADER pShdr;
PDEBUG_MODULE pd;
PDEBUG_MODULE pdTemp;
PICE_SYMBOLFILE_HEADER* pSymbols;
ULONG start_mod,end_mod;
ULONG start,end;
static char temp4[256];
pSymbols = FindModuleSymbols(ulValue);
DPRINT((0,"FindFunctionByAddress(): symbols @ %x\n",(ULONG)pSymbols));
if(pSymbols && pmodule_list)
if(pSymbols && pdebug_module_head)
{
DPRINT((0,"looking up symbol\n"));
pMod = *pmodule_list;
pd = pdebug_module_head;
do
{
if(pMod->size)
{
pModTemp = pMod;
start_mod = (ULONG)pModTemp+sizeof(struct module);
end_mod = (ULONG)pModTemp+pModTemp->size;
}
else
{
pModTemp = &fake_kernel_module;
start_mod = (ULONG)KERNEL_START+sizeof(struct module);
end_mod = (ULONG)KERNEL_START+pModTemp->size;
}
assert(pd->size);
pdTemp = pd;
DPRINT((0,"FindFunctionByAddress(): is it %s for %x\n",(ULONG)pModTemp->name,ulValue));
//initial values for start and end.
start = (ULONG)pdTemp->BaseAddress;
end = start+pdTemp->size;
if(ulValue>=start_mod && ulValue<end_mod)
DPRINT((0,"FindFunctionByAddress(): is it %S for %x\n",(ULONG)pdTemp->name,ulValue));
if(ulValue>=start && ulValue<end)
{
DPRINT((0,"FindFunctionByAddress(): address matches %s\n",(ULONG)pModTemp->name));
if(PICE_strcmpi((LPSTR)pModTemp->name,pSymbols->name) == 0)
DPRINT((0,"FindFunctionByAddress(): address matches %S\n",(ULONG)pdTemp->name));
if(PICE_wcsicmp(pdTemp->name,pSymbols->name) == 0)
{
DPRINT((0,"found symbols for module %s\n",pModTemp->name));
pElfSym = (Elf32_Sym*)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pElfStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pElfShdr = (Elf32_Shdr*)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
DPRINT((0,"pElfSym = %x\n",pElfSym));
DPRINT((0,"pElfStr = %x\n",pElfStr));
DPRINT((0,"pElfShdr = %x\n",pElfShdr));
for(i=0;i<(pSymbols->ulSizeOfGlobals/sizeof(Elf32_Sym));i++)
DPRINT((0,"found symbols for module %S\n",pdTemp->name));
pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
if(!IsRangeValid((ULONG)pSym,sizeof(IMAGE_SYMBOL) ) ) //should we actually check all the symbols here?
{
if((ELF32_ST_BIND(pElfSym->st_info)==STB_GLOBAL || ELF32_ST_BIND(pElfSym->st_info)==STB_LOCAL || ELF32_ST_BIND(pElfSym->st_info)==STB_LOCAL)&&
ELF32_ST_TYPE(pElfSym->st_info)==STT_FUNC &&
(pElfSym->st_shndx<SHN_LORESERVE || pElfSym->st_shndx==SHN_ABS || pElfSym->st_shndx==SHN_COMMON))
DPRINT((0,"FindFunctionByAddress(): pSym = %x is not a valid pointer\n",(ULONG)pSym));
return FALSE;
}
DPRINT((0,"pSym = %x\n",pSym));
DPRINT((0,"pStr = %x\n",pStr));
DPRINT((0,"pShdr = %x\n",pShdr));
while( pSym < pSymEnd )
{
//symbol is a function is it's type is 0x20, storage class is external and section>0
if(( (pSym->Type == 0x20) && (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC) &&
(pSym->SectionNumber > 0 ))
{
LPSTR pName = &pElfStr[pElfSym->st_name];
ULONG start,end;
ULONG ulCurrAddr;
PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + pSym->SectionNumber;
if(pMod->size)
{
start = ((ULONG)pModTemp+pElfShdr[pElfSym->st_shndx].sh_offset);
start = (start+pElfShdr[pElfSym->st_shndx].sh_addralign)&~(pElfShdr[pElfSym->st_shndx].sh_addralign-1);
DPRINT((0,"FindFunctionByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis));
start += pElfSym->st_value;
}
else
{
start = pElfSym->st_value;
}
end = start+pElfSym->st_size;
DPRINT((0,"[%u] %.8X %.8X %.8X %.8X %.8X %.8X %.8X %.8X %.8X\n",
i,
start,
end,
pElfSym->st_shndx,
pElfShdr[pElfSym->st_shndx].sh_addr,
pElfShdr[pElfSym->st_shndx].sh_offset,
pElfShdr[pElfSym->st_shndx].sh_size,
pElfShdr[pElfSym->st_shndx].sh_type,
pElfShdr[pElfSym->st_shndx].sh_link,
pElfShdr[pElfSym->st_shndx].sh_addralign));
if(ulValue>=start && ulValue<end)
if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) )
{
DPRINT((0,"[%u] %.8X %.8X %.8X %.8X %.8X %.8X %.8X\n",
pElfSym->st_shndx,
((ULONG)pModTemp+pElfShdr[pElfSym->st_shndx].sh_offset),
pElfShdr[pElfSym->st_shndx].sh_addr,
pElfShdr[pElfSym->st_shndx].sh_offset,
pElfShdr[pElfSym->st_shndx].sh_size,
pElfShdr[pElfSym->st_shndx].sh_type,
pElfShdr[pElfSym->st_shndx].sh_link,
pElfShdr[pElfSym->st_shndx].sh_addralign));
DPRINT((0,"in section [%u] %8x value = %x module struct %x (%x)\n",pElfSym->st_shndx,pElfShdr[pElfSym->st_shndx].sh_offset,ulValue,sizeof(struct module),((sizeof(struct module)+0x10)&~0x0F)));
DPRINT((0,"[%u] %32s %.8X %.8X %.8X %.8X %.8X %.8X\n",i,pName,pElfSym->st_name,pElfSym->st_value,pElfSym->st_info,pElfSym->st_other,pElfSym->st_size,pElfSym->st_shndx));
DPRINT((0,"start %x end %x\n",start,end));
if(pulstart)
*pulstart = start;
if(pulend)
*pulend = end;
return pName;
DPRINT((0,"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis));
return FALSE;
}
//to get address in the memory we base address of the module and
//add offset of the section and then add offset of the symbol from
//the begining of the section
ulCurrAddr = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
DPRINT((0,"FindFunctionByAddress(): CurrAddr [1] = %x\n",ulCurrAddr));
if(ulCurrAddr<=ulValue && ulCurrAddr>start)
{
start = ulCurrAddr;
pFoundSym = pSym;
}
else if(ulCurrAddr>=ulValue && ulCurrAddr<end)
{
end = ulCurrAddr;
}
}
//skip the auxiliary symbols and get the next symbol
pSym += pSym->NumberOfAuxSymbols + 1;
}
pElfSym++;
//we went through all the symbols for this module
//now start should point to the start of the function and
//end to the start of the next (or end of section)
if(pulstart)
*pulstart = start;
if(pulend){
//just in case there is more than one code section
PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + pFoundSym->SectionNumber;
if( end > (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData ){
DPRINT((0,"Hmm: end=%d, end of section: %d\",end, (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData));
end = (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData;
}
*pulend = end;
}
if( !(pFoundSym->Name.Short) ){
//name is in the header. it's not zero terminated. have to copy.
PICE_sprintf(temp4,"%.8s", pFoundSym->ShortName);
pName = temp4;
DPRINT((0,"Function name: %S!%.8s",pdTemp->name,pName));
}
else{
assert(pFoundSym->Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
pName = pStr[pFoundSym->Name.Long];
if(!IsAddressValid((ULONG)pName))
{
DPRINT((0,"FindFunctionByAddress(): pName = %x is not a valid pointer\n",pName));
return NULL;
}
DPRINT((0,"Function name: %S!%s",pdTemp->name,pName));
}
return pName;
}
}
}
}while((pMod = pMod->next));
}while((pd = pd->next) != pdebug_module_tail);
}
return NULL;
}
@@ -838,6 +866,7 @@ LPSTR FindFunctionByAddress(ULONG ulValue,PULONG pulstart,PULONG pulend)
// FindDataSectionOffset()
//
//*************************************************************************
/* ei: never used
ULONG FindDataSectionOffset(Elf32_Shdr* pSHdr)
{
@@ -856,18 +885,20 @@ ULONG FindDataSectionOffset(Elf32_Shdr* pSHdr)
return 0;
}
*/
//*************************************************************************
// FindFunctionInModuleByNameViaKsyms()
//
//*************************************************************************
/* ei: not needed. no Ksyms!
ULONG FindFunctionInModuleByNameViaKsyms(struct module* pMod,LPSTR szFunctionname)
{
ULONG i;
ENTER_FUNC();
if(pMod->nsyms)
if(pMod->nsyms)
{
DPRINT((0,"FindFunctionInModuleByNameViaKsyms(): %u symbols for module %s\n",pMod->nsyms,pMod->name));
for(i=0;i<pMod->nsyms;i++)
@@ -886,99 +917,73 @@ ULONG FindFunctionInModuleByNameViaKsyms(struct module* pMod,LPSTR szFunctionnam
LEAVE_FUNC();
return 0;
}
*/
//*************************************************************************
// FindFunctionInModuleByName()
//
//*************************************************************************
ULONG FindFunctionInModuleByName(LPSTR szFunctionname,struct module* pMod)
ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pd)
{
ULONG i,addr;
PICE_SYMBOLFILE_HEADER* pSymbols=NULL;
Elf32_Sym* pElfSym;
LPSTR pElfStr;
Elf32_Shdr* pElfShdr;
PIMAGE_SYMBOL pSym, pSymEnd;
LPSTR pStr;
PIMAGE_SECTION_HEADER pShdr;
ENTER_FUNC();
DPRINT((0,"FindFunctionInModuleByName(%s)\n",szFunctionname));
DPRINT((0,"FindFunctionInModuleByName(): mod size = %x\n",pd->size));
DPRINT((0,"FindFunctionInModuleByName(): module is %S\n",pMod->name));
DPRINT((0,"FindFunctionInModuleByName(): mod size = %x\n",pMod->size));
if(pMod == &fake_kernel_module)
{
DPRINT((0,"FindFunctionInModuleByName(): module is kernel\n"));
addr = KERNEL_START;
}
else
{
DPRINT((0,"FindFunctionInModuleByName(): module is %s\n",pMod->name));
addr = (ULONG)pMod;
}
addr += sizeof(struct module);
addr = (ULONG)pd->BaseAddress;
pSymbols = FindModuleSymbols(addr);
if(pSymbols)
{
DPRINT((0,"FindFunctionInModuleByName(): found symbol table for %s\n",pSymbols->name));
pElfSym = (Elf32_Sym*)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pElfStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pElfShdr = (Elf32_Shdr*)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
DPRINT((0,"FindFunctionInModuleByName(): found symbol table for %S\n",pSymbols->name));
pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
for(i=0;i<(pSymbols->ulSizeOfGlobals/sizeof(Elf32_Sym));i++)
while( pSym < pSymEnd )
{
DPRINT((0,"FindFunctionInModuleByName(): BIND = %.8X TYPE = %.8X\n",ELF32_ST_BIND(pElfSym->st_info),ELF32_ST_TYPE(pElfSym->st_info)));
if((ELF32_ST_BIND(pElfSym->st_info)==STB_GLOBAL || ELF32_ST_BIND(pElfSym->st_info)==STB_LOCAL || ELF32_ST_BIND(pElfSym->st_info)==STB_WEAK) &&
(ELF32_ST_TYPE(pElfSym->st_info)==STT_FUNC || ELF32_ST_TYPE(pElfSym->st_info)==STT_OBJECT) &&
(pElfSym->st_shndx<SHN_LORESERVE))
//symbol is a function is it's type is 0x20, storage class is external and section>0
if(( (pSym->Type == 0x20) && (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC) &&
(pSym->SectionNumber > 0 ))
{
LPSTR pName = &pElfStr[pElfSym->st_name];
ULONG start;
LPSTR pName;
PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + pSym->SectionNumber;
DPRINT((0,"[%u] %.8X %.8X %.8X %.8X %.8X %.8X %.8X %.8X\n",
pElfSym->st_shndx,
pElfSym->st_value,
((ULONG)pMod+pElfShdr[pElfSym->st_shndx].sh_offset),
pElfShdr[pElfSym->st_shndx].sh_addr,
pElfShdr[pElfSym->st_shndx].sh_offset,
pElfShdr[pElfSym->st_shndx].sh_size,
pElfShdr[pElfSym->st_shndx].sh_type,
pElfShdr[pElfSym->st_shndx].sh_link,
pElfShdr[pElfSym->st_shndx].sh_addralign));
DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",pName,start));
start = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
if(pMod->size && pMod != &fake_kernel_module)
{
start = ((ULONG)pMod+pElfShdr[pElfSym->st_shndx].sh_offset);
start = (start+pElfShdr[pElfSym->st_shndx].sh_addralign)&~(pElfShdr[pElfSym->st_shndx].sh_addralign-1);
start += pElfSym->st_value;
}
else
{
start = pElfSym->st_value;
}
DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",pName,start));
if(PICE_strcmpi(pName,szFunctionname) == 0 && start)
{
DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table\n"));
LEAVE_FUNC();
return start;
}
}
pElfSym++;
}
}
// for all symbols in BSS we can't find their location via the external symbols since
// insmod puts BSS and data anywhere it likes.
// so we try to look up the symbol via the kernel symbol table
DPRINT((0,"FindFunctionInModuleByName(): try lookup via kernel symbol table\n"));
if( !(pSym->Name.Short) ){ //if name is stored in the structure
//name may be not zero terminated but 8 characters max
if((PICE_strncmpi(pName,szFunctionname, 8) == 0) && start)
{
DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table\n"));
LEAVE_FUNC();
return start;
}
}else{
if((PICE_strcmpi(pName,szFunctionname) == 0) && start)
{
DPRINT((0,"FindFunctionInModuleByName(): symbol was in string table\n"));
LEAVE_FUNC();
return start;
}
}
}
//skip the auxiliary symbols and get the next symbol
pSym += pSym->NumberOfAuxSymbols + 1;
}
}
LEAVE_FUNC();
return FindFunctionInModuleByNameViaKsyms(pMod,szFunctionname);
return 0;
}
//*************************************************************************
@@ -1633,7 +1638,7 @@ LPSTR FindSourceLineForAddress(ULONG addr,PULONG pulLineNumber,LPSTR* ppSrcStart
// FindAddressForSourceLine()
//
//*************************************************************************
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,struct module* pMod,PULONG pValue)
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,PDEBUG_MODULE pMod,PULONG pValue)
{
ULONG i;
PSTAB_ENTRY pStab;
@@ -1648,12 +1653,7 @@ BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,struct modul
DPRINT((0,"FindAddressForSourceLine(%u,%s,%x)\n",ulLineNumber,pFilename,(ULONG)pMod));
if(pMod == &fake_kernel_module)
addr = KERNEL_START;
else
addr = (ULONG)pMod;
addr += sizeof(struct module);
addr = (ULONG)pMod->BaseAddress;
pSymbols = FindModuleSymbols(addr);
if(pSymbols)
@@ -1739,66 +1739,69 @@ BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,struct modul
//*************************************************************************
// ListSymbolStartingAt()
//
// iterate through the list of module symbols (both functions and variables)
//*************************************************************************
ULONG ListSymbolStartingAt(struct module* pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput)
ULONG ListSymbolStartingAt(PDEBUG_MODULE pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput)
{
ULONG i;
Elf32_Sym* pElfSym;
LPSTR pElfStr;
Elf32_Shdr* pElfShdr;
PIMAGE_SYMBOL pSym, pSymEnd;
LPSTR pStr;
PIMAGE_SECTION_HEADER pShdr;
DPRINT((0,"ListSymbolStartingAt(%x,%u)\n",(ULONG)pSymbols,index));
DPRINT((0,"ListSymbolStartingAt(%x,%u)\n",(ULONG)pSymbols,index));
DPRINT((0,"ListSymbolStartingAt(): ulOffsetToGlobals = %x ulSizeofGlobals = %x\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals);
pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
pElfSym = (Elf32_Sym*)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals);
pElfStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings);
pElfShdr = (Elf32_Shdr*)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders);
pSym += index;
pElfSym +=index;
for(i=index;i<(pSymbols->ulSizeOfGlobals/sizeof(Elf32_Sym));i++)
while( pSym < pSymEnd )
{
LPSTR pName = &pElfStr[pElfSym->st_name];
LPSTR pName;
DPRINT((0,"ListSymbolStartingAt(): [%u] %.8X %.8X %s\n",i,pElfSym->st_info,pElfSym->st_shndx,pName));
if((ELF32_ST_BIND(pElfSym->st_info)==STB_GLOBAL || ELF32_ST_BIND(pElfSym->st_info)==STB_LOCAL || ELF32_ST_BIND(pElfSym->st_info)==STB_WEAK) &&
(ELF32_ST_TYPE(pElfSym->st_info)==STT_FUNC || ELF32_ST_TYPE(pElfSym->st_info)==STT_OBJECT)&&
(pElfSym->st_shndx<SHN_LORESERVE || pElfSym->st_shndx==SHN_ABS || pElfSym->st_shndx==SHN_COMMON) )
if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) &&
((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) || (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)) &&
(pSym->SectionNumber > 0 ))
{
ULONG section_flags = pElfShdr[pElfSym->st_shndx].sh_flags;
PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + pSym->SectionNumber;
ULONG section_flags;
ULONG start;
if(pElfSym->st_shndx!=SHN_ABS && pElfSym->st_shndx!=SHN_COMMON)
{
if(pMod != &fake_kernel_module)
{
start = ((ULONG)pMod+pElfShdr[pElfSym->st_shndx].sh_offset);
DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis));
start = (start+pElfShdr[pElfSym->st_shndx].sh_addralign)&~(pElfShdr[pElfSym->st_shndx].sh_addralign-1);
if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) )
{
DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis));
return FALSE;
}
section_flags = pShdrThis->Characteristics;
//to get address in the memory we base address of the module and
//add offset of the section and then add offset of the symbol from
//the begining of the section
start += pElfSym->st_value;
}
else
{
start = pElfSym->st_value;
}
}
else
{
start = FindFunctionInModuleByNameViaKsyms(pMod,pName);
}
PICE_sprintf(pOutput,"%.8X (%s) %s\n",start,(section_flags&SHF_EXECINSTR)?"TEXT":"DATA",pName);
if((i+1)<(pSymbols->ulSizeOfGlobals/sizeof(Elf32_Sym)) )
return i+1;
start = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
if( !(pSym->Name.Short) ){
//name is in the header. it's not zero terminated. have to copy.
PICE_sprintf(pOutput,"%.8X (%s) %.8s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pSym->ShortName);
}
else{
assert(pSym->Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check
pName = pStr[pSym->Name.Long];
if(!IsAddressValid((ULONG)pName))
{
DPRINT((0,"ListSymbolStartingAt(): pName = %x is not a valid pointer\n",pName));
return NULL;
}
PICE_sprintf(pOutput,"%.8X (%s) %s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pName);
}
if((pSym+pSym->NumberOfAuxSymbols+1)<(pSymEnd))
return (index+pSym->NumberOfAuxSymbols+1);
}
pElfSym++;
}
index += pSym->NumberOfAuxSymbols + 1;
pSym += pSym->NumberOfAuxSymbols + 1;
}
return 0;
}
@@ -1812,7 +1815,8 @@ BOOLEAN SanityCheckExports(void)
ULONG i,ulValue,incr;
Print(OUTPUT_WINDOW,"pICE: sanity-checking exports...\n");
return TRUE;
/* fix later!!! do we really need to cross reference two kinds of symbolic info?
if(fake_kernel_module.nsyms && fake_kernel_module.syms)
{
incr = (fake_kernel_module.nsyms/4);
@@ -1847,6 +1851,7 @@ BOOLEAN SanityCheckExports(void)
}
return bResult;
*/
}
//*************************************************************************
@@ -1899,9 +1904,7 @@ BOOLEAN LoadExports(void)
DbgPrint("error reading ntoskrnl map!\n");
//set_fs(oldfs);
}
}
PICE_close(hf);
}
else
@@ -1975,14 +1978,14 @@ PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename)
if(pSymbols->magic == PICE_MAGIC)
{
DPRINT((0,"magic = %X\n",pSymbols->magic));
DPRINT((0,"name = %s\n",pSymbols->name));;
DPRINT((0,"name = %S\n",pSymbols->name));;
DPRINT((0,"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader));
DPRINT((0,"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
DPRINT((0,"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings));
DPRINT((0,"ulOffsetToStabs,ulSizeOfStabs = %X,%X\n",pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs));
DPRINT((0,"ulOffsetToStabsStrings,ulSizeOfStabsStrings = %X,%X\n",pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings));
DPRINT((0,"ulOffsetToSrcFiles,ulNumberOfSrcFiles = %X,%X\n",pSymbols->ulOffsetToSrcFiles,pSymbols->ulNumberOfSrcFiles));
DPRINT((0,"pICE: symbols loaded for module \"%s\" @ %x\n",pSymbols->name,pSymbols));
DPRINT((0,"pICE: symbols loaded for module \"%S\" @ %x\n",pSymbols->name,pSymbols));
apSymbols[ulNumSymbolsLoaded++]=pSymbols;
}
else
@@ -1994,8 +1997,6 @@ PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename)
}
}
PICE_close(hf);
}
else
@@ -2246,16 +2247,7 @@ BOOLEAN FindGlobalStabSymbol(LPSTR pExpression,PULONG pValue,PULONG pulTypeNumbe
if(pCurrentMod)
{
// in case we query for the kernel we need to use the fake kernel module
if(pCurrentMod == &fake_kernel_module)
{
addr = KERNEL_START;
}
else
{
addr = (ULONG)pCurrentMod;
}
addr += sizeof(struct module);
addr = (ULONG)pCurrentMod->BaseAddress;
// find the symbols for the module
pSymbols = FindModuleSymbols(addr);
+9 -7
View File
@@ -40,7 +40,8 @@ typedef struct _LOCAL_VARIABLE
ULONG value,offset,line;
BOOLEAN bRegister;
}LOCAL_VARIABLE,*PLOCAL_VARIABLE;
struct _DEBUG_MODULE_SYMBOL_
{
ULONG value;
@@ -53,7 +54,7 @@ typedef struct _DEBUG_MODULE_
ULONG size;
PVOID BaseAddress;
PVOID EntryPoint;
UNICODE_STRING name;
WCHAR name[DEBUG_MODULE_NAME_LEN];
struct _DEBUG_MODULE_SYMBOL_ syms;
}DEBUG_MODULE, *PDEBUG_MODULE;
@@ -70,17 +71,18 @@ 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,struct module* pMod);
ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pMod);
PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName(LPSTR modname);
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,struct module* pMod,PULONG pValue);
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename, PDEBUG_MODULE pMod,PULONG pValue);
ULONG ConvertDecimalToUlong(LPSTR p);
struct module* FindModuleFromAddress(ULONG addr);
PDEBUG_MODULE FindModuleFromAddress(ULONG addr);
PICE_SYMBOLFILE_HEADER* FindModuleSymbols(ULONG addr);
ULONG ListSymbolStartingAt(struct module* pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput);
struct module* FindModuleByName(LPSTR modname);
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);
//extern ULONG kernel_end;
extern PICE_SYMBOLFILE_HEADER* apSymbols[32];
+12 -12
View File
@@ -12,7 +12,7 @@ Environment:
Kernel mode only
Author:
Author:
Klaus P. Gerlicher
@@ -56,7 +56,7 @@ ULONG OldSyscallHandler=0;
ULONG ulFreeModule=0;
struct module* pModJustFreed=NULL;
PDEBUG_MODULE pModJustFreed=NULL;
void (*old_cleanup_module)(void)=NULL;
void other_module_cleanup_module(void)
@@ -68,14 +68,14 @@ void other_module_cleanup_module(void)
DPRINT((0,"other_module_cleanup_module(): calling %x\n",(ULONG)old_cleanup_module));
old_cleanup_module();
}
if(pModJustFreed)
{
DPRINT((0,"other_module_cleanup_module(): calling RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pModJustFreed));
RevirtualizeBreakpointsForModule(pModJustFreed);
}
}
#error fix that
void CSyscallHandler(FRAME_SYSCALL* ptr,ULONG ulSysCall,ULONG ebx)
{
// DPRINT((0,"CSyscallHandler(): %.4X:%.8X (syscall = %u)\n",ptr->cs,ptr->eip,ulSysCall));
@@ -162,14 +162,14 @@ void CSyscallHandler(FRAME_SYSCALL* ptr,ULONG ulSysCall,ULONG ebx)
}
}
__asm__ ("
__asm__ ("
NewSyscallHandler:
// save used regs
pushfl
cli
cld
pushal
pushl %ds
pushl %ds
// push the syscall number
pushl %ebx
@@ -179,9 +179,9 @@ NewSyscallHandler:
lea 48(%esp),%eax
pushl %eax
// setup default data selectors
// setup default data selectors
movw %ss,%ax
movw %ax,%ds
movw %ax,%ds
call CSyscallHandler
@@ -189,11 +189,11 @@ NewSyscallHandler:
add $12,%esp
// restore used regs
popl %ds
popl %ds
popal
popfl
// chain to old handler
// chain to old handler
.byte 0x2e
jmp *OldSyscallHandler");
@@ -211,7 +211,7 @@ void InstallSyscallHook(void)
:
:"eax");
OldSyscallHandler=SetGlobalInt(0x80,(ULONG)LocalSyscallHandler);
ScanExports("free_module",(PULONG)&ulFreeModule);
DPRINT((0,"InstallSyscallHook(): free_module @ %x\n",ulFreeModule));
@@ -234,4 +234,4 @@ void DeInstallSyscallHook(void)
UnmaskIrqs();
LEAVE_FUNC();
}
}
+8 -26
View File
@@ -347,6 +347,14 @@ USHORT PICE_strlen(char* s)
return 0;
}
WCHAR * PICE_wcscpy(WCHAR * str1,const WCHAR * str2)
{
WCHAR *save = str1;
for (; (*str1 = *str2); ++str2, ++str1);
return save;
}
#ifndef LINUX
//*************************************************************************
// GetShortName()
@@ -612,32 +620,6 @@ ULONG i,NumPages,PageNum;
return TRUE;
}
//*************************************************************************
// IsModuleLoaded()
//
//*************************************************************************
struct module* IsModuleLoaded(LPSTR p)
{
struct module* pMod;
DPRINT((0,"IsModuleLoaded(%s)\n",p));
if(pmodule_list)
{
pMod = *pmodule_list;
do
{
DPRINT((0,"module (%x) %s\n",pMod->size,pMod->name));
if(pMod->size && strcmp(p,(LPSTR)pMod->name) == 0)
{
DPRINT((0,"module %s is loaded!\n",pMod->name));
return pMod;
}
}while((pMod = pMod->next));
}
return NULL;
}
//*************************************************************************
// GetGDTPtr()
//
+14 -14
View File
@@ -15,7 +15,7 @@ Environment:
LINUX 2.2.X
Kernel mode only
Author:
Author:
Klaus P. Gerlicher
@@ -161,7 +161,7 @@ typedef struct tagIdt
ULONG Offset_31_16 :16;
}IDT,*PIDT;
typedef struct tagDESCRIPTOR
typedef struct tagDESCRIPTOR
{
USHORT Cpl :2; // current privilege level
USHORT Ti :1; // table index (GDT=0 LDT=1)
@@ -186,12 +186,11 @@ char* PICE_strchr(char* s,char c);
int PICE_sprintf(char * buf, const char *fmt, ...);
int PICE_vsprintf(char *buf, const char *fmt, va_list args);
BOOLEAN IsAddressValid(ULONG Addr);
BOOLEAN IsAddressValid(ULONG Addr);
BOOLEAN IsAddressWriteable(ULONG Addr);
BOOLEAN SetAddressWriteable(ULONG address,BOOLEAN bSet);
BOOLEAN IsRangeValid(ULONG addr,ULONG Length);
BOOLEAN IsRangeValid(ULONG addr,ULONG Length);
void IntelStackWalk(ULONG pc,ULONG ebp,ULONG esp);
struct module* IsModuleLoaded(LPSTR p);
ULONG ReadPhysMem(ULONG Address,ULONG ulSize);
void WritePhysMem(ULONG Address,ULONG Datum,ULONG ulSize);
@@ -199,27 +198,27 @@ void WritePhysMem(ULONG Address,ULONG Datum,ULONG ulSize);
BOOLEAN IsRetAtEIP(void);
BOOLEAN IsCallInstrAtEIP(void);
ULONG GetLinearAddress(USHORT Segment,ULONG Offset);
ULONG GetLinearAddress(USHORT Segment,ULONG Offset);
#define OUTPUT_BUFFER_FULL 0x01
#define INPUT_BUFFER_FULL 0x02
#define MOUSE_OUTPUT_BUFFER_FULL 0x20
#define OUTPUT_BUFFER_FULL 0x01
#define INPUT_BUFFER_FULL 0x02
#define MOUSE_OUTPUT_BUFFER_FULL 0x20
void ShowStoppedMsg(void);
void ShowRunningMsg(void);
void SetHardwareBreakPoints(void);
void SetHardwareBreakPoints(void);
void SetHardwareBreakPoint(ULONG ulAddress,ULONG ulReg);
// this should be in disasm.h but someone misused the header files
BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst);
//////////////////////////////////////////////////////////////////
#define GLOBAL_CODE_SEGMENT (__KERNEL_CS)
#define GLOBAL_DATA_SEGMENT (__KERNEL_DS)
#define GLOBAL_CODE_SEGMENT (__KERNEL_CS)
#define GLOBAL_DATA_SEGMENT (__KERNEL_DS)
//#define OVR_CS .byte 0x2e
//#define OVR_FS .byte 0x64
//#define OVR_CS .byte 0x2e
//#define OVR_FS .byte 0x64
void DisplayRegs(void);
void SaveOldRegs(void);
@@ -268,3 +267,4 @@ HANDLE PICE_open (LPCWSTR lpPathName, int iReadWrite);
long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes);
int PICE_close (HANDLE hFile);
size_t PICE_len( HANDLE hFile );
WCHAR * PICE_wcscpy(WCHAR * str1,const WCHAR * str2);
+2 -1
View File
@@ -77,10 +77,11 @@ typedef struct _DEBUGGER_STATUS_BLOCK
#define PICE_MAGIC MAGIC_ULONG('P','I','C','E')
#define DEBUG_MODULE_NAME_LEN 32
typedef struct _PICE_SYMBOLFILE_HEADER
{
ULONG magic;
WCHAR name[64];
WCHAR name[DEBUG_MODULE_NAME_LEN];
ULONG ulOffsetToHeaders,ulSizeOfHeader;
ULONG ulOffsetToGlobals,ulSizeOfGlobals;
ULONG ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings;