<div dir="ltr">Hi Greg<div><br></div><div>Thanks for your reply. My next queries are based on the Bug 24457 that I filed 2-3 days ago. </div><div><br></div><div>I analyzed and found the reason of this bug for x86_64-Linux platform.</div><div><br></div><div>A solution to fix this bug requires change in the definition of macro FPR_OFFSET (defined in RegisterInfos_x86_64.h) to calculate offsets for fpr registers wrt to FPR structure (defined in <b>RegisterContext<span style="color:rgb(80,0,80)">_x86.h</span></b>) and not wrt to UserArea structure (defined in <b><span style="color:rgb(80,0,80)">RegisterContextLinux_x86_64.</span><span style="color:rgb(80,0,80)">cpp</span></b>). </div><div><br></div><div>I am a bit unclear on your statements </div><div><b><u>"<span style="font-size:16px">All offsets should be the global offset in the register context's data</span>"</u></b> and </div><div>"<span style="font-size:16px"><u><b>We just require that you append all register sets together into one chunk (GPR + FPR + ...)</b></u></span>" in your last 2 replies. </div><div><br></div><div>In context of this bug, do your statements mean that macro FPR_OFFSET will not be allowed to change? </div><div><br></div><div>- Abhishek Aggarwal</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 14, 2015 at 6:17 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Aug 14, 2015, at 12:25 AM, Abhishek Aggarwal <<a href="mailto:abhiinnitald@gmail.com">abhiinnitald@gmail.com</a>> wrote:<br>
><br>
> Hi<br>
><br>
> As per my understanding (please correct if I am wrong):<br>
><br>
> 1. There exists a file for each platform (Architecture+OS) that calculates the offsets for that platform. e.g. RegisterContextLinux_x86_64.cpp for x86_64 architecture on Linux OS.<br>
<br>
</span>Correct. We allow register context data buffers to just mirror exactly what the OS gives us which is usually N chunks of data representing the raw registers as they would be gotten from the OS supplied functions (like ptrace for reading/writing registers).<br>
<span class=""><br>
> 2. For each platform, offset values for registers might be different because it depends upon the way the members of structures GPR, FPR and UserArea are organized in Platform specific file. e.g. Offset of rax will be 80 and not 0 for RegisterContextLinux_x86_64.cpp because rax lies at 10th position in structure GPR defined in this file.<br>
<br>
</span>Yep, we adapt to the way the OS represents registers in their native buffers. We just require that you append all register sets together into one chunk (GPR + FPR + ...).<br>
<span class="">><br>
> 3. The main motive behind calculating offsets for each register is to fetch data from the correct location in a chunk of data that a ptrace API provides (atleast in case of Linux OS).<br>
<br>
</span>Yes. Just as on MacOSX we mimic how thread_get_state(task_t task, ....) returns registers.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> On Thu, Aug 13, 2015 at 6:42 PM, Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br>
> All registers are placed into one large buffer that contains everything. All offsets should be the global offset in the register context's data. Typically we should see:<br>
><br>
><br>
> GPR<br>
> rax offset 0<br>
> rbx offset 8<br>
> ....<br>
> FPR<br>
> mm0 offset 128<br>
> mm1 offset 160<br>
> ...<br>
> EXC<br>
> fpsr offset 256<br>
> ...<br>
><br>
><br>
> So the offsets should be based on the offset from the start of the one large buffer that contains all register values.<br>
><br>
> > On Aug 13, 2015, at 2:26 AM, Abhishek Aggarwal via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
> ><br>
> ><br>
> > Hello<br>
> ><br>
> > I have a question regarding offset calculations of registers for x86_64 architecture. In file source/Plugins/Process/Utility/RegisterInfos_x86_64.h:<br>
> ><br>
> > The macro FPR_OFFSET(reg) calculates the offset of floating point register 'reg' with respect to 'UserArea' struct while GPR_OFFSET(reg) calculates it wrt to 'GPR' struct. Is there any specific reason of calculating the offsets of floating point registers wrt 'UserArea' struct and not wrt 'FPR' struct (defined in source/Plugins/Process/Utility/RegisterContext_x86.h) ?<br>
> ><br>
> > _______________________________________________<br>
> > lldb-dev mailing list<br>
> > <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>