1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Common defines for cpp files. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __ATCOMMONDEFINES_H__ |
|
20 #define __ATCOMMONDEFINES_H__ |
|
21 |
|
22 #include "../inc/stdafx.h" |
|
23 |
|
24 using namespace std; |
|
25 |
|
26 // CLI return codes. |
|
27 // Note! Do not change the values. Used in extension. |
|
28 struct AT_RETURN_CODE { |
|
29 enum RETURN_CODE { |
|
30 /* basic */ |
|
31 OK = 0, /* All ok. */ |
|
32 INVALID_ARGUMENT_ERROR = 1, /* Arguments failty. */ |
|
33 AT_LIBS_MISSING = 2, /* Missing at libraries cannot compile hooked apps. */ |
|
34 CANNOT_FIND_EPOCROOT = 3, /* Epocroot not set. */ |
|
35 UNHANDLED_EXCEPTION = 4, /* General return code when unhandled exception occurs. */ |
|
36 /* compile errors */ |
|
37 MAKEFILE_ERROR = 5, /* Cannot read/create etc makefiles sbs1/2. */ |
|
38 COMPILE_ERROR = 6, /* Some error related to compilation of code. */ |
|
39 UNKNOWN = 7, /* General compilation error not specific. */ |
|
40 NO_SUPPORTED_MODULES_ERROR = 8, /* Cannot find supported modules from project. */ |
|
41 KERNEL_SIDE_MODULE_ERROR = 9, /* Cannot find supported modules from project because kernel side. */ |
|
42 /* Analyze errors */ |
|
43 WRONG_DATA_FILE_VERSION = 10, /* Invalid data file version in internal gathering mode. */ |
|
44 INVALID_DATA_FILE = 11, /* Data file content invalid. */ |
|
45 ANALYZE_ERROR = 12, /* General error in analyze part not specific. */ |
|
46 EMPTY_DATA_FILE = 13, /* Data file is empty. */ |
|
47 SYMBOL_FILE_ERROR = 14, /* Symbol file content invalid or do not exist. */ |
|
48 /* building&releasing errors */ |
|
49 RELEASABLES_ERROR = 20, /* Cannot find the binaries of module. */ |
|
50 RESTORE_MODULES_ERROR = 21, /* Error restoring mmp file to original. */ |
|
51 CREATING_TEMP_CPP_ERROR = 22, /* Error creating temporary cpps to store variables to s60 core.*/ |
|
52 CLEANING_TEMP_ERROR = 23, /* Error cleaning atool_temp folder from module. */ |
|
53 READ_MAKEFILE_ERROR = 24, /* Some error when reading makefile of module / project (sbs1/2). */ |
|
54 MODIFY_MODULES_ERROR = 25, /* Error modifying module mmp file. */ |
|
55 INVALID_MMP_DEFINED = 27, /* Specified module does not exist in project. */ |
|
56 /* Attribute file related */ |
|
57 WRITE_ATTRIBUTES_ERROR = 30, /* Error writing the cfg file into atool_temp folder (contains arguments).*/ |
|
58 READ_ATTRIBUTES_ERROR = 31, /* Error reading hooking related arguments from cfg file. */ |
|
59 /* User issued exit */ |
|
60 USER_ISSUED_EXIT = 40, /* User aborted the run of application. */ |
|
61 /* HTI */ |
|
62 HTI_NO_CONNECTION = 50, /* No hti connection defined */ |
|
63 HTI_NO_AT_FOLDER = 51, /* Cannot find analyzetool folder from device. */ |
|
64 HTI_NO_FILE_DEFINED = 52 /* No file defined to be fetched. */ |
|
65 }; |
|
66 }; |
|
67 |
|
68 // Debug logging to console |
|
69 extern bool g_bDebugConsole; |
|
70 // Debug logging to windows api debug |
|
71 extern bool g_bDebugDbgView; |
|
72 // Debug (low level functions). |
|
73 extern bool g_bDebugLowLevel; |
|
74 |
|
75 // Temporary directory definition's. |
|
76 const char AT_TEMP_DIR[] = "atool_temp"; |
|
77 const char AT_TEMP_LST_DIR[] = "atool_temp\\static_lsts\\"; |
|
78 |
|
79 // makefile dir is used in atool.cpp to check will we use sbs2 (in analyze and clear) |
|
80 #define RAPTOR_MAKEFILE_DIR "atool_temp\\build" |
|
81 |
|
82 // Atool version number and date |
|
83 #define ATOOL_VERSION "1.8.0" // NOTE! This version number is written also to temporary cpp file. |
|
84 #define ATOOL_DATE "1st December 2009" |
|
85 |
|
86 // Default/min/max call stack sizes |
|
87 const int AT_ALLOC_CALL_STACK_SIZE_DEFAULT = 40; |
|
88 const int AT_FREE_CALL_STACK_SIZE_DEFAULT = 0; |
|
89 const int AT_CALL_STACK_SIZE_MIN = 0; |
|
90 const int AT_CALL_STACK_SIZE_MAX = 256; |
|
91 |
|
92 // What version of data file contains timestamps in dll's. |
|
93 const int AT_DLL_TIMESTAMP_DATA_VERSION = 2; |
|
94 |
|
95 // Constant compatibility string in temporary cpp. |
|
96 // Api version ; current version. |
|
97 #define ATOOL_COMPATIBILITY_STRING "1.7.4;1.8.0" |
|
98 |
|
99 // Datafile version |
|
100 #define AT_DATA_FILE_VERSION "DATA_FILE_VERSION 11" |
|
101 |
|
102 // Build summary constants |
|
103 const string AT_BUILD_SUMMARY_HEADER = "\n### AnalyzeTool ###\n### Build Summary ###\n\n"; |
|
104 const string AT_BUILD_SUMMARY_INSTRUMENTED_BUILD_COMPLETE = "Instrumented build complete: "; |
|
105 const string AT_BUILD_SUMMARY_TARGET = "\tTarget: "; |
|
106 const string AT_BUILD_SUMMARY_FAILED = "Build failed: "; |
|
107 const string AT_BUILD_SUMMARY_ERRORS = "\tErrors: "; |
|
108 const string AT_BUILD_SUMMARY_DATA_FILE_NAME = "\tInternal data gathering filename: "; |
|
109 const string AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE = "Normal build complete: "; |
|
110 const string AT_BUILD_SUMMARY_STATIC_LIBRARY = "\tModule is static library."; |
|
111 const string AT_BUILD_SUMMARY_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type."; |
|
112 const string AT_BUILD_SUMMARY_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition."; |
|
113 const string AT_BUILD_SUMMARY_BUILD_TYPE = "Build type: "; |
|
114 const string AT_BUILD_SUMMARY_BUILD_TARGET = "Build target: "; |
|
115 const string AT_BUILD_SUMMARY_BUILD_PLATFORM = "Build platform: "; |
|
116 const string AT_BUILD_SUMMARY_BUILD_VARIANT = "Build variant: "; |
|
117 const string AT_BUILD_SUMMARY_LOGGING_MODE = "Data gathering mode: "; |
|
118 const string AT_BUILD_SUMMARY_ALLOC_CALL_STACK_SIZE = "Allocation call stack size: "; |
|
119 const string AT_BUILD_SUMMARY_FREE_CALL_STACK_SIZE = "Free call stack size: "; |
|
120 const string AT_BUILD_SUMMARY_S60 = "monitored internal"; |
|
121 const string AT_BUILD_SUMMARY_XTI = "monitored external"; |
|
122 const string AT_BUILD_SUMMARY_XTI_FAST = "external"; |
|
123 |
|
124 const string AT_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type."; |
|
125 const string AT_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition."; |
|
126 |
|
127 // List of locations under epocroot where analyzetool.h can be found. |
|
128 // Add all possible to this list so core version information can be read |
|
129 // from file. |
|
130 const string AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER[] = { |
|
131 "epoc32\\include\\domain\\osextensions\\analyzetool\\analyzetool.h", |
|
132 "epoc32\\include\\oem\\analyzetool\\analyzetool.h", |
|
133 "epoc32\\include\\platform\\analyzetool\\analyzetool.h" |
|
134 }; |
|
135 const string AT_CORE_VERSION_NUMBER_TAG = "ANALYZETOOL_CORE_VERSION_FOR_CLE"; |
|
136 |
|
137 // Temporary cpp name |
|
138 const char AT_TEMP_CPP_LOWER_START[] = "0a1b2c3d_atool_temp_"; |
|
139 const char AT_TEMP_CPP_LOWER_END[] = ".cpp"; |
|
140 |
|
141 const char TAB_CHAR_VALUE = 9; |
|
142 const char SPACE_CHAR_VALUE = 32; |
|
143 |
|
144 // Bldmake error msg |
|
145 #define AT_BLDMAKE_ERROR "AnalyzeTool : bldmake bldfiles error.\n" |
|
146 |
|
147 // File copy/move/etc... message definitions |
|
148 #define AT_MSG "AnalyzeTool : " |
|
149 #define AT_MSG_SYSTEM_CALL "AnalyzeTool : System call, " |
|
150 #define AT_FILE_TO " to " |
|
151 |
|
152 // -c messages |
|
153 #define AT_CLEANING_DONE "AnalyzeTool : Cleaning done." |
|
154 #define AT_CLEANING_NOTHING_FOUND "AnalyzeTool : Nothing found to clean." |
|
155 |
|
156 // Analyzing data without process start or dll load |
|
157 #define AT_ANALYZE_INSUFFICIENT_LOGGING_DATA "Insufficient logging data to locate code lines for memory addresses.\nLogging has been started after process start." |
|
158 #define AT_ANALYZE_NO_PROCESS_START "AnalyzeTool : No processes start information found in test run data." |
|
159 #define AT_ANALYZE_NO_DLL_LOAD "AnalyzeTool : No dll load information found in test run data." |
|
160 #define AT_ANALYZE_CANNOT_PINPOINT "AnalyzeTool : Memory addresses cannot be pinpointed." |
|
161 #define AT_ANALYZE_ABNORMAL_EXIT "Abnormal process end" |
|
162 |
|
163 // Analyzing without map / lst files |
|
164 #define AT_ANALYZE_MISSING_LST_MAP_FILES "AnalyzeTool : Missing lst or map files, memory addresses shown only to module level.\n" |
|
165 //#define AT_UNINSTRUMENT_FAILED_IN_ANALYZE_MESSAGE "AnalyzeTool: Error creating map/lst files, leaks shown only to module level.\nRun atool -u to try create lst/map files again after binaries build successfully.\n" |
|
166 |
|
167 // Mmp error msg |
|
168 #define INVALID_MMP_ERROR "AnalyzeTool : Error, Specified mmp is invalid.\n" |
|
169 |
|
170 // Make error msg |
|
171 #define MAKE_ERROR "AnalyzeTool : Error, Running make.\n" |
|
172 |
|
173 #define AT_NOT_BEEN_BUILD_ERROR "AnalyzeTool : Error, project has not been build using AnalyzeTool.\n" |
|
174 |
|
175 // Makefile errors |
|
176 #define LEVEL1_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 1 makefile.\n" |
|
177 #define LEVEL2_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 2 makefile.\n" |
|
178 #define MAKEFILE_ERROR_TIP "AnalyzeTool : Tip, your environment might require you to use -variant [target] argument.\n"; |
|
179 |
|
180 //Variant messages |
|
181 #define INVALID_VARIANT_ERROR "AnalyzeTool : Error,Specified variant is invalid.\n" |
|
182 #define USING_DEFAULT_VARIANT_MESSAGE "AnalyzeTool : Note, Using DEFAULT variant.\n" |
|
183 #define NO_DEFAULT_VARIANT_ERROR "AnalyzeTool : Error, environment does not specify DEFAULT variant (No variant support?).\n" |
|
184 |
|
185 // Variant dir is the dir where all variants are defined |
|
186 #define VARIANT_DIR "\\epoc32\\tools\\variant\\" |
|
187 |
|
188 // Variants defined extension name of the variant must equal filename |
|
189 #define VARIANT_FILE_EXTENSION ".VAR" |
|
190 |
|
191 //Max file name length |
|
192 const int MAX_FILENAME_LENGTH = 1024; |
|
193 |
|
194 //Max line length when reading lines from text file.2048 should be enought. |
|
195 const int MAX_LINE_LENGTH = 2048*8; |
|
196 |
|
197 // ATs project file name to store project attributes |
|
198 #define AT_PROJECT_ATTRIBUTES_FILE_NAME "project.cfg" |
|
199 const string AT_PROJECT_ATTRIBUTES_SEPARATOR( ":$:" ); |
|
200 |
|
201 // ATs level1 makefile name |
|
202 #define AT_LEVEL_1_MAKEFILE_NAME "main.at" |
|
203 |
|
204 // ATs level2 makefiles extension |
|
205 #define AT_LEVEL_2_MAKEFILE_EXT "atm" |
|
206 |
|
207 //Default logging level |
|
208 const int DEFAULT_LOGGING_LEVEL = 3; |
|
209 |
|
210 //Minimun value of logging level |
|
211 const int MIN_LOGGING_LEVEL = 0; |
|
212 |
|
213 //Maximun value of logging level |
|
214 const int MAX_LOGGING_LEVEL = 3; |
|
215 |
|
216 //Const char represeting dash |
|
217 const char DASH = '\\'; |
|
218 |
|
219 /* Table of file extension not to delete |
|
220 * from atools temp directory when compiling |
|
221 * note define all in lowercase |
|
222 */ |
|
223 const string TEMP_EXTENSION_NO_DELETE[] = { |
|
224 "xml", |
|
225 "dat", |
|
226 "tmp", |
|
227 "cpp", |
|
228 "at", |
|
229 "atm", |
|
230 "cfg" |
|
231 }; |
|
232 |
|
233 // Allowed characters/digits, other than these will be filtered out when using CATBase FilterString |
|
234 const char CFILTERSTRING[] = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; |
|
235 |
|
236 /* Table of unsupported target types |
|
237 * (i.e. mmp file syntax targettype in makefile) |
|
238 * List of target types which will not be hooked: |
|
239 */ |
|
240 const string UNSUPPORTED_TARGET_TYPES[] = { |
|
241 "CTL", |
|
242 "ECOMIIC", |
|
243 "IMPLIB", |
|
244 "KDLL", |
|
245 "KEXT", |
|
246 "KLIB", |
|
247 "LDD", |
|
248 /* "LIB", currently have own vector in project.*/ |
|
249 "MDA", |
|
250 "MDL", |
|
251 "NONE", |
|
252 "NOTIFIER", |
|
253 "PDD", |
|
254 "RDL", |
|
255 "STDLIB", |
|
256 "VAR" |
|
257 }; |
|
258 |
|
259 /** |
|
260 * Kernel side target types |
|
261 */ |
|
262 const string KERNEL_SIDE_TARGET_TYPES[] = { |
|
263 "VAR", |
|
264 "LDD", |
|
265 "PDD", |
|
266 "KEXT" |
|
267 }; |
|
268 |
|
269 // Kernel mode compile definition |
|
270 const string KERNEL_MODE_COMPILE_DEFINITION = "__KERNEL_MODE__"; |
|
271 |
|
272 /** |
|
273 * MMP file changes for AT |
|
274 * Note "SOURCE 0a1b2c3d_atool_temp_TARGET.cpp" is added also. |
|
275 */ |
|
276 const string MMPFILECHANGES[] = { |
|
277 "//*** AnalyzeTool changes start ***", |
|
278 "SOURCEPATH atool_temp", |
|
279 "LIBRARY AToolMemoryHook.lib", |
|
280 "STATICLIBRARY AToolStaticLib.lib", |
|
281 "OPTION ARMCC --interleave", |
|
282 "//*** AnalyzeTool changes end ***" |
|
283 }; |
|
284 |
|
285 //MMP file changes for AT |
|
286 //For targettype Dll |
|
287 const string MMPFILECHANGES_DLL[] = { |
|
288 "//*** AnalyzeTool changes start ***", |
|
289 "OPTION ARMCC --interleave", |
|
290 "//*** AnalyzeTool changes end ***" |
|
291 }; |
|
292 |
|
293 // Trace file constants definitions |
|
294 #define LABEL_DATA_FILE_VERSION "DATA_FILE_VERSION" |
|
295 #define LABEL_PROCESS_START "PROCESS_START" |
|
296 #define LABEL_DLL_LOAD "DLL_LOAD" |
|
297 #define LABEL_DLL_UNLOAD "DLL_UNLOAD" |
|
298 #define LABEL_MEM_LEAK "MEM_LEAK" |
|
299 #define LABEL_PROCESS_END "PROCESS_END" |
|
300 #define LABEL_ERROR_OCCURED "ERROR_OCCURED" |
|
301 #define LABEL_HANDLE_LEAK "HANDLE_LEAK" |
|
302 #define LABEL_TEST_START "TEST_START" |
|
303 #define LABEL_TEST_END "TEST_END" |
|
304 #define LABEL_LOGGING_CANCELLED "LOGGING_CANCELLED" |
|
305 |
|
306 // AddressToLine related constants |
|
307 |
|
308 #define LABEL_ABNORMAL "ABNORMAL" |
|
309 const int FUNCTIONS_OFFSET_IN_MAP_FILE_ARMV5 = 0x8000; |
|
310 const int FUNCTIONS_OFFSET_IN_GCCE = 0x8000; |
|
311 const int FUNCTIONS_OFFSET_IN_MAP_FILE_WINSCW = 0x400000; |
|
312 #define TEXT_NO_HANDLE_LEAKS "No handle leaks." |
|
313 |
|
314 // Make file constant labels |
|
315 #define MAKEFILE_TARGETTYPE_STRING "# TargetType " |
|
316 #define MAKEFILE_BASIC_TARGETTYPE_STRING "# BasicTargetType " |
|
317 #define MAKEFILE_TARGET_STRING "# Target " |
|
318 #define MAKEFILE_FEATURE_VARIANT_NAME "# FeatureVariantName " |
|
319 #define MAKEFILE_FEATURE_VARIANT_UREL_LABEL "# FeatureVariantURELLabel " |
|
320 #define MAKEFILE_FEATURE_VARIANT_UDEB_LABEL "# FeatureVariantUDEBLabel " |
|
321 #define UDEB_OPTIMIZATION_LEVEL 0 |
|
322 |
|
323 // Listing file contant labels |
|
324 #define LST_FILE_SOURCE_FILE_LABEL "Source file:" |
|
325 |
|
326 /** |
|
327 * Struct for saving module info from .dat file and number of leaks in module. |
|
328 * |
|
329 */ |
|
330 struct DLL_LOAD_INFO |
|
331 { |
|
332 string sModuleName; |
|
333 unsigned long iStartAddress; |
|
334 unsigned long iEndAddress; |
|
335 int iLeaks; |
|
336 unsigned long iPID; |
|
337 int iSubTestStartOpenHandles; |
|
338 int iSubTestEndOpenHandles; |
|
339 // Load/Unload times, note these are micro seconds from 1970 so size is huge. |
|
340 unsigned long long iLoadTime; |
|
341 unsigned long long iUnloadTime; |
|
342 DLL_LOAD_INFO() { |
|
343 iStartAddress = 0; |
|
344 iEndAddress = 0; |
|
345 iLeaks = 0; |
|
346 iPID = 0; |
|
347 iSubTestStartOpenHandles = 0; |
|
348 iSubTestEndOpenHandles = 0; |
|
349 iLoadTime = 0; |
|
350 iUnloadTime = 0; |
|
351 }; |
|
352 }; |
|
353 |
|
354 /** |
|
355 * Struct for saving symbol information from listing file |
|
356 */ |
|
357 struct LINE_IN_FILE |
|
358 { |
|
359 int iLine; |
|
360 string sFileName; |
|
361 string sFunction; |
|
362 string sMangledName; |
|
363 string sLstName; |
|
364 }; |
|
365 |
|
366 /** |
|
367 * Struct for saving symbol information from map file |
|
368 */ |
|
369 struct MAP_FUNC_INFO |
|
370 { |
|
371 int iAddress; |
|
372 int iFuncLength; |
|
373 string sMangledName; |
|
374 string sWholeLine; |
|
375 string sFunctionName; |
|
376 }; |
|
377 |
|
378 /** |
|
379 * State that represents the outcome |
|
380 * of locating memory address code line from module |
|
381 */ |
|
382 enum ADDRESS_TO_LINE_STATE { |
|
383 no_map_data = 0, /* Map data was missing */ |
|
384 out_of_function_range, /* Could not locate it to any function */ |
|
385 mangled_symbol_name, |
|
386 only_function_name, /* Only got function name not code line */ |
|
387 succesfull /* Have line number, function, etc...*/ |
|
388 }; |
|
389 |
|
390 /** |
|
391 * Struct to store detail data and state when |
|
392 * locating memory addresses code lines |
|
393 */ |
|
394 struct ADDRESS_TO_LINE_ITEM { |
|
395 ADDRESS_TO_LINE_STATE eState; /* outcome*/ |
|
396 string sFileName; /* Filename of address*/ |
|
397 string sFunctionName; /* Function name of address*/ |
|
398 string sMangledFunctionName; /* function/Symbol name */ |
|
399 int iFunctionLineNumber; /* Functions line number */ |
|
400 int iExactLineNumber; /* Exact line number of address */ |
|
401 }; |
|
402 |
|
403 /** |
|
404 * Struct to store memory leaks |
|
405 * call stack entry data |
|
406 */ |
|
407 struct CALL_STACK_ITEM { |
|
408 string sAddress; /* Address in string */ |
|
409 int iAddress; /* Address in number (converted)*/ |
|
410 int iLocation; /* Location. i.e. corresponds m_vDllLoadModList's index*/ |
|
411 int iCalculatedLeakAddress; |
|
412 bool bBuildUdeb; /* Optimization level */ |
|
413 string sModuleName; /* Modules name were leak is*/ |
|
414 ADDRESS_TO_LINE_ITEM addressToLine; /* Data from locating code line for memory address */ |
|
415 }; |
|
416 |
|
417 /** |
|
418 * Enumerations used in argument structure. |
|
419 */ |
|
420 enum MAIN_SWITCH |
|
421 { |
|
422 SWITCH_UNKNOWN = 0, |
|
423 SWITCH_ANALYZE = 1, |
|
424 SWITCH_HOOK = 2, |
|
425 SWITCH_UNHOOK = 3, |
|
426 SWITCH_OLD_HOOK = 4, |
|
427 SWITCH_PARSE_TRACE = 5, |
|
428 SWITCH_CLEAN = 6, |
|
429 SWITCH_HTI_GET = 7, |
|
430 SWITCH_HTI_DELETE = 8, |
|
431 SWITCH_VERSION = 9, |
|
432 SWITCH_HELP = 10 |
|
433 }; |
|
434 enum HOOK_SWITCH |
|
435 { |
|
436 HOOK_UNKNOWN = 0, |
|
437 HOOK_INTERNAL, |
|
438 HOOK_EXTERNAL, |
|
439 HOOK_EXTERNAL_FAST, |
|
440 HOOK_EXTENSION_INTERNAL, |
|
441 HOOK_EXTENSION_EXTERNAL, |
|
442 HOOK_EXTENSION_EXTERNAL_FAST, |
|
443 HOOK_EXTENSION_UNINSTRUMENT, |
|
444 HOOK_EXTENSION_FAILED, |
|
445 HOOK_OLD_EXTENSION_INSTRUMENT, |
|
446 HOOK_OLD_EXTENSION_UNINSTRUMENT, |
|
447 HOOK_OLD_EXTENSION_FAILED |
|
448 }; |
|
449 |
|
450 // Hook. |
|
451 struct ARGUMENTS_HOOK |
|
452 { |
|
453 bool bNoBuild; |
|
454 bool bDataFileName; //Internal data gathering filename defined. |
|
455 string sDataFileName; //Internal data gathering filename. |
|
456 int iBuildSystem; //1 = sbs, 2 = raptor. |
|
457 int iLoggingMode; //Just for old parameter parsing. 1=xti, 2=s60, 0=?. |
|
458 int iAllocCallStackSize; |
|
459 int iFreeCallStackSize; |
|
460 string sBuildCmd; //Original build command. |
|
461 vector<string> vBuildCmd; //Build command split in vector. |
|
462 string sPlatform; //Platform. |
|
463 string sBuildType; //Build type (udeb/urel). |
|
464 string sFeatureVariant; |
|
465 vector<string> vTargetPrograms; |
|
466 ARGUMENTS_HOOK() |
|
467 { |
|
468 bNoBuild = false; |
|
469 bDataFileName = false; |
|
470 sDataFileName = ""; |
|
471 iBuildSystem = 0; |
|
472 iLoggingMode = 0; |
|
473 iAllocCallStackSize = AT_ALLOC_CALL_STACK_SIZE_DEFAULT; |
|
474 iFreeCallStackSize = AT_FREE_CALL_STACK_SIZE_DEFAULT; |
|
475 sBuildCmd = ""; |
|
476 sPlatform = ""; |
|
477 sBuildType = ""; |
|
478 sFeatureVariant = ""; |
|
479 vTargetPrograms.clear(); |
|
480 }; |
|
481 }; |
|
482 // Analyze. |
|
483 struct ARGUMENTS_ANALYZE |
|
484 { |
|
485 string sDataFile; |
|
486 string sOutputFile; |
|
487 bool bSymbolFile; |
|
488 vector<string> vSymbolFiles; |
|
489 int iLoggingLevel; |
|
490 ARGUMENTS_ANALYZE() |
|
491 { |
|
492 sDataFile = ""; |
|
493 sOutputFile = ""; |
|
494 bSymbolFile = false; |
|
495 iLoggingLevel = 3; |
|
496 }; |
|
497 }; |
|
498 //Parsing trace. |
|
499 struct ARGUMENTS_PARSE |
|
500 { |
|
501 bool bDataFile; |
|
502 string sDataFile; |
|
503 bool bOutputFile; |
|
504 string sOutputFile; |
|
505 ARGUMENTS_PARSE() |
|
506 { |
|
507 bDataFile = false; |
|
508 sDataFile = ""; |
|
509 bOutputFile = false; |
|
510 sOutputFile = ""; |
|
511 }; |
|
512 }; |
|
513 //Hti get file. |
|
514 struct ARGUMENTS_HTI |
|
515 { |
|
516 string sFile; |
|
517 ARGUMENTS_HTI() |
|
518 { |
|
519 sFile = ""; |
|
520 }; |
|
521 }; |
|
522 /** |
|
523 * Struct to store parsed arguments from console. |
|
524 */ |
|
525 struct ARGUMENTS |
|
526 { |
|
527 // Base arguments. |
|
528 MAIN_SWITCH eMainSwitch; // main switch |
|
529 HOOK_SWITCH eHookSwitch; |
|
530 bool bHelp; //Show help. |
|
531 bool bDebugConsole; //Debug logging to console. |
|
532 bool bDebugDbgView; //Debug logging to win api. |
|
533 bool bDebugLowLevel; //Debug also low level functions. |
|
534 bool bEnableSbs2; //Use raptor. |
|
535 ARGUMENTS_HOOK HOOK; |
|
536 ARGUMENTS_ANALYZE ANALYZE; |
|
537 ARGUMENTS_PARSE PARSE; |
|
538 ARGUMENTS_HTI HTI; |
|
539 ARGUMENTS() |
|
540 { |
|
541 eMainSwitch = SWITCH_UNKNOWN; |
|
542 eHookSwitch = HOOK_UNKNOWN; |
|
543 bHelp = false; |
|
544 bDebugConsole = false; |
|
545 bDebugDbgView = false; |
|
546 bEnableSbs2 = false; |
|
547 }; |
|
548 }; |
|
549 // DEBUG MACROS |
|
550 // constant string for all beginning of all debug messages |
|
551 const char START_LOG_MESSAGE[] = "*** CLE "; |
|
552 // Log normal function entry (AAA = class::function ) |
|
553 #define LOG_FUNC_ENTRY( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; cout << strs.str(); } } |
|
554 // Log normal function exit |
|
555 #define LOG_FUNC_EXIT( AAA ){ if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; cout << strs.str(); } } |
|
556 // Log low level function entry |
|
557 #define LOG_LOW_FUNC_ENTRY( AAA ) { if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } } |
|
558 // Log low level function exit |
|
559 #define LOG_LOW_FUNC_EXIT( AAA ) { if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } } |
|
560 // Log stringstream (string, int, etc..) i.e. string1 << int1 << "log this" |
|
561 #define LOG_STRING( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } |
|
562 |
|
563 #endif |
|