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

Tong Shen endlessroad at google.com
Tue Aug 12 15:38:35 PDT 2014


In i386 .eh_frame, esp=4, ebp=5. I confirmed it by cfi directives gcc
generates and objdump -W.

So it's either we chose the wrong eRegisterKindXXX, or we put {dwarf,
gcc}_{esp, ebp}_i386 in wrong order in
source/Plugins/Process/Utility/RegisterContext_x86.h :-)


On Tue, Aug 12, 2014 at 3:23 PM, Jason Molenda <jmolenda at apple.com> wrote:

> Hi Tong, sorry for not replying earlier.
>
> I don't understand why the current code is wrong.
>
>         eRegisterKindGCC = 0,    // the register numbers seen in eh_frame
>         eRegisterKindDWARF,      // the register numbers seen DWARF
>
> and
>
>         SectionSP sect = sl->FindSectionByType (eSectionTypeEHFrame, true);
>         if (sect.get())
>         {
>             m_eh_frame = new DWARFCallFrameInfo(m_object_file, sect,
> eRegisterKindGCC, true);
>         }
>
> We create a DWARFCallFrameInfo object to read the eh_frame information and
> we tell it that the register kind to use for the reg numbers is
> eRegisterKindGCC - aka the eh_frame register numbering domain.
>
> This all looks correct to me, and designed specifically to handle the case
> of that ancient gcc register numbering bug in the eh_frame section for i386.
>
> We never read the actual DWARF debug_frame (today) because I've never seen
> a case where it had more information than the eh_frame unwind info.
>
>
>
> > On Aug 12, 2014, at 1:36 PM, Tong Shen <endlessroad at google.com> wrote:
> >
> > Aha, got it.
> > Patch confirmed and attached.
> >
> >
> > On Tue, Aug 12, 2014 at 12:51 PM, Ed Maste <emaste at freebsd.org> wrote:
> > On 12 August 2014 15:43, Todd Fiala <tfiala at google.com> wrote:
> > >
> > > 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!
> >
> > There was a thread on this topic on this list a while back, and I
> > think the two register sets in question here are DWARF and GCC, which
> > are identical in all cases except that i386 swaps esp and ebp between
> > the two.  This is all the legacy of an ancient GCC bug.  So I think
> > you're right Todd, just picking the other set should solve this.
> >
> >
> >
> > --
> > Best Regards, Tong Shen
> > <fix_register_kind.patch>_______________________________________________
> > lldb-commits mailing list
> > lldb-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>


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


More information about the lldb-commits mailing list