[llvm-branch-commits] [lldb] r287345 - Merging r283728:

2016-11-18 Thread Nitesh Jain via llvm-branch-commits
Author: nitesh.jain
Date: Fri Nov 18 08:14:37 2016
New Revision: 287345

URL: http://llvm.org/viewvc/llvm-project?rev=287345&view=rev
Log:
Merging r283728:

r283728 | nitesh.jain | 2016-10-10 14:32:41 +0530 (Mon, 10 Oct 2016) | 7 lines

[LLDB][MIPS] Fix register read/write for 32 bit big endian system

Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, mohit.bhakkad, slthakur, llvm-commits

Differential Revision: https://reviews.llvm.org/D24124


Modified:
lldb/branches/release_39/   (props changed)
lldb/branches/release_39/source/Core/RegisterValue.cpp

lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp

Propchange: lldb/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 18 08:14:37 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001
+/lldb/trunk:277343,277426,277997,277999,278001,283728

Modified: lldb/branches/release_39/source/Core/RegisterValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Core/RegisterValue.cpp?rev=287345&r1=287344&r2=287345&view=diff
==
--- lldb/branches/release_39/source/Core/RegisterValue.cpp (original)
+++ lldb/branches/release_39/source/Core/RegisterValue.cpp Fri Nov 18 08:14:37 
2016
@@ -652,34 +652,37 @@ RegisterValue::GetAsUInt32 (uint32_t fai
 uint64_t
 RegisterValue::GetAsUInt64 (uint64_t fail_value, bool *success_ptr) const
 {
-if (success_ptr)
-*success_ptr = true;
-switch (m_type)
-{
-default:break;
-case eTypeUInt8:
-case eTypeUInt16:
-case eTypeUInt32:
-case eTypeUInt64:
-case eTypeFloat:
-case eTypeDouble:
-case eTypeLongDouble: return m_scalar.ULongLong(fail_value);
-case eTypeBytes:
-{
-switch (buffer.length)
-{
-default:break;
-case 1:
-case 2:
-case 4:
-case 8: return *(const uint64_t *)buffer.bytes;
-}
-}
-break;
+  if (success_ptr)
+*success_ptr = true;
+  switch (m_type) {
+  default:
+break;
+  case eTypeUInt8:
+  case eTypeUInt16:
+  case eTypeUInt32:
+  case eTypeUInt64:
+  case eTypeFloat:
+  case eTypeDouble:
+  case eTypeLongDouble:
+return m_scalar.ULongLong(fail_value);
+  case eTypeBytes: {
+switch (buffer.length) {
+default:
+  break;
+case 1:
+  return *(const uint8_t *)buffer.bytes;
+case 2:
+  return *(const uint16_t *)buffer.bytes;
+case 4:
+  return *(const uint32_t *)buffer.bytes;
+case 8:
+  return *(const uint64_t *)buffer.bytes;
 }
-if (success_ptr)
-*success_ptr = false;
-return fail_value;
+  } break;
+  }
+  if (success_ptr)
+*success_ptr = false;
+  return fail_value;
 }
 
 llvm::APInt

Modified: 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp?rev=287345&r1=287344&r2=287345&view=diff
==
--- 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
 (original)
+++ 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
 Fri Nov 18 08:14:37 2016
@@ -180,8 +180,8 @@ NativeRegisterContextLinux::DoReadRegist
 PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast(offset), nullptr, 0, &data);
 
 if (error.Success())
-// First cast to an unsigned of the same size to avoid sign extension.
-value.SetUInt64(static_cast(data));
+  // First cast to an unsigned of the same size to avoid sign extension.
+  value.SetUInt(static_cast(data), size);
 
 if (log)
 log->Printf ("NativeRegisterContextLinux::%s() reg %s: 0x%lx", 
__FUNCTION__, reg_name, data);


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] r287641 - Merging r283729:

2016-11-22 Thread Nitesh Jain via llvm-branch-commits
Author: nitesh.jain
Date: Tue Nov 22 08:23:14 2016
New Revision: 287641

URL: http://llvm.org/viewvc/llvm-project?rev=287641&view=rev
Log:
Merging r283729:

r283729 | nitesh.jain | 2016-10-10 14:46:20 +0530 (Mon, 10 Oct 2016) | 7 lines

[LLDB][MIPS] Fix TestReturnValue failure for MIPS

Reviewers: clayborg, labath, bhushan

Subscribers: jaydeep, slthakur, llvm-commits

Differential Revision: https://reviews.llvm.org/D24498


Modified:
lldb/branches/release_39/   (props changed)
lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp

Propchange: lldb/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 22 08:23:14 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001,283728
+/lldb/trunk:277343,277426,277997,277999,278001,283728-283729

Modified: 
lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=287641&r1=287640&r2=287641&view=diff
==
--- lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp 
(original)
+++ lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp 
Tue Nov 22 08:23:14 2016
@@ -565,109 +565,137 @@ ABISysV_mips64::GetReturnValueObjectImpl
 // Any structure of up to 16 bytes in size is returned in the 
registers.
 if (byte_size <= 16)
 {
-DataBufferSP data_sp (new DataBufferHeap(16, 0));
-DataExtractor return_ext (data_sp, 
-  target_byte_order, 
-  
target->GetArchitecture().GetAddressByteSize());
+DataBufferSP data_sp(new DataBufferHeap(16, 0));
+DataExtractor return_ext(data_sp, target_byte_order,
+ 
target->GetArchitecture().GetAddressByteSize());
 
 RegisterValue r2_value, r3_value, f0_value, f1_value, f2_value;
+// Tracks how much bytes of r2 and r3 registers we've consumed so 
far
+uint32_t integer_bytes = 0;
 
-uint32_t integer_bytes = 0; // Tracks how much bytes of r2 
and r3 registers we've consumed so far
-bool use_fp_regs = 0;   // True if return values are 
in FP return registers.
-bool found_non_fp_field = 0;// True if we found any non 
floating point field in structure.
-bool use_r2 = 0;// True if return values are 
in r2 register.
-bool use_r3 = 0;// True if return values are 
in r3 register.
-bool sucess = 0;// True if the result is 
copied into our data buffer
-std::string name;
-bool is_complex;
-uint32_t count;
-const uint32_t num_children = return_compiler_type.GetNumFields ();
-
-// A structure consisting of one or two FP values (and nothing 
else) will be
-// returned in the two FP return-value registers i.e fp0 and fp2.
-if (num_children <= 2)
-{
-uint64_t field_bit_offset = 0;
-
-// Check if this structure contains only floating point fields
-for (uint32_t idx = 0; idx < num_children; idx++)
-{
-CompilerType field_compiler_type = 
return_compiler_type.GetFieldAtIndex(idx, name, &field_bit_offset, nullptr, 
nullptr);
-
-if (field_compiler_type.IsFloatingPointType (count, 
is_complex))
-use_fp_regs = 1;
-else
-found_non_fp_field = 1;
-}
-
-if (use_fp_regs && !found_non_fp_field)
-{
-// We have one or two FP-only values in this structure. 
Get it from f0/f2 registers.
-DataExtractor f0_data, f1_data, f2_data;
-const RegisterInfo *f0_info = 
reg_ctx->GetRegisterInfoByName("f0", 0);
-const RegisterInfo *f1_info = 
reg_ctx->GetRegisterInfoByName("f1", 0);
-const RegisterInfo *f2_info = 
reg_ctx->GetRegisterInfoByName("f2", 0);
-
-reg_ctx->ReadRegister (f0_info, f0_value);
-reg_ctx->ReadRegister (f2_info, f2_value);
-
-f0_value.GetData(f0_data);
-f2_value.GetData(f2_data);
-
-for (uint32_t idx = 0; idx < num_children; idx++)
-{
- 

[llvm-branch-commits] [lldb] r287746 - Merging r284003:

2016-11-22 Thread Nitesh Jain via llvm-branch-commits
Author: nitesh.jain
Date: Wed Nov 23 01:37:31 2016
New Revision: 287746

URL: http://llvm.org/viewvc/llvm-project?rev=287746&view=rev
Log:
Merging r284003:

r284003 | nitesh.jain | 2016-10-12 16:23:57 +0530 (Wed, 12 Oct 2016) | 7 lines

[LLDB][MIPS] fix Floating point register read/write for big endian

Reviewers: clayborg, labath, jaydeep

Subscribers: bhushan, slthakur, lldb-commits

Differential Revision: https://reviews.llvm.org/D24603


Modified:
lldb/branches/release_39/   (props changed)

lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp

lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
lldb/branches/release_39/source/Plugins/Process/Utility/RegisterInfos_mips.h

lldb/branches/release_39/source/Plugins/Process/Utility/RegisterInfos_mips64.h

lldb/branches/release_39/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h

Propchange: lldb/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 23 01:37:31 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001,283728-283729
+/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284003

Modified: 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp?rev=287746&r1=287745&r2=287746&view=diff
==
--- 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
 (original)
+++ 
lldb/branches/release_39/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
 Wed Nov 23 01:37:31 2016
@@ -22,6 +22,7 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Core/EmulateInstruction.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "Plugins/Process/Linux/NativeProcessLinux.h"
@@ -569,10 +570,14 @@ NativeRegisterContextLinux_mips64::ReadR
 }
 
 const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
+uint8_t byte_size = reg_info->byte_size;
 if (reg == LLDB_INVALID_REGNUM)
 {
-// This is likely an internal register for lldb use only and should 
not be directly queried.
-error.SetErrorStringWithFormat ("register \"%s\" is an internal-only 
lldb register, cannot read directly", reg_info->name);
+// This is likely an internal register for lldb use only and should 
not be
+// directly queried.
+error.SetErrorStringWithFormat("register \"%s\" is an internal-only 
lldb "
+   "register, cannot read directly",
+   reg_info->name);
 return error;
 }
 
@@ -584,7 +589,8 @@ NativeRegisterContextLinux_mips64::ReadR
 
 if (IsMSA(reg) || IsFPR(reg))
 {
-uint8_t *src;
+uint8_t *src = nullptr;
+lldbassert(reg_info->byte_offset < sizeof(UserArea));
 
 error = ReadCP1();
 
@@ -596,29 +602,35 @@ NativeRegisterContextLinux_mips64::ReadR
 
 if (IsFPR(reg))
 {
-assert (reg_info->byte_offset < sizeof(UserArea));
-src = (uint8_t *)&m_fpr + reg_info->byte_offset - (sizeof(m_gpr));
+if (IsFR0() && (byte_size != 4))
+{
+byte_size = 4;
+uint8_t ptrace_index;
+ptrace_index = 
reg_info->kinds[lldb::eRegisterKindProcessPlugin];
+src = ReturnFPOffset(ptrace_index, reg_info->byte_offset);
+}
+else
+src = (uint8_t *)&m_fpr + reg_info->byte_offset - 
sizeof(m_gpr);
 }
 else
-{
-assert (reg_info->byte_offset < sizeof(UserArea));
-src = (uint8_t *)&m_msa + reg_info->byte_offset - (sizeof(m_gpr) + 
sizeof(m_fpr));
-}
-switch (reg_info->byte_size)
+src = (uint8_t *)&m_msa + reg_info->byte_offset -
+   (sizeof(m_gpr) + sizeof(m_fpr));
+switch (byte_size)
 {
 case 4:
-reg_value.SetUInt32(*(uint32_t *)src);
-break;
+reg_value.SetUInt32(*(uint32_t *)src);
+break;
 case 8:
-reg_value.SetUInt64(*(uint64_t *)src);
-break;
+reg_value.SetUInt64(*(uint64_t *)src);
+break;
 case 16:
-reg_value.SetBytes((const void *)src, 16, GetByteOrder());
-   

[llvm-branch-commits] [lldb] r287747 - Merging r284001:

2016-11-23 Thread Nitesh Jain via llvm-branch-commits
Author: nitesh.jain
Date: Wed Nov 23 02:18:42 2016
New Revision: 287747

URL: http://llvm.org/viewvc/llvm-project?rev=287747&view=rev
Log:
Merging r284001:

r284001 | nitesh.jain | 2016-10-12 15:51:09 +0530 (Wed, 12 Oct 2016) | 7 lines

[LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI

Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

Differential Revision: https://reviews.llvm.org/D25021


Modified:
lldb/branches/release_39/   (props changed)
lldb/branches/release_39/include/lldb/Core/ArchSpec.h
lldb/branches/release_39/source/Core/ArchSpec.cpp

lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Propchange: lldb/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 23 02:18:42 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284003
+/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284001,284003

Modified: lldb/branches/release_39/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/include/lldb/Core/ArchSpec.h?rev=287747&r1=287746&r2=287747&view=diff
==
--- lldb/branches/release_39/include/lldb/Core/ArchSpec.h (original)
+++ lldb/branches/release_39/include/lldb/Core/ArchSpec.h Wed Nov 23 02:18:42 
2016
@@ -382,6 +382,14 @@ public:
 return m_core >= eCore_arm_generic && m_core < kNumCores;
 }
 
+//--
+/// Return a string representing target application ABI.
+///
+/// @return A string representing target application ABI.
+//--
+std::string GetTargetABI() const;
+
+
 bool
 TripleVendorWasSpecified() const
 {
@@ -677,6 +685,8 @@ public:
 m_flags = flags;
 }
 
+  void SetFlags(std::string elf_abi);
+
 protected:
 bool
 IsEqualTo (const ArchSpec& rhs, bool exact_match) const;

Modified: lldb/branches/release_39/source/Core/ArchSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Core/ArchSpec.cpp?rev=287747&r1=287746&r2=287747&view=diff
==
--- lldb/branches/release_39/source/Core/ArchSpec.cpp (original)
+++ lldb/branches/release_39/source/Core/ArchSpec.cpp Wed Nov 23 02:18:42 2016
@@ -519,11 +519,46 @@ ArchSpec::IsMIPS() const
 return false;
 }
 
-std::string
-ArchSpec::GetClangTargetCPU ()
-{
-std::string cpu;
-const llvm::Triple::ArchType machine = GetMachine();
+
+std::string ArchSpec::GetTargetABI() const {
+
+  std::string abi;
+
+  if (IsMIPS()) {
+switch (GetFlags() & ArchSpec::eMIPSABI_mask) {
+case ArchSpec::eMIPSABI_N64:
+  abi = "n64";
+  return abi;
+case ArchSpec::eMIPSABI_N32:
+  abi = "n32";
+  return abi;
+case ArchSpec::eMIPSABI_O32:
+  abi = "o32";
+  return abi;
+default:
+  return abi;
+}
+  }
+  return abi;
+}
+
+void ArchSpec::SetFlags(std::string elf_abi) {
+
+  uint32_t flag = GetFlags();
+  if (IsMIPS()) {
+if (elf_abi == "n64")
+  flag |= ArchSpec::eMIPSABI_N64;
+else if (elf_abi == "n32")
+  flag |= ArchSpec::eMIPSABI_N32;
+else if (elf_abi == "o32")
+  flag |= ArchSpec::eMIPSABI_O32;
+  }
+  SetFlags(flag);
+}
+
+std::string ArchSpec::GetClangTargetCPU() {
+  std::string cpu;
+  const llvm::Triple::ArchType machine = GetMachine();
 
 if (machine == llvm::Triple::mips ||
 machine == llvm::Triple::mipsel ||

Modified: 
lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=287747&r1=287746&r2=287747&view=diff
==
--- 
lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
 (original)
+++ 
lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
 Wed Nov 23 02:18:42 2016
@@ -2856,6 +2856,7 @@ GDBRemoteCommunicationClient::GetCurrent
 std::string os_name;
 std::string vendor_name;
 std::string triple;
+std::string elf_abi;
 uint32_t pointer_byte_size = 0;
 StringExtractor extractor;
 Byt