This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: throwing exception when new fails


> Now the problem I've found is in frame.c. __throw calls
> __frame_state_for to obtain the function frame information. This
> ends up generating an ordered list of the fde's (what's FDE stand
> for?)

Frame Descriptor Element. There is one per function, and it describes
where the function code is located, and what the register lifetimes
and stack layout are within the function.

The data structures are defined in the DWARF specfication, although
not in a very readable way.

Every time an exception is thrown, the code needs to locate the FDE
for the current function, and starts to look for exception regions
from that FDE. This works in a two-level search:
a) in a linear search, find the shared image (i.e. DLL) containing
   the PC
b) using the FDE table for that shared object, locate the FDE using
   binary search (which requires the sorting)

> Suggestions?

If malloc fails, one could try to locate the FDE using linear search.
Of course, this means that there would be considerable computational
overhead, and the code implementing it would rarely be used and not
well tested (unless you design some unit testing for it).

Hope this helps,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]