From: Petr Machata Date: Wed, 13 Apr 2011 08:56:01 +0000 (+0200) Subject: dwarflint: Initialize whole abbrev/abbrev_attrib instead of just the where X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a8f063a2b169a974fe53f86903d020863c22e0f;p=thirdparty%2Felfutils.git dwarflint: Initialize whole abbrev/abbrev_attrib instead of just the where --- diff --git a/dwarflint/check_debug_abbrev.cc b/dwarflint/check_debug_abbrev.cc index 771c506d5..f7ae7d2ae 100644 --- a/dwarflint/check_debug_abbrev.cc +++ b/dwarflint/check_debug_abbrev.cc @@ -303,18 +303,17 @@ namespace << "duplicate abbrev code " << abbr_code << "; already defined at " << original->where << '.' << std::endl; - struct abbrev fake; - struct abbrev *cur; + abbrev fake; + abbrev *cur; /* Don't actually save this abbrev if it's duplicate. */ if (likely (original == NULL)) { REALLOC (section, abbr); cur = section->abbr + section->size++; + new (cur) abbrev (); } else cur = &fake; - WIPE (*cur); - new (&cur->where) class where (); cur->code = abbr_code; cur->where = where; @@ -383,8 +382,7 @@ namespace REALLOC (cur, attribs); struct abbrev_attrib *acur = cur->attribs + cur->size++; - WIPE (*acur); - new (&acur->where) class where (); + new (acur) abbrev_attrib (); acur->name = attrib_name; acur->form = attrib_form; acur->where = where; diff --git a/dwarflint/check_debug_abbrev.hh b/dwarflint/check_debug_abbrev.hh index 7fc1aefdf..c1cbc9359 100644 --- a/dwarflint/check_debug_abbrev.hh +++ b/dwarflint/check_debug_abbrev.hh @@ -1,5 +1,5 @@ /* Low-level checking of .debug_abbrev. - Copyright (C) 2009, 2010 Red Hat, Inc. + Copyright (C) 2009, 2010, 2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -33,18 +33,24 @@ struct abbrev_attrib { - struct where where; + ::where where; uint16_t name; uint8_t form; + + abbrev_attrib () + : where () + , name (0) + , form (0) + {} }; struct abbrev { + ::where where; uint64_t code; - struct where where; /* Attributes. */ - struct abbrev_attrib *attribs; + abbrev_attrib *attribs; size_t size; size_t alloc; @@ -56,6 +62,17 @@ struct abbrev /* Whether some DIE uses this abbrev. */ bool used; + + abbrev () + : where () + , code (0) + , attribs (0) + , size (0) + , alloc (0) + , tag (0) + , has_children (false) + , used (false) + {} }; struct abbrev_table