Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\misc\thrdlist.cpp
21 _LIT(KFileName,"C:\\THRDLIST.TXT");
22 _LIT(KLitAsterisk,"*");
23 _LIT(KLitProblem,"Could not open thread");
47 TUint ThreadId(const RThread& aThread)
49 TThreadId id=aThread.Id();
54 TUint ProcessId(const RProcess& aProcess)
56 TProcessId id=aProcess.Id();
61 GLDEF_C TInt E32Main()
63 RThread().SetPriority(EPriorityAbsoluteHigh);
67 User::Panic(_L("THRDLIST FS"),r);
69 r=file.Open(fs,KFileName,EFileWrite);
71 r=file.Create(fs,KFileName,EFileWrite);
75 r=file.Seek(ESeekEnd,p);
78 User::Panic(_L("THRDLIST FILE"),r);
82 TDateTime dt=now.DateTime();
83 buf.Format(_L("Time %02d:%02d:%02d:%06d Date %02d/%02d/%04d\n"),dt.Hour(),dt.Minute(),dt.Second(),dt.MicroSecond(),dt.Day()+1,dt.Month()+1,dt.Year());
86 User::Panic(_L("THRDLIST WRITE"),r);
87 TFindThread ft(KLitAsterisk);
89 while (ft.Next(fn)==KErrNone)
93 TExitType exitType=EExitKill;
100 Mem::FillZ(®s,sizeof(regs));
101 TPckg<SArmRegSet> regPckg(regs);
105 exitType=t.ExitType();
106 exitReason=t.ExitReason();
107 exitCat=t.ExitCategory();
113 procName=p.FullName();
120 buf.Format(_L("Thread %S (id=%d) in process %S (id=%d)\n"),&fn,tid,&procName,pid);
122 buf.Format(_L("Exit info %d,%d,%S\n"),exitType,exitReason,&exitCat);
124 buf.Format(_L(" R0=%08x R1=%08x R2=%08x R3=%08x\n"),regs.iR0,regs.iR1,regs.iR2,regs.iR3);
126 buf.Format(_L(" R4=%08x R5=%08x R6=%08x R7=%08x\n"),regs.iR4,regs.iR5,regs.iR6,regs.iR7);
128 buf.Format(_L(" R8=%08x R9=%08x R10=%08x R11=%08x\n"),regs.iR8,regs.iR9,regs.iR10,regs.iR11);
130 buf.Format(_L(" R12=%08x R13=%08x R14=%08x R15=%08x\n"),regs.iR12,regs.iR13,regs.iR14,regs.iR15);
132 buf.Format(_L("CPSR=%08x DACR=%08x\n\n"),regs.iFlags,regs.iDacr);