sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: extern void ProcessAllTrace(unsigned (*aInput)(void* aBuffer, unsigned aMaxSize),int aReportLevel); sl@0: sl@0: FILE* InFile = 0; sl@0: sl@0: unsigned GetTraceData(void* aBuffer, unsigned aMaxSize) sl@0: { sl@0: return fread(aBuffer, 1, aMaxSize, InFile); sl@0: } sl@0: sl@0: char* ThisProgram = "BTRACE"; sl@0: sl@0: int Help() sl@0: { sl@0: printf("Usage: %s [options] file\n",ThisProgram); sl@0: printf("Options:\n"); sl@0: printf(" -a Set analysis level, 0 = brief summary, 1 = full summary,\n"); sl@0: printf(" 2 = condensed trace dump, 3 = full trace dump (DEFAULT)\n"); sl@0: printf("\nTHIS TOOL IS UNOFFICIAL, UNSUPPORTED AND SUBJECT TO CHANGE WITHOUT NOTICE!\n"); sl@0: return 1; sl@0: } sl@0: sl@0: int main(int argc, char** argv) sl@0: { sl@0: int reportLevel = 99; sl@0: InFile = 0; sl@0: sl@0: ThisProgram = argv[0]; sl@0: int nextArg=0; sl@0: for(;;) sl@0: { sl@0: ++nextArg; sl@0: if(nextArg>=argc) sl@0: { sl@0: fprintf(stderr,"Missing input file\n"); sl@0: return Help(); sl@0: } sl@0: if(argv[nextArg][0]!='-') sl@0: break; // not option sl@0: if(argv[nextArg][1]=='a') sl@0: { sl@0: reportLevel = strtoul(argv[nextArg]+2,0,10); sl@0: continue; sl@0: } sl@0: fprintf(stderr,"Unknown option: %s\n",argv[nextArg]); sl@0: return Help(); sl@0: } sl@0: sl@0: InFile = fopen(argv[nextArg],"rb"); sl@0: if(!InFile) sl@0: { sl@0: fprintf(stderr,"Can't open input file '%s'\n",argv[nextArg]); sl@0: return Help(); sl@0: } sl@0: sl@0: ProcessAllTrace(GetTraceData,reportLevel); sl@0: sl@0: fclose(InFile); sl@0: return 0; sl@0: } sl@0: