Re: [Lldb-commits] [lldb] r249379 - Bug 25050: X87 FPU Special Purpose Registers

2015-10-06 Thread Aggarwal, Abhishek A via lldb-commits
I had submitted a patch for the Bug 24457 which is similar kind of bug but on 
Linux x86_64 Platform. There, I had submitted a new test to reproduce this 
issue. The test is already there in public repository. Since, the same test 
goes for FreeBSD also therefore I didn’t need to write a new one.

-Thanks


From: Zachary Turner [mailto:ztur...@google.com]
Sent: Tuesday, October 6, 2015 4:53 PM
To: Aggarwal, Abhishek A; lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r249379 - Bug 25050: X87 FPU Special Purpose 
Registers

Please don't submit CLs like this without a test in the future.  This should be 
testable by writing some assembly to move a value into an FPU register, setting 
a breakpoint, then querying the register values.  Can you submit this as a 
followup?

On Tue, Oct 6, 2015 at 12:05 AM Abhishek Aggarwal via lldb-commits 
mailto:lldb-commits@lists.llvm.org>> wrote:
Author: abhishek
Date: Tue Oct  6 02:04:03 2015
New Revision: 249379

URL: http://llvm.org/viewvc/llvm-project?rev=249379&view=rev
Log:
Bug 25050: X87 FPU Special Purpose Registers

Summary:
  - For x86_64-FreeBSD Platform:
-- LLDB now provides correct values of X87 FPU
   Special Purpose Registers like fstat, ftag, fctrl etc..

Signed-off-by: Abhishek Aggarwal 
mailto:abhishek.a.aggar...@intel.com>>

Reviewers: emaste, mikesart, clayborg

Subscribers: emaste

Differential Revision: http://reviews.llvm.org/D13434

Modified:

lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp

lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h

Modified: 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp?rev=249379&r1=249378&r2=249379&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
 Tue Oct  6 02:04:03 2015
@@ -58,6 +58,9 @@ RegisterContextPOSIXProcessMonitor_x86_6

  lldb_private::RegisterInfoInterface *register_info)
 : RegisterContextPOSIX_x86(thread, concrete_frame_idx, register_info)
 {
+// Store byte offset of fctrl (i.e. first register of FPR) wrt 'UserArea'
+const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
+m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
 }

 ProcessMonitor &
@@ -254,8 +257,15 @@ RegisterContextPOSIXProcessMonitor_x86_6
 }

 // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
-assert (reg_info->byte_offset < sizeof(m_fpr));
-uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;
+// Byte offsets of all registers are calculated wrt 'UserArea' structure.
+// However, ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)}
+// and stores them in 'm_fpr' (of type FPR structure). To extract values 
of fpu
+// registers, m_fpr should be read at byte offsets calculated wrt to FPR 
structure.
+
+// Since, FPR structure is also one of the member of UserArea structure.
+// byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - 
byte_offset(fctrl wrt UserArea)
+assert ( (reg_info->byte_offset - m_fctrl_offset_in_userarea) < 
sizeof(m_fpr));
+uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset - 
m_fctrl_offset_in_userarea;
 switch (reg_info->byte_size)
 {
 case 2:
@@ -308,8 +318,15 @@ RegisterContextPOSIXProcessMonitor_x86_6
 else
 {
 // Get pointer to m_fpr.xstate.fxsave variable and set the data to 
it.
-assert (reg_info->byte_offset < sizeof(m_fpr));
-uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset;
+// Byte offsets of all registers are calculated wrt 'UserArea' 
structure.
+// However, WriteFPR() takes m_fpr (of type FPR structure) and 
writes only fpu
+// registers using ptrace(PT_SETFPREGS,..) API. Hence fpu 
registers should
+// be written in m_fpr at byte offsets calculated wrt FPR 
structure.
+
+// Since, FPR structure is also one of the member of UserArea 
structure.
+// byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - 
byte_offset(fctrl wrt UserArea)
+assert ( (reg_info->byte_offset - m_fctrl_offset_in_userarea) < 
sizeof(m_fpr));
+uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset - 
m_fctrl_offset_in_userarea;
 switch (reg_info->byte_size)
 {
 case 2:

Modified: 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Pl

Re: [Lldb-commits] [lldb] r249379 - Bug 25050: X87 FPU Special Purpose Registers

2015-10-07 Thread Aggarwal, Abhishek A via lldb-commits
Sure. Thanks a lot for suggesting this.

Thanks & Regards
Abhishek Aggarwal

From: Zachary Turner [mailto:ztur...@google.com]
Sent: Tuesday, October 6, 2015 6:01 PM
To: Aggarwal, Abhishek A; lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r249379 - Bug 25050: X87 FPU Special Purpose 
Registers

I see.  In the future in this kind of situation could you mention in the commit 
message what test this fixes.  For example, "This fixes TestRegisters.py on 
FreeBSD".


On Tue, Oct 6, 2015 at 7:59 AM Aggarwal, Abhishek A 
mailto:abhishek.a.aggar...@intel.com>> wrote:
I had submitted a patch for the Bug 24457 which is similar kind of bug but on 
Linux x86_64 Platform. There, I had submitted a new test to reproduce this 
issue. The test is already there in public repository. Since, the same test 
goes for FreeBSD also therefore I didn’t need to write a new one.

-Thanks


From: Zachary Turner [mailto:ztur...@google.com]
Sent: Tuesday, October 6, 2015 4:53 PM
To: Aggarwal, Abhishek A; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r249379 - Bug 25050: X87 FPU Special Purpose 
Registers

Please don't submit CLs like this without a test in the future.  This should be 
testable by writing some assembly to move a value into an FPU register, setting 
a breakpoint, then querying the register values.  Can you submit this as a 
followup?

On Tue, Oct 6, 2015 at 12:05 AM Abhishek Aggarwal via lldb-commits 
mailto:lldb-commits@lists.llvm.org>> wrote:
Author: abhishek
Date: Tue Oct  6 02:04:03 2015
New Revision: 249379

URL: http://llvm.org/viewvc/llvm-project?rev=249379&view=rev
Log:
Bug 25050: X87 FPU Special Purpose Registers

Summary:
  - For x86_64-FreeBSD Platform:
-- LLDB now provides correct values of X87 FPU
   Special Purpose Registers like fstat, ftag, fctrl etc..

Signed-off-by: Abhishek Aggarwal 
mailto:abhishek.a.aggar...@intel.com>>

Reviewers: emaste, mikesart, clayborg

Subscribers: emaste

Differential Revision: http://reviews.llvm.org/D13434

Modified:

lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp

lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h

Modified: 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp?rev=249379&r1=249378&r2=249379&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
 Tue Oct  6 02:04:03 2015
@@ -58,6 +58,9 @@ RegisterContextPOSIXProcessMonitor_x86_6

  lldb_private::RegisterInfoInterface *register_info)
 : RegisterContextPOSIX_x86(thread, concrete_frame_idx, register_info)
 {
+// Store byte offset of fctrl (i.e. first register of FPR) wrt 'UserArea'
+const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
+m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
 }

 ProcessMonitor &
@@ -254,8 +257,15 @@ RegisterContextPOSIXProcessMonitor_x86_6
 }

 // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
-assert (reg_info->byte_offset < sizeof(m_fpr));
-uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;
+// Byte offsets of all registers are calculated wrt 'UserArea' structure.
+// However, ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)}
+// and stores them in 'm_fpr' (of type FPR structure). To extract values 
of fpu
+// registers, m_fpr should be read at byte offsets calculated wrt to FPR 
structure.
+
+// Since, FPR structure is also one of the member of UserArea structure.
+// byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - 
byte_offset(fctrl wrt UserArea)
+assert ( (reg_info->byte_offset - m_fctrl_offset_in_userarea) < 
sizeof(m_fpr));
+uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset - 
m_fctrl_offset_in_userarea;
 switch (reg_info->byte_size)
 {
 case 2:
@@ -308,8 +318,15 @@ RegisterContextPOSIXProcessMonitor_x86_6
 else
 {
 // Get pointer to m_fpr.xstate.fxsave variable and set the data to 
it.
-assert (reg_info->byte_offset < sizeof(m_fpr));
-uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset;
+// Byte offsets of all registers are calculated wrt 'UserArea' 
structure.
+// However, WriteFPR() takes m_fpr (of type FPR structure) and 
writes only fpu
+// registers using ptrace(PT_SETFPREGS,..) API. Hence fpu 
registers should
+// be written in m_fpr at byte offsets calculated wrt FPR

Re: [Lldb-commits] [lldb] r253026 - Fix to solve Bug 23139 & Bug 23560

2015-11-13 Thread Aggarwal, Abhishek A via lldb-commits
Hi Pavel

Thanks for pointing out. Both of these tests are passing at my end. I am using 
Ubuntu Desktop (14.04 x86_64) machine and the same compiler version as used by 
build-bot. However, I will have to take a deeper look into the logs you 
attached to figure out the reason of this discrepancy.

Thanks & Regards
Abhishek Aggarwal

-Original Message-
From: Pavel Labath [mailto:lab...@google.com] 
Sent: Friday, November 13, 2015 1:06 PM
To: Aggarwal, Abhishek A 
Cc: lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r253026 - Fix to solve Bug 23139 & Bug 23560

Hi,

two of the tests you have enabled here are still failing on the linux build bot 
.
I have disabled them for now. I am also attaching full logs from the buildbot. 
I hope that will help you diagnose this. If you need any more info, let me know.

btw, good job on these bugs. I was looking into these a while back, but I 
couldn't figure them out.

pl


On 13 November 2015 at 10:47, Abhishek Aggarwal via lldb-commits 
 wrote:
> Author: abhishek
> Date: Fri Nov 13 04:47:49 2015
> New Revision: 253026
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253026&view=rev
> Log:
> Fix to solve Bug 23139 & Bug 23560
>
> Summary:
>  - Reason of both bugs:
>
>1. For the very first frame, Unwinder doesn't check the validity
>   of Full UnwindPlan before creating StackFrame from it:
>
> When 'process launch' command is run after setting a breakpoint
> in inferior, the Unwinder runs and saves only Frame 0 (the frame
> in which breakpoint was set) in thread's StackFrameList i.e.
> m_curr_frames_sp. However, it doesn't check the validity of the
> Full UnwindPlan for this frame by unwinding 2 more frames further.
>
>2. Unwinder doesn't update the CFA value of Cursor when Full UnwindPlan
>   fails and FallBack UnwindPlan succeeds in providing valid CFA values
>   for frames:
>
> Sometimes during unwinding of stack frames, the Full UnwindPlan
> inside the RegisterContextLLDB object may fail to provide valid
> CFA values for these frames. Then the Fallback UnwindPlan is used
> to unwind the frames.
>
> If the Fallback UnwindPlan succeeds, then it provides a valid new
> CFA value. The RegisterContextLLDB::m_cfa field of Cursor object
> is updated during the Fallback UnwindPlan execution. However,
> UnwindLLDB misses the implementation to update the 'cfa' field
> of this Cursor with this valid new CFA value.
>
>  - This patch fixes both these issues.
>
>  - Remove XFAIL in test files corresponding to these 2 Bugs
>
> Change-Id: I932ea407545ceee2d628f946ecc61a4806d4cc86
> Signed-off-by: Abhishek Aggarwal 
>
> Reviewers: jingham, lldb-commits, jasonmolenda
>
> Subscribers: lldb-commits, ovyalov, tberghammer
>
> Differential Revision: http://reviews.llvm.org/D14226
>
> Modified:
> 
> lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
> lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
> lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
>
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultit
> hreaded.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsui
> te/test/api/multithreaded/TestMultithreaded.py?rev=253026&r1=253025&r2
> =253026&view=diff 
> ==
> 
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultit
> hreaded.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMu
> +++ ltithreaded.py Fri Nov 13 04:47:49 2015
> @@ -17,7 +17,6 @@ class SBBreakpointCallbackCase(TestBase)
>  @skipIfRemote
>  @skipIfNoSBHeaders
>  @skipIfWindows # clang-cl does not support throw or catch 
> (llvm.org/pr24538)
> -@expectedFailureAll("llvm.org/pr23139", oslist=["linux"], 
> compiler="gcc", compiler_version=[">=","4.9"], archs=["x86_64"])
>  def test_breakpoint_callback(self):
>  """Test the

Re: [Lldb-commits] [lldb] r254499 - PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-12-02 Thread Aggarwal, Abhishek A via lldb-commits
Hi Tamas

Yes, it was a bug in clang that I had submitted some months ago (ID: 23491) and 
it was fixed. But the fix is not present in clang 3.5/3.6. Hence, the failure 
is occurring.

Thanks & Regards
Abhishek Aggarwal

From: Tamas Berghammer [mailto:tbergham...@google.com]
Sent: Wednesday, December 2, 2015 2:41 PM
To: Aggarwal, Abhishek A ; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r254499 - PTRACE ABI to read FXSAVE area for 
32-bit inferior

Hi Abhishek,

After this change TestReturnValue.py is failing on Linux with i386 inferior 
when compiling the inferior with clang-3.5 (it passes with gcc and with ToT 
clang). I marked the test XFAIL for that specific configuration to get the 
buildbot green but can you take a look?

My suspicion is that clang 3.5 and 3.6 uses an incorrect ABI for returning 
small structs from functions (returning it in register instead of in memory 
pointed by a register) what causing the issue but I am not certain.

Thanks,
Tamas

On Wed, Dec 2, 2015 at 9:43 AM Abhishek Aggarwal via lldb-commits 
mailto:lldb-commits@lists.llvm.org>> wrote:
Author: abhishek
Date: Wed Dec  2 03:40:17 2015
New Revision: 254499

URL: http://llvm.org/viewvc/llvm-project?rev=254499&view=rev
Log:
PTRACE ABI to read FXSAVE area for 32-bit inferior

Summary:
 - Problem occurs when:
-- 32-bit inferiors run on x86_32 machine and
   the architecture doesn't have AVX feature

-- This causes FPRType to be set to eFPRTypeFXSAVE

-- PTRACE_GETFPREGS was being used to read FXSAVE area

-- For 32-bit inferiors running on x86_32 machine,
   PTRACE_GETFPREGS reads FSAVE area and not FXSAVE area

 - Changed ptrace API to PTRACE_GETREGSET for 32-bit inferiors
-- This reads FPR data in FXSAVE format.
-- For 64-bit inferiors, no change has been made.

 - Modified XFAIL for TestReturnValue.py
-- Earlier, this test was passing for Linux OS
-- Now, it passes for Android OS as well

Change-Id: Ieed72bc969b79516fc7b263b32493aa1e7a1a2ac
Signed-off-by: Abhishek Aggarwal 
mailto:abhishek.a.aggar...@intel.com>>

Reviewers: ovyalov, jingham, lldb-commits, tberghammer, labath

Subscribers: jevinskie, labath, tberghammer, danalbert

Differential Revision: http://reviews.llvm.org/D15042

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py

lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py?rev=254499&r1=254498&r2=254499&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
 Wed Dec  2 03:40:17 2015
@@ -16,7 +16,7 @@ class ReturnValueTestCase(TestBase):

 mydir = TestBase.compute_mydir(__file__)

-@expectedFailurei386
+@expectedFailureAll(oslist=["macosx","freebsd"], archs=["i386"])
 @expectedFailureWindows("llvm.org/pr24778")
 @add_test_categories(['pyapi'])
 def test_with_python(self):

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=254499&r1=254498&r2=254499&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
Wed Dec  2 03:40:17 2015
@@ -327,6 +327,9 @@ namespace
 #ifndef NT_X86_XSTATE
 #define NT_X86_XSTATE 0x202
 #endif
+#ifndef NT_PRXFPREG
+#define NT_PRXFPREG 0x46e62b7f
+#endif

 NativeRegisterContextLinux*
 NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(const 
ArchSpec& target_arch,
@@ -832,6 +835,7 @@ NativeRegisterContextLinux_x86_64::IsGPR
 NativeRegisterContextLinux_x86_64::FPRType
 NativeRegisterContextLinux_x86_64::GetFPRType () const
 {
+Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 if (m_fpr_type == eFPRTypeNotValid)
 {
 // TODO: Use assembly to call cpuid on the inferior and query ebx or 
ecx.
@@ -842,9 +846,15 @@ NativeRegisterContextLinux_x86_64::GetFP
 {
 // Fall back to general floating point with no AVX support.
 m_fpr_type = eFPRTypeFXSAVE;
+
+// Check if FXSAVE area can be read.
+if 
(const_cast(this)->ReadFPR().Fail())
+{
+if (log)
+log->Printf("NativeRegisterContextLinux_x86_64::%s ptrace 
APIs failed to read XSAVE/FXSAVE area", 

Re: [Lldb-commits] [lldb] r246955 - Bug 24457 - X87 FPU Special Purpose Registers

2015-09-07 Thread Aggarwal, Abhishek A via lldb-commits
Hi 

Thanks a lot for pointing out. There was a problem with the compilation of the 
inferior with clang and hence, the absence of the inferior's executable was 
causing the failure of the test for clang compiler. I fixed it and will soon 
upstream the change. 

Thanks & Regards
Abhishek Aggarwal

-Original Message-
From: Pavel Labath [mailto:lab...@google.com] 
Sent: Monday, September 7, 2015 10:58 AM
To: Aggarwal, Abhishek A
Cc: lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [lldb] r246955 - Bug 24457 - X87 FPU Special 
Purpose Registers

Hi,

this new test fails when the inferior is compiled with clang, as the produced 
line tables are not what you expect. I have marked it as XFAIL to get the bots 
green, but it would be great if we could write it in a way that works on clang 
as well.

pl


On 7 September 2015 at 08:40, Abhishek Aggarwal via lldb-commits 
 wrote:
> Author: abhishek
> Date: Mon Sep  7 02:40:16 2015
> New Revision: 246955
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246955&view=rev
> Log:
> Bug 24457 - X87 FPU Special Purpose Registers
>
> Summary:
>   - For 'register read --all' command on x86_64-Linux Platform:
>
>   -- Provide correct values of X87 FPU Special Purpose Registers
>   -- Both 32-bit & 64-bit inferiors give correct values on this
>  Platform
>
>   - Added a Test Vector:
>   -- To verify the expected behaviour of the command
>
> Signed-off-by: Abhishek Aggarwal 
>
> Reviewers: ashok.thirumurthi, granata.enrico, tfiala, clayborg
>
> Differential Revision: http://reviews.llvm.org/D12592
>
> Added:
> lldb/trunk/test/functionalities/register/a.cpp   (with props)
> Modified:
> 
> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
>   (contents, props changed)
> 
> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
> lldb/trunk/test/functionalities/register/Makefile   (contents, props 
> changed)
> lldb/trunk/test/functionalities/register/TestRegisters.py   (contents, 
> props changed)
> lldb/trunk/test/functionalities/register/main.cpp   (contents, props 
> changed)
>
> Modified: 
> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86
> _64.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/
> Linux/NativeRegisterContextLinux_x86_64.cpp?rev=246955&r1=246954&r2=24
> 6955&view=diff 
> ==
> 
> --- 
> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86
> _64.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux
> +++ _x86_64.cpp Mon Sep  7 02:40:16 2015
> @@ -422,6 +422,10 @@ NativeRegisterContextLinux_x86_64::Nativ
>
>  // Clear out the FPR state.
>  ::memset(&m_fpr, 0, sizeof(FPR));
> +
> +// Store byte offset of fctrl (i.e. first register of FPR)
> +const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
> +m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
>  }
>
>  // CONSIDER after local and llgs debugging are merged, register set 
> support can @@ -559,8 +563,16 @@ NativeRegisterContextLinux_x86_64::ReadR
>  }
>
>  // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
> -assert (reg_info->byte_offset < sizeof(m_fpr));
> -uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;
> +
> +// Byte offsets of all registers are calculated wrt 'UserArea' structure.
> +// However, ReadFPR() reads fpu registers {using 
> ptrace(PTRACE_GETFPREGS,..)}
> +// and stores them in 'm_fpr' (of type FPR structure). To extract values 
> of fpu
> +// registers, m_fpr should be read at byte offsets calculated wrt to FPR 
> structure.
> +
> +// Since, FPR structure is also one of the member of UserArea structure.
> +// byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - 
> byte_offset(fctrl wrt UserArea)
> +assert ( (reg_info->byte_offset - m_fctrl_offset_in_userarea) < 
> sizeof(m_fpr));
> +uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset - 
> + m_fctrl_offset_in_userarea;
>  switch (reg_info->byte_size)
>  {
>  case 2:
> @@ -620,8 +632,16 @@ NativeRegisterContextLinux_x86_64::Write
>  else
>  {
>  // Get pointer to m_fpr.xstate.fxsave variable and set the data 
> to it.
> -assert (reg_info->byte_offset < sizeof(m_fpr));
> -uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset;
> +
> +// Byte offsets of all registers are calculated wrt 'UserArea' 
> structure.
> +// However, WriteFPR() takes m_fpr (of type FPR structure) and 
> writes only fpu
> +// registers using ptrace(PTRACE_SETFPREGS,..) API. Hence fpu 
> registers should
> +// be written in m_fpr at byte offsets calculated wrt FPR 
> structure.
> +
> +// Since, FPR structure is also one of the member