[Dwarf-Discuss] debug_names - what should go in ?

Greg Clayton clayborg@gmail.com
Wed Apr 11 18:23:50 GMT 2018



> On Apr 11, 2018, at 4:45 AM, Pavel Labath via Dwarf-Discuss <dwarf-discuss at lists.dwarfstd.org> wrote:
> 
> Thank you all for the feedback. There seems to be general consensus that enumerators should be present in the name index.
> 
> However, I am starting to have second thoughts about imported declarations. While the entities they declare are (can be) global in the sense that they are not (don't have to be) inside a function, they are also *local* in the sense that they are valid only inside one compilation unit -- just because one .cpp file does a "namespace X = foo:bar", it does not mean that everyone can refer to these entities that way.
> 
> The example of "using namespace a" in Greg's very informative response made my realize I may be going about this the wrong way. If I were to represent every name imported by "using namespace std", I would have to create thousands of entries. That seems like a bad idea, and totally unnecessary, as lldb seems to handle the "using namspace" case just fine without this.
> 
> Greg, could you elaborate on how this works? Do we just parse the compilation unit we are stopped in and pick out the "using" declarations from there? If that is the case, then why doesn't the namespace alias declaration work as well ? The expression 2 from my example fails in lldb. Could it be that it's just an lldb bug, and that we don't need to change anything in the accelerator tables?

Since we use clang as our expression parser, we get asked about each name as the expression parser runs into it. So for namesp2::var we would first get asked about "namesp2" and we probably tried to look that up in our tables and found nothing. I believe our expression parser does try to determine using directives using the debug info, but I would defer to the expression parsing folks as I remember hearing about that, but don't remember what was done about it. So it is probably failing due to "namesp2" not being the accelerator tables that causes it to fail. I am pretty sure we don't add imported declarations to our tables.
 
> 
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org




More information about the Dwarf-discuss mailing list