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 30BF8382FC96 for ; Thu, 24 Nov 2022 16:13:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30BF8382FC96 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 CD12E1E112; Thu, 24 Nov 2022 11:13:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1669306393; bh=Jq47SPvS0ygB9N/ya3vlUU8NdcfWq0trqC4paQVJ9Eo=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SFXqEMBaVZw/XVy1XTzr5685DLlYeGZ6gvacWrhE9+jhzuM3WyeDN9fB0gsYNu/Kp sjiFGIFpO06wqQyIN6dIted5Y6YavupsakGAowW7ejqh4kp6YTpQdgM0LTHZzJMafz OVIUP/8OGm1mq0painnx+tb3DTHwkQYm2vtvL61A= Message-ID: Date: Thu, 24 Nov 2022 11:13:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [RFA] Fix jump on uninit producer_is_clang of cu.h, rm declared/undefined find_partial_die Content-Language: fr To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20221123113254.2771869-1-philippe.waroquiers@skynet.be> From: Simon Marchi In-Reply-To: <20221123113254.2771869-1-philippe.waroquiers@skynet.be> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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,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 11/23/22 06:32, Philippe Waroquiers via Gdb-patches wrote: > Valgrind reports a "jump on unitialised bit error" when running > e.g. gdb.base/macro-source-path.exp (see details below). > > Fix this by initializing producer_is_clang member variable of dwarf2_cu. > Also remove the declared but undefined/unused method > struct partial_die_info *find_partial_die (sect_offset sect_off); > > Tested on amd64/debian11 and re-running gdb.base/macro-source-path.exp > under valgrind. > > ==2140965== Conditional jump or move depends on uninitialised value(s) > ==2140965== at 0x5211F7: dwarf_decode_macro_bytes(dwarf2_per_objfile*, buildsym_compunit*, bfd*, unsigned char const*, unsigned char const*, macro_source_file*, line_header const*, dwarf2_section_info const*, int, int, unsigned int, dwarf2_section_info*, dwarf2_section_info*, gdb::optional, htab*, dwarf2_cu*) (macro.c:676) > ==2140965== by 0x52158A: dwarf_decode_macros(dwarf2_per_objfile*, buildsym_compunit*, dwarf2_section_info const*, line_header const*, unsigned int, unsigned int, dwarf2_section_info*, dwarf2_section_info*, gdb::optional, int, dwarf2_cu*) (macro.c:967) > ==2140965== by 0x523BC4: dwarf_decode_macros(dwarf2_cu*, unsigned int, int) (read.c:23379) > ==2140965== by 0x552AB5: read_file_scope(die_info*, dwarf2_cu*) (read.c:9687) > ==2140965== by 0x54F7B2: process_die(die_info*, dwarf2_cu*) (read.c:8660) > ==2140965== by 0x5569C7: process_full_comp_unit (read.c:8429) > ==2140965== by 0x5569C7: process_queue (read.c:7675) > ==2140965== by 0x5569C7: dw2_do_instantiate_symtab (read.c:2063) > ==2140965== by 0x5569C7: dw2_instantiate_symtab(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085) > ==2140965== by 0x55700B: dw2_expand_symtabs_matching_one(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view, gdb::function_view) (read.c:3984) > ==2140965== by 0x557EA3: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view, lookup_name_info const*, gdb::function_view, gdb::function_view, enum_flags, domain_enum, search_domain) (read.c:18781) > ==2140965== by 0x778977: objfile::lookup_symbol(block_enum, char const*, domain_enum) (symfile-debug.c:276) > .... > ==2140965== Uninitialised value was created by a heap allocation > ==2140965== at 0x4839F01: operator new(unsigned long) (vg_replace_malloc.c:434) > ==2140965== by 0x533A64: cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) (read.c:6264) > ==2140965== by 0x5340C2: load_full_comp_unit(dwarf2_per_cu_data*, dwarf2_per_objfile*, dwarf2_cu*, bool, language) (read.c:7729) > ==2140965== by 0x548338: load_cu(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2021) > ==2140965== by 0x55634C: dw2_do_instantiate_symtab (read.c:2048) > ==2140965== by 0x55634C: dw2_instantiate_symtab(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085) > ==2140965== by 0x55700B: dw2_expand_symtabs_matching_one(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view, gdb::function_view) (read.c:3984) > ==2140965== by 0x557EA3: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view, lookup_name_info const*, gdb::function_view, gdb::function_view, enum_flags, domain_enum, search_domain) (read.c:18781) > ==2140965== by 0x778977: objfile::lookup_symbol(block_enum, char const*, domain_enum) (symfile-debug.c:276) > .... > --- > gdb/dwarf2/cu.c | 1 + > gdb/dwarf2/cu.h | 2 -- > 2 files changed, 1 insertion(+), 2 deletions(-) Both changes are ok (you can add my Approved-By), but please push a separate patch for each change. Simon