[patch/rfc] Add a sentinel frame

Andrew Cagney ac131313@redhat.com
Fri Feb 28 15:48:00 GMT 2003


> Andrew Cagney wrote:
> To give this x86-64 thread clear closure.  The internal-error you are seeing from the new frame code is now, officially, "not-a-frame-bug".
> 
> Yes, I've already realised so. Thank you for confirmation.
> 
> The underlying problem is caused by a design flaw (one of many) in the original CFI code (on which the x86-64 depends).  It's trying to use the CFI unwinder on a block of code that either: has no CFI information; or has CFI information that isn't relevant to the stack frame being unwound.  Using CFI to unwind such a frame is meaningless.
> [...]
> To fix this problem, the x86-64 will need to implement both that and the save_dummy_frame_tos() method.
> 
> OK. So, first I need to convert x86-64 target to use all the new frame-id stuff I think. And then implement handling of different frame types (normal (CFI), dummy, sigtramp, and specifically for x86-64 also normal frames without CFI debug info).
> Basically all calls to cfi_*() functions from x86-64-*.c files should become x86_64_*() functions that call the appropriate cfi_*() functions if needed, or a frame-type specific thing otherwise.
> Correct?

Well, to fix this specific bug I think you'd just need to implement:

	save_dummy_frame_tos()
	unwind_dummy_id() (see uncommitted patch I posted).

And ensure that the top-of-stack value saved by save_dummy_frame_tos() 
matches the id.base value returned by unwind_dummy_id().

--

The cleanup is more substantial:.  The first shaky step is to implement 
a  cfi-frame.[hc] object (using dwarf2expr.[hc]?).  After that are the 
separate x86-64 specific unwinders: traditional, sigtramp.  The key 
difference is that with the old code the sequence:

	frame->get_saved_register ()
	->x86_64_get_saved_register ()
	->cfi_get_saved_register ()

where as the new code is more direct:

	frame->register_unwind()
	->cfi_register_unwind()

(the x86-64 code doesn't get a look in), and very recursive:

	frame->register_unwind()
	->cfi_register_unwind(frame)
	... determines that it needs the next frame's register
	... that frame happens to be a dummy
	frame->register ()
	frame->next->register_unwind()
	->dummy_frame_register_unwind(frame->next)

Andrew




More information about the Gdb-patches mailing list