]> git.lizzy.rs Git - rust.git/commit
Add an abs_path member to FileMap, use it when writing debug info.
authorTed Mielczarek <ted@mielczarek.org>
Thu, 9 Jun 2016 20:36:20 +0000 (16:36 -0400)
committerTed Mielczarek <ted@mielczarek.org>
Thu, 16 Jun 2016 17:08:46 +0000 (18:08 +0100)
commit24e7491660845e52240afc36acf332b92547b0a1
tree106c01facc7fbff9a373112707b34eb383a93b89
parenta479a6a7a6fa1bfe1f18d7d7411ad14e7b8ca17b
Add an abs_path member to FileMap, use it when writing debug info.

When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
15 files changed:
src/librustc_metadata/creader.rs
src/librustc_save_analysis/span_utils.rs
src/librustc_trans/debuginfo/create_scope_map.rs
src/librustc_trans/debuginfo/metadata.rs
src/librustc_trans/debuginfo/mod.rs
src/librustc_trans/debuginfo/namespace.rs
src/librustdoc/html/highlight.rs
src/libsyntax/codemap.rs
src/libsyntax/errors/emitter.rs
src/libsyntax/errors/snippet/test.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/util/parser_testing.rs