[lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-15 Thread xgsa via lldb-dev
Hi, I am working on issue that in C++ program for some complex cases with templates showing dynamic type based on RTTI in lldb doesn't work properly. Consider the following example:enum class TagType : bool {    Tag1 }; struct I {    virtual ~I() = default; }; template struct Impl : pu

[lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-15 Thread xgsa via lldb-dev
Sorry, I probably shouldn't have used HTML for that message. Converted to plain text. Original message 15.12.2017, 18:01, "xgsa" : Hi, I am working on issue that in C++ program for some complex cases with templates showing dynamic type based on RTTI in lldb doesn't work prope

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-15 Thread Jim Ingham via lldb-dev
First off, just a technical point. lldb doesn't use RTTI to find dynamic types, and in fact works for projects like lldb & clang that turn off RTTI. It just uses the fact that the vtable symbol for an object demangles to: vtable for CLASSNAME That's not terribly important, but I just wanted t

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-18 Thread xgsa via lldb-dev
Thank you for clarification, Jim, you are right, I misunderstood a little bit what lldb actually does. It is not that the compiler can't be fixed, it's about the fact that relying on correspondence of mangled and demangled forms are not reliable enough, so we are looking for more robust alterna

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-18 Thread Tamas Berghammer via lldb-dev
Hi Anton and Jim, What do you think about storing the mangled type name or the mangled vtable symbol name somewhere in DWARF in the DW_AT_MIPS_linkage_name attribute? We are already doing it for the mangled names of functions so extending it to types shouldn't be too controversial. Tamas On Mon,

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-18 Thread Robinson, Paul via lldb-dev
sa Cc: lldb-dev@lists.llvm.org Subject: Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols Hi Anton and Jim, What do you think about storing the mangled type name or the mangled vtable symbol name somewhere in DWARF i

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-18 Thread xgsa via lldb-dev
Hi Tamas, First, why DW_AT_MIPS_linkage_name, but not just DW_AT_linkage_name? The later is standartized and currently generated by clang at least on x64. Second, this doesn't help to solve the issue, because this will require parsing all the DWARF types during startup to build a map that breaks DW

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-19 Thread Tamas Berghammer via lldb-dev
Hi, I thought most compiler still emits DW_AT_MIPS_linkage_name instead of the standard DW_AT_linkage_name but I agree that if we can we should use the standard one. Regarding performance we have 2 different scenarios. On Apple platforms we have the apple accelerator tables to improve load time (

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-19 Thread Greg Clayton via lldb-dev
I agree with Tamas. The right way to do this it to add the DW_AT_linkage_name to the class. Apple accelerator tables have many different forms, but one is a mapping of type name to exact DIE offset (in the __DWARF_ segment in the __apple_types section). If the mangled name was added to the class

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-19 Thread Anton Gorenkov via lldb-dev
Tamas, Greg, thank you, I got the idea how it should work without accelerator tables, but I still cannot figure out how to use/update the existing accelerator tables. So let me walk trough it once again:   1. It is necessary to perform lookup by mangled name (as all we initially have is mangled

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-19 Thread Greg Clayton via lldb-dev
> On Dec 19, 2017, at 12:33 PM, Anton Gorenkov wrote: > > Tamas, Greg, thank you, I got the idea how it should work without accelerator > tables, but I still cannot figure out how to use/update the existing > accelerator tables. So let me walk trough it once again: > 1. It is necessary to pe

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-19 Thread Anton Gorenkov via lldb-dev
19.12.2017 23:12, Greg Clayton wrote: On Dec 19, 2017, at 12:33 PM, Anton Gorenkov > wrote: Tamas, Greg, thank you, I got the idea how it should work without accelerator tables, but I still cannot figure out how to use/update the existing accelerator tables. So let me

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-20 Thread Pavel Labath via lldb-dev
On 19 December 2017 at 17:39, Greg Clayton via lldb-dev wrote: > The apple accelerator tables are only enabled for Darwin target, but there > is nothing to say we couldn't enable these for other targets in ELF files. > It would be a quick way to gauge the performance improvement that these > accel

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-20 Thread Greg Clayton via lldb-dev
> On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: > > On 19 December 2017 at 17:39, Greg Clayton via lldb-dev > wrote: >> The apple accelerator tables are only enabled for Darwin target, but there >> is nothing to say we couldn't enable these for other targets in ELF files. >> It would be a qu

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-20 Thread Ted Woodward via lldb-dev
> -Original Message- > From: lldb-dev [mailto:lldb-dev-boun...@lists.llvm.org] On Behalf Of Greg > Clayton via lldb-dev > Sent: Wednesday, December 20, 2017 12:41 PM > To: Pavel Labath > Cc: lldb-dev@lists.llvm.org > Subject: Re: [lldb-dev] Resolving dynamic type b

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-20 Thread Frédéric Riss via lldb-dev
PM >> To: Pavel Labath >> Cc: lldb-dev@lists.llvm.org >> Subject: Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of >> type names inequality in DWARF and mangled symbols >> >> >> Modifying llvm-dsymutil to handle ELF so we can use "

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Pavel Labath via lldb-dev
On 20 December 2017 at 18:40, Greg Clayton wrote: > >> On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: >> >> On 19 December 2017 at 17:39, Greg Clayton via lldb-dev >> wrote: >>> The apple accelerator tables are only enabled for Darwin target, but there >>> is nothing to say we couldn't enable

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread xgsa via lldb-dev
21.12.2017, 13:45, "Pavel Labath via lldb-dev" : > On 20 December 2017 at 18:40, Greg Clayton wrote: >>>  On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: >>> >>>  On 19 December 2017 at 17:39, Greg Clayton via lldb-dev >>>   wrote:  The apple accelerator tables are only enabled for Darwin t

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Pavel Labath via lldb-dev
On 21 December 2017 at 12:29, xgsa wrote: > 21.12.2017, 13:45, "Pavel Labath via lldb-dev" : >> On 20 December 2017 at 18:40, Greg Clayton wrote: On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: On 19 December 2017 at 17:39, Greg Clayton via lldb-dev wrote: > The app

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Greg Clayton via lldb-dev
> On Dec 21, 2017, at 2:45 AM, Pavel Labath wrote: > > On 20 December 2017 at 18:40, Greg Clayton > wrote: >> >>> On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: >>> >>> On 19 December 2017 at 17:39, Greg Clayton via lldb-dev >>> wrote: The apple accelerator

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Greg Clayton via lldb-dev
> On Dec 21, 2017, at 4:58 AM, Pavel Labath wrote: > > On 21 December 2017 at 12:29, xgsa mailto:x...@yandex.ru>> > wrote: >> 21.12.2017, 13:45, "Pavel Labath via lldb-dev" : >>> On 20 December 2017 at 18:40, Greg Clayton wrote: > On Dec 20, 2017, at 3:33 AM, Pavel Labath wrote: > >>

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Pavel Labath via lldb-dev
On 21 December 2017 at 10:45, Pavel Labath wrote: > I'm not sure now whether you're suggesting to use the dsymutil > approach just to gauge the potential speedup we can obtain and get > people interested, or as a productized solution. If it's the first one > then I fully agree with you. Although I

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Greg Clayton via lldb-dev
> On Dec 21, 2017, at 8:23 AM, Pavel Labath wrote: > > On 21 December 2017 at 10:45, Pavel Labath wrote: >> I'm not sure now whether you're suggesting to use the dsymutil >> approach just to gauge the potential speedup we can obtain and get >> people interested, or as a productized solution. If

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Pavel Labath via lldb-dev
That's not the case, the nested debugger get's stopped in CommandObjectTargetCreate::DoExecute before it even touches the /bin/ls file. I could have passed anything there (probably /bin/ls wasn't the best choice though), it's just this was the easiest thing I came up with for stopping at a place wi

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-21 Thread Greg Clayton via lldb-dev
I wonder if making indexing multi-threaded has solved speed issues? > On Dec 21, 2017, at 8:54 AM, Pavel Labath wrote: > > That's not the case, the nested debugger get's stopped in > CommandObjectTargetCreate::DoExecute before it even touches the > /bin/ls file. I could have passed anything ther

Re: [lldb-dev] Resolving dynamic type based on RTTI fails in case of type names inequality in DWARF and mangled symbols

2017-12-22 Thread Pavel Labath via lldb-dev
On 21 December 2017 at 16:22, Greg Clayton wrote: > > > The main idea is to touch as few pages as possible when doing searches. We > effectively have this scenario right now with Apple DWARF in .o file > debugging. So much time is spent paging in each accelerator table that we > have very long del