title: How do I map a segfault instruction pointer address from /var/log/messages to an address/function in my .map file?
body: <p>(My environment is 64-bit Ubuntu, my application is C++ compiled and linked with g++.)</p>
  
  <p>When an application does something like divide by zero or run a <code>asm("int $3")</code> left in the code, one of the following gets logged via syslog to <code>/var/log/kern.log</code> and <code>/var/log/messages</code>:</p>
  
  <pre><code>Sep 10 18:06:47 VM kernel: [117194.123452] a.out[20288] trap divide error ip:45c59d sp:7fff65a91810 error:0 in a.out[400000+144000]
  Sep 10 18:07:10 VM kernel: [117217.020833] a.out[20294] trap int3 ip:45c493 sp:7fff5cc559f0 error:0
  </code></pre>
  
  <p>In both those cases, the instruction pointer address points to something that I can easily look up in the <code>.map</code> file produced at link time (using the "<code>-Wl,-Map,output.map</code>").</p>
  
  <p>But if I cause a seg fault, in this case by a call to <code>memcpy()</code> with the source set to NULL, the instruction pointer is so out of range, I have no idea how it is supposed to be mapped:</p>
  
  <pre><code>Sep 10 18:06:13 VM kernel: [117160.228587] a.out[20282]: segfault at 0 ip 00007f7e79209092 sp 00007fff831faf08 error 4 in libc-2.9.so[7f7e79185000+168000]
  </code></pre>
  
  <p>In this example, I would have expected the IP to be in the range of 0x445e70-0x445e7f, which is the location of memcpy() according to my .map file.</p>
  
  <p>My question:  What is the trick to interpreting the ip in this case?</p>