[Lldb-commits] Patch: Add additional nullptr check to SBValue::CreateValueFromData

2016-05-20 Thread Sebastian Theophil via lldb-commits
SBValue::CreateValueFromData didn’t check if the SBType argument was in fact a 
nullptr. This leads to a crash when dereferencing it of course. I followed the 
naming used in SBValue CreateValueFromAddress above.

Regards,
Sebastian

--
Dr. Sebastian Theophil | stheop...@think-cell.com
Senior Software Engineer

We are looking for C++ Developers: http://www.think-cell.com/career

think-cell Software GmbH | Chausseestr. 8/E | 10115 Berlin | Germany
http://www.think-cell.com | phone +49 30 666473-10 | US phone +1 800 891 8091

Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schödl


SBValue.cpp.patch
Description: SBValue.cpp.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r270201 - Work around android-arm NDK bug exposed by rL269992

2016-05-20 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri May 20 05:58:55 2016
New Revision: 270201

URL: http://llvm.org/viewvc/llvm-project?rev=270201&view=rev
Log:
Work around android-arm NDK bug exposed by rL269992

In the android-arm ndk there is a duplicated typedef in link.h
and in unwind.h causing build erros. This CL introduces a HACK
to prevent LLVM from finding unwind.h to fix the issue.

Modified:
lldb/trunk/cmake/platforms/Android.cmake

Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=270201&r1=270200&r2=270201&view=diff
==
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Fri May 20 05:58:55 2016
@@ -165,6 +165,15 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY O
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 
 # BEGIN EVIL HACK ##
+# In the android-arm NDK unwind.h and link.h contains 2 conflicting
+# typedef for _Unwind_Ptr. Force HAVE_UNWIND_BACKTRACE to 0 to prevent
+# LLVM from finding unwind.h what would break the build.
+if ( ANDROID_ABI STREQUAL "armeabi" )
+ set( HAVE_UNWIND_BACKTRACE 0 CACHE INTERNAL "Hack to disable the finding of 
unwind.h on Android arm" )
+endif()
+# END EVIL HACK 
+
+# BEGIN EVIL HACK ##
 # lldb-server links against libdl even though it's not being used and
 # libdl.a is currently missing from the toolchain (b.android.com/178517).
 # Therefore, in order to statically link lldb-server, we need a temporary
@@ -178,7 +187,8 @@ if( LLVM_BUILD_STATIC )
 void *   dlopen  (const char *filename, int flag)   { return 0; }
 const char * dlerror (void) { return 0; }
 void *   dlsym   (void *handle, const char *symbol) { return 0; }
-int  dlclose (void *handle) { return 0; }")
+int  dlclose (void *handle) { return 0; }
+int  dladdr  (const void *addr, Dl_info *info)  { return 0; }")
  set( flags "${CMAKE_C_FLAGS}" )
  separate_arguments( flags )
  execute_process( COMMAND ${CMAKE_C_COMPILER} ${flags} -c ${libdl}/libdl.c -o 
${libdl}/libdl.o )


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


Re: [Lldb-commits] [PATCH] D19535: Fix 2 LLVM assertion caoused by an API missues in Scalar

2016-05-20 Thread Tamas Berghammer via lldb-commits
tberghammer abandoned this revision.
tberghammer added a comment.

Abandoning. as http://reviews.llvm.org/rL270062 fixed the same issue before I 
managed to add a test for this CL.


http://reviews.llvm.org/D19535



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


Re: [Lldb-commits] [PATCH] D20368: Remove Platform usages from NativeProcessLinux

2016-05-20 Thread Nitesh Jain via lldb-commits
nitesh.jain added inline comments.


Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:39
@@ +38,3 @@
+int regset = NT_PRSTATUS;
+Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, tid, 
®set, &ioVec, sizeof_native_regs_struct);
+HostInfo::ArchitectureKind kind = HostInfo::eArchKindDefault; // same 
bitness this process

Ptrace call with ptrace request "PTRACE_GETREGSET"  is failing for MIPS. We are 
currently investigating the reason for the failure. I will let you know asap.

Thanks


http://reviews.llvm.org/D20368



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


Re: [Lldb-commits] [PATCH] D20368: Remove Platform usages from NativeProcessLinux

2016-05-20 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:39
@@ +38,3 @@
+int regset = NT_PRSTATUS;
+Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, tid, 
®set, &ioVec, sizeof_native_regs_struct);
+HostInfo::ArchitectureKind kind = HostInfo::eArchKindDefault; // same 
bitness this process

nitesh.jain wrote:
> Ptrace call with ptrace request "PTRACE_GETREGSET"  is failing for MIPS. We 
> are currently investigating the reason for the failure. I will let you know 
> asap.
> 
> Thanks
Thanks for checking it out. I'll hold this for now.

Out of curiosity, what is errno being set to after this? Also, in which 
scenario does this happen (64->64 or 64->32, 32->32)?


http://reviews.llvm.org/D20368



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


[Lldb-commits] [lldb] r270207 - [LLDB][MIPS] Fix floating point handling in case of thread step-out

2016-05-20 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Fri May 20 07:07:27 2016
New Revision: 270207

URL: http://llvm.org/viewvc/llvm-project?rev=270207&view=rev
Log:
[LLDB][MIPS] Fix floating point handling in case of thread step-out

Patch by Nitesh Jain.

Summary: These patch fix thread step-out for hard and soft float.

Reviewers: clayborg, bhushan, jaydeep
Subscribers: mohit.bhakkad, sagar, sdardis
Differential: D20416

Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=270207&r1=270206&r2=270207&view=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Fri May 20 07:07:27 2016
@@ -75,6 +75,20 @@ public:
 eMIPSABI_mask   = 0x000ff000
 };
 
+// MIPS Floating point ABI Values
+enum MIPS_ABI_FP
+{
+eMIPS_ABI_FP_ANY = 0x,
+eMIPS_ABI_FP_DOUBLE  = 0x0010,  // hard float / -mdouble-float
+eMIPS_ABI_FP_SINGLE  = 0x0020,  // hard float / -msingle-float
+eMIPS_ABI_FP_SOFT= 0x0030,  // soft float
+eMIPS_ABI_FP_OLD_64  = 0x0040,  // -mips32r2 -mfp64
+eMIPS_ABI_FP_XX  = 0x0050,  // -mfpxx
+eMIPS_ABI_FP_64  = 0x0060,  // -mips32r2 -mfp64
+eMIPS_ABI_FP_64A = 0x0070,  // -mips32r2 -mfp64 -mno-odd-spreg
+eMIPS_ABI_FP_mask= 0x0070
+};
+
 // ARM specific e_flags
 enum ARMeflags
 {

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=270207&r1=270206&r2=270207&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Fri May 20 
07:07:27 2016
@@ -397,7 +397,11 @@ ABISysV_mips::GetReturnValueObjectImpl (
 if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == 
nullptr)
 return return_valobj_sp;
 
+Target *target = exe_ctx.GetTargetPtr();
+const ArchSpec target_arch = target->GetArchitecture();
+ByteOrder target_byte_order = target_arch.GetByteOrder();
 value.SetCompilerType(return_compiler_type);
+uint32_t fp_flag = target_arch.GetFlags() & 
lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
 
 RegisterContext *reg_ctx = thread.GetRegisterContext().get();
 if (!reg_ctx)
@@ -409,8 +413,7 @@ ABISysV_mips::GetReturnValueObjectImpl (
 
 // In MIPS register "r2" (v0) holds the integer function return values
 const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
-size_t bit_width = return_compiler_type.GetBitSize(&thread);
-
+size_t bit_width = return_compiler_type.GetBitSize(&thread); 
 if (return_compiler_type.IsIntegerType (is_signed))
 {
 switch (bit_width)
@@ -467,37 +470,107 @@ ABISysV_mips::GetReturnValueObjectImpl (
 }
 else if (return_compiler_type.IsFloatingPointType (count, is_complex))
 {
-const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
-const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
-
-if (count == 1 && !is_complex)
+if (IsSoftFloat (fp_flag))
 {
+uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 
0);
+if (count != 1 && is_complex)
+return return_valobj_sp;
 switch (bit_width)
 {
 default:
 return return_valobj_sp;
-case 64:
-{
-static_assert(sizeof(double) == sizeof(uint64_t), "");
-uint64_t raw_value;
-raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & 
UINT32_MAX;
-raw_value |= 
((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(f1_info, 0) & UINT32_MAX)) << 32;
-value.GetScalar() = *reinterpret_cast(&raw_value);
-break;
-}
 case 32:
-{
 static_assert(sizeof(float) == sizeof(uint32_t), "");
-uint32_t raw_value = 
reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & UINT32_MAX;
-value.GetScalar() = *reinterpret_cast(&raw_value);
+value.GetScalar() = *((float *)(&raw_value));
+break;
+case 64:
+ 

[Lldb-commits] [lldb] r270208 - [LLDB][MIPS] Fix Floating point Registers Encoding

2016-05-20 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Fri May 20 07:11:52 2016
New Revision: 270208

URL: http://llvm.org/viewvc/llvm-project?rev=270208&view=rev
Log:
[LLDB][MIPS] Fix Floating point Registers Encoding

Patch by Nitesh Jain.

Summary: Currently floating point regsiters has eEncodingUint encoding. Hence 
register write  '1.25' will failed. This patch add eEncodingIEEE754 encoding 
for floating point registers( - ). This patch will fix test_fp_register_write 
in TestRegisters.py

Reviewers: clayborg, sagar
Subscribers: mohit.bhakkad, jaydeep, bhushan, sdardis, lldb-commits
Differential: D18853

Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips.h
lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips64.h

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips.h?rev=270208&r1=270207&r2=270208&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips.h Fri May 20 
07:11:52 2016
@@ -39,8 +39,12 @@
   eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips }, NULL, NULL 
}
 
 #define DEFINE_FPR(reg, alt, kind1, kind2, kind3, kind4)   \
-{ #reg, alt, sizeof(((FPR_linux_mips*)NULL)->reg), FPR_OFFSET(reg), 
eEncodingUint,   \
-  eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips }, NULL, NULL 
}
+{ #reg, alt, sizeof(((FPR_linux_mips*)NULL)->reg), FPR_OFFSET(reg), 
eEncodingIEEE754,   \
+  eFormatFloat, { kind1, kind2, kind3, kind4, fpr_##reg##_mips }, NULL, 
NULL }
+
+#define DEFINE_FPR_INFO(reg, alt, kind1, kind2, kind3, kind4)  \
+   { #reg, alt, sizeof(((FPR_linux_mips*)NULL)->reg), FPR_OFFSET(reg), 
eEncodingUint,   \
+ eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips }, NULL, NULL }
 
 #define DEFINE_MSA(reg, alt, kind1, kind2, kind3, kind4)\
 { #reg, alt, sizeof(((MSA_linux_mips*)0)->reg), MSA_OFFSET(reg), 
eEncodingVector,   \
@@ -126,9 +130,9 @@ g_register_infos_mips[] =
 DEFINE_FPR (f29,   nullptr,dwarf_f29_mips,  dwarf_f29_mips,  
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
 DEFINE_FPR (f30,   nullptr,dwarf_f30_mips,  dwarf_f30_mips,  
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
 DEFINE_FPR (f31,   nullptr,dwarf_f31_mips,  dwarf_f31_mips,  
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
-DEFINE_FPR (fcsr,  nullptr,dwarf_fcsr_mips, dwarf_fcsr_mips, 
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
-DEFINE_FPR (fir,   nullptr,dwarf_fir_mips,  dwarf_fir_mips,  
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
-DEFINE_FPR (config5,   nullptr,dwarf_config5_mips,  
dwarf_config5_mips,  LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
+DEFINE_FPR_INFO (fcsr,  nullptr,dwarf_fcsr_mips, dwarf_fcsr_mips, 
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
+DEFINE_FPR_INFO (fir,   nullptr,dwarf_fir_mips,  dwarf_fir_mips,  
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
+DEFINE_FPR_INFO (config5,   nullptr,dwarf_config5_mips,  
dwarf_config5_mips,  LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
 DEFINE_MSA (w0,nullptr,dwarf_w0_mips,   dwarf_w0_mips,   
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
 DEFINE_MSA (w1,nullptr,dwarf_w1_mips,   dwarf_w1_mips,   
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
 DEFINE_MSA (w2,nullptr,dwarf_w2_mips,   dwarf_w2_mips,   
LLDB_INVALID_REGNUM,LLDB_INVALID_REGNUM),
@@ -176,6 +180,7 @@ static_assert((sizeof(g_register_infos_m
 #undef MSA_OFFSET
 #undef DEFINE_GPR
 #undef DEFINE_FPR
+#undef DEFINE_FPR_INFO
 #undef DEFINE_MSA
 #undef DEFINE_MSA_INFO
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips64.h?rev=270208&r1=270207&r2=270208&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_mips64.h Fri May 20 
07:11:52 2016
@@ -56,6 +56,10 @@
   eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips64 }, NULL, 
NULL }
 
 #define DEFINE_FPR(reg, alt, kind1, kind2, kind3, kind4)\
+{ #reg, alt, sizeof(((FPR_linux_mips*)0)->reg), FPR_OFFSET(reg), 
eEncodingIEEE754,  \
+  eFormatFloat, { kind1, kind2, kind3, kind4, fpr_##reg##_mips64 }, NULL, 
NULL }
+
+#define DEFINE_FPR_INFO(reg, alt, kind1, kind2, kind3, kind4)\
 { #reg, alt, sizeof(((FPR_linux_mips*)0)->reg), FPR_OFFSET(reg), 
eEncodingUint,   \
   eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips64 }, NULL, 
NULL }
 
@@ -184,9 +188,9 @@ g_register_infos_mips64[] =
 DEFINE_FPR (f29

Re: [Lldb-commits] [PATCH] D18853: [LLDB][MIPS] Fix Floating point Registers Encoding

2016-05-20 Thread Nitesh Jain via lldb-commits
nitesh.jain closed this revision.
nitesh.jain added a comment.

Committed in revision 270208.


Repository:
  rL LLVM

http://reviews.llvm.org/D18853



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


Re: [Lldb-commits] [PATCH] D20416: [LLDB][MIPS] Fix floating point handling in case of thread step-out

2016-05-20 Thread Nitesh Jain via lldb-commits
nitesh.jain added a comment.

committed in revision 270207


Repository:
  rL LLVM

http://reviews.llvm.org/D20416



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


Re: [Lldb-commits] [PATCH] D20368: Remove Platform usages from NativeProcessLinux

2016-05-20 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:39
@@ +38,3 @@
+int regset = NT_PRSTATUS;
+Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, tid, 
®set, &ioVec, sizeof_native_regs_struct);
+HostInfo::ArchitectureKind kind = HostInfo::eArchKindDefault; // same 
bitness this process

labath wrote:
> nitesh.jain wrote:
> > Ptrace call with ptrace request "PTRACE_GETREGSET"  is failing for MIPS. We 
> > are currently investigating the reason for the failure. I will let you know 
> > asap.
> > 
> > Thanks
> Thanks for checking it out. I'll hold this for now.
> 
> Out of curiosity, what is errno being set to after this? Also, in which 
> scenario does this happen (64->64 or 64->32, 32->32)?
Also, what is the kernel version you are using? NT_PRSTATUS was apparently 
added in 3.13, although I'm not sure if all the all the necessary pieces were 
there already -- (it may have been enabled slightly later).


http://reviews.llvm.org/D20368



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


[Lldb-commits] [lldb] r270214 - Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread step-out"

2016-05-20 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri May 20 08:07:16 2016
New Revision: 270214

URL: http://llvm.org/viewvc/llvm-project?rev=270214&view=rev
Log:
Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread 
step-out"

The CL causes a build breakage on platforms where sizeof(double) == sizeof(long 
double)
and it incorrectly assumes that sizeof(double) and sizeof(long double) is the 
same
on the host and the target.

Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=270214&r1=270213&r2=270214&view=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Fri May 20 08:07:16 2016
@@ -75,20 +75,6 @@ public:
 eMIPSABI_mask   = 0x000ff000
 };
 
-// MIPS Floating point ABI Values
-enum MIPS_ABI_FP
-{
-eMIPS_ABI_FP_ANY = 0x,
-eMIPS_ABI_FP_DOUBLE  = 0x0010,  // hard float / -mdouble-float
-eMIPS_ABI_FP_SINGLE  = 0x0020,  // hard float / -msingle-float
-eMIPS_ABI_FP_SOFT= 0x0030,  // soft float
-eMIPS_ABI_FP_OLD_64  = 0x0040,  // -mips32r2 -mfp64
-eMIPS_ABI_FP_XX  = 0x0050,  // -mfpxx
-eMIPS_ABI_FP_64  = 0x0060,  // -mips32r2 -mfp64
-eMIPS_ABI_FP_64A = 0x0070,  // -mips32r2 -mfp64 -mno-odd-spreg
-eMIPS_ABI_FP_mask= 0x0070
-};
-
 // ARM specific e_flags
 enum ARMeflags
 {

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=270214&r1=270213&r2=270214&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Fri May 20 
08:07:16 2016
@@ -397,11 +397,7 @@ ABISysV_mips::GetReturnValueObjectImpl (
 if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == 
nullptr)
 return return_valobj_sp;
 
-Target *target = exe_ctx.GetTargetPtr();
-const ArchSpec target_arch = target->GetArchitecture();
-ByteOrder target_byte_order = target_arch.GetByteOrder();
 value.SetCompilerType(return_compiler_type);
-uint32_t fp_flag = target_arch.GetFlags() & 
lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
 
 RegisterContext *reg_ctx = thread.GetRegisterContext().get();
 if (!reg_ctx)
@@ -413,7 +409,8 @@ ABISysV_mips::GetReturnValueObjectImpl (
 
 // In MIPS register "r2" (v0) holds the integer function return values
 const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
-size_t bit_width = return_compiler_type.GetBitSize(&thread); 
+size_t bit_width = return_compiler_type.GetBitSize(&thread);
+
 if (return_compiler_type.IsIntegerType (is_signed))
 {
 switch (bit_width)
@@ -470,107 +467,37 @@ ABISysV_mips::GetReturnValueObjectImpl (
 }
 else if (return_compiler_type.IsFloatingPointType (count, is_complex))
 {
-if (IsSoftFloat (fp_flag))
+const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
+const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+
+if (count == 1 && !is_complex)
 {
-uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 
0);
-if (count != 1 && is_complex)
-return return_valobj_sp;
 switch (bit_width)
 {
 default:
 return return_valobj_sp;
-case 32:
-static_assert(sizeof(float) == sizeof(uint32_t), "");
-value.GetScalar() = *((float *)(&raw_value));
-break;
 case 64:
+{
 static_assert(sizeof(double) == sizeof(uint64_t), "");
-const RegisterInfo *r3_reg_info = 
reg_ctx->GetRegisterInfoByName("r3", 0);
-if (target_byte_order == eByteOrderLittle)
-raw_value = 
((reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0)) << 32) | raw_value;
-else
-raw_value = (raw_value << 32) | 
reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0);
-value.GetScalar() = *((double *)(&raw_value));
+uint64_t raw_value;
+raw_value = reg_ctx->ReadRegiste

Re: [Lldb-commits] [lldb] r270207 - [LLDB][MIPS] Fix floating point handling in case of thread step-out

2016-05-20 Thread Tamas Berghammer via lldb-commits
I had to revert this CL with rL270214 as it causes a build breakage (see
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/7282)
and makes a false assumption regarding host-target compatibility. Please
see my commit message in http://reviews.llvm.org/rL270214 for more details.

Thanks,
Tamas

On Fri, May 20, 2016 at 1:13 PM Sagar Thakur via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: slthakur
> Date: Fri May 20 07:07:27 2016
> New Revision: 270207
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270207&view=rev
> Log:
> [LLDB][MIPS] Fix floating point handling in case of thread step-out
>
> Patch by Nitesh Jain.
>
> Summary: These patch fix thread step-out for hard and soft float.
>
> Reviewers: clayborg, bhushan, jaydeep
> Subscribers: mohit.bhakkad, sagar, sdardis
> Differential: D20416
>
> Modified:
> lldb/trunk/include/lldb/Core/ArchSpec.h
> lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
> lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
> lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
> lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
> lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
>
> Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=270207&r1=270206&r2=270207&view=diff
>
> ==
> --- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
> +++ lldb/trunk/include/lldb/Core/ArchSpec.h Fri May 20 07:07:27 2016
> @@ -75,6 +75,20 @@ public:
>  eMIPSABI_mask   = 0x000ff000
>  };
>
> +// MIPS Floating point ABI Values
> +enum MIPS_ABI_FP
> +{
> +eMIPS_ABI_FP_ANY = 0x,
> +eMIPS_ABI_FP_DOUBLE  = 0x0010,  // hard float / -mdouble-float
> +eMIPS_ABI_FP_SINGLE  = 0x0020,  // hard float / -msingle-float
> +eMIPS_ABI_FP_SOFT= 0x0030,  // soft float
> +eMIPS_ABI_FP_OLD_64  = 0x0040,  // -mips32r2 -mfp64
> +eMIPS_ABI_FP_XX  = 0x0050,  // -mfpxx
> +eMIPS_ABI_FP_64  = 0x0060,  // -mips32r2 -mfp64
> +eMIPS_ABI_FP_64A = 0x0070,  // -mips32r2 -mfp64
> -mno-odd-spreg
> +eMIPS_ABI_FP_mask= 0x0070
> +};
> +
>  // ARM specific e_flags
>  enum ARMeflags
>  {
>
> Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=270207&r1=270206&r2=270207&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
> +++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Fri May 20
> 07:07:27 2016
> @@ -397,7 +397,11 @@ ABISysV_mips::GetReturnValueObjectImpl (
>  if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() ==
> nullptr)
>  return return_valobj_sp;
>
> +Target *target = exe_ctx.GetTargetPtr();
> +const ArchSpec target_arch = target->GetArchitecture();
> +ByteOrder target_byte_order = target_arch.GetByteOrder();
>  value.SetCompilerType(return_compiler_type);
> +uint32_t fp_flag = target_arch.GetFlags() &
> lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
>
>  RegisterContext *reg_ctx = thread.GetRegisterContext().get();
>  if (!reg_ctx)
> @@ -409,8 +413,7 @@ ABISysV_mips::GetReturnValueObjectImpl (
>
>  // In MIPS register "r2" (v0) holds the integer function return values
>  const RegisterInfo *r2_reg_info =
> reg_ctx->GetRegisterInfoByName("r2", 0);
> -size_t bit_width = return_compiler_type.GetBitSize(&thread);
> -
> +size_t bit_width = return_compiler_type.GetBitSize(&thread);
>  if (return_compiler_type.IsIntegerType (is_signed))
>  {
>  switch (bit_width)
> @@ -467,37 +470,107 @@ ABISysV_mips::GetReturnValueObjectImpl (
>  }
>  else if (return_compiler_type.IsFloatingPointType (count, is_complex))
>  {
> -const RegisterInfo *f0_info =
> reg_ctx->GetRegisterInfoByName("f0", 0);
> -const RegisterInfo *f1_info =
> reg_ctx->GetRegisterInfoByName("f1", 0);
> -
> -if (count == 1 && !is_complex)
> +if (IsSoftFloat (fp_flag))
>  {
> +uint64_t raw_value =
> reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 0);
> +if (count != 1 && is_complex)
> +return return_valobj_sp;
>  switch (bit_width)
>  {
>  default:
>  return return_valobj_sp;
> -case 64:
> -{
> -static_assert(sizeof(double) == sizeof(uint64_t), "");
> -uint64_t raw_value;
> -raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info,
> 0) & UINT32_MAX;
> -raw_value |=
> 

Re: [Lldb-commits] [PATCH] D20368: Remove Platform usages from NativeProcessLinux

2016-05-20 Thread Muhammad Omair Javaid via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.

Seems to be causing no regressions on arm-linux.


http://reviews.llvm.org/D20368



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


Re: [Lldb-commits] [PATCH] D17027: [expression evaluator] Allow runtimes to execute custom LLVM ModulePasses over the generated IR at various stages after expression compilation.

2016-05-20 Thread Luke Drummond via lldb-commits
ldrumm added a comment.

gentle ping, if @spyffe or @jingham is available to take another pass at this.


http://reviews.llvm.org/D17027



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


[Lldb-commits] [lldb] r270254 - Adopt mmap flags that allow mmap'ed memory to be less crash prone.

2016-05-20 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri May 20 14:18:20 2016
New Revision: 270254

URL: http://llvm.org/viewvc/llvm-project?rev=270254&view=rev
Log:
Adopt mmap flags that allow mmap'ed memory to be less crash prone.

On Darwin if a mmap file is code signed and the code signature is invalid, it 
used to crash. If we specify the MAP_RESILIENT_CODESIGN mmap flag when mapping 
a file for reading, we can avoid crashing.

Another mmap flag named MAP_RESILIENT_MEDIA allows us to survive if we mmap 
files that are on removable media like network servers or removable hard 
drives. If a file was mapped and later the media that had the file became 
unavailable, we would crash when we would touch the next page that wasn't paged 
in. Now it will return zeroes and stop of from us from crashing.




Modified:
lldb/trunk/source/Core/DataBufferMemoryMap.cpp

Modified: lldb/trunk/source/Core/DataBufferMemoryMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataBufferMemoryMap.cpp?rev=270254&r1=270253&r2=270254&view=diff
==
--- lldb/trunk/source/Core/DataBufferMemoryMap.cpp (original)
+++ lldb/trunk/source/Core/DataBufferMemoryMap.cpp Fri May 20 14:18:20 2016
@@ -14,8 +14,29 @@
 #include "lldb/Host/windows/windows.h"
 #else
 #include 
-#endif
 
+#define MAP_EXTRA_HOST_READ_FLAGS 0
+
+#if defined (__APPLE__)
+//--
+// Newer versions of MacOSX have a flag that will allow us to read from
+// binaries whose code signature is invalid without crashing by using
+// the MAP_RESILIENT_CODESIGN flag. Also if a file from removable media
+// is mapped we can avoid crashing and return zeroes to any pages we try
+// to read if the media becomes unavailable by using the
+// MAP_RESILIENT_MEDIA flag.
+//--
+#if defined(MAP_RESILIENT_CODESIGN)
+#undef MAP_EXTRA_HOST_READ_FLAGS
+#if defined(MAP_RESILIENT_MEDIA)
+#define MAP_EXTRA_HOST_READ_FLAGS MAP_RESILIENT_CODESIGN | 
MAP_RESILIENT_MEDIA
+#else
+#define MAP_EXTRA_HOST_READ_FLAGS MAP_RESILIENT_CODESIGN
+#endif
+#endif // #if defined(MAP_RESILIENT_CODESIGN)
+#endif // #if defined (__APPLE__)
+
+#endif // #else #ifdef _WIN32
 // C++ Includes
 #include 
 #include 
@@ -255,10 +276,12 @@ DataBufferMemoryMap::MemoryMapFromFileDe
 if (length > 0)
 {
 int prot = PROT_READ;
+int flags = MAP_PRIVATE;
 if (writeable)
 prot |= PROT_WRITE;
+else
+flags |= MAP_EXTRA_HOST_READ_FLAGS;
 
-int flags = MAP_PRIVATE;
 if (fd_is_file)
 flags |= MAP_FILE;
 


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


Re: [Lldb-commits] Patch: Add additional nullptr check to SBValue::CreateValueFromData

2016-05-20 Thread Enrico Granata via lldb-commits

> On May 20, 2016, at 2:35 AM, Sebastian Theophil via lldb-commits 
>  wrote:
> 
> SBValue::CreateValueFromData didn’t check if the SBType argument was in fact 
> a nullptr. This leads to a crash when dereferencing it of course. I followed 
> the naming used in SBValue CreateValueFromAddress above.
> 
> Regards,
> Sebastian
> 
> --
> Dr. Sebastian Theophil | stheop...@think-cell.com
> Senior Software Engineer
> 
> We are looking for C++ Developers: http://www.think-cell.com/career
> 
> think-cell Software GmbH | Chausseestr. 8/E | 10115 Berlin | Germany
> http://www.think-cell.com | phone +49 30 666473-10 | US phone +1 800 891 8091
> 
> Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id 
> DE813474306
> Directors: Dr. Markus Hannebauer, Dr. Arno Schödl
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Sebastian,
Your patch LGTM - thanks for submitting it for review.

If you have commit access, feel free to commit yourself - otherwise I will 
gladly do it for you.

With that said, in general, LLDB patches go through review on 
http://reviews.llvm.org 

Thanks,
- Enrico___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-05-20 Thread Zachary Turner via lldb-commits
zturner added a comment.

I'm still getting a lot of crashes after this, but this will at least fix the 
compiler errors.  I will try to look at the crashes on Monday.



Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:354-355
@@ -358,5 +353,4 @@
 {
-// Calculate absolute timeout value
-TimeValue timeout = TimeValue::Now();
-timeout.OffsetWithMicroSeconds(timeout_usec);
+std::chrono::time_point until =
+std::chrono::system_clock::now() + 
std::chrono::microseconds(timeout_usec);
 

Need to use `auto` here, otherwise there's a compiler error.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:844
@@ -845,1 +843,3 @@
+if (m_async_packet_predicate.WaitForValueEqualTo(
+false, until - 
std::chrono::system_clock::now(), &timed_out))
 {

this needs to use `std::chrono::duration_cast(until 
- std::chrono::system_clock::now())`.  Maybe raise this into a temporary 
variable (also make sure to use auto on the result just in case).


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:860
@@ -859,2 +859,3 @@
 // Make sure we wait until the continue packet has 
been sent again...
-if (m_private_is_running.WaitForValueEqualTo (true, 
&timeout_time, &timed_out))
+if (m_private_is_running.WaitForValueEqualTo(true, 
until - std::chrono::system_clock::now(),
+ 
&timed_out))

`duration_cast` again.


Comment at: source/Target/Process.cpp:5547
@@ +5546,3 @@
+log->Printf("Process::RunThreadPlan(): about to wait - now 
is %llu - endpoint is %llu",
+
std::chrono::time_point(
+std::chrono::system_clock::now())

Delete the cast here.  Just use `std::chrono::system_clock::now()`.


Comment at: source/Target/Process.cpp:5551
@@ +5550,3 @@
+.count(),
+
std::chrono::time_point(timeout)
+.time_since_epoch()

Change to `timeout.time_since_epoch()`


Repository:
  rL LLVM

http://reviews.llvm.org/D20436



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