Make file names and line numbers in exceptions inline-aware
commit372588fe0bce24bee2947f9b3e67f6f8d190d9c2
authorJan Oravec <jan@fb.com>
Tue, 24 Sep 2019 23:17:22 +0000 (24 16:17 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 24 Sep 2019 23:22:16 +0000 (24 16:22 -0700)
treed1bd0a1a57de635e64f1bb15d455280378174374
parentd3be4921dc7c3a1de635b6a29ac2c5251134b9c4
Make file names and line numbers in exceptions inline-aware

Summary:
Previously, the stacktrace portion of the exception was produced using
createBacktrace(), which is inline-aware, but file names and line numbers were
not, so they were pointing to the first non-inlined frame, which could be in
the middle of a stacktrace. E.g., in this example, the same frame is listed
twice (file/line + stacktrace):

  Fatal error: Uncaught exception 'BadMethodCallException' with message 'Function C::f requires 2 generics but 1 given' in .../hphp/test/slow/reified_generics/error-function-call-5.php:8
  Stack trace:
  #0 .../hphp/test/slow/reified_generics/error-function-call-5.php(8): C->f()
  #1 (): main()
  #2 {main}

Fix this by using the same mechanism to obtain current function and offset as
we use to produce a stacktrace.

Reviewed By: alexeyt

Differential Revision: D17552359

fbshipit-source-id: 90e51458e32f63c9be14d48ef0860f82007b8a04
hphp/runtime/base/backtrace.cpp
hphp/runtime/base/backtrace.h
hphp/runtime/base/exceptions.cpp