On 27/07/2021 09:39, Richard Biener wrote: > 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.
I have filed https://sourceware.org/bugzilla/show_bug.cgi?id=28147 for this issue. Thanks, -- Hafiz Abid Qadeer Mentor, a Siemens Business