1
Fork 0

Implement support for DWARF version 5.

DWARF version 5 brings a number of improvements over version 4. Quoting from
the announcement [1]:

> Version 5 incorporates improvements in many areas: better data compression,
> separation of debugging data from executable files, improved description of
> macros and source files, faster searching for symbols, improved debugging
> optimized code, as well as numerous improvements in functionality and
> performance.

On platforms where DWARF version 5 is supported (Linux, primarily), this commit
adds support for it behind a new `-Z dwarf-version=5` flag.

[1]: https://dwarfstd.org/Public_Review.php
This commit is contained in:
Patrick Walton 2022-06-20 16:26:51 -07:00
parent 45263fc66d
commit 1e0ad0c1d4
13 changed files with 59 additions and 21 deletions

View file

@ -1272,6 +1272,8 @@ options! {
computed `block` spans (one span encompassing a block's terminator and \
all statements). If `-Z instrument-coverage` is also enabled, create \
an additional `.html` file showing the computed coverage spans."),
dwarf_version: Option<u32> = (None, parse_opt_number, [TRACKED],
"version of DWARF debug information to emit (default: 2 or 4, depending on platform)"),
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
"emit a section containing stack size metadata (default: no)"),
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],

View file

@ -1498,6 +1498,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
))
}
}
if let Some(dwarf_version) = sess.opts.debugging_opts.dwarf_version {
if dwarf_version > 5 {
sess.err(&format!("requested DWARF version {} is greater than 5", dwarf_version));
}
}
}
/// Holds data on the current incremental compilation session, if there is one.