GCC for AArch64 never emits CFI in debug_frame
Alexander Fedotov
alfedotov@gmail.com
Fri Oct 5 14:51:00 GMT 2018
According to http://wiki.dwarfstd.org/index.php?title=Exception_Handling#Relationship_with_DWARF
current GCC behavior for aarch64 simply violates DWARF standard that
in turn doesn't define EH.
p.s. I've also found a note that .eh_frame uses different numbering of
registers than .debug_frame on PPC target
(https://www.sourceware.org/ml/binutils/2009-10/msg00028.html)
Alex
On Fri, Oct 5, 2018 at 4:09 PM Alexander Fedotov <alfedotov@gmail.com> wrote:
>
> >>So I presume this is done to avoid wasting space with duplicate information.
> Well yes, I had the same thought too. But seems like it is makes no
> sense because you can disable/strip debug sections.
>
> But the major problem that I've seen is that non-GDB debugger expects
> CFI in debug_frame section but not eh_frame. And their point is pretty
> strong - eh_frame is just for EH, not for debugging. purposes.
> GDB is smart enough to use this info from eh_frame but it is not
> specified for architecture in documents (or I was unable to find it).
>
>
> Alex
> On Fri, Oct 5, 2018 at 3:33 PM Richard Earnshaw (lists)
> <Richard.Earnshaw@arm.com> wrote:
> >
> > On 05/10/18 13:27, Kyrill Tkachov wrote:
> > > Hi Alex,
> > >
> > > I'm forwarding this to the gcc-help list which is the appropriate place
> > > for this discussion.
> > > gcc-bugs is for automated emails from the bug tracker and your mail is
> > > likely to get lost in there.
> > >
> > > Thanks,
> > > Kyrill
> > >
> > > On 05/10/18 13:24, Alexander Fedotov wrote:
> > >> Hello
> > >>
> > >> I've noticed that for C++ translation unit GCC for aarch64 always
> > >> emits CFI into eh_frame but never debug_frame even if debug
> > >> information is enabled. Tried on GCC versions 6 to 8.
> > >> DWARF for the ARM 64-bit architecture (AArch64) states that it must be
> > >> debug_frame
> > >> ((https://static.docs.arm.com/ihi0057/b/IHI0057B_aadwarf64.pdf)
> > >> GAS supports emitting CFI to both sections by directive: .cfi_sections
> > >> .debug_frame,.eh_frame
> > >>
> > >> At the same time gcc for arm emits CFI in both debug_frame and .ARM.exidx
> > >>
> > >> I'm aware about CFI for Exception Handling. But what the reason to not
> > >> emit both ?
> > >> Is there any implicit reason for that or it's just a bug ?
> >
> > On Arm, the .ARM.exidx data is insufficient for debugging, so we
> > certainly need the additional information in the dwarf unwinding tables.
> > On AArch64 that's not true, the information is complete enough for a
> > debugger to use. So I presume this is done to avoid wasting space with
> > duplicate information.
> >
> > What do other targets that use dwarf exception unwinding do?
> >
> > R.
> >
> > >>
> > >> Steps to reproduce:
> > >>
> > >> cat > test.cpp <<EOF
> > >> int foo() {
> > >> return 0;
> > >> }
> > >> EOF
> > >>
> > >> ./aarch64-none-elf-gcc -c -g test.cpp -o test_cpp.o &&
> > >> ./aarch64-none-elf-objdump -g test_cpp.o | grep -B 3 "CIE" | grep
> > >> "_frame"
> > >> Contents of the .eh_frame section:
> > >>
> > >> While for C code it does:
> > >> cat > test.c <<EOF
> > >> int foo() {
> > >> return 0;
> > >> }
> > >> EOF
> > >>
> > >> ./aarch64-none-elf-gcc -c -g test.c -o test_c.o &&
> > >> ./aarch64-none-elf-objdump -g test_c.o | grep -B 3 "CIE" | grep
> > >> "_frame"
> > >> Contents of the .debug_frame section:
> > >>
> > >>
> > >> Alex
> > >
> >
>
>
> --
> Best regards,
> AF
--
Best regards,
AF
More information about the Gcc-help
mailing list