How can I provide addr2line with a symbol file for use with a stripped binary in Ubuntu?
<p>I have an C++ application running in Ubuntu. What I'd like to do is to strip the application binary of its symbols so that they are not part of the binary, but use the addr2line utility to get backtrace information by referencing a symbol file instead of the symbols that are part of the binary. Is this possible?</p>

<p>The closest I've gotten so far is to generate a symbol file using:</p>

<pre><code>strip MyBinary -o thesymbols.sym
</code></pre>

<p>And then I tried using that file with the addr2line utility like so:</p>

<pre><code>addr2line 0x779e81 -b thesymbols.sym
</code></pre>

<p>But this yields the complaint:</p>

<pre><code>addr2line: 'a.out': No such file
</code></pre>

<p>So then I tried:</p>

<pre><code>addr2line 0x779e81 -e MyBinary -b thesymbols.sym
</code></pre>

<p>But this yields the complaint:</p>

<pre><code>addr2line: MyBinary: Invalid bfd target
</code></pre>

<p>Can someone steer my in the right direction? What am I doing wrong?</p>

<p>Thanks in advance for any help!</p>

<p><strong>Edit:</strong></p>

<p>I realize now that when I thought I was creating a file that just contained symbol information with the following:</p>

<pre><code>strip MyBinary -o thesymbols.sym
</code></pre>

<p>that I was actually just creating a stripped binary called thesymbols.sym</p>

<p>That being said, my original question still stands. Any ideas?</p>