core/builtins/ps.cpp
changeset 7 184a1eb85cf2
parent 0 7f656887cf89
child 86 849a0b46c767
equal deleted inserted replaced
6:96d581d2147d 7:184a1eb85cf2
   167 	aOptions.AppendBoolL(iPrintFlags, KOptFlags);
   167 	aOptions.AppendBoolL(iPrintFlags, KOptFlags);
   168 #endif
   168 #endif
   169 
   169 
   170 	_LIT(KOptAddresses, "addresses");
   170 	_LIT(KOptAddresses, "addresses");
   171 	aOptions.AppendBoolL(iAddresses, KOptAddresses);
   171 	aOptions.AppendBoolL(iAddresses, KOptAddresses);
       
   172 
       
   173 #ifdef FSHELL_MEMORY_ACCESS_SUPPORT
       
   174 	_LIT(KOptCodeSegs, "codesegs");
       
   175 	aOptions.AppendBoolL(iPrintCodesegs, KOptCodeSegs);
       
   176 #endif
   172 	}
   177 	}
   173 
   178 
   174 #if defined(__WINS__) && !defined(EKA2)
   179 #if defined(__WINS__) && !defined(EKA2)
   175 void CCmdPs::PrintInfoL(RThread& aProcess)
   180 void CCmdPs::PrintInfoL(RThread& aProcess)
   176 #else
   181 #else
   314 		TInt err = iMemoryAccess.GetObjectInfoByHandle(EProcess, RThread().Id(), aProcess.Handle(), objectInfoPckg);
   319 		TInt err = iMemoryAccess.GetObjectInfoByHandle(EProcess, RThread().Id(), aProcess.Handle(), objectInfoPckg);
   315 		if (err == KErrNone)
   320 		if (err == KErrNone)
   316 			{
   321 			{
   317 			iFormatter->AppendFormatL(_L("\tAddress: 0x%08x\r\n"), objectInfo.iAddressOfKernelObject);
   322 			iFormatter->AppendFormatL(_L("\tAddress: 0x%08x\r\n"), objectInfo.iAddressOfKernelObject);
   318 			}
   323 			}
       
   324 		}
       
   325 	if (iPrintCodesegs && iMemoryAccess.Handle())
       
   326 		{
       
   327 		PrintCodeSegsL(aProcess);
   319 		}
   328 		}
   320 #endif // FSHELL_MEMORY_ACCESS_SUPPORT
   329 #endif // FSHELL_MEMORY_ACCESS_SUPPORT
   321 	
   330 	
   322 	if (iHandleCount)
   331 	if (iHandleCount)
   323 		{
   332 		{
   540 		_LIT(KFormat, "%S%d\r\n");
   549 		_LIT(KFormat, "%S%d\r\n");
   541 		iFormatter->AppendFormatL(KFormat, &aCaption, aSize);
   550 		iFormatter->AppendFormatL(KFormat, &aCaption, aSize);
   542 		}
   551 		}
   543 	}
   552 	}
   544 
   553 
       
   554 void ReleaseCodesegMutex(TAny* aMemAccess)
       
   555 	{
       
   556 	static_cast<RMemoryAccess*>(aMemAccess)->ReleaseCodeSegMutex();
       
   557 	}
       
   558 
       
   559 void CCmdPs::PrintCodeSegsL(RProcess& aProcess)
       
   560 	{
       
   561 	TInt count = iMemoryAccess.AcquireCodeSegMutexAndFilterCodesegsForProcess(aProcess.Id());
       
   562 	LeaveIfErr(count, _L("Couldn't acquire codeseg mutex"));
       
   563 	CleanupStack::PushL(TCleanupItem(&ReleaseCodesegMutex, &iMemoryAccess));
       
   564 
       
   565 	iFormatter->AppendFormatL(_L("\t%d code segments:\r\n"), count);
       
   566 
       
   567 	TCodeSegKernelInfo codeSegInfo;
       
   568 	TPckg<TCodeSegKernelInfo> pkg(codeSegInfo);
       
   569 	while (iMemoryAccess.GetNextCodeSegInfo(pkg) == KErrNone)
       
   570 		{
       
   571 		// Reuse iChunkName, I'm sure it doesn't mind
       
   572 		iChunkName.Copy(codeSegInfo.iFileName);
       
   573 		iFormatter->AppendFormatL(_L("\t\t%S\r\n"), &iChunkName);
       
   574 		}
       
   575 	CleanupStack::PopAndDestroy(); // ReleaseCodesegMutex
       
   576 	}
       
   577 
   545 #ifdef EXE_BUILD
   578 #ifdef EXE_BUILD
   546 EXE_BOILER_PLATE(CCmdPs)
   579 EXE_BOILER_PLATE(CCmdPs)
   547 #endif
   580 #endif
   548 
   581