From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C7D693858D28 for ; Tue, 17 Jan 2023 18:09:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7D693858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.64] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6E07A1E0D3; Tue, 17 Jan 2023 13:09:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1673978985; bh=Ypk6Cw6suVTVYfjwGAWpENfNv6YyMLTh64kM8ulHoeI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=MfhGko9LNPnuptIX7f4n3dPAaGlRcA9VVQxiFlsGVl2Ix8kQ4BaqFnXREPsx5vYxS bhkWqLxWO+RGQDe0TWOGTbB5RUEJZ6oXTt7EOtEDdXxUb8BtuDpRxx9OE3rj++H+R3 6M6khoETAJeL8ioZv3hCCxcG9I1Hcz5VAP4DLbtg= Message-ID: Date: Tue, 17 Jan 2023 13:09:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v2 4/4] Fix parameter-less template regression in new DWARF reader Content-Language: fr To: Tom Tromey , gdb-patches@sourceware.org References: <20230110183338.2623088-1-tromey@adacore.com> <20230110183338.2623088-5-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20230110183338.2623088-5-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/10/23 13:33, Tom Tromey via Gdb-patches wrote: > PR c++/29896 points out a regression in the new DWARF reader. It does > not properly handle a case like "break fn", where "fn" is a template > function. > > This happens because the new index uses strncasecmp to compare. > However, to make this work correctly, we need a custom function that > ignores template parameters. > > This patch adds a custom comparison function and fixes the bug. A new > test case is included. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29896 Starting with this patch, I get (using _GLIBCXX_DEBUG): $83 = {void (void)} 0x555555556a82 ()> (gdb) PASS: gdb.cp/cpexprs-debug-types.exp: print flubber print policy1::function /usr/include/c++/11/bits/stl_algo.h:2105: In function: _FIter std::upper_bound(_FIter, _FIter, const _Tp&, _Compare) [with _FIter = gnu_debug::_Safe_iterator > >, std:: debug::vector, std::random_access_iterator_tag>; _Tp = std::cxx11::basic_string; _Compare = cooked_index::find(const string&, bool)::] Error: elements in iterator range [first, last) are not partitioned by the predicate __comp and value __val. Objects involved in the operation: iterator "first" @ 0x7ffcb7cf5430 { type = gnu_cxx::normal_iterator > > (mutable iterator); state = dereferenceable (start-of-sequence); references sequence with type 'std::debug::vector >' @ 0x611000098758 } iterator "last" @ 0x7ffcb7cf5480 { type = gnu_cxx::normal_iterator > > (mutable iterator); state = past-the-end; references sequence with type 'std::debug::vector >' @ 0x611000098758 } Fatal signal: Aborted ----- Backtrace ----- 0x560e18f13e2f gdb_internal_backtrace_1 /home/smarchi/src/binutils-gdb/gdb/bt-utils.c:122 0x560e18f14325 _Z22gdb_internal_backtracev /home/smarchi/src/binutils-gdb/gdb/bt-utils.c:168 0x560e19b71251 handle_fatal_signal /home/smarchi/src/binutils-gdb/gdb/event-top.c:956 0x7f0ac36a251f ??? 0x7f0ac36f6a7c ??? 0x7f0ac36a2475 ??? 0x7f0ac36887f2 ??? 0x7f0ac4069240 ??? 0x560e1956f665 upper_bound<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator > >, std::__debug::vector, std::random_access_iterator_tag>, std::__cxx11::basic_string, cooked_index::find(const string&, bool):: > /usr/include/c++/11/bits/stl_algo.h:2105 0x560e1956bd41 _ZN12cooked_index4findERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.c:376 0x560e1956d664 _ZN19cooked_index_vector4findERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.c:421 0x560e198a9748 _ZN22cooked_index_functions23expand_symtabs_matchingEP7objfileN3gdb13function_viewIFbPKcbEEEPK16lookup_name_infoNS3_IFbS5_EEENS3_IFbP15compunit_symtabEEE10enum_flagsI24block_search_flag_valuesE11domain_enum13search_domain /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:18747 0x560e1adc12c6 _ZN7objfile13lookup_symbolE10block_enumPKc11domain_enum /home/smarchi/src/binutils-gdb/gdb/symfile-debug.c:276 0x560e1ae99109 lookup_symbol_via_quick_fns /home/smarchi/src/binutils-gdb/gdb/symtab.c:2414 0x560e1ae99c80 lookup_symbol_in_objfile /home/smarchi/src/binutils-gdb/gdb/symtab.c:2543 0x560e1ae9a10a operator() /home/smarchi/src/binutils-gdb/gdb/symtab.c:2589 0x560e1aecff72 operator() /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/function-view.h:305 0x560e1aed000c _FUN /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/function-view.h:299 0x560e1a5cb694 _ZNK3gdb13function_viewIFbP7objfileEEclES2_ /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/function-view.h:289 0x560e1ac74071 svr4_iterate_over_objfiles_in_search_order /home/smarchi/src/binutils-gdb/gdb/solib-svr4.c:3456 0x560e18b8b7a1 _Z45gdbarch_iterate_over_objfiles_in_search_orderP7gdbarchN3gdb13function_viewIFbP7objfileEEES4_ /home/smarchi/src/binutils-gdb/gdb/gdbarch.c:4981 0x560e1ae9a8b3 lookup_global_or_static_symbol /home/smarchi/src/binutils-gdb/gdb/symtab.c:2586 0x560e1ae9ade2 _Z20lookup_global_symbolPKcPK5block11domain_enum /home/smarchi/src/binutils-gdb/gdb/symtab.c:2641 0x560e193f3f86 cp_basic_lookup_symbol /home/smarchi/src/binutils-gdb/gdb/cp-namespace.c:155 0x560e193fba75 cp_lookup_nested_symbol_1 /home/smarchi/src/binutils-gdb/gdb/cp-namespace.c:884 0x560e193fc85a _Z23cp_lookup_nested_symbolP4typePKcPK5block11domain_enum /home/smarchi/src/binutils-gdb/gdb/cp-namespace.c:975 0x560e1900fcb0 classify_inner_name /home/smarchi/src/binutils-gdb/gdb/c-exp.y:3172 0x560e1901136e c_yylex /home/smarchi/src/binutils-gdb/gdb/c-exp.y:3322 0x560e18fe729c _Z9c_yyparsev /home/smarchi/build/binutils-gdb/gdb/c-exp.c.tmp:2023 0x560e1901349a _Z7c_parseP12parser_state /home/smarchi/src/binutils-gdb/gdb/c-exp.y:3420 0x560e1a096ec5 _ZNK13language_defn6parserEP12parser_state /home/smarchi/src/binutils-gdb/gdb/language.c:618 0x560e1a637374 parse_exp_in_context /home/smarchi/src/binutils-gdb/gdb/parse.c:515 0x560e1a637b81 _Z16parse_expressionPKcP23innermost_block_trackerb /home/smarchi/src/binutils-gdb/gdb/parse.c:551 0x560e1a64ea7c process_print_command_args /home/smarchi/src/binutils-gdb/gdb/printcmd.c:1305 0x560e1a64ec7c print_command_1 /home/smarchi/src/binutils-gdb/gdb/printcmd.c:1319 0x560e1a64fb18 print_command /home/smarchi/src/binutils-gdb/gdb/printcmd.c:1452 Simon