title: Tracing fIle path and line number
body: <p>I'm using python's <code>trace</code> module to trace some code. When I trace code this way, I can get one of the following two results:</p>
  
  <p><strong>Call</strong>:</p>
  
  <pre><code>tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix])
  r = tracer.run('run()')
  tracer.results().write_results(show_missing=True)
  </code></pre>
  
  <p><strong>Result</strong>:</p>
  
  <pre><code>&lt;filename&gt;(&lt;line number&gt;): &lt;line of code&gt;
  </code></pre>
  
  <p><strong>Call</strong> [<a href="https://stackoverflow.com/a/14496861/198633">citation</a>]:</p>
  
  <pre><code>tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix], countfuncs=True)
  r = tracer.run('run()')
  tracer.results().write_results(show_missing=True)
  </code></pre>
  
  <p><strong>Result</strong>:</p>
  
  <pre><code>filename:&lt;filepath&gt;, modulename:&lt;module name&gt;, funcname: &lt;function name&gt;
  </code></pre>
  
  <p>What I really need is a trace that gives me this:</p>
  
  <pre><code>&lt;filepath&gt; &lt;line number&gt;
  </code></pre>
  
  <p>It would seem that I could use the above information and interleave them to get what I need, but such an attempt would fail in the following use case:</p>
  
  <ul>
  <li><code>sys.path</code> contains directory <code>A</code> and directory <code>B</code>.</li>
  <li>There are two files <code>A/foo.py</code> and <code>B/foo.py</code></li>
  <li>Both <code>A/foo.py</code> and <code>B/foo.py</code> contain the function <code>bar</code>, defined on lines 100 - 120</li>
  <li>There are some minor differences between <code>A/foo.py</code> and <code>B/foo.py</code></li>
  </ul>
  
  <p>In this scenario, using such interleaving to correctly identifying which <code>bar</code> is called is impossible (please correct me if I'm wrong) without statically analyzing the code within each <code>bar</code>, which itself is very difficult for non-trivial functions.</p>
  
  <p>So, how can I get the correct trace output that I need?</p>