From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5DC65385780D for ; Thu, 4 Nov 2021 20:05:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5DC65385780D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 1A4K4rtn021742 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Nov 2021 16:04:58 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1A4K4rtn021742 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BB4DA1EDDB; Thu, 4 Nov 2021 16:04:53 -0400 (EDT) Message-ID: <972f3e77-0788-e0e7-e524-e8617e4a4aee@polymtl.ca> Date: Thu, 4 Nov 2021 16:04:53 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH] gdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests Content-Language: en-US To: Tom de Vries , Simon Marchi , gdb-patches@sourceware.org References: <20211102203434.3889269-1-simon.marchi@efficios.com> <39183fd0-d31d-feb4-9cfd-8c928b5eaf06@suse.de> From: Simon Marchi In-Reply-To: <39183fd0-d31d-feb4-9cfd-8c928b5eaf06@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 4 Nov 2021 20:04:53 +0000 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2021 20:05:02 -0000 On 2021-11-03 06:24, Tom de Vries via Gdb-patches wrote: > On 11/2/21 9:34 PM, Simon Marchi via Gdb-patches wrote: >> We see some additional failures when running the testsuite against a GDB >> compiled with ASan, compared to a GDB compiled without ASan. Some of >> them are caused by the memory leak report shown by the GDB process when >> it exits, and the fact that it makes it exit with a non-zero exit code. >> >> I generally try to remember to set ASAN_OPTIONS=detect_leaks=0 in my >> environment when running the tests, but I don't always do it. I think >> it would be nice if the testsuite did it. I don't see any use to have >> leak detection when running the tests. That is, unless we ever have a >> test that ensures GDB doesn't leak memory, which isn't going to happen >> any time soon. >> > > I like the idea. I also use the setting in my test scripts. > > FWIW, in addition, I also use "alloc_dealloc_mismatch=0", that error was > triggered at some point. I've just done a run without this setting, and > it didn't trigger anything. > > I tried to understand why, and stumbled onto > https://sourceware.org/pipermail/gdb-patches/2021-May/178413.html , > which seems to have been approved, but never committed. The problem > described there, using LD_PRELOAD like so: > ... > $ LD_PRELOAD=/usr/lib64/libasan.so.6 ./gdb > ... > does reproduce for me, and applying the patch fixes it. I've done a > build and test run, and will commit shortly. > > Also there a few test-cases which fail when using asan, we could > annotate those perhaps with abort_on_error=1 or some such. Starting with this commit, I get these 4 errors with clang 12, in a non-ASan build. The 2 -Wimplicit-exception-spec-mismatch can be fixed by adding "noexcept", but I don't know about the -Wmissing-prototypes ones. It might indicate that the prototype of the functions isn't right, but I can't find the problem. Note that with Clang, I build with -std=gnu++17 in CXXFLAGS to avoid the problem with gnulib headers in the string_view selftests. $ clang++ -DHAVE_CONFIG_H -I. -I/home/simark/src/binutils-gdb/gdbsupport -I/home/simark/src/binutils-gdb/gdbsupport/../include -I/home/simark/src/binutils-gdb/gdbsupport/../gdb -I../gnulib/import -I/home/simark/src/binutils-gdb/gdbsupport/../gnulib/import -I.. -I/home/simark/src/binutils-gdb/gdbsupport/.. -I../bfd -I/home/simark/src/binutils-gdb/gdbsupport/../bfd -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-mismatched-tags -Wno-error=deprecated-register -Wsuggest-override -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wmissing-prototypes -Wformat -Wformat-nonliteral -Werror -std=gnu++17 -g3 -O0 -D_GLIBCXX_DEBUG=1 -MT new-op.o -MD -MP -MF .deps/new-op.Tpo -c -o new-op.o /home/simark/src/binutils-gdb/gdbsupport/new-op.cc /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:102:1: error: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Werror,-Wimplicit-exception-spec-mismatch] operator delete (void *p) ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0/new:130:6: note: previous declaration is here void operator delete(void*) _GLIBCXX_USE_NOEXCEPT ^ /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:114:1: error: no previous prototype for function 'operator delete' [-Werror,-Wmissing-prototypes] operator delete (void *p, std::size_t) noexcept ^ /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:113:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void ^ static /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:120:1: error: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Werror,-Wimplicit-exception-spec-mismatch] operator delete[] (void *p) ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0/new:132:6: note: previous declaration is here void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT ^ /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:132:1: error: no previous prototype for function 'operator delete[]' [-Werror,-Wmissing-prototypes] operator delete[] (void *p, std::size_t) noexcept ^ /home/simark/src/binutils-gdb/gdbsupport/new-op.cc:131:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void ^ static 4 errors generated. Simon