Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH][gdb/breakpoint] Fix assert in jit_event_handler
Date: Fri, 21 May 2021 00:04:38 +0200	[thread overview]
Message-ID: <4c38f520-bc5d-f2d0-fa90-d60a2f2dd6a3@suse.de> (raw)
In-Reply-To: <ec0a73be-8cb8-3fa3-36b4-f514a53e0343@polymtl.ca>

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

  reply	other threads:[~2021-05-20 22:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 15:29 Tom de Vries
2021-05-20 16:22 ` Simon Marchi via Gdb-patches
2021-05-20 22:04   ` Tom de Vries [this message]
2021-05-21 19:12     ` Tom de Vries
2021-05-21 11:27   ` Tom de Vries
2021-05-21 14:07     ` Simon Marchi via Gdb-patches
2021-05-24 15:20     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c38f520-bc5d-f2d0-fa90-d60a2f2dd6a3@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox