-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit debug info for trait object pointer
Emit better debugging information for a trait object pointer. In particular, now: * The fields are explicitly represented in the DWARF; * DWARF for the vtable itself is emitted; and * The DWARF for the vtable's type has a DW_AT_containing_type which points to the concrete type for which the vtable was emitted. This is a small DWARF extension, that allows debuggers to determine the real type of the object to which a trait object points. I'll submit the gdb patch to take advantage of this new debuginfo once this lands. The vtable type is not currently complete -- it doesn't include members for the pointers it contains. This information was not needed for this feature. This addresses part 1 of #1563.
- Loading branch information
Showing
5 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule llvm
updated
6 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// This test depends on a patch that was committed to upstream LLVM | ||
// after 5.0, then backported to the Rust LLVM fork. | ||
|
||
// ignore-tidy-linelength | ||
// ignore-windows | ||
// ignore-macos | ||
// min-system-llvm-version 5.1 | ||
|
||
// compile-flags: -g -C no-prepopulate-passes | ||
|
||
// CHECK-LABEL: @main | ||
// CHECK: {{.*}}DICompositeType{{.*}}name: "vtable",{{.*}}vtableHolder:{{.*}} | ||
|
||
pub trait T { | ||
} | ||
|
||
impl T for f64 { | ||
} | ||
|
||
pub fn main() { | ||
let d = 23.0f64; | ||
let td = &d as &T; | ||
} |