From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1751) id 5EE8B3858031; Sat, 26 Nov 2022 12:23:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EE8B3858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669465403; bh=ljG3a0x3fRz+SSxcZpnsn4rjO3c6qSht1Qxit0sFB0I=; h=From:To:Subject:Date:From; b=YTLuD81yc2oPA+8qmn+y6UELaMkzTEr8bgWjIttIr800+SiEJEYoyd+qi6rkkiPdI aApnpd/xguz1LKPD0X/gIhv57j+q4aU4HKs9qt7sYP/rrTRRVA7s9GxSu7ly/VnSJx 5RcHsmNtJpYlfI2UV/KDSJ1UgD7UXjc5CVqMJ/8Q= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Philippe Waroquiers To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix jump on uninit producer_is_clang bit of cu.h dwarf2_cu struct. X-Act-Checkin: binutils-gdb X-Git-Author: Philippe Waroquiers X-Git-Refname: refs/heads/master X-Git-Oldrev: ea118ff5b18763c3f9b3033e2c74b0d3eac4245b X-Git-Newrev: 14ae285f344fe76aff1d0da8366cd54599aea730 Message-Id: <20221126122323.5EE8B3858031@sourceware.org> Date: Sat, 26 Nov 2022 12:23:23 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D14ae285f344f= e76aff1d0da8366cd54599aea730 commit 14ae285f344fe76aff1d0da8366cd54599aea730 Author: Philippe Waroquiers Date: Sat Nov 26 12:43:58 2022 +0100 Fix jump on uninit producer_is_clang bit of cu.h dwarf2_cu struct. =20 Valgrind reports a "jump on unitialised bit error" when running e.g. gdb.base/macro-source-path.exp (see details below). =20 Fix this by initializing producer_is_clang member variable of dwarf= 2_cu. =20 Tested on amd64/debian11 and re-running gdb.base/macro-source-path.= exp under valgrind. =20 =3D=3D2140965=3D=3D Conditional jump or move depends on uninitialis= ed value(s) =3D=3D2140965=3D=3D at 0x5211F7: dwarf_decode_macro_bytes(dwarf2= _per_objfile*, buildsym_compunit*, bfd*, unsigned char const*, unsigned cha= r 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) =3D=3D2140965=3D=3D 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) =3D=3D2140965=3D=3D by 0x523BC4: dwarf_decode_macros(dwarf2_cu*,= unsigned int, int) (read.c:23379) =3D=3D2140965=3D=3D by 0x552AB5: read_file_scope(die_info*, dwar= f2_cu*) (read.c:9687) =3D=3D2140965=3D=3D by 0x54F7B2: process_die(die_info*, dwarf2_c= u*) (read.c:8660) =3D=3D2140965=3D=3D by 0x5569C7: process_full_comp_unit (read.c:= 8429) =3D=3D2140965=3D=3D by 0x5569C7: process_queue (read.c:7675) =3D=3D2140965=3D=3D by 0x5569C7: dw2_do_instantiate_symtab (read= .c:2063) =3D=3D2140965=3D=3D by 0x5569C7: dw2_instantiate_symtab(dwarf2_p= er_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085) =3D=3D2140965=3D=3D by 0x55700B: dw2_expand_symtabs_matching_one= (dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view, gdb::function_view) (read.c:3984) =3D=3D2140965=3D=3D by 0x557EA3: cooked_index_functions::expand_= symtabs_matching(objfile*, gdb::function_view, lo= okup_name_info const*, gdb::function_view, gdb::functio= n_view, enum_flags, doma= in_enum, search_domain) (read.c:18781) =3D=3D2140965=3D=3D by 0x778977: objfile::lookup_symbol(block_en= um, char const*, domain_enum) (symfile-debug.c:276) .... =3D=3D2140965=3D=3D Uninitialised value was created by a heap allo= cation =3D=3D2140965=3D=3D at 0x4839F01: operator new(unsigned long) (v= g_replace_malloc.c:434) =3D=3D2140965=3D=3D by 0x533A64: cutu_reader::cutu_reader(dwarf2= _per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev= _cache*) (read.c:6264) =3D=3D2140965=3D=3D by 0x5340C2: load_full_comp_unit(dwarf2_per_= cu_data*, dwarf2_per_objfile*, dwarf2_cu*, bool, language) (read.c:7729) =3D=3D2140965=3D=3D by 0x548338: load_cu(dwarf2_per_cu_data*, dw= arf2_per_objfile*, bool) (read.c:2021) =3D=3D2140965=3D=3D by 0x55634C: dw2_do_instantiate_symtab (read= .c:2048) =3D=3D2140965=3D=3D by 0x55634C: dw2_instantiate_symtab(dwarf2_p= er_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085) =3D=3D2140965=3D=3D by 0x55700B: dw2_expand_symtabs_matching_one= (dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view, gdb::function_view) (read.c:3984) =3D=3D2140965=3D=3D by 0x557EA3: cooked_index_functions::expand_= symtabs_matching(objfile*, gdb::function_view, lo= okup_name_info const*, gdb::function_view, gdb::functio= n_view, enum_flags, doma= in_enum, search_domain) (read.c:18781) =3D=3D2140965=3D=3D by 0x778977: objfile::lookup_symbol(block_en= um, char const*, domain_enum) (symfile-debug.c:276) .... Diff: --- gdb/dwarf2/cu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index e95208e2e75..af95725ebcf 100644 --- a/gdb/dwarf2/cu.c +++ b/gdb/dwarf2/cu.c @@ -39,6 +39,7 @@ dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, producer_is_icc (false), producer_is_icc_lt_14 (false), producer_is_codewarrior (false), + producer_is_clang (false), processing_has_namespace_info (false), load_all_dies (false) {