Re: Question re symbols, symtabs and blocks

Simon Marchi via Gdb
2024-08-29T14:41:52Z

On 2024-08-28 06:08, Jan Vrany via Gdb wrote:
> Hi,
>
> in GDB, are there any constraints for blocks belonging to
> to particular symtab? Like: must each blocks' start and end address
> be within its superblocks' start and end address?

This is how my mental model works, that children blocks must be entirely
within their parents (even considering that blocks may be
non-contiguous), but I don't have proof of that. It's just what would
make sense to me.

> Also, must blocks of different symtabs be always disjunct
> (meaning, their start-end ranges must not overlap)?

What kind of symtab are you talking about? "struct symtab" or "struct
compunit_symtab"? I don't think that blocks care about "struct symtab".
However, blocks are part of a blockvector, and each compunit_symtab has
its own blockvector. So my intuition is that blocks belonging to
different compunit_symtabs should be disjoint, as compilation unit
address ranges are typically disjoints. But then I don't know if there
are weird cases, for instance I don't know how LTO affects this, if
compilation units start sharing some code.

Simon