[Lldb-commits] [PATCH] Profile Assembly Until Ret Instruction

Tong Shen endlessroad at google.com
Fri Jul 25 13:41:05 PDT 2014


Hi Molenda, lldb-commits,

For now, x86 assembly profiler will stop after 10 "non-prologue"
instructions. In practice it may not be sufficient. For example, we have a
hand-written assembly function, which have hundreds of instruction before
actual (stack-adjusting) prologue instructions.

One way is to change the limit to 1000; but there will always be functions
that break the limit :-) I believe the right thing to do here is parsing
all instructions before "ret"/"call" as prologue instructions.

Here's what I changed:
- For "push %rbx" and "mov %rbx, -8(%rbp)": only add first row for that
register. They may appear multiple times in function body. But as long as
one of them appears, first appearance should be in prologue(If it's not in
prologue, this function will not use %rbx, so these 2 instructions should
not appear at all).
- Also monitor "add %rsp 0x20".
- Remove non prologue instruction count.
- Add "call" instruction detection, and stop parsing after it.

Thanks.

-- 
Best Regards, Tong Shen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140725/71b973f8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extend_assebmly_profiler_to_ret.patch
Type: text/x-patch
Size: 5564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140725/71b973f8/attachment.bin>


More information about the lldb-commits mailing list