From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by sourceware.org (Postfix) with ESMTPS id 560D5385DC35 for ; Mon, 18 May 2020 08:44:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 560D5385DC35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dodji@seketeli.org Received: from localhost (91-166-131-130.subs.proxad.net [91.166.131.130]) (Authenticated sender: dodj@seketeli.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 628B4100018; Mon, 18 May 2020 08:44:16 +0000 (UTC) Received: by localhost (Postfix, from userid 1001) id 3E4781A033D; Mon, 18 May 2020 10:44:15 +0200 (CEST) From: Dodji Seketeli To: Matthias Maennich Cc: libabigail@sourceware.org, gprocida@google.com, kernel-team@android.com Subject: Re: [PATCH] configure: add more diagnostic options when ABIGAIL_DEVEL is set Organization: Me, myself and I References: <20200515092018.31764-1-maennich@google.com> X-Operating-System: Red Hat Enterprise Linux Server 7.7 X-URL: http://www.seketeli.net/~dodji X-Patchwork-State: Committed Date: Mon, 18 May 2020 10:44:15 +0200 In-Reply-To: <20200515092018.31764-1-maennich@google.com> (Matthias Maennich's message of "Fri, 15 May 2020 11:20:18 +0200") Message-ID: <86zha5aazk.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2020 08:44:22 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Matthias Maennich a =C3=A9crit: > When exporting ABIGAIL_DEVEL=3D1, add more flags to ABIGAIL_DEVEL that are > suitable for development to find issues during edit/compile/test time. > > To accommodate the need for checked return values of system(), adjust > the tests to explicitely ignore them. > > Note, unless bug #25989 is addressed, runtestannotate is failing. > See https://sourceware.org/bugzilla/show_bug.cgi?id=3D25989 for details. > > * configure.ac: add -D_FORTIFY_SOURCE=3D2 and -D_GLIBCXX_DEBUG > compilation defines if ABIGAIL_DEVEL is set > > Signed-off-by: Matthias Maennich Acked-By: Dodji Seketeli When testing this with gcc 4.8.5, it appeared that -D_FORTIFY_SOURCE required optimization to work, so I set the optimization level to -O2. I added some source code changes required by the compiler when building with the resulting new value of CXXFLAGS. I have also updated the ChangeLog part of the commit message. I am adding below the patch that I have applied to master. Thanks. Cheers, --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-configure-add-more-diagnostic-options-when-ABIGAIL_D.patch >From d02de5a7846d7f44621c1e100e60f36f5a0c051e Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Fri, 15 May 2020 11:20:18 +0200 Subject: [PATCH] configure: add more diagnostic options when ABIGAIL_DEVEL is set When exporting ABIGAIL_DEVEL=1, add more flags to ABIGAIL_DEVEL that are suitable for development to find issues during edit/compile/test time. The subsequent changes to source and test code are needed to make the code compile with ABIGAIL_DEVEL=yes. Note, unless bug #25989 is addressed, runtestannotate is failing. See https://sourceware.org/bugzilla/show_bug.cgi?id=25989 for details. * configure.ac: add -D_FORTIFY_SOURCE=2 and -D_GLIBCXX_DEBUG compilation defines if ABIGAIL_DEVEL is set. Note that with GCC 4.8.5, -D_FORTIFY_SOURCE=2 requires options to be set. So I am setting the optimization level to -Og. * src/abg-dwarf-reader.cc (read_context::{compute_canonical_die, get_or_compute_canonical_die, associate_die_to_decl, set_canonical_die_offset, schedule_type_for_late_canonicalization, compare_dies}, get_scope_for_die, add_or_update_union_type) (read_debug_info_into_corpus, build_ir_node_from_die): Initialize the 'source' variable. * tests/test-diff-filter.cc (main): Check the return value of the system function. * tests/test-diff-pkg.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. Signed-off-by: Matthias Maennich Signed-off-by: Dodji Seketeli --- configure.ac | 4 ++-- src/abg-dwarf-reader.cc | 22 ++++++++++++---------- tests/test-diff-filter.cc | 3 ++- tests/test-diff-pkg.cc | 3 ++- tests/test-read-write.cc | 3 ++- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 1d6fe56..36296d6 100644 --- a/configure.ac +++ b/configure.ac @@ -617,8 +617,8 @@ DEPS_LIBS="$XML_LIBS $LIBZIP_LIBS $ELF_LIBS $DW_LIBS" AC_SUBST(DEPS_LIBS) if test x$ABIGAIL_DEVEL != x; then - CFLAGS="-g -Wall -Wextra -Werror" - CXXFLAGS="-g -Wall -Wextra -Werror" + CFLAGS="-Og -Wall -Wextra -Werror -D_FORTIFY_SOURCE=2" + CXXFLAGS="-Og -Wall -Wextra -Werror -D_FORTIFY_SOURCE=2 -D_GLIBCXX_DEBUG" fi if test x$ABIGAIL_DEBUG != x; then diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 5024deb..4bcc652 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -3060,7 +3060,8 @@ public: Dwarf_Die &canonical_die, bool die_as_type) const { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; + ABG_ASSERT(get_die_source(die, source)); Dwarf_Off die_offset = dwarf_dieoffset(const_cast(die)); @@ -3298,7 +3299,7 @@ public: size_t where, bool die_as_type) const { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(get_die_source(die, source)); offset_offset_map_type &canonical_dies = @@ -3521,7 +3522,7 @@ public: size_t where_offset, bool do_associate_by_repr = false) { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(get_die_source(die, source)); die_artefact_map_type& m = @@ -4151,7 +4152,7 @@ public: Dwarf_Off canonical_die_offset, bool die_as_type) const { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(get_die_source(die, source)); Dwarf_Off die_offset = dwarf_dieoffset(const_cast(die)); @@ -4732,7 +4733,7 @@ public: schedule_type_for_late_canonicalization(const Dwarf_Die *die) { Dwarf_Off o; - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; Dwarf_Die equiv_die; ABG_ASSERT(get_canonical_die(die, equiv_die, @@ -11860,7 +11861,8 @@ compare_dies(const read_context& ctxt, Dwarf_Off l_offset = dwarf_dieoffset(const_cast(l)), r_offset = dwarf_dieoffset(const_cast(r)); Dwarf_Off l_canonical_die_offset = 0, r_canonical_die_offset = 0; - die_source l_die_source, r_die_source; + die_source l_die_source = NO_DEBUG_INFO_DIE_SOURCE, + r_die_source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(ctxt.get_die_source(l, l_die_source)); ABG_ASSERT(ctxt.get_die_source(r, r_die_source)); @@ -12700,7 +12702,7 @@ get_scope_for_die(read_context& ctxt, bool called_for_public_decl, size_t where_offset) { - die_source source_of_die; + die_source source_of_die = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(ctxt.get_die_source(die, source_of_die)); if (is_c_language(ctxt.cur_transl_unit()->get_language())) @@ -14141,7 +14143,7 @@ add_or_update_union_type(read_context& ctxt, if (tag != DW_TAG_union_type) return result; - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(ctxt.get_die_source(die, source)); { die_class_or_union_map_type::const_iterator i = @@ -16232,7 +16234,7 @@ read_debug_info_into_corpus(read_context& ctxt) static void maybe_canonicalize_type(const Dwarf_Die *die, read_context& ctxt) { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(ctxt.get_die_source(die, source)); size_t die_offset = dwarf_dieoffset(const_cast(die)); @@ -16445,7 +16447,7 @@ build_ir_node_from_die(read_context& ctxt, return result; } - die_source source_of_die; + die_source source_of_die = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(ctxt.get_die_source(die, source_of_die)); if ((result = ctxt.lookup_decl_from_die_offset(dwarf_dieoffset(die), diff --git a/tests/test-diff-filter.cc b/tests/test-diff-filter.cc index 000da6d..215485b 100644 --- a/tests/test-diff-filter.cc +++ b/tests/test-diff-filter.cc @@ -708,7 +708,8 @@ main() { is_ok = false; if (!t->diff_cmd.empty()) - system(t->diff_cmd.c_str()); + if (system(t->diff_cmd.c_str()) == -1) + cerr << "execution of '" << t->diff_cmd << "' failed\n"; if (!t->error_message.empty()) cerr << t->error_message << '\n'; } diff --git a/tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc index 51f117a..8e324da 100644 --- a/tests/test-diff-pkg.cc +++ b/tests/test-diff-pkg.cc @@ -840,7 +840,8 @@ main() { is_ok = false; if (!t->diff_cmd.empty()) - system(t->diff_cmd.c_str()); + if (system(t->diff_cmd.c_str()) == -1) + cerr << "execution of '" << t->diff_cmd << "' failed\n"; if (!t->error_message.empty()) cerr << t->error_message << '\n'; } diff --git a/tests/test-read-write.cc b/tests/test-read-write.cc index f32fc25..7d24bee 100644 --- a/tests/test-read-write.cc +++ b/tests/test-read-write.cc @@ -404,7 +404,8 @@ main() cerr << t->error_message << '\n'; if (!t->diff_cmd.empty()) - system(t->diff_cmd.c_str()); + if (system(t->diff_cmd.c_str()) == -1) + cerr << "execution of '" << t->diff_cmd << "' failed\n"; } } -- 1.8.3.1 --=-=-= Content-Type: text/plain -- Dodji --=-=-=--