dbgsrv/coredumpserver/plugins/formatters/symbianelf/test/tsymbianelfformatter.cpp
author ravikurupati
Tue, 02 Mar 2010 10:33:16 +0530
changeset 0 c6b0df440bee
permissions -rw-r--r--
Initial contribution of EPL licensed sources
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     2
// All rights reserved.
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     3
// This component and the accompanying materials are made available
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     5
// which accompanies this distribution, and is available
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     7
//
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     8
// Initial Contributors:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    10
//
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    11
// Contributors:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    12
//
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    13
// Description:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    14
//
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    15
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    16
#include <e32base.h>
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    17
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    18
#include "symbianelfformatter.h"
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    19
#include "tsymbianelfformatter.h"
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    20
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    21
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    22
CSymbianElfFormatterTest * CSymbianElfFormatterTest::NewL(RTest &itest)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    23
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    24
    CSymbianElfFormatterTest *self = CSymbianElfFormatterTest::NewLC(itest);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    25
    CleanupStack::Pop();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    26
    return self;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    27
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    28
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    29
CSymbianElfFormatterTest * CSymbianElfFormatterTest::NewLC(RTest &itest)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    30
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    31
    CSymbianElfFormatterTest *self = new(ELeave) CSymbianElfFormatterTest(itest);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    32
    CleanupStack::PushL(self);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    33
    self->ConstructL();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    34
    return self;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    35
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    36
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    37
void CSymbianElfFormatterTest::ConstructL()
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    38
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    39
    server = new(ELeave) CTestCrashDataSource;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    40
    formatter = CSymbianElfFormatter::NewL();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    41
	iStrInfoTbl = CStringInfoTable::NewL();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    42
    writer = CTestDataSave::NewL();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    43
    formatter->ConfigureDataSaveL(writer);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    44
    formatter->ConfigureDataSourceL(server);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    45
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    46
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    47
CSymbianElfFormatterTest::CSymbianElfFormatterTest(RTest &aTest) : itest(aTest) { }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    48
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    49
CSymbianElfFormatterTest::~CSymbianElfFormatterTest()
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    50
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    51
    delete server;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    52
    delete writer;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    53
    delete iStrInfoTbl;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    54
    delete formatter;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    55
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    56
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    57
void CSymbianElfFormatterTest::CleanupEComArray(TAny* aArray)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    58
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    59
	(static_cast<RImplInfoPtrArray*> (aArray))->ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    60
    REComSession::FinalClose();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    61
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    62
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    63
void CSymbianElfFormatterTest::TestSuiteL(TSuite aSuite)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    64
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    65
    RDebug::Print(_L("-> TestSuite(%d)\n"), aSuite);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    66
    TInt err;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    67
    //TInt handle;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    68
    //           123456789012345678901
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    69
    TBuf<23> name(KTestName); 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    70
    name.AppendNum(aSuite);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    71
    itest.Next(name);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    72
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    73
	iCrashInfo.iType = TCrashInfo::ECrashException;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    74
	iCrashInfo.iExcNumber = KCrashExcCode;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    75
	iCrashInfo.iTime = KCrashTime;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    76
	iCrashInfo.iPid = KCrashPid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    77
	iCrashInfo.iTid = KCrashTid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    78
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    79
	iCrashInfo.iContext.iFaultAddress = KCrashFaultAddress;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    80
	iCrashInfo.iContext.iFaultStatus = KCrashFaultStatus;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    81
	
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    82
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    83
	iCrashInfo.iContext.iR15 = KRegValue32 + KCrashTid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    84
	iCrashInfo.iContext.iR13Svc = iCrashInfo.iContext.iR15 + 1;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    85
	iCrashInfo.iContext.iR14Svc = iCrashInfo.iContext.iR15 + 2;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    86
	iCrashInfo.iContext.iSpsrSvc = iCrashInfo.iContext.iR15 + 3;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    87
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    88
	if( iStrInfoTbl )
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    89
		delete iStrInfoTbl;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    90
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    91
	iStrInfoTbl = CStringInfoTable::NewLC();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    92
	formatter->iStrInfoTbl = iStrInfoTbl;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    93
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    94
    RBuf8 reference;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    95
    switch(aSuite)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    96
    {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    97
        case EConfigData:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    98
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
    99
            RDebug::Print(_L("EConfigData starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   100
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   101
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   102
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   103
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   104
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   105
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   106
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   107
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   108
            TRAP(err, formatter->ConfigureDataSourceL(NULL)); 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   109
            itest(err == KErrNoMemory);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   110
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   111
            TRAP(err, formatter->ConfigureDataSaveL(NULL));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   112
            itest(err == KErrNoMemory);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   113
            RDebug::Print(_L("EConfigData passed!\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   114
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   115
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   116
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   117
        case EFindImplementation:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   118
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   119
            RDebug::Print(_L("EFindImplementation starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   120
            RImplInfoPtrArray infoArray;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   121
            TCleanupItem cleanup(CSymbianElfFormatterTest::CleanupEComArray, (TAny*)&infoArray);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   122
            CleanupStack::PushL(cleanup);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   123
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   124
            TRAPD(err, CSymbianElfFormatter::ListAllImplementationsL(infoArray));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   125
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   126
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   127
            CCoreDumpFormatter* formatter = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   128
            RBuf description;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   129
            description.CreateL(MaxPluginDescription);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   130
            CleanupClosePushL(description);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   131
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   132
            err = KErrNotFound;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   133
            for (TInt i = 0; i < infoArray.Count(); i++)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   134
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   135
                TUid uid = infoArray[i]->ImplementationUid();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   136
                formatter = CCoreDumpFormatter::NewL(uid);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   137
                formatter->GetDescription(description);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   138
                delete formatter;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   139
                RDebug::Print(_L("found plugin[%d]: (%S)\n"), i, &description);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   140
                if(description == KPluginDescription())
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   141
                {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   142
                    itest(uid == KSymbianElfFormatterUid);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   143
                    err = KErrNone;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   144
                    break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   145
                }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   146
                description.Zero();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   147
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   148
            CleanupStack::PopAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   149
            description.Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   150
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   151
            CleanupStack::PopAndDestroy(); // infoArray, results in a call to CleanupEComArray
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   152
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   153
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   154
        case EWriteSymbianInfo:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   155
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   156
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   157
			RDebug::Print(_L("EWriteSymbianInfo starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   158
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   159
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   160
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   161
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   162
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   163
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   164
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   165
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   166
            reference.CreateL( sizeof(Sym32_dhdr) + sizeof(Sym32_syminfod) );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   167
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   168
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   169
            TPtrC8 ptr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   170
            Sym32_dhdr dhdr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   171
            ptr.Set(reinterpret_cast<TUint8*>(&dhdr), sizeof(Sym32_dhdr));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   172
            TInt32 index = iStrInfoTbl->GetIndex(KSymbian);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   173
            dhdr.d_name	= (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   174
            dhdr.d_descrsz	= sizeof(Sym32_syminfod);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   175
            dhdr.d_type	= ESYM_NOTE_SYM;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   176
            dhdr.d_version = iStrInfoTbl->GetIndex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   177
            dhdr.d_elemnum = 1;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   178
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   179
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   180
            Sym32_syminfod seg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   181
            ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_syminfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   182
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   183
            seg.sd_date_time = (Elf64_Word)KCrashTime;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   184
            seg.sd_exit_type = KCrashType;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   185
            seg.sd_exit_reason = KCrashReason;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   186
            seg.sd_thread_id = KCrashTid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   187
            seg.sd_proc_id = KCrashPid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   188
        
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   189
            TBuf8<KMaxExitCategoryName> buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   190
            buf.Copy(KCrashCategory);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   191
            if (buf.Length() > 0)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   192
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   193
                iStrInfoTbl->AddStringL(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   194
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   195
            index = iStrInfoTbl->GetIndex(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   196
            seg.sd_exit_cat = (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   197
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   198
            Sym32_execid id = {I64LOW(KCrashTime), KCrc32};            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   199
            seg.sd_execid = id;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   200
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   201
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   202
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   203
            writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   204
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   205
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   206
            TInt offset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   207
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   208
			RDebug::Print(_L("->formatter->WriteSymbianInfoL( )\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   209
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   210
			formatter->WriteSymbianInfoL( iCrashInfo, KCrc32 );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   211
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   212
			RDebug::Print(_L("<-formatter->WriteSymbianInfoL( )\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   213
            itest(offset + sizeof(Sym32_dhdr) + sizeof(Sym32_syminfod) == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   214
			itest(offset != formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   215
			
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   216
			//RDebug::Print(_L("itest3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   217
            //itest(reference == writer->iData);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   218
			//writer->Print();						
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   219
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   220
            itest(reference != _L8(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   221
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   222
            CleanupStack::PopAndDestroy(&reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   223
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   224
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   225
        case EWriteCodeSegments:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   226
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   227
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   228
			RDebug::Print(_L("EWriteCodeSegments starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   229
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   230
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   231
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   232
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   233
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   234
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   235
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   236
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   237
			RCodeSegPointerList codeSegs;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   238
			RArray<TUint> codeSegOffsets;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   239
			CleanupClosePushL(codeSegOffsets);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   240
			TUint totalCodeSegListDescSize;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   241
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   242
			RDebug::Print(_L("server->GetCodeSegmentsL( KCrashTid, codeSegs );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   243
			server->GetCodeSegmentsL( KCrashTid, codeSegs, totalCodeSegListDescSize );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   244
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   245
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   246
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   247
			writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   248
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   249
			RDebug::Print(_L("formatter->WriteCodeSegmentsL( KCrashTid, codeSegs, codeSegOffsets );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   250
            formatter->WriteCodeSegmentsL( KCrashTid, codeSegs, codeSegOffsets );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   251
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   252
			RDebug::Print(_L("itest(codeSegOffsets.Count() == KCodeSegsCount );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   253
			itest(codeSegOffsets.Count() == KCodeSegsCount );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   254
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   255
			for(TInt i = 0; i < KCodeSegsCount; i++)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   256
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   257
				RDebug::Printf( "itest( codeSegs[i] = %d );\n", codeSegOffsets[i] );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   258
                itest( codeSegOffsets[i] == 0 );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   259
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   260
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   261
			RDebug::Printf( "itest(0 == formatter->iOffset);" );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   262
            itest(0 == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   263
			
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   264
			RDebug::Printf( "CleanupStack::PopAndDestroy(&codeSegOffsets);" );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   265
			CleanupStack::PopAndDestroy(&codeSegOffsets);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   266
			RDebug::Printf( "CleanupStack::PopAndDestroy(&codeSegs);" );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   267
            codeSegs.ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   268
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   269
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   270
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   271
        case EWriteDataSegments:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   272
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   273
			RDebug::Print(_L("EWriteDataSegments starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   274
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   275
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   276
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   277
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   278
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   279
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   280
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   281
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   282
            reference.CreateL(KDataSegsCount * (KDataSegSize + KCrashPid + KDataSegsCount*(KDataSegsCount+1)/2) ); 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   283
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   284
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   285
            RBuf8 buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   286
            buf.CreateL((KDataSegSize + KCrashPid + KDataSegsCount));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   287
            for(TInt i = 0; i < KDataSegSize + KCrashPid + KDataSegsCount; ++i)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   288
                    buf.Append((TUint8*)&i, 1);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   289
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   290
            for(TInt i = 0; i < KDataSegsCount; ++i)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   291
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   292
                reference.Append(buf.Ptr(), KDataSegSize + KCrashPid + i);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   293
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   294
            buf.Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   295
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   296
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   297
            TInt offset = formatter->iOffset;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   298
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   299
			RThreadPointerList *threadList = new(ELeave)RThreadPointerList ;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   300
			formatter->iDataSource->GetThreadListL((TUint64)KCrashPid, *threadList);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   301
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   302
			RCodeSegPointerList codeSegs;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   303
			CleanupClosePushL(codeSegs);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   304
			CSymbianElfFormatter::RSegmentList dataSegs;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   305
			CleanupClosePushL(dataSegs);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   306
			RArray<TUint> dataSegOffsets;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   307
			CleanupClosePushL(dataSegOffsets);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   308
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   309
			writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   310
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   311
            formatter->WriteDataSegmentsL( 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   312
				KCrashTid, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   313
				KCrashPid, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   314
				*threadList, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   315
				codeSegs, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   316
				dataSegs, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   317
				dataSegOffsets );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   318
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   319
			//RDebug::Print(_L("itest1\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   320
            //itest(offset + reference.Length() == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   321
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   322
			RDebug::Print(_L("itest2\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   323
            itest(offset != formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   324
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   325
			//RDebug::Print(_L("itest3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   326
            //itest(reference == writer->iData);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   327
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   328
			// Note that the number of sements is not the same as KDataSegsCount, 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   329
			//since we also create thread stack segments
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   330
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   331
			RDebug::Print(_L("itest4\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   332
            itest(reference != _L8(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   333
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   334
			threadList->ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   335
			threadList->Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   336
			delete threadList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   337
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   338
			CleanupStack::PopAndDestroy(&dataSegOffsets);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   339
			CleanupStack::PopAndDestroy(&dataSegs);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   340
			CleanupStack::PopAndDestroy(&codeSegs);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   341
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   342
            CleanupStack::PopAndDestroy(); //reference
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   343
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   344
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   345
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   346
        case EWriteThreadsInfo:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   347
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   348
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   349
			RDebug::Print(_L("EWriteThreadsInfo  starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   350
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   351
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   352
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   353
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   354
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   355
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   356
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   357
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   358
            reference.CreateL( sizeof(Sym32_dhdr) + sizeof(Sym32_thrdinfod)*KCrashThreadsCount );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   359
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   360
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   361
            TPtrC8 ptr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   362
            Sym32_dhdr dhdr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   363
            ptr.Set(reinterpret_cast<TUint8*>(&dhdr), sizeof(Sym32_dhdr));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   364
            TInt32 index = iStrInfoTbl->GetIndex(KThread);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   365
            dhdr.d_name	= (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   366
            dhdr.d_descrsz	= sizeof(Sym32_thrdinfod);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   367
            dhdr.d_type	= ESYM_NOTE_THRD;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   368
            dhdr.d_version = iStrInfoTbl->GetIndex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   369
            dhdr.d_elemnum = KCrashThreadsCount;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   370
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   371
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   372
			RThreadPointerList *threadList = new(ELeave) RThreadPointerList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   373
			formatter->iDataSource->GetThreadListL(KCrashPid, *threadList);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   374
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   375
            Sym32_thrdinfod seg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   376
            ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_thrdinfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   377
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   378
            for(TInt i = 0; i < KCrashThreadsCount; ++i)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   379
				{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   380
				seg.td_id = KCrashTid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   381
				seg.td_owning_process = KCrashPid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   382
				seg.td_priority = KCrashThreadPriority + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   383
				seg.td_svc_sp = KCrashSvcStackPtr + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   384
				seg.td_svc_stack = KCrashSvcStackAddr + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   385
				seg.td_svc_stacksz = KCrashSvcStackSize + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   386
				seg.td_usr_stack = KCrashUsrStackAddr + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   387
				seg.td_usr_stacksz = KCrashUsrStackSize + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   388
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   389
				TBuf8<KMaxProcessName> buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   390
				buf.Copy(KCrashThreadName);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   391
				if (buf.Length() > 0)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   392
				{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   393
					iStrInfoTbl->AddStringL(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   394
				}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   395
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   396
				index = iStrInfoTbl->GetIndex(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   397
				seg.td_name = (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   398
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   399
				reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   400
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   401
				}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   402
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   403
            writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   404
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   405
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   406
            TInt offset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   407
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   408
            formatter->WriteThreadInfoL(KCrashPid, *threadList);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   409
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   410
			RDebug::Print(_L("itest1\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   411
            itest(offset + reference.Length() == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   412
			RDebug::Print(_L("itest2\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   413
            itest(offset != formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   414
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   415
			//RDebug::Print(_L("itest3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   416
            //itest(reference == writer->iData);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   417
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   418
			RDebug::Print(_L("itest4\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   419
            itest(reference != _L8(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   420
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   421
			threadList->ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   422
			threadList->Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   423
			delete threadList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   424
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   425
            CleanupStack::PopAndDestroy(); //reference
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   426
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   427
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   428
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   429
        case EWriteProcessInfo:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   430
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   431
			RDebug::Print(_L("EWriteProcessInfo starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   432
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   433
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   434
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   435
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   436
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   437
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   438
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   439
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   440
            reference.CreateL( sizeof(Sym32_dhdr) + sizeof(Sym32_procinfod) );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   441
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   442
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   443
			RProcessPointerList *processList = new(ELeave)RProcessPointerList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   444
			formatter->iDataSource->GetProcessListL( *processList );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   445
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   446
            TPtrC8 ptr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   447
            Sym32_dhdr dhdr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   448
            ptr.Set(reinterpret_cast<TUint8*>(&dhdr), sizeof(Sym32_dhdr));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   449
            TInt32 index = iStrInfoTbl->GetIndex(KProcess);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   450
            dhdr.d_name	= (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   451
            dhdr.d_descrsz	= sizeof(Sym32_procinfod);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   452
            dhdr.d_type	= ESYM_NOTE_PROC;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   453
            dhdr.d_version = iStrInfoTbl->GetIndex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   454
            dhdr.d_elemnum = 1;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   455
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   456
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   457
            Sym32_procinfod seg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   458
            ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_procinfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   459
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   460
            seg.pd_id = KCrashPid;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   461
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   462
            TBuf8<KMaxProcessName> buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   463
            buf.Copy(KCrashProcessName);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   464
            if (buf.Length() > 0)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   465
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   466
                iStrInfoTbl->AddStringL(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   467
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   468
            index = iStrInfoTbl->GetIndex(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   469
            seg.pd_name = (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   470
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   471
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   472
            writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   473
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   474
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   475
            TInt offset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   476
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   477
            formatter->WriteProcessInfoL(KCrashPid, *processList );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   478
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   479
			RDebug::Print(_L("itest1\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   480
            itest(offset + reference.Length() == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   481
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   482
			RDebug::Print(_L("itest2\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   483
            itest(offset != formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   484
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   485
			//RDebug::Print(_L("itest3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   486
            //itest(reference == writer->iData);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   487
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   488
			RDebug::Print(_L("itest4\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   489
            itest(reference != _L8(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   490
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   491
			processList->ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   492
			processList->Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   493
			delete processList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   494
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   495
            CleanupStack::PopAndDestroy(&reference); //reference
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   496
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   497
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   498
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   499
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   500
        case EWriteExecutableInfo:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   501
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   502
			RDebug::Print(_L("EWriteExecutableInfo starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   503
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   504
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   505
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   506
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   507
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   508
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   509
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   510
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   511
            reference.CreateL(sizeof(Sym32_dhdr) + KCodeSegsCount * sizeof(Sym32_execinfod) );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   512
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   513
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   514
            TPtrC8 ptr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   515
            Sym32_dhdr dhdr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   516
            ptr.Set(reinterpret_cast<TUint8*>(&dhdr), sizeof(Sym32_dhdr));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   517
            TInt32 index = iStrInfoTbl->GetIndex(KExecutable);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   518
            dhdr.d_name	= (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   519
            dhdr.d_descrsz	= sizeof(Sym32_execinfod);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   520
            dhdr.d_type	= ESYM_NOTE_EXEC;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   521
            dhdr.d_version = iStrInfoTbl->GetIndex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   522
            dhdr.d_elemnum = KCodeSegsCount;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   523
            reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   524
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   525
            Sym32_execinfod seg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   526
            ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_execinfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   527
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   528
            Sym32_execid id = {I64LOW(KCrashTime), KCrc32};
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   529
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   530
            seg.ed_execid = id;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   531
            seg.ed_XIP = KCrashXIP;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   532
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   533
            for(TInt i = 0; i < KCodeSegsCount; i++)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   534
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   535
                if(i == 2)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   536
                    seg.ed_XIP = !KCrashXIP;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   537
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   538
                seg.ed_codesize = KCrashCodeSize + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   539
                seg.ed_coderunaddr = KCrashCodeRunAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   540
                seg.ed_codeloadaddr = KCrashCodeLoadAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   541
                seg.ed_rodatasize = KCrashRODataSize + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   542
                seg.ed_rodatarunaddr = KCrashRODataRunAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   543
                seg.ed_rodataloadaddr = KCrashRODataLoadAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   544
                seg.ed_datasize = KCrashDataSize + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   545
                seg.ed_datarunaddr = KCrashDataRunAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   546
                seg.ed_dataloadaddr = KCrashDataLoadAddr + KCrashPid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   547
                TBuf8<KMaxFileName> buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   548
                switch(i)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   549
                {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   550
                    case 0:    
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   551
                        buf.Copy(KCrashFileName);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   552
                        break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   553
                    case 1:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   554
                        buf.Copy(KLibName1);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   555
                        break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   556
                    case 2:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   557
                        buf.Copy(KLibName2);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   558
                        break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   559
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   560
                }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   561
                if (buf.Length() > 0)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   562
                {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   563
                    iStrInfoTbl->AddStringL(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   564
                }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   565
                index = iStrInfoTbl->GetIndex(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   566
                seg.ed_name = (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   567
                reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   568
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   569
            
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   570
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   571
            writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   572
			formatter->iOffset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   573
            TInt offset = 0;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   574
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   575
			RCodeSegPointerList segList;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   576
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   577
            formatter->iDataSource->GetCodeSegmentsL(KCrashTid, segList);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   578
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   579
			formatter->WriteExecutableInfoL( segList, KCrashTime, KCrashTid );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   580
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   581
            segList.ResetAndDestroy();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   582
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   583
			RDebug::Print(_L("itest1\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   584
            itest(offset + reference.Length() == formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   585
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   586
			RDebug::Print(_L("itest2\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   587
            itest(offset != formatter->iOffset);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   588
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   589
			//RDebug::Print(_L("itest3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   590
            //itest(reference == writer->iData);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   591
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   592
			RDebug::Print(_L("itest4\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   593
            itest(reference != _L8(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   594
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   595
            CleanupStack::PopAndDestroy(&reference); //reference
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   596
			
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   597
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   598
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   599
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   600
        case EWriteRegistersInfo:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   601
        {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   602
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   603
			RDebug::Print(_L("EWriteRegistersInfo starting...\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   604
            TRAP(err, formatter->ConfigureDataSourceL(server));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   605
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   606
            itest(server == formatter->iDataSource);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   607
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   608
            TRAP(err, formatter->ConfigureDataSaveL(writer));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   609
            itest(err == KErrNone);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   610
            itest(writer == formatter->iDataSave);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   611
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   612
            reference.CreateL( sizeof(Sym32_dhdr) + sizeof(Sym32_reginfod) * (1 + KCoProRegsCount/4) 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   613
                                                  + sizeof(Sym32_regdatad) * (KCoreRegsCount+KCoProRegsCount/2) );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   614
            CleanupClosePushL(reference);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   615
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   616
            TPtrC8 ptr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   617
            Sym32_dhdr dhdr;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   618
            //Sym32_reginfod seg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   619
            //Sym32_regdatad reg;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   620
            for(TInt i =0; i < KCrashThreadsCount; ++i)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   621
            {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   622
                TBuf8<255> buf;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   623
                buf.Format(_L8("CORE.SYMBIAN.REGISTER.%u"), KCrashTid + i);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   624
                iStrInfoTbl->AddStringL(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   625
                TInt32 index = iStrInfoTbl->GetIndex(buf);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   626
                dhdr.d_name	= (index == KErrNotFound) ? ESYM_STR_UNDEF : index;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   627
                dhdr.d_descrsz	= (sizeof(Sym32_reginfod) + sizeof(Sym32_regdatad)) * KCoreRegsCount; 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   628
                dhdr.d_type	= ESYM_NOTE_REG;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   629
                dhdr.d_version = iStrInfoTbl->GetIndex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   630
                dhdr.d_elemnum = KCoreRegsCount + KCoProRegsCount/4; //core regs plus one for each copro reg size
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   631
                ptr.Set(reinterpret_cast<TUint8*>(&dhdr), sizeof(Sym32_dhdr));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   632
                reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   633
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   634
                /*
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   635
                 defect in formatter code needs to be fixed, so not sure how is it going to be implemented
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   636
                 but it should match the code below
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   637
                //all core regs are 32-bit and available
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   638
                seg.rid_class = ESYM_CORE;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   639
                seg.rid_num_registers = KCoreRegsCount;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   640
                seg.rid_repre = ESYM_REG_32;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   641
                seg.rid_thread_id = KCrashTid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   642
                seg.rid_version = iStrInfoTbl->Getindex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   643
                ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_reginfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   644
                reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   645
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   646
                for(TInt j = 0; j < KCoreRegsCount; ++j)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   647
                {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   648
                    reg.rd_id = regid; //r0...r15 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   649
                    reg.rd_sub_id = 0; //not important for core
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   650
                    reg.rd_data = 0; //good question??
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   651
                    ptr.Set(reinterpret_cast<TUint8*>(&reg), sizeof(Sym32_regdatad));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   652
                    reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   653
                }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   654
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   655
                //done with core regs now four types of copro regs
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   656
                seg.rid_class = ESYM_COPRO;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   657
                seg.rid_num_registers = KCoProRegsCount/4;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   658
                seg.rid_num_registers /=2; //half of them is not available
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   659
                seg.rid_repre = ESYM_REG_8;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   660
                seg.rid_thread_id = KCrashTid + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   661
                seg.rid_version = iStrInfoTbl->Getindex(KSymbianElfCoreDumpVersion);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   662
                ptr.Set(reinterpret_cast<TUint8*>(&seg), sizeof(Sym32_reginfod));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   663
                reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   664
                
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   665
                for(TInt j = 0; j < KCoProRegsCount/2; ++j) //half of them is available
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   666
                {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   667
                    if(i%4 == 0)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   668
                    {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   669
                        reg.rd_id = j;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   670
                        reg.rd_sub_id = KRegSubId + i;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   671
                        reg.rd_data = 0; //what about that?
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   672
                        ptr.Set(reinterpret_cast<TUint8*>(&reg), sizeof(Sym32_regdatad));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   673
                        reference.Append(ptr);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   674
                    }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   675
                }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   676
                */
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   677
            }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   678
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   679
            writer->OpenL(_L("") ); //clear writer buffer
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   680
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   681
            CleanupStack::PopAndDestroy(&reference); //reference
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   682
            break;    
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   683
        }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   684
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   685
        default:
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   686
            break;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   687
    }
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   688
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   689
	RDebug::Print(_L("-> CleanupStack::PopAndDestroy( iStrInfoTbl );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   690
	CleanupStack::PopAndDestroy( iStrInfoTbl );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   691
	iStrInfoTbl = NULL;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   692
	RDebug::Print(_L("<- TestSuiteL()\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   693
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   694
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   695
void RunTestsL()
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   696
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   697
    RDebug::Print(_L("-> RunTestsL()0\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   698
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   699
	RArray<TUint> pt;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   700
	CleanupStack::PushL(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   701
	CleanupStack::Check(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   702
		
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   703
    CSymbianElfFormatterTest::TSuite suite[] = {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   704
                                         CSymbianElfFormatterTest::ENone,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   705
                                         CSymbianElfFormatterTest::EConfigData,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   706
                                         //CSymbianElfFormatterTest::EFindImplementation,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   707
                                         CSymbianElfFormatterTest::EConfigParams,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   708
                                         CSymbianElfFormatterTest::EGetDescription,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   709
                                         CSymbianElfFormatterTest::EWriteSymbianInfo,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   710
                                         CSymbianElfFormatterTest::EWriteCodeSegments,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   711
                                         CSymbianElfFormatterTest::EWriteDataSegments,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   712
                                         CSymbianElfFormatterTest::EWriteThreadsInfo,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   713
                                         CSymbianElfFormatterTest::EWriteProcessInfo,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   714
                                         CSymbianElfFormatterTest::EWriteExecutableInfo,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   715
                                         //CSymbianElfFormatterTest::EWriteRegistersInfo,
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   716
                                         CSymbianElfFormatterTest::ECrash
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   717
                                         };
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   718
	RDebug::Print(_L("-> RunTestsL()2\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   719
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   720
    RTest rtest(KTestTitle);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   721
    rtest.Title(); 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   722
    rtest.Start(_L(""));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   723
    CSymbianElfFormatterTest::TSuite *test = suite; 
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   724
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   725
	CleanupStack::Check(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   726
	RDebug::Print(_L("-> RunTestsL()3\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   727
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   728
    while(*test != CSymbianElfFormatterTest::ECrash)
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   729
    {
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   730
		RDebug::Print(_L("-> CleanupStack::Check(&pt);\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   731
		CleanupStack::Check(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   732
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   733
        CSymbianElfFormatterTest *itester = CSymbianElfFormatterTest::NewLC(rtest);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   734
        itester->TestSuiteL(*test++);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   735
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   736
		RDebug::Print(_L("-> CleanupStack::PopAndDestroy( itester );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   737
        CleanupStack::PopAndDestroy( itester );
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   738
		RDebug::Print(_L("<- CleanupStack::PopAndDestroy( itester );\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   739
	}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   740
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   741
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   742
    rtest.End();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   743
    rtest.Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   744
    RDebug::Print(_L("<- RunTestsL()\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   745
	CleanupStack::Check(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   746
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   747
	pt.Close();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   748
	CleanupStack::Pop(&pt);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   749
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   750
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   751
	
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   752
TInt E32Main()
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   753
{
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   754
    RDebug::Print(_L("-> E32Main()\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   755
	__UHEAP_MARK;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   756
	CTrapCleanup* cleanup = CTrapCleanup::New();
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   757
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   758
    __ASSERT_ALWAYS(cleanup, User::Panic(_L("SYMBIAN_ELF_TEST-NO_CLEANUP"), KErrNoMemory));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   759
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   760
	TRAPD(err, RunTestsL());
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   761
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   762
	RDebug::Print(_L("E32Main() after TRAPD(err=%d, RunTestsL());\n"), err);
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   763
	__ASSERT_ALWAYS(!err, User::Panic(_L("SYMBIAN_ELF_TEST-RunTestsL trapped with error: "), err));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   764
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   765
	RDebug::Print(_L("delete cleanup;\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   766
	delete cleanup;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   767
	__UHEAP_MARKEND;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   768
    RDebug::Print(_L("<- E32Main()\n"));
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   769
	return err;
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   770
}
c6b0df440bee Initial contribution of EPL licensed sources
ravikurupati
parents:
diff changeset
   771