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