[Dwarf-discuss] Re: dwarf2 question

Mathieu Lacage Mathieu.Lacage
Thu Mar 3 02:21:33 GMT 2005

On Wed, 2005-03-02 at 08:50 -0800, Michael Eager wrote:
> Mathieu Lacage wrote:
> > hi michael,
> > 
> > I am not sure this question would be apropriate to the dwarf mailing
> > list so I thought I could ask you and well, hope for the best :)
> > 
> > I wonder whether it is safe to assume that the abbreviation code of an
> > abbreviation declaration is strictly increasing over a compilation unit.
> > (see section 7.5.3 of the dwarf2 spec). i.e.: I wonder whether the
> > abbreviation code of the abbreviation declaration is necessarily higher
> > than the abbreviation code of the current declaration. 
> > 
> > If this was the case, then it would be sort of nice because it would be
> > possible not to start from the beginning of the array of abbreviation
> > declarations or to stop before the end of the array if you already know
> > the location of a few abbreviation declarations...
> I think this would be a reasonable question for the mailing list.

Ok, I will try it next time.

> There is no ordering specified in the spec, so I can't say that it
> is safe to assume that abbrevitions are in ascending order.  On the
> other hand, I believe most compilers write the abbrev section from
> a fixed list, which would (most likely) be in order.
> The design of the abbrev section allows a compiler to dynamically
> generate abbreviations, which might not be in order.
> Given that the abbrev table has variable length entries, most
> compilers would read the table into memory and create an index
> so that one could quickly find the desired abbrev entry.  That way
> the question of whether the entries are in order becomes moot.

Yes, I am trying to write a parser which uses a minimum amount of memory
but which is reasonably efficient.

I guess I can assume they are in ascending order since at least the
tables generated by gcc seem to be in ascending order and if I cannot
find what I am looking for, I can easily revert to simply parsing the
whole table. Of course, this will be probably less efficient if they are
never in order but well...

thank you for your answer,

More information about the Dwarf-discuss mailing list