Commit Graph

311 Commits

Author SHA1 Message Date
ortem 47c26e69a9 Implement new gdb/lldb pretty-printers
Replace old GDB and LLDB pretty-printers with new ones
which were originally written for IntelliJ Rust.
New LLDB pretty-printers support synthetic children.
New GDB/LLDB pretty-printers support all Rust types
supported by old pretty-printers, and also support:
Rc, Arc, Cell, Ref, RefCell, RefMut, HashMap, HashSet.
2020-06-09 16:13:11 +03:00
Dylan MacKenzie 2fe1170613 `ret` has been optimized away in debuginfo test 2020-05-16 17:15:24 -07:00
Josh Stone 8506bb0060 Update the minimum external LLVM to 8
LLVM 8 was released on March 20, 2019, over a year ago.
2020-04-14 12:44:41 -07:00
Stein Somers 3d435d8023 Test and fix gdb pretty printing again 2020-03-26 23:09:20 +00:00
Stein Somers d8a136fa10 Test pretty printing more and fix overzealous type substitution 2020-03-21 14:03:09 +00:00
Mark Rousskov bce7f6f3a0 Fix debugger pretty printing of BTrees 2020-03-20 12:02:07 -04:00
Yuki Okushi 45a30cdf1d Update tests 2020-03-03 18:22:05 +09:00
spunit262 a9b5c692d9 Ignore GDB versions with broken str printing.
https://sourceware.org/bugzilla/show_bug.cgi?id=22236
2020-02-16 17:49:45 -07:00
Eduard-Mihai Burtescu 1a8f5efab8 rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo. 2020-02-09 16:39:23 +02:00
Jonas Schievink 044fe0f558 Add a resume type parameter to `Generator` 2020-02-02 13:20:57 +01:00
Nikita Popov b27b1d8efc Remove legacy debuginfo tests
These are no longer relevant, as our minimum supported version
is LLVM 7.
2020-01-07 21:28:22 +01:00
MaulingMonkey 839d58ca56 debuginfo: Support for std::collections::Hash* in windows debuggers. 2019-11-20 19:27:42 -08:00
Maximilian Roos 445af68c23
fix debuginfo/issue22656 with LLDB 8 2019-09-18 10:42:55 -04:00
Guanqun Lu 5355a16150 use println!() 2019-09-15 23:15:06 +08:00
Joe Ranweiler 6ed50f4777 Rename test locals to work around LLDB bug
LLDB's expression parser can't unambiguously resolve local variables in
some cases, as described in #47938. Work around this by using names that
don't shadow direct submodules of `core`.
2019-08-31 20:05:10 -07:00
Philip Craig 61ff27aa1c debuginfo: always include disambiguator in type names 2019-08-27 10:36:27 +10:00
Philip Craig fbe3f3e98f debuginfo: give unique names to closure and generator types
Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822
2019-08-25 13:12:24 +10:00
MaulingMonkey 0a423a70bb Fix CDB support tidy check line length failures. 2019-05-20 02:44:26 -07:00
MaulingMonkey e33c4415b3 Add basic CDB support to debuginfo compiletest s, to help catch `*.natvis` regressions, like those fixed in #60687.
Several Microsoft debuggers (VS, VS Code, WinDbg, CDB, ...) consume the `*.natvis` files we embed into rust `*.pdb` files.
While this only tests CDB, that test coverage should help for all of them.

CHANGES

src\bootstrap
  - test.rs:  Run CDB debuginfo tests on MSVC targets

src\test\debuginfo
  - issue-13213.rs:  CDB has trouble with this, skip for now (newly discovered regression?)
  - pretty-std.rs:  Was ignored, re-enable for CDB only to start with, add CDB tests.
  - should-fail.rs:  Add CDB tests.

src\tools\compiletest:
  - Added "-cdb" option
  - Added Mode::DebugInfoCdb ("debuginfo-cdb")
  - Added run_debuginfo_cdb_test[_no_opt]
  - Renamed Mode::DebugInfoBoth -> DebugInfoGdbLldb ("debuginfo-gdb+lldb") since it's no longer clear what "Both" means.
  - Find CDB at the default Win10 SDK install path "C:\Program Files (x86)\Windows Kits\10\Debugger\*\cdb.exe"
  - Ignore CDB tests if CDB not found.

ISSUES

  - `compute_stamp_hash`: not sure if there's any point in hashing `%ProgramFiles(x86)%`
  - `OsString` lacks any `*.natvis` entries (would be nice to add in a followup changelist)
  - DSTs (array/string slices) which work in VS & VS Code fail in CDB.
  - I've avoided `Mode::DebugInfoAll` as 3 debuggers leads to pow(2,3)=8 possible combinations.

REFERENCE

CDB is not part of the base Visual Studio install, but can be added via the Windows 10 SDK:
  https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
Installing just "Debugging Tools for Windows" is sufficient.

CDB appears to already be installed on appveyor CI, where this changelist can find it, based on it's use here:
  0ffc573110/appveyor.yml (L227)

CDB commands and command line reference:
  https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-reference
2019-05-19 17:10:48 -07:00
Tyler Mandry 77a6d29f48 Address review comments 2019-05-03 19:25:35 -07:00
Tyler Mandry f772c39bf9 Include generator locals as field names in debuginfo 2019-04-25 10:28:09 -07:00
Tyler Mandry 6e2e17d115 Make generator object debuginfo easier to read 2019-04-25 10:28:09 -07:00
Tyler Mandry 961ba95e5a Describe generator variants in debuginfo 2019-04-25 10:28:09 -07:00
Tyler Mandry 9e06f25200 Test debuginfo of different var liveness in generators 2019-04-25 10:12:57 -07:00
varkor 62838975d0 Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
varkor 7f0f0e31ec Remove double trailing newlines 2019-04-22 16:57:01 +01:00
Mazdak Farrokhzad ae2551825d
Rollup merge of #59380 - philipc:thinlto-variant, r=michaelwoerister
Fix invalid DWARF for enums when using ThinLTO

We were setting the same identifier for both the DW_TAG_structure_type
and the DW_TAG_variant_part. This becomes a problem when using ThinLTO
becauses it uses the identifier as a key for a map of types that is used
to delete duplicates based on the ODR, so one of them is deleted as a
duplicate, resulting in invalid DWARF.

The DW_TAG_variant_part isn't a standalone type, so it doesn't need
an identifier. Fix by omitting its identifier.

ODR uniquing is [enabled here](f21dee2c61/src/rustllvm/PassWrapper.cpp (L1101)).
2019-03-30 14:14:53 +01:00
Philip Craig 3a5a8a529a Give variant parts their own unique id
and bump llvm version in test
2019-03-27 15:22:37 +10:00
Philip Craig e8de4c3b1f Fix invalid DWARF for enums when using thinlto
We were setting the same identifier for both the DW_TAG_structure_type
and the DW_TAG_variant_part. This becomes a problem when using thinlto
becauses it uses the identifier as a key for a map of types that is used
to delete duplicates based on the ODR, so one of them is deleted as a
duplicate, resulting in invalid DWARF.

The DW_TAG_variant_part isn't a standalone type, so it doesn't need
an identifier. Fix by omitting its identifier.
2019-03-23 17:13:58 +10:00
Samuel Holland 8d3dd39d88 Correct minimum system LLVM version in tests
Since commit 9452a8dfa3, the new debug info format is only generated
for LLVM 8 and newer versions. However, the tests still assume that LLVM
7 will use the new debug info format. Fix the tests (and a comment in
the code) to match the actual version check.
2019-03-22 21:28:25 -05:00
Alexander Regueiro fe30743c79 Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
Mazdak Farrokhzad 6371622662
Rollup merge of #58629 - euclio:debug-empty-str, r=alexcrichton
rust-lldb: fix crash when printing empty string

Fixes #52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
2019-03-09 17:18:14 +01:00
Andy Russell 9e5def9616
rust-lldb: fix crash when printing empty string 2019-03-06 12:28:38 -05:00
Wim Looman 61097bce0d Add debug-info to access variables from generator state 2019-02-23 12:13:39 +01:00
Wim Looman e7d66758cf Update generator upvar debug info 2019-01-27 22:58:59 +01:00
Wiktor Kuchta 190d139f3a Fix repeated word typos
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2019-01-03 21:33:37 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors 3f7c718926 Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check, r=nikomatsakis
Less conservative uninhabitedness check

Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays.

Pulled out of #47291 and #50262.

Fixes https://github.com/rust-lang/rust/issues/54586.

r? @nikomatsakis
2018-12-20 22:04:21 +00:00
varkor 0a8b696793 Remove nil-enum test 2018-12-20 19:24:16 +00:00
kennytm 4a0ee22bc2
Rollup merge of #56756 - tromey:Bug-56730-btree-pretty-printer, r=alexcrichton
Disable btree pretty-printers on older gdbs

gdb versions before 8.1 have a bug that prevents the BTreeSet and
BTreeMap pretty-printers from working.  This patch disables the test
on those versions, and also disables the pretty-printers there as
well.

Closes #56730
2018-12-14 22:17:49 +08:00
Tom Tromey 4007adfb6b Disable btree pretty-printers on older gdbs
gdb versions before 8.1 have a bug that prevents the BTreeSet and
BTreeMap pretty-printers from working.  This patch disables the test
on those versions, and also disables the pretty-printers there as
well.

Closes #56730
2018-12-12 15:18:08 -07:00
bors 8375ab4ff4 Auto merge of #53497 - fukatani:test-debuginfo-function-call, r=tromey
Test with gdb8.2 and add debuginfo printing function call test

As far as I can see, `print function()` is not tested. It is important feature for debugging.
2018-12-11 16:27:49 +00:00
Unknown e6bbf7ef8d Add function call test, Update gdb and test docker image install gdb by ppa. 2018-12-11 22:20:15 +09:00
varkor 62b359094f Check for uninhabitedness instead of never 2018-12-11 11:18:19 +00:00
Alexander Regueiro ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Tom Tromey fb204cb92f Add template parameter debuginfo to generic types
This changes debuginfo generation to add template parameters to
generic types.  With this change the DWARF now has
DW_TAG_template_type_param for types, not just for functions, like:

 <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type)
    <40e>   DW_AT_name        : (indirect string, offset: 0x375): Generic<i32>
    <412>   DW_AT_byte_size   : 4
    <413>   DW_AT_alignment   : 4
...
 <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param)
    <420>   DW_AT_type        : <0x42a>
    <424>   DW_AT_name        : (indirect string, offset: 0xa65e): T

Closes #9224
2018-11-29 13:04:09 -07:00
Pietro Albini ed6c7b751d
Rollup merge of #56144 - tromey:Bug-55771-btreemap, r=alexcrichton
Fix BTreeSet and BTreeMap gdb pretty-printers

The BTreeSet and BTreeMap gdb pretty-printers did not take the node
structure into account, and consequently only worked for shallow sets.
This fixes the problem by iterating over child nodes when needed.

This patch avoids the current approach of implementing some of the
value manipulations in debugger-indepdendent code.  This was done for
convenience: a type lookup was needed for the first time, and there
currently are no lldb formatters for these types.

Closes #55771
2018-11-25 17:05:04 +01:00
kennytm 91bceb8fc2
Rollup merge of #55767 - tromey:disable-some-pretty-printers, r=alexcrichton
Disable some pretty-printers when gdb is rust-enabled

A rust-enabled gdb already knows how to display string slices,
structs, tuples, and enums (and after #54004, the pretty-printers
can't handle enums at all).  This patch disables these pretty-printers
when gdb is rust-enabled.

The "gdb-pretty-struct-and-enums-pre-gdb-7-7.rs" test is renamed,
because it does not seem to depend on any behavior of that version of
gdb, and because gdb 7.7 is 4 years old now.
2018-11-24 01:31:47 +08:00
Tom Tromey d4ee1c93ff Fix BTreeSet and BTreeMap gdb pretty-printers
The BTreeSet and BTreeMap gdb pretty-printers did not take the node
structure into account, and consequently only worked for shallow sets.
This fixes the problem by iterating over child nodes when needed.

This patch avoids the current approach of implementing some of the
value manipulations in debugger-indepdendent code.  This was done for
convenience: a type lookup was needed for the first time, and there
currently are no lldb formatters for these types.

Closes #55771
2018-11-21 14:07:22 -07:00
Tom Tromey 30178b422a Disable some pretty-printers when gdb is rust-enabled
A rust-enabled gdb already knows how to display string slices,
structs, tuples, and enums (and after #54004, the pretty-printers
can't handle enums at all).  This patch disables these pretty-printers
when gdb is rust-enabled.

The "gdb-pretty-struct-and-enums-pre-gdb-7-7.rs" test is renamed,
because it does not seem to depend on any behavior of that version of
gdb, and because gdb 7.7 is 4 years old now.
2018-11-19 08:08:46 -07:00