]> git.lizzy.rs Git - rust.git/commit
debuginfo: Make sure that all calls to drop glue are associated with debug locations.
authorMichael Woerister <michaelwoerister@posteo>
Wed, 24 Sep 2014 06:49:38 +0000 (08:49 +0200)
committerMichael Woerister <michaelwoerister@posteo>
Thu, 25 Sep 2014 12:17:14 +0000 (14:17 +0200)
commit302486e49bca590347d018665c339c512168da08
tree983ecadd6e00bc363d9363a2a60dcd33ff59f23f
parentd299bafb31a7c0528e690e48ec6d5591f1eb0bac
debuginfo: Make sure that all calls to drop glue are associated with debug locations.

This commit makes rustc emit debug locations for all call
and invoke statements in LLVM IR, if they are contained
within a function that debuginfo is enabled for. This is
important because LLVM does not handle the case where a
function body containing debuginfo is inlined into another
function with debuginfo, but the inlined call statement
does not have a debug location. In this case, LLVM will
not know where (in terms of source code coordinates) the
function was inlined to and we end up with some statements
still linked to the source locations in there original,
non-inlined function without any indication that they are
indeed an inline-copy. Later, when generating DWARF from
the IR, LLVM will interpret this as corrupt IR and abort.

Unfortunately, the undesirable case described above can
still occur when using LTO. If there is a crate compiled
without debuginfo calling into a crate compiled with
debuginfo, we again end up with the conditions triggering
the error. This is why some LTO tests still fail with the
dreaded assertion, if the standard library was built with
debuginfo enabled.
That is, `RUSTFLAGS_STAGE2=-g make rustc-stage2` will
succeed but `RUSTFLAGS_STAGE2=-g make check` will still
fail after this commit has been merged. This is a problem
that has to be dealt with separately.

Fixes #17201
Fixes #15816
Fixes #15156
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/cleanup.rs
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/tvec.rs
src/test/debuginfo/borrowed-basic.rs