<p><code>__func__</code>, <code>__FUNCTION__</code> or <code>__PREETY_FUNCTION__</code> don't give too much. I can write some extinguish algorithm which will retrieve names of functions and <code>__FILE__</code>, but still I'm left without line, where <code>__LINE__</code> don't help either.</p>

<p>The simpliest way as I know is to "dump" output file with <code>objdump</code> which is provided in <code>binutils-dev</code>. Then I can get some <code>hex</code> numbers from "relocations" of <code>PC</code> - I mean addresses which program counter was calling. After I should find those addresses in symbolic table or dynamic symbols table in section <code>.text</code> of <code>objdump</code> output where next to the names of functions are file's names and line numbers.</p>

<p>Even when I use <code>libc</code> libraries to get addresses of functions (like I actually do only to get addresses) You can go straight forward to symbolic table, but still I'm depending on <code>objdump</code>.</p>

<p>For sure there is simple way to obtain all those informations but I think I'll need some 'hacky-tricks' to "dump" myself output file or go straight into stack.</p>

<p>That is why it's easier to depend on already prepared library <code>bfd</code> from <code>binutils-dev</code> because time to get full backtrace this way is equal to get backtrace only for one frame when I was searching through <code>objdump</code>.</p>

<p>Of course those are my short experiences with debugging that is why please don't take them too seriously. ;)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/380#issuecomment-163120489">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFDboslSh8uXO6JEZZT8eipOo7lj_ks5pN7yCgaJpZM4DRaYY.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/380#issuecomment-163120489"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>