[Lldb-commits] Possible UnwindAssembly-x86 Problem & Fix
Tong Shen
endlessroad at google.com
Thu Jul 24 15:33:05 PDT 2014
Hi jmolenda, lldb-commits,
While hacking around x86 assembly profiler, I found a problem about
non-volatile register information.
At UnwindAssembly-x86.cpp line 630 (ViewVC link
<http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?view=markup#l630>),
stack_offset is calculated but not used.
I think it should be used in line 636:
regloc.SetAtCFAPlusOffset (-row->GetCFAOffset() + stack_offset);
instead of what's there now:
regloc.SetAtCFAPlusOffset (-row->GetCFAOffset());
Also, in line 417 of the same file, when calculating stack_offset, why is
rbp_offset set to abs(offset)?
For testing, I wrote an assembly (test.S in attachment) to test if lldb can
recover non-volatile registers.
You can put a breakpoint after where asm_frame() overrides %rbx, then do "f
1" & "register read" to see if %rbx is correctly restored.
In my test, unmodified lldb gives wrong %rbx.
Attached patch solved this problem, and make lldb recover those registers
correctly.
Am I missing anything here? Is the original behavior intentional? Please
correct me if I'm wrong :-)
Thank you.
--
Best Regards, Tong Shen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140724/a5a27894/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.S
Type: application/octet-stream
Size: 262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140724/a5a27894/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: text/x-patch
Size: 1032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140724/a5a27894/attachment.bin>
More information about the lldb-commits
mailing list