1<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
5<meta http-equiv="content-style-type" content="text/css">
6<link rel="stylesheet" type="text/css" href="../style.css">
7<title>ReTrace Usage</title>
8</head>
9<body>
10
11<script type="text/javascript" language="JavaScript">
12<!--
13if (window.self==window.top)
14  document.write('<a class="largebutton" target="_top" href="../../index.html#manual/retrace/usage.html">ProGuard index</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a> <a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>')
15//-->
16</script>
17<noscript>
18<a class="largebutton" target="_top"  href="../../index.html#manual/retrace/usage.html">ProGuard index</a>
19<a class="largebutton" target="_top"  href="http://www.saikoa.com/dexguard">DexGuard</a>
20<a class="largebutton" target="_top"  href="http://www.saikoa.com/">Saikoa</a>
21<a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>
22</noscript>
23
24<h2>Usage</h2>
25
26You can find the ReTrace jar in the <code>lib</code> directory of the
27ProGuard distribution. To run ReTrace, just type:
28<p>
29<p class="code">
30<code><b>java -jar retrace.jar </b></code>[<i>options...</i>]
31         <i>mapping_file</i> [<i>stacktrace_file</i>]
32</p>
33Alternatively, the <code>bin</code> directory contains some short Linux and
34Windows scripts containing this command. These are the arguments:
35
36<dl>
37<dt><i>mapping_file</i></dt>
38
39<dd>Specifies the name of the mapping file, produced by ProGuard with the
40    option
41    "<a href="../usage.html#printmapping"><code>-printmapping</code></a> <i>mapping_file</i>",
42    while obfuscating the application that produced the stack trace.</dd>
43
44<dt><i>stacktrace_file</i></dt>
45
46<dd>Optionally specifies the name of the file containing the stack trace. If
47    no file is specified, a stack trace is read from the standard input. Blank
48    lines and unrecognized lines are ignored, as far as possible.</dd>
49</dl>
50
51The following options are supported:
52<dl>
53<dt><code><b>-verbose</b></code></dt>
54
55<dd>Specifies to print out more informative stack traces that include not only
56    method names, but also method return types and arguments.</dd>
57
58<dt><code><b>-regex</b></code> <i>regular_expression</i></dt>
59
60<dd>Specifies the regular expression that is used to parse the lines in the
61    stack trace. Specifying a different regular expression allows to
62    de-obfuscate more general types of input than just stack traces. The
63    default is suitable for stack traces produced by most JVMs:
64    <pre>
65    (?:.*?\bat\s+%c\.%m\s*\(.*?(?::%l)?\)\s*)|(?:(?:.*?[:"]\s+)?%c(?::.*)?)
66    </pre>
67    The regular expression is a Java regular expression (cfr. the documentation
68    of <code>java.util.regex.Pattern</code>), with a few additional wildcards:
69    <table cellspacing="10">
70    <tr><td valign="top"><code><b>%c</b></code></td>
71        <td>matches a class name (e.g.
72            "<code>myapplication.MyClass</code>").</td></tr>
73    <tr><td valign="top"><code><b>%C</b></code></td>
74        <td>matches a class name with slashes (e.g.
75            "<code>myapplication/MyClass</code>").</td></tr>
76    <tr><td valign="top"><code><b>%t</b></code></td>
77        <td>matches a field type or method return type (e.g.
78            "<code>myapplication.MyClass[]</code>").</td></tr>
79    <tr><td valign="top"><code><b>%f</b></code></td>
80        <td>matches a field name (e.g.
81            "<code>myField</code>").</td></tr>
82    <tr><td valign="top"><code><b>%m</b></code></td>
83        <td>matches a method name (e.g.
84            "<code>myMethod</code>").</td></tr>
85    <tr><td valign="top"><code><b>%a</b></code></td>
86        <td>matches a list of method arguments (e.g.
87            "<code>boolean,int</code>").</td></tr>
88    <tr><td valign="top"><code><b>%l</b></code></td>
89        <td>matches a line number inside a method (e.g.
90            "<code>123</code>").</td></tr>
91    </table>
92    Elements that match these wildcards are de-obfuscated, when possible. Note
93    that regular expressions must not contain any capturing groups. Use
94    non-capturing groups instead: <code>(?:</code>...<code>)</code>
95    </dd>
96</dl>
97
98The restored stack trace is printed to the standard output. The completeness
99of the restored stack trace depends on the presence of line number tables in
100the obfuscated class files:
101
102<ul>
103<li>If all line numbers have been preserved while obfuscating the application,
104    ReTrace will be able to restore the stack trace completely.</li>
105
106<li>If the line numbers have been removed, mapping obfuscated method names
107    back to their original names has become ambiguous. Retrace will list all
108    possible original method names for each line in the stack trace. The user
109    can then try to deduce the actual stack trace manually, based on the logic
110    of the program.</li>
111
112</ul>
113<p>
114
115Preserving line number tables is explained in detail in this <a
116href="../examples.html#stacktrace">example</a> in the ProGuard User Manual.
117<p>
118
119Unobfuscated elements and obfuscated elements for which no mapping is available
120will be left unchanged.
121
122<hr />
123<address>
124Copyright &copy; 2002-2014
125<a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a> @ <a target="top" href="http://www.saikoa.com/">Saikoa</a>.
126</address>
127</body>
128</html>
129
130