[Dwarf-discuss] Ranges for DW_TAG_namespace

2023-09-14 Thread rifkin.jer--- via Dwarf-discuss
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


Re: [Dwarf-discuss] Ranges for DW_TAG_namespace

2023-09-14 Thread Robinson, Paul via Dwarf-discuss
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

From: Dwarf-discuss 
 On Behalf Of 
rifkin.jer--- via Dwarf-discuss
Sent: Thursday, September 14, 2023 6:51 PM
To: dwarf-discuss@lists.dwarfstd.org
Subject: [Dwarf-discuss] Ranges for DW_TAG_namespace

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


Re: [Dwarf-discuss] Ranges for DW_TAG_namespace

2023-09-14 Thread Greg Clayton via Dwarf-discuss
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. 

> On Sep 14, 2023, at 3:50 PM, rifkin.jer--- via Dwarf-discuss 
>  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


Re: [Dwarf-discuss] Ranges for DW_TAG_namespace

2023-09-14 Thread rifkin.jer--- via Dwarf-discuss
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  
Sent: Thursday, September 14, 2023 9:22 PM
To: rifkin@gmail.com
Cc: DWARF Discuss 
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.robin...@sony.com 

Sent: Thursday, September 14, 2023 7:51 PM
To: rifkin@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
mailto: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