From 2f5e33d02f0103a40de2493f824627effaedc6e0 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 27 Jun 2013 19:27:06 +0200 Subject: [PATCH] debuginfo: Some corrections after review. --- src/librustc/middle/trans/debuginfo.rs | 25 ------------------- .../debug-info/reference-to-managed-basic.rs | 3 +-- src/test/debug-info/struct-with-destructor.rs | 17 +++++++++++-- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index b1434bb798a9..a42f20ea39ca 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -559,31 +559,6 @@ impl StructContext { roundup(self.total_size, self.align) } - //fn verify_against_struct_or_tuple_type(&self, t: ty::t, ccx: &mut CrateContext) { - // let repr = adt::represent_type(ccx, t); - - // match *repr { - // Univariant(*) => - // { - // let size_with_alignment = self.get_total_size_with_alignment(); - - // if st.size != size_with_alignment { - // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type: - // invalid type size. Expected = %u, actual = %u", - // st.size, size_with_alignment); - // } - - // if st.align != self.align { - // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type: - // invalid type alignment. Expected = %u, actual = %u", - // st.align, self.align); - // } - // }, - // _ => ccx.sess.bug(fmt!("StructContext(%s)::verify_against_struct_or_tuple_type: - // called with invalid type %?", self.name, t)) - // } - //} - fn finalize(&self) -> DICompositeType { debug!("StructContext(%s)::finalize: total_size=%u, align=%u", self.name, self.total_size, self.align); diff --git a/src/test/debug-info/reference-to-managed-basic.rs b/src/test/debug-info/reference-to-managed-basic.rs index b93b2cee2d27..e3951c94b6f8 100644 --- a/src/test/debug-info/reference-to-managed-basic.rs +++ b/src/test/debug-info/reference-to-managed-basic.rs @@ -10,8 +10,7 @@ // xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249 -// Gdb doesn't know -// about UTF-32 character encoding and will print a rust char as only +// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only // its numerical value. // compile-flags:-Z extra-debug-info diff --git a/src/test/debug-info/struct-with-destructor.rs b/src/test/debug-info/struct-with-destructor.rs index c023e3c2ccbd..f8281bba49e9 100644 --- a/src/test/debug-info/struct-with-destructor.rs +++ b/src/test/debug-info/struct-with-destructor.rs @@ -49,7 +49,7 @@ struct WithDestructorGuarded { // The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used -// at runtime to prevent finalize() to be executed more than once (see middle::trans::adt). +// at runtime to prevent drop() to be executed more than once (see middle::trans::adt). // This field must be incorporated by the debug info generation. Otherwise the debugger assumes a // wrong size/layout for the struct. fn main() { @@ -63,7 +63,20 @@ fn main() { // If the destructor flag field is not incorporated into the debug info for 'WithDestructor' // then the debugger will have an invalid offset for the field 'guard' and thus should not be - // able to read its value correctly. + // able to read its value correctly (dots are padding bytes, D is the boolean destructor flag): + // + // NoDestructorGuarded = 0000....00000000FFFFFFFF + // <--------------><------> + // NoDestructor guard + // + // + // withDestructorGuarded = 0000....00000000D.......FFFFFFFF + // <--------------><------> // How debug info says it is + // WithDestructor guard + // + // <----------------------><------> // How it actually is + // WithDestructor guard + // let withDestructor = WithDestructorGuarded { a: WithDestructor { x: 10, y: 20 }, guard: -1