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

Jason Molenda jmolenda at apple.com
Tue Aug 12 18:09:15 PDT 2014


Ah, sorry I was afraid the RegisterContext_x86.h change might get lost so I checked that in.


Yeah, we'll need to do something about this for llgs.  We could add an ifdef to RegisterContext_x86.h but that would mean mac-to-linux or linux-to-mac debugging wouldn't work right.

eh_frame is used infrequently on Mac OS X at this point, and 32-bit development/debugging is uncommon outside of iOS simulator debugging.  We have an in-house "compact unwind info" format that the exception unwinder uses almost all of the time.  eh_frame still exists for unwind that can't be expressed in the compact unwind format -- this is almost entirely just hand-written eh_frame instructions.  e.g. sigtramp.  libobjc might have a few too.  But that's about it.

lldb doesn't have a compact unwind info reader yet but it's one of my free-weekend-TODOs in the back of my head.  We use the UnwindAssembly_x86 instruction profiling almost all the time right now.

We'll still need to do the right thing for i386 darwin but if it's a mess to hack in, it won't be the biggest regression around.


> On Aug 12, 2014, at 5:52 PM, Todd Fiala <tfiala at google.com> wrote:
> 
> Hah ok I see I misread the comment check-in as the fix.
> 
> So - I am going to test and check in this:
> 
> Index: RegisterContext_x86.h
> ===================================================================
> --- RegisterContext_x86.h       (revision 215178)
> +++ RegisterContext_x86.h       (working copy)
> @@ -34,8 +34,8 @@
> 
>      gcc_ecx_i386,
>      gcc_edx_i386,
>      gcc_ebx_i386,
> 
> -    gcc_ebp_i386, // Warning: these are switched from dwarf values
> -    gcc_esp_i386, //
> +    gcc_esp_i386,  // on Darwin esp & ebp are reversed in the eh_frame section for i386.
> +    gcc_ebp_i386,  // lldb will get those darwin-specific reg mappings from debugserver instead of here.
> 
>      gcc_esi_i386,
>      gcc_edi_i386,
>      gcc_eip_i386,
> 
> (from Jason).
> 
> Jason - when we get MacOSX on lldb-gdbserver, we’ll just need to make sure we don’t undo this fix for APPLE code. Is there anything else we might want to do about this now while we’re thinking about it for migration purposes? (Like - we could #ifdef it now correctly for APPLE and have it default to the linux style just to be safe?)
> 
> -Todd
> 
>> 
> 
> On Tue, Aug 12, 2014 at 5:41 PM, Todd Fiala <tfiala at google.com> wrote:
> Ok - see you already did it.  Thanks!
> 
> 
> On Tue, Aug 12, 2014 at 5:41 PM, Todd Fiala <tfiala at google.com> wrote:
> Ok - so Jason, your patch is fine to submit?
> 
> 
> On Tue, Aug 12, 2014 at 5:22 PM, Tong Shen <endlessroad at google.com> wrote:
> Sorry just saw this.. Agree.
> 
> 
> On Tue, Aug 12, 2014 at 5:08 PM, Jason Molenda <jmolenda at apple.com> wrote:
> I believe the correct patch looks closer to
> 
> Index: RegisterContext_x86.h
> ===================================================================
> --- RegisterContext_x86.h       (revision 215178)
> +++ RegisterContext_x86.h       (working copy)
> @@ -34,8 +34,8 @@
>      gcc_ecx_i386,
>      gcc_edx_i386,
>      gcc_ebx_i386,
> -    gcc_ebp_i386, // Warning: these are switched from dwarf values
> -    gcc_esp_i386, //
> +    gcc_esp_i386,  // on Darwin esp & ebp are reversed in the eh_frame section for i386.
> +    gcc_ebp_i386,  // lldb will get those darwin-specific reg mappings from debugserver instead of here.
>      gcc_esi_i386,
>      gcc_edi_i386,
>      gcc_eip_i386,
> 
> 
> 
> > On Aug 12, 2014, at 5:05 PM, Todd Fiala <tfiala at google.com> wrote:
> >
> > Yep, will do later tonight.
> >
> > -Todd
> >
> > On Aug 12, 2014, at 4:32 PM, Tong Shen <endlessroad at google.com> wrote:
> >
> >> Got it. So much magic going on there.
> >>
> >> +Todd Can you check this in? Thanks!
> >>
> >>
> >> On Tue, Aug 12, 2014 at 4:23 PM, Jason Molenda <jmolenda at apple.com> wrote:
> >>
> >> > On Aug 12, 2014, at 4:20 PM, Tong Shen <endlessroad at google.com> wrote:
> >> >
> >> > There's this line in your dwarfdump output:
> >> > DW_CFA_def_cfa (5 (esp), 4)
> >> > DW_CFA_offset (8 (eip), -4)
> >> >
> >> > On Ubuntu 14.04, objdump -W outputs this:
> >> > DW_CFA_def_cfa: r4 (esp) ofs 4
> >> > DW_CFA_offset: r8 (eip) at cfa-4
> >> >
> >> > I believe this is the cause. On OSX, esp=5; on linux, esp=4
> >>
> >>
> >> Yeah, I was starting to get that impression too.  I thought the old esp/ebp mixup was across all the gcc platforms - but who knows.  Feel free to fix the RegisterContext_x86 enum definitions for esp/ebp - on Mac OS X we'll still be using the debugserver-provided register definitions.  (and we don't use eh_frame very often on Mac OS X - we primarily use a local compact unwind format that I haven't written an importer for yet)
> >>
> >> Normally this kind of thing would be defined in the processor ABI document -- but I've never been able to find a document like that for IA-32.
> >>
> >>
> >>
> >> --
> >> Best Regards, Tong Shen
> >> <1.patch>
> 
> 
> 
> 
> -- 
> Best Regards, Tong Shen
> 
> 
> 
> -- 
> Todd Fiala |	 Software Engineer |	 tfiala at google.com |	 650-943-3180
> 
> 
> 
> 
> -- 
> Todd Fiala |	 Software Engineer |	 tfiala at google.com |	 650-943-3180
> 
> 
> 
> 
> -- 
> Todd Fiala |	 Software Engineer |	 tfiala at google.com |	 650-943-3180
> 





More information about the lldb-commits mailing list