sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <stdio.h>
|
sl@0
|
17 |
#include <stdlib.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
extern void ProcessAllTrace(unsigned (*aInput)(void* aBuffer, unsigned aMaxSize),int aReportLevel);
|
sl@0
|
20 |
|
sl@0
|
21 |
FILE* InFile = 0;
|
sl@0
|
22 |
|
sl@0
|
23 |
unsigned GetTraceData(void* aBuffer, unsigned aMaxSize)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
return fread(aBuffer, 1, aMaxSize, InFile);
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
char* ThisProgram = "BTRACE";
|
sl@0
|
29 |
|
sl@0
|
30 |
int Help()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
printf("Usage: %s [options] file\n",ThisProgram);
|
sl@0
|
33 |
printf("Options:\n");
|
sl@0
|
34 |
printf(" -a<level> Set analysis level, 0 = brief summary, 1 = full summary,\n");
|
sl@0
|
35 |
printf(" 2 = condensed trace dump, 3 = full trace dump (DEFAULT)\n");
|
sl@0
|
36 |
printf("\nTHIS TOOL IS UNOFFICIAL, UNSUPPORTED AND SUBJECT TO CHANGE WITHOUT NOTICE!\n");
|
sl@0
|
37 |
return 1;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
int main(int argc, char** argv)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
int reportLevel = 99;
|
sl@0
|
43 |
InFile = 0;
|
sl@0
|
44 |
|
sl@0
|
45 |
ThisProgram = argv[0];
|
sl@0
|
46 |
int nextArg=0;
|
sl@0
|
47 |
for(;;)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
++nextArg;
|
sl@0
|
50 |
if(nextArg>=argc)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
fprintf(stderr,"Missing input file\n");
|
sl@0
|
53 |
return Help();
|
sl@0
|
54 |
}
|
sl@0
|
55 |
if(argv[nextArg][0]!='-')
|
sl@0
|
56 |
break; // not option
|
sl@0
|
57 |
if(argv[nextArg][1]=='a')
|
sl@0
|
58 |
{
|
sl@0
|
59 |
reportLevel = strtoul(argv[nextArg]+2,0,10);
|
sl@0
|
60 |
continue;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
fprintf(stderr,"Unknown option: %s\n",argv[nextArg]);
|
sl@0
|
63 |
return Help();
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
InFile = fopen(argv[nextArg],"rb");
|
sl@0
|
67 |
if(!InFile)
|
sl@0
|
68 |
{
|
sl@0
|
69 |
fprintf(stderr,"Can't open input file '%s'\n",argv[nextArg]);
|
sl@0
|
70 |
return Help();
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
ProcessAllTrace(GetTraceData,reportLevel);
|
sl@0
|
74 |
|
sl@0
|
75 |
fclose(InFile);
|
sl@0
|
76 |
return 0;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|