Stream: t-compiler/help

Topic: Backtrace confusion

osa1 (Dec 07 2019 at 17:40, on Zulip):

I'm currently trying to debug an assertion failure. The assertion is in src/librustc_mir/interpret/ (as shown in the panic message), but the backtrace printed does not include that function (copy_op_no_validate). Any ideas how this is possible? I guess I can manually print the backtrace at the time of assertion failure (using the std::backtrace) but I wonder why the default backtrace doesn't have the actual failing function.

oli (Dec 07 2019 at 18:08, on Zulip):

You need to turn on debug-assertions in config.toml. copy config.toml.example and edit it by uncommenting and changing the value of debug-assertions

oli (Dec 07 2019 at 18:08, on Zulip):

(I think, read the docs on that flag)

nagisa (Dec 08 2019 at 17:40, on Zulip):

Likely it happened because inlining removed the function in question ;)

osa1 (Dec 09 2019 at 07:16, on Zulip):

But I see the expected backtrace if I print std::backtrace::Backtrace in the panic message. So the backtrace shown in assert!(..., "{}", std::backtrace::Backtrace::capture()) has copy_op_no_validate) but the backtrace shown by the panic handler does not.

Edd Barrett (Dec 11 2019 at 13:46, on Zulip):

@osa1 It's likely what @oli said above.

The default backtraces are not precise by default.

I remember being confused by this when I first started out. As mentioned above, take a look at debug and debuginfo-level in config.toml.example.

To have accurate traces I think you need debuginfo-level to be at least 1.

Last update: Apr 06 2020 at 02:45UTC