[Lldb-commits] [PATCH] Register Number in DWARFCallFrameInfo.cpp

Tong Shen endlessroad at google.com
Tue Aug 12 10:08:18 PDT 2014


Hi,

Actually there's no patch; just a confirmed bug and a solution.

In eh_frame parsing(DWARFCallFrameInfo.cpp), we just parse the reg_num from
dwarf info and use it directly as register number. But DWARF register
numbering is slightly different from our internal register numbering.

In DWARF register numbering, i386 register esp=4, ebp=5; but in our
register numbering, esp=5, ebp=4. (Other registers in i386, and all
registers in x86_64, are consistent)

So in fact eh_frame parsing for i386 is wrong...

We missed this because:
1. for leaf function, we use assembly profiler instead of eh_frame;
2. i386 prologues are usually "push %ebp; mov %ebp, %esp", so esp and ebp
are the same. Mistaking esp and ebp actually does not matter, and we can
still get correct cfa.

On i386 linux, before fixing this, a C program can only unwind to main().
After fixing this, we can see __libc_start_main() and 2 more frames
underneath main().

I think we should add a DWARFRegisterIdToLLVMRegsiterId or something
similar.

Thanks.

-- 
Best Regards, Tong Shen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140812/8a6e24d5/attachment.html>


More information about the lldb-commits mailing list