<div dir="ltr"><div>Hi jmolenda, lldb-commits,</div><div><br></div><div>While hacking around x86 assembly profiler, I found a problem about non-volatile register information.</div><div><br></div><div>At UnwindAssembly-x86.cpp line 630 (<a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?view=markup#l630">ViewVC link</a>), stack_offset is calculated but not used.</div>
<div>I think it should be used in line 636:</div><div>        regloc.SetAtCFAPlusOffset (-row->GetCFAOffset() + stack_offset);</div><div>instead of what's there now:</div><div>        regloc.SetAtCFAPlusOffset (-row->GetCFAOffset());</div>
<div><br></div><div>Also, in line 417 of the same file, when calculating stack_offset, why is rbp_offset set to abs(offset)?</div><div><br></div><div>For testing, I wrote an assembly (test.S in attachment) to test if lldb can recover non-volatile registers.</div>
<div>You can put a breakpoint after where asm_frame() overrides %rbx, then do "f 1" & "register read" to see if %rbx is correctly restored.</div><div>In my test, unmodified lldb gives wrong %rbx.</div>
<div>Attached patch solved this problem, and make lldb recover those registers correctly.</div><div><br></div><div>Am I missing anything here? Is the original behavior intentional? Please correct me if I'm wrong :-)</div>
<div><br></div><div>Thank you.</div><div><div><div><div><br></div>-- <br><div dir="ltr">Best Regards, Tong Shen</div>
</div></div></div></div>