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]
Other format: [Raw text]

Re: LSDA unwind information is off by one (in __gcc_personality_v0)


On 10/20/2016 11:51 AM, Florian Weimer wrote:
exception handling region.  Subtracting 1 is an extremely hackish way to
achieve that and likely is not portable at all.

Gdb has been doing this for over 25 years for every architecture. When you use the backtrace command, it gets a return address, subtracts one, and then does a file name/line number lookup. This is because the file name and source line number of the call instruction may not be the same as the instruction after the call. This does of course assume that you have a return address, and are doing some kind of range based lookup on addresses, so you don't need an exact instruction address to get a hit. Exception regions work the same way.

I think that there is some sort of configure related problem here, as HAVE_GETIPINFO is set when I build on an Ubuntu x86_64-linux system. Looking at the configure test, which is in config/unwind_ipinfo.m4... if you don't use --with-system-libunwind, then HAVE_GETIPINFO defaults to on. If you do use --with-system-libunwind, then HAVE_GETIPINFO defaults to off, which will break handling for signal frames. I'm not sure if anyone is using --with-system-libunwind, so I'm not sure if this needs a gcc bug report.

But I also see that while HAVE_GETIPINFO appears to be set by configure, it is apparently not being used when building unwind-c.o. I see that HAVE_GETIPINFO is set in the libgcc/auto-target.h file, but this file is not included by unwind-c.c. I only see includes of this in libgcc/config/i386/cpuinfo.c and libgcc/config/sol2/gmon.c. I don't know offhand how auto-target.h is supposed to work, but it appears that it needs to be included in the unwind files built as part of libgcc. This is maybe a bug accidentally caused when libgcc was moved out of the gcc dir and into its own top level dir. I think this warrants a gcc bug report.

Jim


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