debuginfo: Some corrections after review.

This commit is contained in:
Michael Woerister 2013-06-27 19:27:06 +02:00
parent 42dbae7f2a
commit 2f5e33d02f
3 changed files with 16 additions and 29 deletions

View File

@ -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);

View File

@ -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

View File

@ -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