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

Todd Fiala tfiala at google.com
Tue Aug 12 12:43:10 PDT 2014


Hey Tong,

Ah interesting.  The register infos in lldb have a vector of different
register numbers (I think we call them "register kinds") based on the type
of encoding you're using.  Let's have a look at that to see if we can
adjust the code to query for the right register kind.  We'll look at this
today!

-Todd


On Tue, Aug 12, 2014 at 10:08 AM, Tong Shen <endlessroad at google.com> wrote:

> 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
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>


-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140812/639d6238/attachment.html>


More information about the lldb-commits mailing list