[Dwarf-discuss] Ranges for DW_TAG_namespace

David Blaikie dblaikie@gmail.com
Wed Sep 20 17:13:08 GMT 2023


If what you're searching for could be encoded in the fast lookup
tables (.debug_names) that could save you some parsing effort.

Otherwise, if you're searching for an address and you have a lot of
non-addressable DWARF, or really large CUs or something - I can see
how namespace address ranges could help. You could always experiment
with it - implement support in your compiler of choice (assuming it's
open source/you have access to its source) for ranges on namespaces -
the encoding might not be too bad since we have a way to reference an
address range list from another range list, so the namespace's range
list could reference each subprogram's range list, if that's the best
encoding. And if it seems to be useful, could propose it as a DWARF
feature (pretty low cost feature in terms of wording, just saying
"hey, if you like, you can put ranges on namespaces" - the DWARF spec
doesn't need to tell you you can do it, you're allowed to do it
without that explicit allowance, but having the suggestion in the spec
might be nice - if it's a feature worth having)

On Thu, Sep 14, 2023 at 9:51 PM rifkin.jer--- via Dwarf-discuss
<dwarf-discuss@lists.dwarfstd.org> wrote:
>
> Hello,
>
> Thank you both so much for the quick replies. Thank you for clarifying that the expectation is to unconditionally traverse DIEs within a CU when looking for a subprogram. I am currently working with some executables which have large namespace sections that would be nice to skip over completely while querying symbols. Preprocessing this information may be the next best thing, but I will have to benchmark to see if it is beneficial. Despite namespaces not being program entities I had incorrectly assumed there would be some encoding of this information. The space vs time tradeoff is perhaps not entirely clear though.
>
>
>
> Thank you again,
>
> Jeremy
>
>
>
> From: Greg Clayton <clayborg@gmail.com>
> Sent: Thursday, September 14, 2023 9:22 PM
> To: rifkin.jer@gmail.com
> Cc: DWARF Discuss <dwarf-discuss@lists.dwarfstd.org>
> Subject: Re: [Dwarf-discuss] Ranges for DW_TAG_namespace
>
>
>
> When searching for addresses we first see if the compile unit's DW_AT_ranges (or low/high pc) attribute contains the address we are looking for. Any CU that doesn't contain the address doesn't need to have its child DIEs parsed, just the top level DW_TAG_compile_unit DIE. Then we iterate over all the DIEs always descending into all of the children looking for DW_TAG_subprogram entries that contain the address we are looking for. So if we see a DW_TAG_namespace we just call recursively to parse its children.
>
>
>
> From: Robinson, Paul paul.robinson@sony.com
> Sent: Thursday, September 14, 2023 7:51 PM
> To: rifkin.jer@gmail.com; dwarf-discuss@lists.dwarfstd.org
> Subject: RE: [Dwarf-discuss] Ranges for DW_TAG_namespace
>
>
>
> I suppose it didn’t seem useful to provide ranges on namespaces. A C++ namespace isn’t a program entity of its own, it’s a way of managing names of entities. It doesn’t even restrict the scope of those names; you can refer to them anywhere if you use the fully qualified version of the name. (With the obvious caveat about names defined in anonymous namespaces.)
>
>
>
> Did you have a reason for considering a namespace to be a program entity? What would that entity do?
>
> --paulr
>
>
>
>
>
> On Sep 14, 2023, at 3:50 PM, rifkin.jer--- via Dwarf-discuss <dwarf-discuss@lists.dwarfstd.org> wrote:
>
>
>
> Hello,
>
> What is the reasoning for not including range information on DW_TAG_namespace DIEs? Is there a canonical way to check if a DW_TAG_namespace DIE contains a given address?
>
>
>
> Thank you,
>
> Jeremy
>
> --
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss
>
>
>
> --
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss


More information about the Dwarf-discuss mailing list