This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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]

dwarf-frame.c question


Hi Mark,
why do you decrement unwound PC in dwarf_frame_cache() before using it?

dwarf-frame.c:
478       /* Unwind the PC.  */
479       fs->pc = frame_pc_unwind (next_frame);
480       if (get_frame_type (next_frame) == NORMAL_FRAME
481           && frame_relative_level (next_frame) >= 0)
482         fs->pc--;

This makes a problem for a signal trampoline.
If it is sitting on addresses say 0x40000140-0x40000150, the return address from signal handler is 0x40000140, but dwarf_frame_cache() says it is 0x4000013f and couldn't find it's CFI...


This has a tragic consequence few lines below were you look for FDE but don't check if you find one. If you don't, line 488 segfaults.
484 /* Find the correct FDE. */
485 fde = dwarf_frame_find_fde (&fs->pc);
486
487 /* Extract any interesting information from the CIE. */
488 fs->data_align = fde->cie->data_alignment_factor;
489 fs->code_align = fde->cie->code_alignment_factor;
490 fs->retaddr_column = fde->cie->return_address_register;


The problem is, that dwarf_frame_p() looks for the real return address and says that there is a debug info and sets unwinder to use dwarf2 methods for this farme.
But the in unwinder itself in dwarf_frame_cache() looks for the decreased one and of course doesn't find it.


I couldn't see any problems when I removed the decrementation, so why is it there?

Michal Ludvig
--
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz


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