New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for DWARF CFI when switching between stacks #270
Conversation
@@ -615,15 +615,21 @@ let emit_instr fallthrough i = | |||
end; | |||
cfi_remember_state (); | |||
I.mov (domain_field Domainstate.Domain_c_stack) rsp; | |||
(* FIXME: CFI *) | |||
(* cfi_def_cfa_offset 8; *) | |||
cfi_def_cfa_offset 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the offset 8 here? Do you need this? 8 doesn't look right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since here the address will be determined by the value in memory, I think we should load the value into a register use cfi_def_cfa
to set stack pointer to the register value
Can you explain what was the original problem and how the PR fixes it (for posterity)? And, since we are pushing the OCaml stack pointer information into the C stack, is it necessary to still use |
One general point that it's worth bearing in mind, apologies if this is known already: CFI information isn't just for debugging. It is required to be correct by some language runtimes (Objective-C on macOS is one such) in order to unwind the stack for exception handling. |
Agreed. I was a bit sloppy in my use of the term debugging. |
The following is enough to generate the back-trace correctly -
Tested it with an external call, seems to work. Also, can remove the space-time related stuff, because we are assuming this function does not alloc. |
I.sub (int 8) rsp
Will make the stack misaligned. It will fail with functions that expect
16-byte alignment.
…On Mon, 13 Jan 2020 at 20:34, Anmol Sahoo ***@***.***> wrote:
The following is enough to generate the back-trace correctly -
I.mov rsp rbp;
if Config.stats then begin
I.inc (domain_field Domainstate.Domain_extcall_noalloc);
end;
I.mov (domain_field Domainstate.Domain_c_stack) rsp;
cfi_def_cfa ();
I.sub (int 8) rsp;
cfi_def_cfa_offset 8;
emit_call func;
I.mov rbp rsp;
Tested it with an external call, seems to work. Also, can remove the
space-time related stuff, because we are assuming this function does not
alloc.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#270?email_source=notifications&email_token=AADEG5HPHMWRJV7BI7LCIALQ5R7GLA5CNFSM4J74QX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIZBCEQ#issuecomment-573706514>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADEG5BXPLOK5WWIHUIDQHLQ5R7GLANCNFSM4J74QX6Q>
.
|
This is superseded by the implementation in: #272 |
No description provided.