<div dir="ltr">Hi,<div><br></div><div>Actually there's no patch; just a confirmed bug and a solution.</div><div><br></div><div>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.</div>
<div><br></div><div>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)</div><div><br></div><div>So in fact eh_frame parsing for i386 is wrong...</div>
<div><br></div><div>We missed this because:</div><div>1. for leaf function, we use assembly profiler instead of eh_frame;</div><div>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.</div>
<div><br></div><div>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().</div><div><br></div><div>I think we should add a DWARFRegisterIdToLLVMRegsiterId or something similar.</div>
<div><br></div><div>Thanks.</div><div><div><br></div>-- <br><div dir="ltr">Best Regards, Tong Shen</div>
</div></div>