From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1WE4LvzcpmBSZwAAWB0awg (envelope-from ) for ; Thu, 20 May 2021 18:04:44 -0400 Received: by simark.ca (Postfix, from userid 112) id AE1B81F11C; Thu, 20 May 2021 18:04:44 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 97AE71E813 for ; Thu, 20 May 2021 18:04:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBA023857C59; Thu, 20 May 2021 22:04:42 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id C8876385802B for ; Thu, 20 May 2021 22:04:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C8876385802B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E64B2ABCD; Thu, 20 May 2021 22:04:38 +0000 (UTC) From: Tom de Vries Subject: Re: [PATCH][gdb/breakpoint] Fix assert in jit_event_handler To: Simon Marchi , gdb-patches@sourceware.org References: <20210520152938.GA31635@delia> Message-ID: <4c38f520-bc5d-f2d0-fa90-d60a2f2dd6a3@suse.de> Date: Fri, 21 May 2021 00:04:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 5/20/21 6:22 PM, Simon Marchi wrote: > On 2021-05-20 11:29 a.m., Tom de Vries wrote: >> Hi, >> >> Consider a minimal test-case test.c: >> ... >> int main (void) { return 0; } >> ... >> which we can compile into llvm byte code using clang: >> ... >> $ clang -g -S -emit-llvm --target=x86_64-unknown-unknown-elf test.c >> ... >> and then run using lli, which uses the llvm jit: >> ... >> $ lli test.ll >> ... >> >> If we run this under gdb, we run into an assert: >> ... >> $ gdb -q -batch -ex run --args /usr/bin/lli test.ll >> Dwarf Error: Cannot not find DIE at 0x18a936e7 \ >> [from module libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug] > > I guess that's unrelated, but do you know if that error is a sign of > something wrong in GDB? > I assumed not (the last binary I checked where that message occurred was a case of invalid dwarf) but ... I did a readelf -wi and after 11G I did this grep: ... $ grep 18a936e7 READELF <3><18a936e7>: Abbrev Number: 175 (DW_TAG_subprogram) <18aa358f> DW_AT_specification: <0x18a936e7> $ ... So this looks like a GDB problem. I also did: ... $ gdb -q -readnow /usr/lib/debug/usr/lib64/libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug Reading symbols from /usr/lib/debug/usr/lib64/libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug... Expanding full symbols from /usr/lib/debug/usr/lib64/libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug... (gdb) ... so this could be something partial symbols related. A bit more info: ... Compilation Unit @ offset 0x18a23e52: ... <0><18a23e5d>: Abbrev Number: 1 (DW_TAG_compile_unit) <18a23e5e> DW_AT_producer : clang version 10.0.1 /home/abuild/rpmbuild/BUILD/llvm-10.0.1.src/stage1/bin/clang-10 --driver-mode=g++ -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I lib/ExecutionEngine/Orc -I ../lib/ExecutionEngine/Orc -I /usr/include/libxml2 -I include -I ../include -fmessage-length=0 -grecord-command-line -O2 -Wall -D _FORTIFY_SOURCE=0 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -D NDEBUG -fPIC -fvisibility-inlines-hidden -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -flto=thin -O2 -g -D NDEBUG -fno-exceptions -std=c++14 -MD -MT lib/ExecutionEngine/Orc/CMakeFiles/LLVMOrcJIT.dir/LLJIT.cpp.o -MF lib/ExecutionEngine/Orc/CMakeFiles/LLVMOrcJIT.dir/LLJIT.cpp.o.d -o lib/ExecutionEngine/Orc/CMakeFiles/LLVMOrcJIT.dir/LLJIT.cpp.o -c ../lib/ExecutionEngine/Orc/LLJIT.cpp <18a23e62> DW_AT_language : 33 (C++14) <18a23e64> DW_AT_name : ../lib/ExecutionEngine/Orc/LLJIT.cpp ... <1><18a936d4>: Abbrev Number: 71 (DW_TAG_subprogram) <2><18a936d5>: Abbrev Number: 174 (DW_TAG_class_type) <18a936d7> DW_AT_calling_convention: 5 (pass by value) <18a936d8> DW_AT_byte_size : 8 <18a936d9> DW_AT_decl_file : 185 <18a936da> DW_AT_decl_line : 78 <3><18a936db>: Abbrev Number: 9 (DW_TAG_member) <18a936dc> DW_AT_name : this <18a936e0> DW_AT_type : <0x18a8bb20> <18a936e4> DW_AT_decl_file : 185 <18a936e5> DW_AT_decl_line : 78 <18a936e6> DW_AT_data_member_location: 0 <3><18a936e7>: Abbrev Number: 175 (DW_TAG_subprogram) <18a936e9> DW_AT_name : operator() <18a936ed> DW_AT_decl_file : 185 <18a936ee> DW_AT_decl_line : 78 <18a936ef> DW_AT_type : <0x18a557ad> <18a936f3> DW_AT_declaration : 1 <18a936f3> DW_AT_external : 1 <18a936f3> DW_AT_accessibility: 1 (public) ... <1><18aa3589>: Abbrev Number: 251 (DW_TAG_subprogram) <18aa358b> DW_AT_linkage_name: _ZZN4llvm10ThreadPool4waitEvENK3$_1clEv <18aa358f> DW_AT_specification: <0x18a936e7> <18aa3593> DW_AT_inline : 1 (inlined) <18aa3594> DW_AT_object_pointer: <0x18aa3598> ... Compilation Unit @ offset 0x18aa33d6: ... Thanks, - Tom