This is the mail archive of the gcc-patches@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: x86_64 frame unwind info


On Wed, Oct 17, 2001 at 08:49:03PM +0200, Jan Hubicka wrote:
> + @item -fasynchronous-unwind-tables
> + @opindex funwind-tables
> + Generate unwind table in dwarf2 format, if supported by target machine.  The
> + table is exact at each instruction boundary, so it can be used for stack
> + unwinding from asynchronous events (such as debugger or garbage collector) and
> + is emit into eh section so it is not strip with debugging information.

I don't think you need to mention the EH section at all.  This 
is EH data you are emitting, so of course it goes in EH sections.

> !   if ((! flag_non_call_exceptions || !may_trap_p (PATTERN (insn)))
> !       && !flag_asynchronous_unwind_tables
> !       && GET_CODE (insn) == CALL_INSN)

Calling may_trap_p is wrong, as it doesn't actually handle the
interior of a CALL_INSN, and even if it did the information that
it would have used to determine that the call doesn't throw is
located on the REG_NOTES.  You were probably thinking of
can_throw_external || can_throw_internal, which is different.

> !   else if ((! flag_non_call_exceptions || !may_trap_p (PATTERN (insn)))
> ! 	   && !flag_asynchronous_unwind_tables
>   	   && cfa.reg != STACK_POINTER_REGNUM)

Checking may_trap_p here is wrong because it will definitely
be false for a stack adjustment insn, but we've not checked
may_trap_p on the intervening instructions.

You should realize that flag_non_call_exceptions currently implements
flag_asynchronous_unwind_tables.  For now you should just make
flag_non_call_exceptions imply flag_asynchronous_unwind_tables and
adjust dwarf2out appropriately.

Now, something that should arguably be checked here is for_eh.
If !for_eh, then this is .debug_frame, which is for debugger
consumption, which probably ought to keep the CFA up to date
all the time.  But for_eh isn't available here, and it would
take some restructuring to have for_eh discard information later.

> -       int any_eh_needed = 0;
> +       int any_eh_needed = flag_asynchronous_unwind_tables;

Much better.


r~


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