]> git.lizzy.rs Git - rust.git/commit
Auto merge of #42278 - gentoo90:gdb-pretty-printers, r=michaelwoerister
authorbors <bors@rust-lang.org>
Fri, 9 Jun 2017 18:17:15 +0000 (18:17 +0000)
committerbors <bors@rust-lang.org>
Fri, 9 Jun 2017 18:17:15 +0000 (18:17 +0000)
commit3d5b8c6266fd58cefa0d7af8c6115fe22532d069
tree60b8527b541e5c96365292e2b972ed27e7890553
parent5fe923d43455f362408aad30ffc86a6ab71ff7c6
parent63076ddbb8e9856e9996adb49fc0a67a29ca697b
Auto merge of #42278 - gentoo90:gdb-pretty-printers, r=michaelwoerister

Fix GDB pretty-printer for tuples and pointers

Names of children should not be the same, because GDB uses them to distinguish the children.

|Before|After|
|---|---|
|![tuples_before](https://cloud.githubusercontent.com/assets/1297574/26527639/5d6cf10e-43a0-11e7-9498-abfcddb08055.png)|![tuples_after](https://cloud.githubusercontent.com/assets/1297574/26527655/9699233a-43a0-11e7-83c6-f58f713b51a0.png)|

`main.rs`
```rust
enum Test {
    Zero,
    One(i32),
    Two(i32, String),
    Three(i32, String, Vec<String>),
}

fn main() {
    let tuple = (1, 2, "Asdfgh");
    let zero = Test::Zero;
    let one = Test::One(10);
    let two = Test::Two(42, "Qwerty".to_owned());
    let three = Test::Three(9000,
                            "Zxcvbn".to_owned(),
                            vec!["lorem".to_owned(), "ipsum".to_owned(), "dolor".to_owned()]);
    println!(""); // breakpoint here
}
```

`launch.json`
```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "gdb",
            "request": "launch",
            "gdbpath": "rust-gdb",
            "name": "Launch Program",
            "valuesFormatting": "prettyPrinters", //this requires plugin Native Debug >= 0.20.0
            "target": "./target/debug/test_pretty_printers",
            "cwd": "${workspaceRoot}"
        }
    ]
}
```