Fix ReactorDebugInfo off by one line issues
Before this commit, when debugging with the ReactorDebugInfo feature,
variables were being incorrectly displayed in the debugger. For
instance, given:
Int a = 1;
Int b = 2;
The debugger would not display 'a', and would display 'b' as containing
the value '1'. The reason for this was that while the Int constructor
for 'a' was executing, we invoke boost::stacktrace() to determine the
variable's source location (file and line number); however, the stack
trace would return the return address of the constructor call, which
would be on the next line -- that of 'Int b'.
To fix this, knowing that all ReactorDebugInfo emits come from function
calls in Reactor code, we assume that all backtrace addresses point to
the next instruction following the call, thus we subtract 1 from these
addresses. When resolving the file and line number, this gets back the
previous instruction's location. There are likely corner cases where
this doesn't work, but it's better than what we have now.
Bug: b/161821289
Change-Id: Ie92ead393f321fc1a26fc019d6450bfddb7a5e24
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/46868Reviewed-by:
Ben Clayton <bclayton@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment