Skip to content

Commit 2f5e33d

Browse files
debuginfo: Some corrections after review.
1 parent 42dbae7 commit 2f5e33d

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -559,31 +559,6 @@ impl StructContext {
559559
roundup(self.total_size, self.align)
560560
}
561561

562-
//fn verify_against_struct_or_tuple_type(&self, t: ty::t, ccx: &mut CrateContext) {
563-
// let repr = adt::represent_type(ccx, t);
564-
565-
// match *repr {
566-
// Univariant(*) =>
567-
// {
568-
// let size_with_alignment = self.get_total_size_with_alignment();
569-
570-
// if st.size != size_with_alignment {
571-
// ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type:
572-
// invalid type size. Expected = %u, actual = %u",
573-
// st.size, size_with_alignment);
574-
// }
575-
576-
// if st.align != self.align {
577-
// ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type:
578-
// invalid type alignment. Expected = %u, actual = %u",
579-
// st.align, self.align);
580-
// }
581-
// },
582-
// _ => ccx.sess.bug(fmt!("StructContext(%s)::verify_against_struct_or_tuple_type:
583-
// called with invalid type %?", self.name, t))
584-
// }
585-
//}
586-
587562
fn finalize(&self) -> DICompositeType {
588563
debug!("StructContext(%s)::finalize: total_size=%u, align=%u",
589564
self.name, self.total_size, self.align);

src/test/debug-info/reference-to-managed-basic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
1212

13-
// Gdb doesn't know
14-
// about UTF-32 character encoding and will print a rust char as only
13+
// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
1514
// its numerical value.
1615

1716
// compile-flags:-Z extra-debug-info

src/test/debug-info/struct-with-destructor.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct WithDestructorGuarded {
4949

5050

5151
// The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used
52-
// at runtime to prevent finalize() to be executed more than once (see middle::trans::adt).
52+
// at runtime to prevent drop() to be executed more than once (see middle::trans::adt).
5353
// This field must be incorporated by the debug info generation. Otherwise the debugger assumes a
5454
// wrong size/layout for the struct.
5555
fn main() {
@@ -63,7 +63,20 @@ fn main() {
6363

6464
// If the destructor flag field is not incorporated into the debug info for 'WithDestructor'
6565
// then the debugger will have an invalid offset for the field 'guard' and thus should not be
66-
// able to read its value correctly.
66+
// able to read its value correctly (dots are padding bytes, D is the boolean destructor flag):
67+
//
68+
// NoDestructorGuarded = 0000....00000000FFFFFFFF
69+
// <--------------><------>
70+
// NoDestructor guard
71+
//
72+
//
73+
// withDestructorGuarded = 0000....00000000D.......FFFFFFFF
74+
// <--------------><------> // How debug info says it is
75+
// WithDestructor guard
76+
//
77+
// <----------------------><------> // How it actually is
78+
// WithDestructor guard
79+
//
6780
let withDestructor = WithDestructorGuarded {
6881
a: WithDestructor { x: 10, y: 20 },
6982
guard: -1

0 commit comments

Comments
 (0)