--- a/core/builtins/ps.cpp Thu Jul 29 12:03:43 2010 +1000
+++ b/core/builtins/ps.cpp Thu Jul 29 12:05:54 2010 +1000
@@ -169,6 +169,11 @@
_LIT(KOptAddresses, "addresses");
aOptions.AppendBoolL(iAddresses, KOptAddresses);
+
+#ifdef FSHELL_MEMORY_ACCESS_SUPPORT
+ _LIT(KOptCodeSegs, "codesegs");
+ aOptions.AppendBoolL(iPrintCodesegs, KOptCodeSegs);
+#endif
}
#if defined(__WINS__) && !defined(EKA2)
@@ -317,6 +322,10 @@
iFormatter->AppendFormatL(_L("\tAddress: 0x%08x\r\n"), objectInfo.iAddressOfKernelObject);
}
}
+ if (iPrintCodesegs && iMemoryAccess.Handle())
+ {
+ PrintCodeSegsL(aProcess);
+ }
#endif // FSHELL_MEMORY_ACCESS_SUPPORT
if (iHandleCount)
@@ -542,6 +551,30 @@
}
}
+void ReleaseCodesegMutex(TAny* aMemAccess)
+ {
+ static_cast<RMemoryAccess*>(aMemAccess)->ReleaseCodeSegMutex();
+ }
+
+void CCmdPs::PrintCodeSegsL(RProcess& aProcess)
+ {
+ TInt count = iMemoryAccess.AcquireCodeSegMutexAndFilterCodesegsForProcess(aProcess.Id());
+ LeaveIfErr(count, _L("Couldn't acquire codeseg mutex"));
+ CleanupStack::PushL(TCleanupItem(&ReleaseCodesegMutex, &iMemoryAccess));
+
+ iFormatter->AppendFormatL(_L("\t%d code segments:\r\n"), count);
+
+ TCodeSegKernelInfo codeSegInfo;
+ TPckg<TCodeSegKernelInfo> pkg(codeSegInfo);
+ while (iMemoryAccess.GetNextCodeSegInfo(pkg) == KErrNone)
+ {
+ // Reuse iChunkName, I'm sure it doesn't mind
+ iChunkName.Copy(codeSegInfo.iFileName);
+ iFormatter->AppendFormatL(_L("\t\t%S\r\n"), &iChunkName);
+ }
+ CleanupStack::PopAndDestroy(); // ReleaseCodesegMutex
+ }
+
#ifdef EXE_BUILD
EXE_BOILER_PLATE(CCmdPs)
#endif