Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenhelp.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS log2lines 00003 * Written by Jan Roeloffzen 00004 * 00005 * - Help text and functions 00006 */ 00007 00008 #include <stdio.h> 00009 00010 #include "version.h" 00011 #include "compat.h" 00012 #include "config.h" 00013 #include "options.h" 00014 #include "cmd.h" 00015 #include "help.h" 00016 00017 char *verboseUsage = 00018 "\n" 00019 "Description:\n" 00020 " When <exefile> <offset> are given, log2lines works like raddr2line:\n" 00021 " - The <exefile> <offset> combination can be repeated\n" 00022 " - Also, <offset> can be repeated for each <exefile>\n" 00023 " - NOTE: Some of the options below will have no effect in this form.\n" 00024 " Otherwise it reads stdin and tries to translate lines of the form:\n" 00025 " <IMAGENAME:ADDRESS>\n" 00026 " The result is written to stdout.\n\n" 00027 " <offset> or <ADDRESS> can be absolute or relative with the restrictions:\n" 00028 " - An image with base < 0x400000 MUST be relocated to a > 0x400000 address.\n" 00029 " - The offset of a relocated image MUST be relative.\n\n" 00030 " log2lines uses a cache in order to avoid a directory scan at each\n" 00031 " image lookup, greatly increasing performance. Only image path and its\n" 00032 " base address are cached.\n\n" 00033 "Options:\n" 00034 " -b Use this combined with '-l'. Enable buffering on logFile.\n" 00035 " This may solve loosing output on real hardware (ymmv).\n\n" 00036 " -c Console mode. Outputs text per character instead of per line.\n" 00037 " This is slightly slower but enables to see what you type.\n\n" 00038 " -d <directory>|<ISO image>\n" 00039 " <directory>: Directory to scan for images. (Do not append a '" PATH_STR "')\n" 00040 " <ISO image>: This option also takes an ISO image as argument:\n" 00041 " - The image is recognized by the '.iso' or '.7z' extension.\n" 00042 " - NOTE: The '.7z' and extracted '.iso' basenames must be identical,\n" 00043 " which is normally true for ReactOS trunk builds.\n" 00044 " - The image will be unpacked to a directory with the same name.\n" 00045 " - The embedded reactos.cab file will also be unpacked.\n" 00046 " - Combined with -f the file will be re-unpacked.\n" 00047 " - NOTE: this ISO unpack feature needs 7z to be in the PATH.\n" 00048 " Default: " DEF_OPT_DIR "\n\n" 00049 " -f Force creating new cache.\n\n" 00050 " -F As -f but exits immediately after creating cache.\n\n" 00051 " -h This text.\n\n" 00052 " -l <logFile>\n" 00053 " <logFile>: Append copy to specified logFile.\n" 00054 " Default: no logFile\n\n" 00055 " -L <logFile>\n" 00056 " <logFile>: (Over)write copy to specified logFile.\n" 00057 " Default: no logFile\n\n" 00058 " -m Prefix (mark) each translated line with '* '.\n\n" 00059 " -M Prefix (mark) each NOT translated line with '? '.\n" 00060 " ( Only for lines of the form: <IMAGENAME:ADDRESS> )\n\n" 00061 " -P <cmd line>\n" 00062 " Pipeline command line. Spawn <cmd line> and pipeline its output to\n" 00063 " log2lines (as stdin). This is for shells lacking support of (one of):\n" 00064 " - Input file redirection.\n" 00065 " - Pipelining byte streams, needed for the -c option.\n\n" 00066 " -r Raw output without translation.\n\n" 00067 " -R <cmd>\n" 00068 " Revision commands interfacing with SVN. <cmd> is one of:\n" 00069 " - check:\n" 00070 " To be combined with -S. Check each source file in the log and issue\n" 00071 " a warning if its revision is higher than that of the tested build.\n" 00072 " Also when the revison of the source tree is lower than that of the\n" 00073 " tested build (for every source file).\n" 00074 " In both cases the source file's -S output would be unreliable.\n" 00075 " - update:\n" 00076 " Updates the SVN log file. Currently only generates the index file\n" 00077 " The SVN log file itself must be generated by hand in the sources\n" 00078 " directory like this (-v is mandatory here):\n" 00079 " svn log -v > svndb.log ('svn log' accepts also a range)\n" 00080 " 'svndb.log' and its index are needed for '-R regscan'\n" 00081 " - regscan[,<range>]:\n" 00082 " Scan for regression candidates. Essentially it tries to find\n" 00083 " matches between the SVN log entries and the sources hit by\n" 00084 " a backtrace (bt) command.\n" 00085 " <range> is the amount of revisions to look back from the build\n" 00086 " revision (default 500)\n" 00087 " The output of '-R regscan' is printed after EOF. The 'Changed path'\n" 00088 " lists will contain only matched files.\n" 00089 " Limitations:\n" 00090 " - The bug should really be a regression.\n" 00091 " - Expect a number of false positives.\n" 00092 " - The offending change must be in the sources hit by the backtrace.\n" 00093 " This mostly excludes changes in headerfiles for example.\n" 00094 " - Must be combined with -S.\n" 00095 " Can be combined with -tTS.\n\n" 00096 " -s Statistics. A summary with the following info is printed after EOF:\n" 00097 " *** LOG2LINES SUMMARY ***\n" 00098 " - Translated: Translated lines.\n" 00099 " - Reverted: Lines translated back. See -u option\n" 00100 " - Retranslated: Lines retranslated. See -U option\n" 00101 " - Skipped: Lines not translated.\n" 00102 " - Differ: Lines where (addr-1) info differs. See -tT options\n" 00103 " - Differ(func/src):Lines where also function or source info differ.\n" 00104 " - Rev conflicts: Source files conflicting with build. See '-R check'\n" 00105 " - Reg candidates: Regression candidates. See '-R regscan'\n" 00106 " - Offset error: Image exists, but error retrieving offset info.\n" 00107 " - Total: Total number of lines attempted to translate.\n" 00108 " Also some version info is displayed.\n\n" 00109 " -S <context>[+<add>][,<sources>]\n" 00110 " Source line options:\n" 00111 " <context>: Source lines. Display up to <context> lines until linenumber.\n" 00112 " <add> : Optional. Display additional <add> lines after linenumber.\n" 00113 " <sources>: Optional. Specify alternate source tree.\n" 00114 " The environment variable " SOURCES_ENV " should be correctly set\n" 00115 " or specify <sources>. Use double quotes if the path contains spaces.\n" 00116 " For a reliable result, these sources should be up to date with\n" 00117 " the tested revision (or try '-R check').\n" 00118 " Can be combined with -tTR.\n" 00119 " Implies -U (For retrieving source info) and -R check.\n\n" 00120 " -t Translate twice. The address itself and for (address-1).\n" 00121 " Show extra filename, func and linenumber between [..] if they differ\n" 00122 " So if only the linenumbers differ, then only show the extra\n" 00123 " linenumber.\n\n" 00124 " -T As -t, but show only filename+func+linenumber for (address-1)\n\n" 00125 " -u Undo translations.\n" 00126 " Lines are translated back (reverted) to the form <IMAGENAME:ADDRESS>\n" 00127 " Also removes all lines previously added by this tool (e.g. see -S)\n\n" 00128 " -U Undo and reprocess.\n" 00129 " Reverted to the form <IMAGENAME:ADDRESS>, and then retranslated\n" 00130 " Implies -u.\n\n" 00131 " -v Show detailed errors and tracing.\n" 00132 " Repeating this option adds more verbosity.\n" 00133 " Default: only (major) errors\n\n" 00134 " -z <path to 7z>\n" 00135 " <path to 7z>: Specify path to 7z. See also option -d.\n" 00136 " Default: '7z'\n" 00137 "\n" 00138 "CLI escape commands:\n" 00139 " It is possible to change options and perform actions from the 'kdb:>' prompt\n" 00140 " By prepending the `(backquote) character to the option.\n" 00141 " Example: 'kdb:> `l new.log' changes the current logfile to 'new.log'.\n" 00142 " Flag options like 'b' are given a numeric value of 0 (off) or 1 (on).\n" 00143 " Options accepting a string as argument can be cleared by the value '" KDBG_ESC_OFF "'.\n" 00144 " Some ClI commands are read only or not (entirely) implemented.\n" 00145 " If no value is provided, the current one is printed.\n" 00146 " There are a few extra ClI commands or with different behaviour:\n" 00147 " - `a <module>:<reladdress>:\n" 00148 " - Outputs absolute address e.g. for setting breakpoints.\n" 00149 " - Do a 'mod' first to retrieve relocation info.\n" 00150 " - `h : shows this helptext (without exiting)\n" 00151 " - `q : quits log2lines\n" 00152 " - `R regscan : the output is printed immediately (do a 'bt' first)\n" 00153 " - `R regclear : clears previous regscan matches\n" 00154 " - `s : the output is printed immediately\n" 00155 " - `s clear : clears all statistics.\n" 00156 " - `S : only <context> and <add> can be set.\n" 00157 " - `v <level> : sets the current debug loglevel\n" 00158 "\n" 00159 "Option Examples:\n" 00160 " Setup: A VMware machine with its serial port set to: '\\\\.\\pipe\\kdbg'.\n\n" 00161 " Just recreate cache after a svn update or a new module has been added:\n" 00162 " log2lines -F\n\n" 00163 " Use kdbg debugger via console (interactive):\n" 00164 " log2lines -c < \\\\.\\pipe\\kdbg\n\n" 00165 " Use kdbg debugger via console, and append copy to logFile:\n" 00166 " log2lines -c -l dbg.log < \\\\.\\pipe\\kdbg\n\n" 00167 " Same as above, but for PowerShell:\n" 00168 " log2lines -c -l dbg.log -P \"piperead -c \\\\.\\pipe\\kdbg\"\n\n" 00169 " Use kdbg debugger to send output to logfile:\n" 00170 " log2lines < \\\\.\\pipe\\kdbg > dbg.log\n\n" 00171 " Re-translate a debug log:\n" 00172 " log2lines -U -d bootcd-38701-dbg.iso < bugxxxx.log\n\n" 00173 " Re-translate a debug log. Specify a 7z file, which wil be decompressed.\n" 00174 " Also check for (address) - (address-1) differences:\n" 00175 " log2lines -U -t -d bootcd-38701-dbg.7z < bugxxxx.log\n" 00176 " Output:\n" 00177 " <ntdll.dll:60f1 (dll/ntdll/ldr/utils.c:337[331] (LdrPEStartup))>\n\n" 00178 " The following commands are equivalent:\n" 00179 " log2lines msi.dll 2e35d msi.dll 2235 msiexec.exe 30a8 msiexec.exe 2e89\n" 00180 " log2lines msi.dll 2e35d 2235 msiexec.exe 30a8 2e89\n\n" 00181 " Generate source lines from backtrace ('bt') output. Show 2 lines of context:\n" 00182 " log2lines -S 2 -d bootcd-38701-dbg.7z < bugxxxx.log\n" 00183 " Output:\n" 00184 " <msiexec.exe:2e89 (lib/3rdparty/mingw/crtexe.c:259 (__tmainCRTStartup))>\n" 00185 " | 0258 #else\n" 00186 " | 0259 mainret = main (\n" 00187 " <msiexec.exe:2fad (lib/3rdparty/mingw/crtexe.c:160 (WinMainCRTStartup))>\n" 00188 " | 0159 return __tmainCRTStartup ();\n" 00189 " | 0160 }\n\n" 00190 " Generate source lines. Show 2 lines of context plus 1 additional line and\n" 00191 " specify an alternate source tree:\n" 00192 " log2lines -S 2+1,\"c:\\ros trees\\r44000\" -d bootcd-44000-dbg < dbg.log\n" 00193 " Output:\n" 00194 " <msi.dll:2e35d (dll/win32/msi/msiquery.c:189 (MSI_IterateRecords))>\n" 00195 " | 0188 {\n" 00196 " | 0189 r = MSI_ViewFetch( view, &rec );\n" 00197 " | ----\n" 00198 " | 0190 if( r != ERROR_SUCCESS )\n\n" 00199 " Use '-R check' to show that action.c has been changed after the build:\n" 00200 " log2lines -s -d bootcd-43850-dbg.iso -R check -S 2 < dbg.log\n" 00201 " Output:\n" 00202 " <msi.dll:35821 (dll/win32/msi/registry.c:781 (MSIREG_OpenUserDataKey))>\n" 00203 " | 0780 if (create)\n" 00204 " | 0781 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);\n" 00205 " <msi.dll:5262 (dll/win32/msi/action.c:2665 (ACTION_ProcessComponents))>\n" 00206 " | R--- Conflict : source(44191) > build(43850)\n" 00207 " | 2664 else\n" 00208 " | 2665 rc = MSIREG_OpenUserDataKey(comp->ComponentId,\n\n" 00209 "CLI Examples: (some are based on the option examples above)\n" 00210 " Use '`R check' to show that action.c has been changed after the build:\n" 00211 " kdb:> `R check\n" 00212 " | L2L- -R is \"check\" (changed)\n" 00213 " kdb:> bt\n" 00214 " <msi.dll:35821 (dll/win32/msi/registry.c:781 (MSIREG_OpenUserDataKey))>\n" 00215 " | 0780 if (create)\n" 00216 " | 0781 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);\n" 00217 " <msi.dll:5262 (dll/win32/msi/action.c:2665 (ACTION_ProcessComponents))>\n" 00218 " | R--- Conflict : source(44191) > build(43850)\n" 00219 " | 2664 else\n" 00220 " | 2665 rc = MSIREG_OpenUserDataKey(comp->ComponentId,\n\n" 00221 " kdb:>\n\n" 00222 " Generate source lines. Show 2 lines of context plus 1 additional line.\n" 00223 " The -Uu options are dependent on -S:\n" 00224 " kdb:> `S 2+1\n" 00225 " | L2L- -u Undo is 1 (changed)\n" 00226 " | L2L- -U Undo and reprocess is 1 (changed)\n" 00227 " | L2L- -S Sources option is 2+1,\"C:\\ROS\\reactos\\\" \n" 00228 " | L2L- (Setting source tree not implemented)\n" 00229 " kdb:> bt\n" 00230 " <msi.dll:2e35d (dll/win32/msi/msiquery.c:189 (MSI_IterateRecords))>\n" 00231 " | 0188 {\n" 00232 " | 0189 r = MSI_ViewFetch( view, &rec );\n" 00233 " | ----\n" 00234 " | 0190 if( r != ERROR_SUCCESS )\n" 00235 " kdb:>\n\n" 00236 " Change logfile:\n" 00237 " kdb:> `l\n" 00238 " | L2L- -l logfile is "" (unchanged)\n" 00239 " kdb:> `l new.log\n" 00240 " | L2L- -l logfile is \"new.log\" (changed)\n" 00241 " kdb:> `l off\n" 00242 " | L2L- -l logfile is "" (changed)\n" 00243 " kdb:>\n\n" 00244 " Set a breakpoint with help of 'mod' and '`a':\n" 00245 " <msi.dll:2e35d (dll/win32/msi/msiquery.c:189 (MSI_IterateRecords))>\n" 00246 " kdb:> mod (for kernel tracing usually only needed once)\n" 00247 " -- mod output with reloc info\n" 00248 " kdb:> `a msi.dll:2e35d\n" 00249 " | L2L- Address: 0x00096ca0\n" 00250 " kdb:> bpx 0x00096ca0\n\n" 00251 "\n"; 00252 00253 void 00254 usage(int verbose) 00255 { 00256 fprintf(stderr, "log2lines " LOG2LINES_VERSION "\n\n"); 00257 fprintf(stderr, "Usage: log2lines -%s {<exefile> <offset> {<offset>}}\n", optchars); 00258 if (verbose) 00259 fprintf(stderr, "%s", verboseUsage); 00260 else 00261 fprintf(stderr, "Try log2lines -h\n"); 00262 } 00263 00264 /* EOF */ Generated on Sun May 27 2012 04:16:34 for ReactOS by
1.7.6.1
|