Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Issue 383001: Fix for bad register numbering in eh_frame sections under Darwin

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by mrmiller
Modified:
12 years, 7 months ago
Reviewers:
jimb, Ted Mielczarek
CC:
google-breakpad-dev_googlegroups.com
Base URL:
http://google-breakpad.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Under i386 Darwin, DWARF eh_frame sections use a slightly different register
numbering from the standard Linux (and debug section) numbering.  %esp and %ebp
are swapped relative to this standard ordering.  Prior to this patch, running
dump_syms on a Mach-O binary without debug info would produce garbage unwind
instructions because these registers were swapped.

Comparing the unwind instructions in Breakpad and dwarfdump revealed the
apparent numbering issue.  As well,
http://llvm.org/docs/WritingAnLLVMBackend.html "Defining a Register" alludes to
this strange difference with eh_frames under i386.  The following definitions
are used by LLVM for their register numbering (from X86RegisterInfo.td):
  def EBP : RegisterWithSubRegs<"ebp", [BP]>, DwarfRegNum<[-2, 4, 5]>;
  def ESP : RegisterWithSubRegs<"esp", [SP]>, DwarfRegNum<[-2, 5, 4]>;

This patch addresses the above issue.  When we are reading an i386 eh_frame
section in the OS X version of dump_syms, we now use the proper register numbers
with %esp = 5 and %ebp = 4.

Patch Set 1 #

Patch Set 2 : Replaced some tabs with spaces. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
common/dwarf_cfi_to_module.cc View 2 chunks +20 lines, -3 lines 1 comment Download
common/dwarf_cfi_to_module.h View 1 1 chunk +4 lines, -1 line 0 comments Download
common/mac/dump_syms.mm View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3
mrmiller
12 years, 7 months ago #1
jimb
Thanks for writing this patch! When you upload patches to Reitveld, you need to generate ...
12 years, 7 months ago #2
jimb
12 years, 7 months ago #3
Thanks for writing this patch!

When you upload patches to Reitveld, you need to generate them from the top of
the tree. In this
patch, you generated the diff from the src directory, which means the
"Side-by-side" diffs column
doesn't work.

There are actually tests for DwarfCFIToModule::RegisterNames::I386, in
src/common/dwarf_cfi_to_module_unittest.cc. This change needs to be tested.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted