|
From: Åke R. <ake...@gm...> - 2017-05-10 21:41:14
|
On 2017-05-10 23:18, Philipp Klaus Krause wrote: > Am 10.05.2017 um 23:00 schrieb Åke Rehnman: >> On 2017-05-10 22:55, Philipp Klaus Krause wrote: >>> But stm8 codegen basically does all stack-pointer-changing stuff in the >>> three functions push(), pop() and adjustStack(). Does that help in any way? >>> >>> The stm8 codegen also supports the use of a frame-pointer, which >>> currently is rarely used. If it is useful for debugging, I could however >>> easily implement --fno-omit-frame-pointer for stm8. If we can get CFA working fp is not required or even desirable. > Line 356 in src/stm8/gen.c handles the variable access using the frame > pointer. Line 3050 does the frame pointer setup. However, the caller is > responsible for saving and restoring the frame pointer, so it might be > unavailable for a short while after a function call. > Support for the frame pointer has been in there for a long time: The > offsets for sp-relative addressing on the STM8 are 8-bit only, while we > can use 16-bit offsets on the register y, which is used as a frame > pointer. We thus use the frame pointer when there is so much stack space > used by local variables that we can't use sp-relative addressing for all > them. Ok, *that* I've seen. Well I was not sure if the Y register would be available at all times (except during prologue). Also the requirement for frame unwinding to work in gdb is the prologue is consistent and possible to disassemble in a reliable way. Anyhow it was quick patch just a few lines of code to get a soft fp. /Ake |