On Mon, Jul 26, 2021 at 11:34 PM Hafiz Abid Qadeer <abid_qad...@mentor.com> wrote: > > On 22/07/2021 12:52, Richard Biener wrote: > > On Thu, Jul 22, 2021 at 1:48 PM Jakub Jelinek <ja...@redhat.com> wrote: > >> > >> On Thu, Jul 22, 2021 at 01:43:49PM +0200, Richard Biener wrote: > >>> So I think we need to get to an agreement between the debug info > >>> producer and consumer here. > >>> Usually the DWARF spec is not of much help here. > >> > >> It is something that needs to be discussed for DWARF 6, currently indeed > >> can > >> be solved only with some DWARF extensions we'd need to invent. > > > > I mean, the question is what should the concrete instance inherit from > > the abstract instance - IMHO parent-child relationship is one thing, no? > > I guess the problem is that pointer is one-sided from concrete to abstract. > With this change, one > can go from concrete child function to abstract child (and abstract parent). > But it is not easy to > find the concrete parent for the consumer as there is no link from abstract > to concrete.
Yes, that's true - there could be a one-to-many relationship there. But then I wonder in which case such lookup in the DIE tree would be the correct thing to do. If I lookup a variable from the parent then the concrete instance of that should be found by unwinding unless it is a static variable in which case the lookup can be done in any of the concrete instances. But then the original issue that the consumer skips the function if it doesn't have a PC range and thus skips over childs looks like an invalid optimization. Btw, the situation you run into can be simulated by int main(int argc, char **argv) { void foo () { __builtin_puts ("bar"); } foo (); return 0; } and compiling with -g -flto -flto-partition=max which forces main and foo into different LTRANS units and get's us <1><114>: Abbrev Number: 2 (DW_TAG_subprogram) <115> DW_AT_abstract_origin: <0x155> <2><119>: Abbrev Number: 3 (DW_TAG_subprogram) <11a> DW_AT_abstract_origin: <0x179> <11e> DW_AT_low_pc : 0x400515 <126> DW_AT_high_pc : 0x19 <12e> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <130> DW_AT_static_link : 4 byte block: 91 68 6 6 (DW_OP_fbreg: -2 gdb then fails to see 'foo' at all (cannot break on it) and the lookup of 'argc' inside it fails (setting a breakpoint also fails without -flto-partition=max, but I can print argc just fine). I suggest you file a bug with gdb and see how that resolves. Richard. > > Thanks, > -- > Hafiz Abid Qadeer > Mentor, a Siemens Business