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

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


Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:53
@@ -22,2 +52,3 @@
+
 NativeRegisterContextLinux::NativeRegisterContextLinux(NativeThreadProtocol 
&native_thread,
uint32_t 
concrete_frame_idx,

labath wrote:
> jaydeep wrote:
> > We have tried executing ptrace(NT_PRSTATUS) on MIPS with 3.18. It is able 
> > to detect the arch correctly (64->64 and 64->32). However with 3.10 it 
> > fails with EIO. Is there any fallback method when ptrace(NT_PRSTATUS) fails?
> Thanks for checking that out.
> 
> This makes things a bit tricky. We *could* fallback to the "parse the 
> executable ELF" method of getting the architecture, but that would make this 
> patch a bit pointless, as that is what I am trying to remove in the first 
> place. I suppose we could make the fallback mips-only, but that will not be 
> too ideal either.
> 
> I don't know about any other fallbacks. It would be interesting to know how 
> strace does that. I've tried looking at strace source code, but I could not 
> make much out of it. Do you know if a single strace binary is capable of 
> correctly tracing both 32- and 64-bit processes? If so, could you try running 
> the following experiment for me:
> - create a simple c file that does a sleep(1) and exits
> - compile 32- and 64-bit versions of the executable
> - execute the following commands:
> ```
> strace -o /tmp/32.txt -- strace -o /dev/null -- a.out.32
> strace -o /tmp/64.txt -- strace -o /dev/null -- a.out.64
> ```
> 
> Could you send me the outputs (32.txt, 64.txt). Maybe I'll be able to figure 
> something out from that.
> 
> If that does not work, I may have to abandon this.
> 
> thanks.
// 32 bit ELF
gcc-4.9 -g -O0 -mabi=64 -mips64r2 simple.c -o a.out.64

// 64 bit ELF
gcc-4.9 -g -O0 -mabi=32 -mips32r2 simple.c -o a.out.32

// Strace for 32 and 64 bit
strace -o /tmp/64.txt -- strace -o /dev/null -- ./a.out.64
strace -o /tmp/32.txt -- strace -o /dev/null -- ./a.out.32


// File command output for both file

a.out.64: ELF 64-bit LSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld.so.1, 
BuildID[sha1]=6e0f92a8abee292b4b6462d79ec0420a3d8aaad0, for GNU/Linux 2.6.32, 
not stripped

a.out.32: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically 
linked, interpreter /lib/ld.so.1, for GNU/Linux 2.6.32, 
BuildID[sha1]=c4e09148526975f777e3e70bec85868616d3ce94, not stripped


{F1978053}

{F1978054}


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-24 Thread Nitesh Jain via lldb-commits
nitesh.jain added a comment.

In case of MIPS, ptrace always return 64 bit data irrespetive of Arch.


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] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Pavel Labath via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

According to 
https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396,
 characters with codes 1..31 (basically `< ' '`), are illegal as well. We might 
as well convert those, just in case.

I've been sitting on a unit test for the module cache locally for a while 
now... I guess it's time to put that in, and then we can add a test for this as 
well.


http://reviews.llvm.org/D20548



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


[Lldb-commits] [PATCH] D20565: Add MemoryRegionInfo to SB API

2016-05-24 Thread Howard Hellyer via lldb-commits
hhellyer created this revision.
hhellyer added a reviewer: clayborg.
hhellyer added a subscriber: lldb-commits.

This adds new SB API calls and classes to allow a user of the SB API to obtain 
a full list of memory regions accessible within the process. Adding this to the 
API makes it possible use the API for tasks like scanning memory for blocks 
allocated with a header and footer to track down memory leaks, otherwise just 
inspecting every address is impractical especially for 64 bit processes.

These changes only add the API itself and a base implementation of 
GetMemoryRegions() to lldb_private::Process::GetMemoryRegions.
I will submit separate patches to fill in 
lldb_private::Process::GetMemoryRegionInfoList and GetMemoryRegionInfo for 
individual platforms.

The original discussion about this is here:
http://lists.llvm.org/pipermail/lldb-dev/2016-May/010203.html

http://reviews.llvm.org/D20565

Files:
  include/lldb/API/LLDB.h
  include/lldb/API/SBDefines.h
  include/lldb/API/SBMemoryRegionInfo.h
  include/lldb/API/SBMemoryRegionInfoList.h
  include/lldb/API/SBProcess.h
  include/lldb/API/SBStream.h
  include/lldb/Target/MemoryRegionInfo.h
  include/lldb/Target/Process.h
  include/lldb/lldb-forward.h
  source/API/CMakeLists.txt
  source/API/SBMemoryRegionInfo.cpp
  source/API/SBMemoryRegionInfoList.cpp
  source/API/SBProcess.cpp

Index: source/API/SBProcess.cpp
===
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/SystemRuntime.h"
@@ -36,6 +37,8 @@
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBMemoryRegionInfoList.h"
 #include "lldb/API/SBThread.h"
 #include "lldb/API/SBThreadCollection.h"
 #include "lldb/API/SBStream.h"
@@ -1471,3 +1474,72 @@
 error.ref() = PluginManager::SaveCore(process_sp, core_file);
 return error;
 }
+
+lldb::SBError
+SBProcess::GetMemoryRegionInfo (lldb::addr_t load_addr, SBMemoryRegionInfo &sb_region_info) {
+	lldb::SBError sb_error;
+ProcessSP process_sp(GetSP());
+MemoryRegionInfoSP region_info = std::make_shared();
+if (process_sp)
+{
+Process::StopLocker stop_locker;
+if (stop_locker.TryLock(&process_sp->GetRunLock()))
+{
+std::lock_guard guard(process_sp->GetTarget().GetAPIMutex());
+sb_error.ref() = process_sp->GetMemoryRegionInfo(load_addr, *region_info);
+if( sb_error.Success() ) {
+sb_region_info.SetSP(region_info);
+}
+}
+else
+{
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log->Printf ("SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+ static_cast(process_sp.get()));
+sb_error.SetErrorString("process is running");
+}
+}
+else
+{
+sb_error.SetErrorString ("SBProcess is invalid");
+}
+return sb_error;
+}
+
+lldb::SBMemoryRegionInfoList
+SBProcess::GetMemoryRegions() {
+lldb::SBError sb_error;
+lldb::SBMemoryRegionInfoList sb_region_list;
+ProcessSP process_sp(GetSP());
+if (process_sp)
+{
+Process::StopLocker stop_locker;
+if (stop_locker.TryLock(&process_sp->GetRunLock()))
+{
+std::lock_guard guard(process_sp->GetTarget().GetAPIMutex());
+std::vector region_list;
+sb_error.ref() = process_sp->GetMemoryRegions(region_list);
+if( sb_error.Success() ) {
+std::vector::iterator end = region_list.end();
+for( std::vector::iterator it = region_list.begin(); it != end; it++ ) {
+SBMemoryRegionInfo sb_region_info(*it);
+sb_region_list.Append(sb_region_info);
+}
+}
+}
+else
+{
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+if (log)
+log->Printf ("SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+ static_cast(process_sp.get()));
+sb_error.SetErrorString("process is running");
+}
+}
+else
+{
+sb_error.SetErrorString ("SBProcess is invalid");
+}
+return sb_region_list;
+}
Index: source/API/SBMemoryRegionInfoList.cpp
===
--- /dev/null
+++ source/API/SBMemoryRegionInfoList.cpp
@@ -0,0 +1,172 @@
+//===-- SBMemoryRegionInfoList.cpp --*- C++ -*-===//
+//
+// The LLVM 

[Lldb-commits] [PATCH] D20567: Avoid using stdio in TestVirtual

2016-05-24 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added subscribers: zturner, lldb-commits.

using stdio in tests does not work on windows, and it is not completely 
reliable on linux.
Avoid using stdio in this test, as it is not necessary for this purpose.

http://reviews.llvm.org/D20567

Files:
  packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
  packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp

Index: packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
===
--- packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
@@ -1,5 +1,4 @@
-#include 
-#include 
+#include 
 
 class A
 {
@@ -84,18 +83,19 @@
 C *c_as_C = new C();
 A *c_as_A = c_as_C;
 
-printf ("a_as_A->a() = '%s'\n", a_as_A->a());
-printf ("a_as_A->b() = '%s'\n", a_as_A->b());
-printf ("a_as_A->c() = '%s'\n", a_as_A->c());
-printf ("b_as_A->a() = '%s'\n", b_as_A->a());
-printf ("b_as_A->b() = '%s'\n", b_as_A->b());
-printf ("b_as_A->c() = '%s'\n", b_as_A->c());
-printf ("b_as_B->aa() = '%s'\n", b_as_B->aa());
-printf ("c_as_A->a() = '%s'\n", c_as_A->a());
-printf ("c_as_A->b() = '%s'\n", c_as_A->b());
-printf ("c_as_A->c() = '%s'\n", c_as_A->c());
-printf ("c_as_C->aa() = '%s'\n", c_as_C->aa());
-puts("");// Set first breakpoint here.
+std::string golden;
+golden += std::string("a_as_A->a() = '") + a_as_A->a() + "'\n";
+golden += std::string("a_as_A->b() = '") + a_as_A->b() + "'\n";
+golden += std::string("a_as_A->c() = '") + a_as_A->c() + "'\n";
+golden += std::string("b_as_A->a() = '") + b_as_A->a() + "'\n";
+golden += std::string("b_as_A->b() = '") + b_as_A->b() + "'\n";
+golden += std::string("b_as_A->c() = '") + b_as_A->c() + "'\n";
+golden += std::string("b_as_B->aa() = '") + b_as_B->aa() + "'\n";
+golden += std::string("c_as_A->a() = '") + c_as_A->a() + "'\n";
+golden += std::string("c_as_A->b() = '") + c_as_A->b() + "'\n";
+golden += std::string("c_as_A->c() = '") + c_as_A->c() + "'\n";
+golden += std::string("c_as_C->aa() = '") + c_as_C->aa() + "'\n";
+return 0;// Set first breakpoint here.
 // then evaluate:
 // expression a_as_A->a()
 // expression a_as_A->b()
@@ -108,6 +108,4 @@
 // expression c_as_A->b()
 // expression c_as_A->c()
 // expression c_as_C->aa()
-
-return 0;
 }
Index: packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
===
--- packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
+++ packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
@@ -58,11 +58,11 @@
 thread = lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint)
 self.assertTrue(thread.IsValid(), "There should be a thread stopped 
due to breakpoint condition")
 
-# First, capture the golden output from the program itself from the
-# series of printf statements.
-stdout = process.GetSTDOUT(1024)
-
-self.assertIsNotNone(stdout, "Encountered an error reading the 
process's output")
+# First, capture the golden output from the program itself.
+golden = thread.GetFrameAtIndex(0).FindVariable("golden")
+self.assertTrue(golden.IsValid(), "Encountered an error reading the 
process's golden variable")
+golden_str = str(golden)
+self.assertTrue("c_as_C" in golden_str)
 
 # This golden list contains a list of "my_expr = 'value' pairs 
extracted
 # from the golden output.
@@ -72,7 +72,7 @@
 #
 # my_expr = 'value'
 #
-for line in stdout.split(os.linesep):
+for line in golden_str.split(os.linesep):
 match = self.pattern.search(line)
 if match:
 my_expr, val = match.group(1), match.group(2)


Index: packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
===
--- packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
@@ -1,5 +1,4 @@
-#include 
-#include 
+#include 
 
 class A
 {
@@ -84,18 +83,19 @@
 C *c_as_C = new C();
 A *c_as_A = c_as_C;
 
-printf ("a_as_A->a() = '%s'\n", a_as_A->a());
-printf ("a_as_A->b() = '%s'\n", a_as_A->b());
-printf ("a_as_A->c() = '%s'\n", a_as_A->c());
-printf ("b_as_A->a() = '%s'\n", b_as_A->a());
-printf ("b_as_A->b() = '%s'\n", b_as_A->b());
-printf ("b_as_A->c() = '%s'\n", b_as_A->c());
-printf ("b_as_B->aa() = '%s'\n", b_as_B->aa());
-printf ("c_as_A->a() = '%s'\n", c_as_A->a());
-printf ("c_as_A->b() = '%s'\n", c_as_A->b());
-printf ("c_as_A->c() = '%s'\n", c_as_A->c());
-printf ("c_as_C->aa() = '%s'\n", c_as_C->aa());
-puts("");// Set first breakpoint here.
+  

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

2016-05-24 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Tue May 24 09:52:50 2016
New Revision: 270564

URL: http://llvm.org/viewvc/llvm-project?rev=270564&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: jaydeep, bhushan, clayborg
Differential Revision: http://reviews.llvm.org/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=270564&r1=270563&r2=270564&view=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Tue May 24 09:52:50 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=270564&r1=270563&r2=270564&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Tue May 24 
09:52:50 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:
+sta

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

2016-05-24 Thread Sagar Thakur via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270564: [LLDB][MIPS] Fix floating point handling in case of 
thread step-out (authored by slthakur).

Changed prior to commit:
  http://reviews.llvm.org/D20416?vs=57739&id=58236#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20416

Files:
  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

Index: lldb/trunk/include/lldb/Core/ArchSpec.h
===
--- lldb/trunk/include/lldb/Core/ArchSpec.h
+++ lldb/trunk/include/lldb/Core/ArchSpec.h
@@ -75,6 +75,20 @@
 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
 {
Index: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
===
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
@@ -54,6 +54,9 @@
 RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
 
 bool
+IsSoftFloat(uint32_t fp_flag) const;
+
+bool
 CallFrameAddressIsValid(lldb::addr_t cfa) override
 {
 // Make sure the stack call frame addresses are 8 byte aligned
Index: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
===
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -397,7 +397,11 @@
 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 @@
 
 // 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 @@
 }
 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:
+static_assert(sizeof(double) == 

[Lldb-commits] [lldb] r270570 - Add a missing include to ItaniumABILanguageRuntime.h

2016-05-24 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 24 10:32:40 2016
New Revision: 270570

URL: http://llvm.org/viewvc/llvm-project?rev=270570&view=rev
Log:
Add a missing include to ItaniumABILanguageRuntime.h

some (I'm not sure why only some, actually) implementations of std::map require 
the value type to
be a fully specified type when declaring then. This make sure TypeAndOrName is.

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h?rev=270570&r1=270569&r2=270570&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
 Tue May 24 10:32:40 2016
@@ -20,6 +20,7 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Symbol/Type.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Core/Value.h"


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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Adrian,

I'm going to take a look at this with you today.  I'm reviewing all the 
comments on this so far.

-Todd


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

So at this point, it looks like we're just missing a mechanism to check for 
gmodules support, and then add it to the supported_categories list if it is 
available.

I'll have a look a that.

This might be the time where we want to break out an apple-clang vs. 
llvm.org-clang when we talk about version numbers.  We're asking for trouble 
when we treat both as the same, yet they have drastically different version 
numbers that will eventually collide as llvm.org version numbers increase.



Comment at: packages/Python/lldbsuite/test/lldbtest.py:1488
@@ +1487,3 @@
+@wraps(attrvalue)
+def dwarf_test_method(self, attrvalue=attrvalue):
+self.debug_info = "gmodules"

labath wrote:
> Shouldn't this be `gmodules_test_method`?
I agree with @labath


Comment at: packages/Python/lldbsuite/test/plugins/builder_base.py:144
@@ -143,1 +143,3 @@
 
+def buildDwarf(sender=None, architecture=None, compiler=None, dictionary=None, 
clean=True):
+"""Build the binaries with dwarf debug info."""

labath wrote:
> shouldn't this be `buildModules` or something?
buildGModules() sounds right here, particularly since it matches the define 
being passed in.  And adjust the comment below to reflect.


http://reviews.llvm.org/D19998



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


[Lldb-commits] [PATCH] D20570: Add unit tests for ModuleCache

2016-05-24 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: ovyalov, zturner.
labath added a subscriber: lldb-commits.

http://reviews.llvm.org/D20570

Files:
  unittests/Utility/CMakeLists.txt
  unittests/Utility/Inputs/TestModule.c
  unittests/Utility/Inputs/TestModule.so
  unittests/Utility/ModuleCacheTest.cpp

Index: unittests/Utility/ModuleCacheTest.cpp
===
--- /dev/null
+++ unittests/Utility/ModuleCacheTest.cpp
@@ -0,0 +1,166 @@
+#include "gtest/gtest.h"
+
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "Utility/ModuleCache.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/SymbolContext.h"
+
+extern const char *TestMainArgv0;
+
+using namespace lldb_private;
+using namespace lldb;
+
+namespace
+{
+
+class ModuleCacheTest : public testing::Test
+{
+public:
+void
+SetUp() override;
+
+protected:
+FileSpec m_cache_dir;
+llvm::SmallString<128> m_test_executable;
+
+void
+TryGetAndPut(const FileSpec &cache_dir, const char *hostname, bool expect_download);
+};
+}
+
+static const char dummy_hostname[] = "dummy_hostname";
+static const char dummy_remote_dir[] = "bin";
+static const char module_name[] = "TestModule.so";
+static const char module_uuid[] = "F4E7E991-9B61-6AD4-0073-561AC3D9FA10-C043A476";
+static const uint32_t uuid_bytes = 20;
+static const size_t module_size = 5602;
+
+static FileSpec
+GetDummyRemotePath()
+{
+FileSpec fs("/", false, FileSpec::ePathSyntaxPosix);
+fs.AppendPathComponent(dummy_remote_dir);
+fs.AppendPathComponent(module_name);
+return fs;
+}
+
+static FileSpec
+GetUuidView(FileSpec spec)
+{
+spec.AppendPathComponent(".cache");
+spec.AppendPathComponent(module_uuid);
+spec.AppendPathComponent(module_name);
+return spec;
+}
+
+static FileSpec
+GetSysrootView(FileSpec spec, const char *hostname)
+{
+spec.AppendPathComponent(hostname);
+spec.AppendPathComponent(dummy_remote_dir);
+spec.AppendPathComponent(module_name);
+return spec;
+}
+
+void
+ModuleCacheTest::SetUp()
+{
+HostInfo::Initialize();
+ObjectFileELF::Initialize();
+
+FileSpec tmpdir_spec;
+HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, m_cache_dir);
+
+llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0);
+m_test_executable = exe_folder;
+llvm::sys::path::append(m_test_executable, "Inputs", module_name);
+}
+
+static void
+VerifyDiskState(const FileSpec &cache_dir, const char *hostname)
+{
+FileSpec uuid_view = GetUuidView(cache_dir);
+EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString();
+EXPECT_EQ(module_size, uuid_view.GetByteSize());
+
+FileSpec sysroot_view = GetSysrootView(cache_dir, hostname);
+EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: " << sysroot_view.GetCString();
+EXPECT_EQ(module_size, sysroot_view.GetByteSize());
+}
+
+void
+ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir, const char *hostname, bool expect_download)
+{
+ModuleCache mc;
+ModuleSpec module_spec;
+module_spec.GetFileSpec() = GetDummyRemotePath();
+module_spec.GetUUID().SetFromCString(module_uuid, uuid_bytes);
+module_spec.SetObjectSize(module_size);
+ModuleSP module_sp;
+bool did_create;
+bool download_called = false;
+
+Error error = mc.GetAndPut(
+cache_dir, hostname, module_spec,
+[this, &download_called](const ModuleSpec &module_spec, const FileSpec &tmp_download_file_spec) {
+download_called = true;
+EXPECT_STREQ(GetDummyRemotePath().GetCString(), module_spec.GetFileSpec().GetCString());
+std::error_code ec = llvm::sys::fs::copy_file(m_test_executable, tmp_download_file_spec.GetCString());
+EXPECT_FALSE(ec);
+return Error();
+},
+[](const ModuleSP &module_sp, const FileSpec &tmp_download_file_spec) { return Error("Not supported."); },
+module_sp, &did_create);
+EXPECT_EQ(expect_download, download_called);
+
+EXPECT_TRUE(error.Success()) << "Error was: " << error.AsCString();
+EXPECT_TRUE(did_create);
+ASSERT_TRUE(bool(module_sp));
+
+SymbolContextList sc_list;
+EXPECT_EQ(1u, module_sp->FindFunctionSymbols(ConstString("boom"), eFunctionNameTypeFull, sc_list));
+EXPECT_STREQ(GetDummyRemotePath().GetCString(), module_sp->GetPlatformFileSpec().GetCString());
+EXPECT_STREQ(module_uuid, module_sp->GetUUID().GetAsString().c_str());
+}
+
+TEST_F(ModuleCacheTest, GetAndPut)
+{
+FileSpec test_cache_dir = m_cache_dir;
+test_cache_dir.AppendPathComponent("GetAndPut");
+
+const bool expect_download = true;
+TryGetAndPut(test_cache_dir, dummy_hostname, expect_download);
+VerifyDiskState(test_cache_dir, dummy_hostname);
+}
+

Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Zachary Turner via lldb-commits
Just chiming in to say modules is unsupported on Windows even with clang,
so please make sure the gmodules support function takes this into account
On Tue, May 24, 2016 at 9:05 AM Todd Fiala via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> tfiala added a comment.
>
> So at this point, it looks like we're just missing a mechanism to check
> for gmodules support, and then add it to the supported_categories list if
> it is available.
>
> I'll have a look a that.
>
> This might be the time where we want to break out an apple-clang vs.
> llvm.org-clang when we talk about version numbers.  We're asking for
> trouble when we treat both as the same, yet they have drastically different
> version numbers that will eventually collide as llvm.org version numbers
> increase.
>
>
> 
> Comment at: packages/Python/lldbsuite/test/lldbtest.py:1488
> @@ +1487,3 @@
> +@wraps(attrvalue)
> +def dwarf_test_method(self, attrvalue=attrvalue):
> +self.debug_info = "gmodules"
> 
> labath wrote:
> > Shouldn't this be `gmodules_test_method`?
> I agree with @labath
>
> 
> Comment at: packages/Python/lldbsuite/test/plugins/builder_base.py:144
> @@ -143,1 +143,3 @@
>
> +def buildDwarf(sender=None, architecture=None, compiler=None,
> dictionary=None, clean=True):
> +"""Build the binaries with dwarf debug info."""
> 
> labath wrote:
> > shouldn't this be `buildModules` or something?
> buildGModules() sounds right here, particularly since it matches the
> define being passed in.  And adjust the comment below to reflect.
>
>
> http://reviews.llvm.org/D19998
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D19998#437820, @zturner wrote:

> Just chiming in to say modules is unsupported on Windows even with clang,
>  so please make sure the gmodules support function takes this into account


Okay, thanks Zachary.  We'll make sure it doesn't somehow get enabled there.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Greg Clayton via lldb-commits
clayborg added a comment.

At some point we should probably make a host layer call like:

const char *const char *Host::GetIllegalFilenameCharacters();" so that each 
host can determine the correct thing for the current host. Then FileSpec can be 
updated to use this function handle this with a method like "void 
FileSpec::NormalizePathForHost()". This will probably need to be done elsewhere.


http://reviews.llvm.org/D20548



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


Re: [Lldb-commits] [PATCH] D20565: Add MemoryRegionInfo to SB API

2016-05-24 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Few minor changes, but looks great overall. Thanks for doing this.



Comment at: include/lldb/Target/MemoryRegionInfo.h:18-19
@@ -17,3 +17,4 @@
 {
-class MemoryRegionInfo
+class MemoryRegionInfo :
+public std::enable_shared_from_this
 {

We don't need to inherit from std::enable_shared_from_this do we? Is there a 
future patch where you intend on using this? If not, lets leave it out for now 
and add it later if we need to.


Comment at: source/API/SBProcess.cpp:1482
@@ +1481,3 @@
+ProcessSP process_sp(GetSP());
+MemoryRegionInfoSP region_info = 
std::make_shared();
+if (process_sp)

Please name "region_info_sp". All variables that are shared pointers should 
have "_sp" suffixes. 


http://reviews.llvm.org/D20565



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


Re: [Lldb-commits] [PATCH] D20567: Avoid using stdio in TestVirtual

2016-05-24 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
This revision now requires changes to proceed.


Comment at: packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py:64
@@ +63,3 @@
+self.assertTrue(golden.IsValid(), "Encountered an error reading the 
process's golden variable")
+golden_str = str(golden)
+self.assertTrue("c_as_C" in golden_str)

Are we relying on std::string data formatters working here? Seems like a 
dangerous change as we would require any new ports of LLDB to have std::string 
formatters working or this test will fail?


http://reviews.llvm.org/D20567



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


Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
ovyalov updated this revision to Diff 58258.
ovyalov added a comment.

Added the check for symbol in [1;31] range.


http://reviews.llvm.org/D20548

Files:
  source/Utility/ModuleCache.cpp

Index: source/Utility/ModuleCache.cpp
===
--- source/Utility/ModuleCache.cpp
+++ source/Utility/ModuleCache.cpp
@@ -33,6 +33,21 @@
 const char* kTempFileName = ".temp";
 const char* kTempSymFileName = ".symtemp";
 const char* kSymFileExtension = ".sym";
+const char* kFSIllegalChars = "\\/:*?\"<>|";
+
+std::string
+GetEscapedHostname(const char* hostname)
+{
+std::string result(hostname);
+size_t size = result.size();
+for (size_t i = 0; i < size; ++i)
+{
+if ((result[i] >=1 && result[i] <= 31) ||
+strchr(kFSIllegalChars, result[i]) != nullptr)
+result[i] = '_';
+}
+return result;
+}
 
 class ModuleLock
 {
@@ -280,8 +295,9 @@
 if (error.Fail ())
 return Error("Failed to lock module %s: %s", module_spec.GetUUID 
().GetAsString().c_str(), error.AsCString ());
 
+const auto escaped_hostname(GetEscapedHostname(hostname));
 // Check local cache for a module.
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, 
did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, 
cached_module_sp, did_create_ptr);
 if (error.Success ())
 return error;
 
@@ -292,12 +308,12 @@
 return Error("Failed to download module: %s", error.AsCString ());
 
 // Put downloaded file into local module cache.
-error = Put (root_dir_spec, hostname, module_spec, tmp_download_file_spec, 
module_spec.GetFileSpec ());
+error = Put (root_dir_spec, escaped_hostname.c_str(), module_spec, 
tmp_download_file_spec, module_spec.GetFileSpec ());
 if (error.Fail ())
 return Error ("Failed to put module into cache: %s", error.AsCString 
());
 
 tmp_file_remover.releaseFile ();
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, 
did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, 
cached_module_sp, did_create_ptr);
 if (error.Fail ())
 return error;
 
@@ -310,7 +326,7 @@
 // contain the neccessary symbols and the debugging is also possible 
without a symfile.
 return Error ();
 
-error = Put (root_dir_spec, hostname, module_spec, 
tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec ()));
+error = Put (root_dir_spec, escaped_hostname.c_str(), module_spec, 
tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec ()));
 if (error.Fail ())
 return Error ("Failed to put symbol file into cache: %s", 
error.AsCString ());
 


Index: source/Utility/ModuleCache.cpp
===
--- source/Utility/ModuleCache.cpp
+++ source/Utility/ModuleCache.cpp
@@ -33,6 +33,21 @@
 const char* kTempFileName = ".temp";
 const char* kTempSymFileName = ".symtemp";
 const char* kSymFileExtension = ".sym";
+const char* kFSIllegalChars = "\\/:*?\"<>|";
+
+std::string
+GetEscapedHostname(const char* hostname)
+{
+std::string result(hostname);
+size_t size = result.size();
+for (size_t i = 0; i < size; ++i)
+{
+if ((result[i] >=1 && result[i] <= 31) ||
+strchr(kFSIllegalChars, result[i]) != nullptr)
+result[i] = '_';
+}
+return result;
+}
 
 class ModuleLock
 {
@@ -280,8 +295,9 @@
 if (error.Fail ())
 return Error("Failed to lock module %s: %s", module_spec.GetUUID ().GetAsString().c_str(), error.AsCString ());
 
+const auto escaped_hostname(GetEscapedHostname(hostname));
 // Check local cache for a module.
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, cached_module_sp, did_create_ptr);
 if (error.Success ())
 return error;
 
@@ -292,12 +308,12 @@
 return Error("Failed to download module: %s", error.AsCString ());
 
 // Put downloaded file into local module cache.
-error = Put (root_dir_spec, hostname, module_spec, tmp_download_file_spec, module_spec.GetFileSpec ());
+error = Put (root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_file_spec, module_spec.GetFileSpec ());
 if (error.Fail ())
 return Error ("Failed to put module into cache: %s", error.AsCString ());
 
 tmp_file_remover.releaseFile ();
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, cached_module_sp, did_create_ptr);
 if (error.Fail ())
 return error;
 
@@ -310,7 +326,7 @@
 // contain the neccessary symbols and the debugging is also possible without a symfile.
 return Error ();
 
-error = Put (root_dir_spec, host

Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

In http://reviews.llvm.org/D20548#437567, @labath wrote:

> According to 
> https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396,
>  characters with codes 1..31 (basically `< ' '`), are illegal as well. We 
> might as well convert those, just in case.


Agree - done.

> I've been sitting on a unit test for the module cache locally for a while 
> now... I guess it's time to put that in, and then we can add a test for this 
> as well.


Sounds good.


http://reviews.llvm.org/D20548



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


Re: [Lldb-commits] [PATCH] D20570: Add unit tests for ModuleCache

2016-05-24 Thread Zachary Turner via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

Nothing obvious that will break on Windows here, so looks good.


http://reviews.llvm.org/D20570



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


Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

In http://reviews.llvm.org/D20548#437862, @clayborg wrote:

> At some point we should probably make a host layer call like:
>
> const char *const char *Host::GetIllegalFilenameCharacters();" so that each 
> host can determine the correct thing for the current host. Then FileSpec can 
> be updated to use this function handle this with a method like "void 
> FileSpec::NormalizePathForHost()". This will probably need to be done 
> elsewhere.


I like this idea of generalizing illegal symbols handling on per-platform basis 
- since Pavel mentioned that 1..31 range of symbols is forbidden in Windows 
filenames we may have a method like bool Host::IsIllegalFilenameCharacter(char) 
to tell whether symbol is illegal on this platform.


http://reviews.llvm.org/D20548



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


Re: [Lldb-commits] [PATCH] D20567: Avoid using stdio in TestVirtual

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


Comment at: packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py:64
@@ +63,3 @@
+self.assertTrue(golden.IsValid(), "Encountered an error reading the 
process's golden variable")
+golden_str = str(golden)
+self.assertTrue("c_as_C" in golden_str)

clayborg wrote:
> Are we relying on std::string data formatters working here? Seems like a 
> dangerous change as we would require any new ports of LLDB to have 
> std::string formatters working or this test will fail?
That did not occur to me. Would shoving the data into a `char *` be acceptable?


http://reviews.llvm.org/D20567



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


Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Pavel Labath via lldb-commits
labath added a comment.

I like the idea of having a centralized place defining "invalid characters". 
However, I am not sure if that needs to be (at least in this case) 
system-dependent. Since presumably the code will need to work on all platforms 
anyway, having the escaping done in a divergent manner will just complicate 
testing. I don't see a reason to not define the illegal characters as a union 
of illegal characters across all platforms (which basically means, using the 
windows set).


http://reviews.llvm.org/D20548



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


Re: [Lldb-commits] [PATCH] D20570: Add unit tests for ModuleCache

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.


Comment at: unittests/Utility/ModuleCacheTest.cpp:74
@@ +73,3 @@
+{
+HostInfo::Initialize();
+ObjectFileELF::Initialize();

If it's one-off initialization can we use setUpTestCase for these purposes (for 
HostInfo::Initialize and ObjectFileELF::Initialize)?


http://reviews.llvm.org/D20570



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


Re: [Lldb-commits] [PATCH] D20567: Avoid using stdio in TestVirtual

2016-05-24 Thread Greg Clayton via lldb-commits
clayborg added a comment.

I would just make a large buffer and use snprintf:

  char buffer[4096];
  char *p = buffer;
  char *end = p + sizeof(buffer);
  p += snprintf(p, end - p, "a_as_A->a() = '%s'\n", a_as_A->a());
  p += snprintf(p, end - p, "a_as_A->b() = '%s'\n", a_as_A->b());


http://reviews.llvm.org/D20567



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


[Lldb-commits] [lldb] r270588 - Improve wording in TSan reports involving global variables. Don't repeat hex addresses that are the same.

2016-05-24 Thread Kuba Brecka via lldb-commits
Author: kuba.brecka
Date: Tue May 24 12:47:23 2016
New Revision: 270588

URL: http://llvm.org/viewvc/llvm-project?rev=270588&view=rev
Log:
Improve wording in TSan reports involving global variables.  Don't repeat hex 
addresses that are the same.


Modified:

lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp

lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp?rev=270588&r1=270587&r2=270588&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
 Tue May 24 12:47:23 2016
@@ -583,7 +583,12 @@ ThreadSanitizerRuntime::GenerateSummary(
 addr = 
loc->GetAsDictionary()->GetValueForKey("start")->GetAsInteger()->GetValue();
 
 if (addr != 0) {
-summary = summary + " at " + Sprintf("0x%llx", addr);
+std::string global_name = GetSymbolNameFromAddress(process_sp, 
addr);
+if (!global_name.empty()) {
+summary = summary + " at " + global_name;
+} else {
+summary = summary + " at " + Sprintf("0x%llx", addr);
+}
 } else {
 int fd = 
loc->GetAsDictionary()->GetValueForKey("file_descriptor")->GetAsInteger()->GetValue();
 if (fd != 0) {
@@ -610,7 +615,7 @@ ThreadSanitizerRuntime::GetMainRacyAddre
 }
 
 std::string
-ThreadSanitizerRuntime::GetLocationDescription(StructuredData::ObjectSP 
report, std::string &filename, uint32_t &line)
+ThreadSanitizerRuntime::GetLocationDescription(StructuredData::ObjectSP 
report, addr_t &global_addr, std::string &global_name, std::string &filename, 
uint32_t &line)
 {
 std::string result = "";
 
@@ -620,12 +625,16 @@ ThreadSanitizerRuntime::GetLocationDescr
 StructuredData::ObjectSP loc = 
report->GetAsDictionary()->GetValueForKey("locs")->GetAsArray()->GetItemAtIndex(0);
 std::string type = 
loc->GetAsDictionary()->GetValueForKey("type")->GetStringValue();
 if (type == "global") {
-addr_t addr = 
loc->GetAsDictionary()->GetValueForKey("address")->GetAsInteger()->GetValue();
-std::string global_name = GetSymbolNameFromAddress(process_sp, 
addr);
-result = Sprintf("Location is a global '%s'", global_name.c_str());
+global_addr = 
loc->GetAsDictionary()->GetValueForKey("address")->GetAsInteger()->GetValue();
+global_name = GetSymbolNameFromAddress(process_sp, global_addr);
+if (!global_name.empty()) {
+result = Sprintf("'%s' is a global variable (0x%llx)", 
global_name.c_str(), global_addr);
+} else {
+result = Sprintf("0x%llx is a global variable", global_addr);
+}
 
 Declaration decl;
-GetSymbolDeclarationFromAddress(process_sp, addr, decl);
+GetSymbolDeclarationFromAddress(process_sp, global_addr, decl);
 if (decl.GetFile()) {
 filename = decl.GetFile().GetPath();
 line = decl.GetLine();
@@ -670,14 +679,30 @@ ThreadSanitizerRuntime::NotifyBreakpoint
 addr_t main_address = instance->GetMainRacyAddress(report);
 report->GetAsDictionary()->AddIntegerItem("memory_address", 
main_address);
 
+addr_t global_addr = 0;
+std::string global_name = "";
 std::string location_filename = "";
 uint32_t location_line = 0;
-std::string location_description = 
instance->GetLocationDescription(report, location_filename, location_line);
+std::string location_description = 
instance->GetLocationDescription(report, global_addr, global_name, 
location_filename, location_line);
 report->GetAsDictionary()->AddStringItem("location_description", 
location_description);
+if (global_addr != 0) {
+report->GetAsDictionary()->AddIntegerItem("global_address", 
global_addr);
+}
+if (!global_name.empty()) {
+report->GetAsDictionary()->AddStringItem("global_name", 
global_name);
+}
 if (location_filename != "") {
 report->GetAsDictionary()->AddStringItem("location_filename", 
location_filename);
 report->GetAsDictionary()->AddIntegerItem("location_line", 
location_line);
 }
+
+bool all_addresses_are_same = true;
+
report->GetObjectForDotSeparatedPath("mops")->GetAsArray()->ForEach([&all_addresses_are_same,
 main_address] (StructuredData::Object *o) -> bool {
+addr_t 

Re: [Lldb-commits] [lldb] r270488 - We have many radars showing that stepping through C++ code can result in slow steps.

2016-05-24 Thread Ed Maste via lldb-commits
On 23 May 2016 at 16:37, Greg Clayton via lldb-commits
 wrote:
> Author: gclayton
> Date: Mon May 23 15:37:24 2016
> New Revision: 270488
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270488&view=rev
> Log:
> We have many radars showing that stepping through C++ code can result in slow 
> steps.

This broke the build on FreeBSD 10 (Clang 3.4.1):

In file included from
../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp:10:
In file included from
../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h:15:
In file included from /usr/include/c++/v1/map:423:
In file included from /usr/include/c++/v1/__tree:16:
In file included from /usr/include/c++/v1/memory:602:
/usr/include/c++/v1/utility:254:9: error: field has incomplete type
'lldb_private::TypeAndOrName'
_T2 second;
^
/usr/include/c++/v1/type_traits:2370:27: note: in instantiation of
template class 'std::__1::pair' requested here
 decltype(__is_constructible_test(declval<_Tp>(),
declval<_Args>()...))
  ^
/usr/include/c++/v1/type_traits:2419:14: note: in instantiation of
template class 'std::__1::__libcpp_is_constructible >>' requested here
: public __libcpp_is_constructible::value ||
is_reference<_Tp>::value,
 ^
/usr/include/c++/v1/type_traits:2445:14: note: in instantiation of
template class 'std::__1::__is_constructible_void_check >>' requested here
: public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
 ^
/usr/include/c++/v1/type_traits:2936:41: note: in instantiation of
template class 
'std::__1::is_constructible >>' requested here
: __libcpp_is_nothrow_constructible::value, is_reference<_Tp>::value, _Tp, _Args...>
^
/usr/include/c++/v1/type_traits:3059:14: note: in instantiation of
template class 
'std::__1::is_nothrow_constructible >>' requested here
: public is_nothrow_constructible<_Tp>
 ^
/usr/include/c++/v1/map:840:13: note: in instantiation of template
class 
'std::__1::is_nothrow_default_constructible > >' requested
here
is_nothrow_default_constructible::value &&
^
/usr/include/c++/v1/__config:349:34: note: expanded from macro '_NOEXCEPT_'
#  define _NOEXCEPT_(x) noexcept(x)
 ^
../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h:111:15:
note: in instantiation of exception specification for 'map' requested
here
  m_dynamic_type_map(),
  ^
../tools/lldb/include/lldb/lldb-forward.h:258:9: note: forward
declaration of 'lldb_private::TypeAndOrName'
class   TypeAndOrName;
^
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r270590 - Replace file system forbidden symbols in the hostname which passed to the ModuleCache.

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
Author: ovyalov
Date: Tue May 24 13:09:05 2016
New Revision: 270590

URL: http://llvm.org/viewvc/llvm-project?rev=270590&view=rev
Log:
Replace file system forbidden symbols in the hostname which passed to the 
ModuleCache.

http://reviews.llvm.org/D20548


Modified:
lldb/trunk/source/Utility/ModuleCache.cpp

Modified: lldb/trunk/source/Utility/ModuleCache.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ModuleCache.cpp?rev=270590&r1=270589&r2=270590&view=diff
==
--- lldb/trunk/source/Utility/ModuleCache.cpp (original)
+++ lldb/trunk/source/Utility/ModuleCache.cpp Tue May 24 13:09:05 2016
@@ -33,6 +33,21 @@ const char* kLockDirName = ".lock";
 const char* kTempFileName = ".temp";
 const char* kTempSymFileName = ".symtemp";
 const char* kSymFileExtension = ".sym";
+const char* kFSIllegalChars = "\\/:*?\"<>|";
+
+std::string
+GetEscapedHostname(const char* hostname)
+{
+std::string result(hostname);
+size_t size = result.size();
+for (size_t i = 0; i < size; ++i)
+{
+if ((result[i] >=1 && result[i] <= 31) ||
+strchr(kFSIllegalChars, result[i]) != nullptr)
+result[i] = '_';
+}
+return result;
+}
 
 class ModuleLock
 {
@@ -280,8 +295,9 @@ ModuleCache::GetAndPut (const FileSpec &
 if (error.Fail ())
 return Error("Failed to lock module %s: %s", module_spec.GetUUID 
().GetAsString().c_str(), error.AsCString ());
 
+const auto escaped_hostname(GetEscapedHostname(hostname));
 // Check local cache for a module.
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, 
did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, 
cached_module_sp, did_create_ptr);
 if (error.Success ())
 return error;
 
@@ -292,12 +308,12 @@ ModuleCache::GetAndPut (const FileSpec &
 return Error("Failed to download module: %s", error.AsCString ());
 
 // Put downloaded file into local module cache.
-error = Put (root_dir_spec, hostname, module_spec, tmp_download_file_spec, 
module_spec.GetFileSpec ());
+error = Put (root_dir_spec, escaped_hostname.c_str(), module_spec, 
tmp_download_file_spec, module_spec.GetFileSpec ());
 if (error.Fail ())
 return Error ("Failed to put module into cache: %s", error.AsCString 
());
 
 tmp_file_remover.releaseFile ();
-error = Get (root_dir_spec, hostname, module_spec, cached_module_sp, 
did_create_ptr);
+error = Get (root_dir_spec, escaped_hostname.c_str(), module_spec, 
cached_module_sp, did_create_ptr);
 if (error.Fail ())
 return error;
 
@@ -310,7 +326,7 @@ ModuleCache::GetAndPut (const FileSpec &
 // contain the neccessary symbols and the debugging is also possible 
without a symfile.
 return Error ();
 
-error = Put (root_dir_spec, hostname, module_spec, 
tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec ()));
+error = Put (root_dir_spec, escaped_hostname.c_str(), module_spec, 
tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec ()));
 if (error.Fail ())
 return Error ("Failed to put symbol file into cache: %s", 
error.AsCString ());
 


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


Re: [Lldb-commits] [PATCH] D20548: Replace file system forbidden symbols in the hostname which passed to the ModuleCache

2016-05-24 Thread Oleksiy Vyalov via lldb-commits
ovyalov closed this revision.
ovyalov added a comment.

Submitted as r270590


http://reviews.llvm.org/D20548



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


Re: [Lldb-commits] [PATCH] D20509: Skip leading spaces when decoding hex values

2016-05-24 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270592: Skip leading spaces when decoding hex values 
(authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D20509?vs=58041&id=58277#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20509

Files:
  lldb/trunk/source/Utility/StringExtractor.cpp

Index: lldb/trunk/source/Utility/StringExtractor.cpp
===
--- lldb/trunk/source/Utility/StringExtractor.cpp
+++ lldb/trunk/source/Utility/StringExtractor.cpp
@@ -104,6 +104,7 @@
 int
 StringExtractor::DecodeHexU8()
 {
+SkipSpaces();
 if (GetBytesLeft() < 2)
 {
 return -1;
@@ -230,6 +231,7 @@
 uint32_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;
@@ -292,6 +294,7 @@
 uint64_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;


Index: lldb/trunk/source/Utility/StringExtractor.cpp
===
--- lldb/trunk/source/Utility/StringExtractor.cpp
+++ lldb/trunk/source/Utility/StringExtractor.cpp
@@ -104,6 +104,7 @@
 int
 StringExtractor::DecodeHexU8()
 {
+SkipSpaces();
 if (GetBytesLeft() < 2)
 {
 return -1;
@@ -230,6 +231,7 @@
 uint32_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;
@@ -292,6 +294,7 @@
 uint64_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r270592 - Skip leading spaces when decoding hex values

2016-05-24 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Tue May 24 13:19:45 2016
New Revision: 270592

URL: http://llvm.org/viewvc/llvm-project?rev=270592&view=rev
Log:
Skip leading spaces when decoding hex values

Summary:
The StringExtractor functions using stroull will already
skip leading whitespace (ie GetU64). Make sure that the manual
hex parsing functions also skip leading whitespace.

This is important for members of the gdb protocol which are defined
as using whitespace separators (ie qfThreadInfo, qC, etc). While
lldb-server does not use the whitespace separators, gdb-remotes
should work if they do, as the whitespace is defined by the gdb-remote
protocol.

Reviewers: vharron, jasonmolenda, clayborg

Subscribers: sas, lldb-commits

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

Modified:
lldb/trunk/source/Utility/StringExtractor.cpp

Modified: lldb/trunk/source/Utility/StringExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=270592&r1=270591&r2=270592&view=diff
==
--- lldb/trunk/source/Utility/StringExtractor.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractor.cpp Tue May 24 13:19:45 2016
@@ -104,6 +104,7 @@ StringExtractor::GetChar (char fail_valu
 int
 StringExtractor::DecodeHexU8()
 {
+SkipSpaces();
 if (GetBytesLeft() < 2)
 {
 return -1;
@@ -230,6 +231,7 @@ StringExtractor::GetHexMaxU32 (bool litt
 uint32_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;
@@ -292,6 +294,7 @@ StringExtractor::GetHexMaxU64 (bool litt
 uint64_t result = 0;
 uint32_t nibble_count = 0;
 
+SkipSpaces();
 if (little_endian)
 {
 uint32_t shift_amount = 0;


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


[Lldb-commits] [lldb] r270593 - Lock out Process::RunThreadPlan so only one can be in flight at a time.

2016-05-24 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue May 24 13:29:36 2016
New Revision: 270593

URL: http://llvm.org/viewvc/llvm-project?rev=270593&view=rev
Log:
Lock out Process::RunThreadPlan so only one can be in flight at a time.

What with all sorts of folks (TSAN, ASAN, queue detection, etc...) trying to
gather info by calling functions down in the lower layers of lldb, we've started
to see people running expressions simultaneously.  The expression evaluation 
part
is okay, but only one RunThreadPlan can be active at a time.  I added a lock to
enforce that.



Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=270593&r1=270592&r2=270593&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue May 24 13:29:36 2016
@@ -3402,6 +3402,7 @@ protected:
 bool m_destroy_in_process;
 bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, 
don't support the ability to modify the stack.
 WarningsCollection  m_warnings_issued;  // A set of object 
pointers which have already had warnings printed
+std::mutex  m_run_thread_plan_lock;
 
 enum {
 eCanJITDontKnow= 0,

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=270593&r1=270592&r2=270593&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue May 24 13:29:36 2016
@@ -771,6 +771,7 @@ Process::Process(lldb::TargetSP target_s
   m_destroy_in_process(false),
   m_can_interpret_function_calls(false),
   m_warnings_issued(),
+  m_run_thread_plan_lock(),
   m_can_jit(eCanJITDontKnow)
 {
 CheckInWithManager();
@@ -5195,6 +5196,8 @@ Process::RunThreadPlan(ExecutionContext
const EvaluateExpressionOptions &options, 
DiagnosticManager &diagnostic_manager)
 {
 ExpressionResults return_value = eExpressionSetupError;
+
+std::lock_guard run_thread_plan_locker(m_run_thread_plan_lock);
 
 if (!thread_plan_sp)
 {
@@ -5223,7 +5226,7 @@ Process::RunThreadPlan(ExecutionContext
 
 // We need to change some of the thread plan attributes for the thread 
plan runner.  This will restore them
 // when we are done:
-
+
 RestorePlanState thread_plan_restorer(thread_plan_sp);
 
 // We rely on the thread plan we are running returning "PlanCompleted" if 
when it successfully completes.


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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

F1981148: gmodules-test-support-v2.diff 

I just uploaded a modified patch.  This patch does nothing more than fix 
invalid behavior in the initial patch, as it had several issues that would 
cause runtime errors.

With the adjusted patch, which is based against lldb r270570, I see the 
following failures on OS X 10.11.5 with Xcode 7.3.1, building test inferiors 
with the in-tree clang (with both compiler-rt and libcxx from top of tree):

  FAIL: test_NSString_expr_commands_gmodules 
(lang/objc/foundation/TestObjCMethods2.py)
  FAIL: test_break_gmodules (lang/objc/foundation/TestRuntimeTypes.py)
  FAIL: test_c_global_variables_gmodules 
(lang/c/global_variables/TestGlobalVariables.py)
  ERROR: test_top_level_expressions_gmodules 
(expression_command/top-level/TestTopLevelExprs.py)

As it stands right now, it looks like it will always try to run gmodules.  I'll 
adjust that now per previous comments.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [lldb] r270488 - We have many radars showing that stepping through C++ code can result in slow steps.

2016-05-24 Thread Pavel Labath via lldb-commits
r270570 fixed it for me.

On 24 May 2016 at 19:11, Ed Maste via lldb-commits
 wrote:
> On 23 May 2016 at 16:37, Greg Clayton via lldb-commits
>  wrote:
>> Author: gclayton
>> Date: Mon May 23 15:37:24 2016
>> New Revision: 270488
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=270488&view=rev
>> Log:
>> We have many radars showing that stepping through C++ code can result in 
>> slow steps.
>
> This broke the build on FreeBSD 10 (Clang 3.4.1):
>
> In file included from
> ../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp:10:
> In file included from
> ../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h:15:
> In file included from /usr/include/c++/v1/map:423:
> In file included from /usr/include/c++/v1/__tree:16:
> In file included from /usr/include/c++/v1/memory:602:
> /usr/include/c++/v1/utility:254:9: error: field has incomplete type
> 'lldb_private::TypeAndOrName'
> _T2 second;
> ^
> /usr/include/c++/v1/type_traits:2370:27: note: in instantiation of
> template class 'std::__1::pair lldb_private::TypeAndOrName>' requested here
>  decltype(__is_constructible_test(declval<_Tp>(),
> declval<_Args>()...))
>   ^
> /usr/include/c++/v1/type_traits:2419:14: note: in instantiation of
> template class 'std::__1::__libcpp_is_constructible std::__1::allocator lldb_private::TypeAndOrName> >>' requested here
> : public __libcpp_is_constructible::value ||
> is_reference<_Tp>::value,
>  ^
> /usr/include/c++/v1/type_traits:2445:14: note: in instantiation of
> template class 'std::__1::__is_constructible_void_check std::__1::allocator lldb_private::TypeAndOrName> >>' requested here
> : public __is_constructible_void_check<__contains_void<_Tp, 
> _Args...>::value
>  ^
> /usr/include/c++/v1/type_traits:2936:41: note: in instantiation of
> template class 
> 'std::__1::is_constructible lldb_private::Address, lldb_private::TypeAndOrName> >>' requested here
> : __libcpp_is_nothrow_constructible _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
> ^
> /usr/include/c++/v1/type_traits:3059:14: note: in instantiation of
> template class 
> 'std::__1::is_nothrow_constructible lldb_private::Address, lldb_private::TypeAndOrName> >>' requested here
> : public is_nothrow_constructible<_Tp>
>  ^
> /usr/include/c++/v1/map:840:13: note: in instantiation of template
> class 
> 'std::__1::is_nothrow_default_constructible lldb_private::Address, lldb_private::TypeAndOrName> > >' requested
> here
> is_nothrow_default_constructible::value &&
> ^
> /usr/include/c++/v1/__config:349:34: note: expanded from macro '_NOEXCEPT_'
> #  define _NOEXCEPT_(x) noexcept(x)
>  ^
> ../tools/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h:111:15:
> note: in instantiation of exception specification for 'map' requested
> here
>   m_dynamic_type_map(),
>   ^
> ../tools/lldb/include/lldb/lldb-forward.h:258:9: note: forward
> declaration of 'lldb_private::TypeAndOrName'
> class   TypeAndOrName;
> ^
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r270488 - We have many radars showing that stepping through C++ code can result in slow steps.

2016-05-24 Thread Ed Maste via lldb-commits
On 24 May 2016 at 15:18, Pavel Labath  wrote:
> r270570 fixed it for me.

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


[Lldb-commits] [lldb] r270603 - xfail TestRedefinitionsInline with older Clang

2016-05-24 Thread Ed Maste via lldb-commits
Author: emaste
Date: Tue May 24 14:51:11 2016
New Revision: 270603

URL: http://llvm.org/viewvc/llvm-project?rev=270603&view=rev
Log:
xfail TestRedefinitionsInline with older Clang

This fails on FreeBSD 10 with the system compiler, Clang 3.4.1.

llvm.org/pr27845

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py?rev=270603&r1=270602&r2=270603&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
 Tue May 24 14:51:11 2016
@@ -1,4 +1,5 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(), 
[decorators.expectedFailureAll(oslist=["windows"], 
bugnumber="llvm.org/pr27845")])
+lldbinline.MakeInlineTest(__file__, globals(), 
[decorators.expectedFailureAll(oslist=["windows"], 
bugnumber="llvm.org/pr27845"),
+
decorators.expectedFailureAll(compiler="clang", compiler_version=["<", "3.5"], 
bugnumber="llvm.org/pr27845")])


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


[Lldb-commits] [lldb] r270608 - Reword the "Happened at" TSan-reported thread to contain a thread id.

2016-05-24 Thread Kuba Brecka via lldb-commits
Author: kuba.brecka
Date: Tue May 24 15:35:28 2016
New Revision: 270608

URL: http://llvm.org/viewvc/llvm-project?rev=270608&view=rev
Log:
Reword the "Happened at" TSan-reported thread to contain a thread id.


Modified:

lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp?rev=270608&r1=270607&r2=270608&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
 Tue May 24 15:35:28 2016
@@ -386,9 +386,11 @@ ThreadSanitizerRuntime::RetrieveReportDa
 dict->AddIntegerItem("report_count", 
main_value->GetValueForExpressionPath(".report_count")->GetValueAsUnsigned(0));
 dict->AddItem("sleep_trace", 
StructuredData::ObjectSP(CreateStackTrace(main_value, ".sleep_trace")));
 
-StructuredData::Array *stacks = ConvertToStructuredArray(main_value, 
".stacks", ".stack_count", [] (ValueObjectSP o, StructuredData::Dictionary 
*dict) {
+StructuredData::Array *stacks = ConvertToStructuredArray(main_value, 
".stacks", ".stack_count", [thread_sp] (ValueObjectSP o, 
StructuredData::Dictionary *dict) {
 dict->AddIntegerItem("index", 
o->GetValueForExpressionPath(".idx")->GetValueAsUnsigned(0));
 dict->AddItem("trace", StructuredData::ObjectSP(CreateStackTrace(o)));
+// "stacks" happen on the current thread
+dict->AddIntegerItem("thread_id", thread_sp->GetIndexID());
 });
 dict->AddItem("stacks", StructuredData::ObjectSP(stacks));
 
@@ -823,7 +825,8 @@ GenerateThreadName(std::string path, Str
 }
 
 if (path == "stacks") {
-result = "happened at";
+int thread_id = 
o->GetObjectForDotSeparatedPath("thread_id")->GetIntegerValue();
+result = Sprintf("Thread %d", thread_id);
 }
 
 result[0] = toupper(result[0]);


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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

F1981558: gmodules-test-support-v3.diff 

The attached patch contains an implementation that properly checks for gmodules 
support and runs clean on OS X.  I filed a few bugs and marked a few tests as 
failing with gmodules debug info in this patch.

I'm going to give it a run on Linux and see if we have more tests that need to 
be marked xfail with gmodules support.

@aprantl, can you update the patch sets with the latest patch?  It is built 
against r270593.


http://reviews.llvm.org/D19998



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


[Lldb-commits] [lldb] r270618 - In r268475 I made a change to ObjectFileMachO so that if it is

2016-05-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue May 24 16:46:23 2016
New Revision: 270618

URL: http://llvm.org/viewvc/llvm-project?rev=270618&view=rev
Log:
In r268475 I made a change to ObjectFileMachO so that if it is
missing an LC_FUNCTION_STARTS section, we assume it has been
aggressively stripped (it is *very* unusual for anyone to strip
LC_FUNCTION_STARTS) so we disable assembly instruction unwind plan
creation.

Kernel extensions (kexts) don't have LC_FUNCTION_STARTS, but we
almost always have good symbol bounds just with the linker symbols.
So add an exception to allow assembly instruction unwind plan
creation for kexts even though they lack LC_FUNCTION_STARTS.

 

Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=270618&r1=270617&r2=270618&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue May 24 
16:46:23 2016
@@ -2607,7 +2607,10 @@ ObjectFileMachO::ParseSymtab ()
 
 const size_t function_starts_count = function_starts.GetSize();
 
-if (function_starts_count == 0)
+// kext bundles don't have LC_FUNCTION_STARTS / eh_frame sections, but 
we can assume that we have
+// accurate symbol boundaries for them, they're a special case.
+
+if (function_starts_count == 0 && header.filetype != MH_KEXT_BUNDLE)
 {
 // No LC_FUNCTION_STARTS/eh_frame section in this binary, we're 
going to assume the binary 
 // has been stripped.  Don't allow assembly language instruction 
emulation because we don't


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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

F1981749: gmodules-test-support-v4.diff 

Patch updated.  TestDeadStrip.py required xfailing for Ubuntu with gmodules 
debug info.


http://reviews.llvm.org/D19998



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


[Lldb-commits] [lldb] r270620 - Ach, editing too many files at once. Make this file compile again.

2016-05-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue May 24 17:05:22 2016
New Revision: 270620

URL: http://llvm.org/viewvc/llvm-project?rev=270620&view=rev
Log:
Ach, editing too many files at once.  Make this file compile again.

Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=270620&r1=270619&r2=270620&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue May 24 
17:05:22 2016
@@ -2610,7 +2610,7 @@ ObjectFileMachO::ParseSymtab ()
 // kext bundles don't have LC_FUNCTION_STARTS / eh_frame sections, but 
we can assume that we have
 // accurate symbol boundaries for them, they're a special case.
 
-if (function_starts_count == 0 && header.filetype != MH_KEXT_BUNDLE)
+if (function_starts_count == 0 && m_header.filetype != 
llvm::MachO::MH_KEXT_BUNDLE)
 {
 // No LC_FUNCTION_STARTS/eh_frame section in this binary, we're 
going to assume the binary 
 // has been stripped.  Don't allow assembly language instruction 
emulation because we don't


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


[Lldb-commits] [lldb] r270621 - Fix an issue where the NSDate data formatter was not using the proper alignment on watchOS targets

2016-05-24 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue May 24 17:11:57 2016
New Revision: 270621

URL: http://llvm.org/viewvc/llvm-project?rev=270621&view=rev
Log:
Fix an issue where the NSDate data formatter was not using the proper alignment 
on watchOS targets

Fixes rdar://problem/23298264


Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=270621&r1=270620&r2=270621&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue May 24 17:11:57 2016
@@ -670,8 +670,10 @@ lldb_private::formatters::NSDateSummaryP
 }
 else
 {
+llvm::Triple 
triple(process_sp->GetTarget().GetArchitecture().GetTriple());
+uint32_t delta = (triple.isWatchOS() && triple.isWatchABI()) ? 8 : 
ptr_size;
 Error error;
-date_value_bits = 
process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+ptr_size, 8, 0, error);
+date_value_bits = 
process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+delta, 8, 0, error);
 date_value = *((double*)&date_value_bits);
 if (error.Fail())
 return false;


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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

F1981857: gmodules-test-support-v5.diff 

This is the final patch for the way I'd like to see this.  It breaks out 
gmodules checking into a separate support module (in 
lldbsuite/support/gmodules.py).  The skipUnless for gmodules now uses this 
mechanism, and the one previous gmodules-specific test is now set to run only 
for gmodules debug info.

@aprantl, if you can put up this patch set here, then we're good to get a final 
pass on the review from others.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

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

In `is_compiler_clang_with_gmodules` you will need to explicitly return false 
if the target is Windows, because clang help will still show the command line 
option as being valid, even though it doesn't work properly.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D19998#438529, @zturner wrote:

> In `is_compiler_clang_with_gmodules` you will need to explicitly return false 
> if the target is Windows, because clang help will still show the command line 
> option as being valid, even though it doesn't work properly.


Ah okay.

Two code paths call that, one is guarded against Windows, but the very last 
change for that one single gmodules-only test uses the decorator that doesn't 
guard.  (I had mis-expected that -gmodules would just be missing entirely from 
the Windows end).

Adrian is about to put up the patch set.  I'll catch him and we'll modify that 
before it goes up.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

F1982070: gmodules-test-support-v6.diff 

Updated gmodules.is_compiler_clang_with_gmodules() to guard on Windows with:

  def _gmodules_supported_internal():
  compiler = os.path.basename(compiler_path)
  if "clang" not in compiler:
  return False
  elif os.name == "nt":
  # gmodules support is broken on Windows
  return False
  else:
  # Check the compiler help for the -gmodules option.
  clang_help = os.popen("%s --help" % compiler_path).read()
  return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not None


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

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

In http://reviews.llvm.org/D19998#438586, @tfiala wrote:

> F1982070: gmodules-test-support-v6.diff 
>
> Updated gmodules.is_compiler_clang_with_gmodules() to guard on Windows with:
>
>   def _gmodules_supported_internal():
>   compiler = os.path.basename(compiler_path)
>   if "clang" not in compiler:
>   return False
>   elif os.name == "nt":
>   # gmodules support is broken on Windows
>   return False
>   else:
>   # Check the compiler help for the -gmodules option.
>   clang_help = os.popen("%s --help" % compiler_path).read()
>   return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not None
>   


So I asked some of the guys here, and they said modules debug info (in 
particular -gmodules) will not work anywhere but OSX.


http://reviews.llvm.org/D19998



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


[Lldb-commits] LLVM buildmaster will be restarted tonight

2016-05-24 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D19998#438614, @zturner wrote:

> In http://reviews.llvm.org/D19998#438586, @tfiala wrote:
>
> > F1982070: gmodules-test-support-v6.diff 
> >
> > Updated gmodules.is_compiler_clang_with_gmodules() to guard on Windows with:
> >
> >   def _gmodules_supported_internal():
> >   compiler = os.path.basename(compiler_path)
> >   if "clang" not in compiler:
> >   return False
> >   elif os.name == "nt":
> >   # gmodules support is broken on Windows
> >   return False
> >   else:
> >   # Check the compiler help for the -gmodules option.
> >   clang_help = os.popen("%s --help" % compiler_path).read()
> >   return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not 
> > None
> >   
>
>
> So I asked some of the guys here, and they said modules debug info (in 
> particular -gmodules) will not work anywhere but OSX.


I don't think that's right.  I ran all these tests on Linux, and our debug info 
guy (Adrian Prantl) thinks it is better supported on Linux than OS X.  ?  I'll 
let Adrian weigh in on that though.  I got all but the one dead code stripping 
test to run fine on Ubuntu 14.04 x86_64.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Adrian Prantl via lldb-commits
aprantl updated this revision to Diff 58369.
aprantl added a comment.

Update with Todds most recent infrastructure additions.


http://reviews.llvm.org/D19998

Files:
  packages/Python/lldbsuite/support/gmodules.py
  packages/Python/lldbsuite/test/decorators.py
  
packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
  packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
  packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
  packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
  packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
  packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
  packages/Python/lldbsuite/test/lldbinline.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/make/Makefile.rules
  packages/Python/lldbsuite/test/plugins/builder_base.py
  packages/Python/lldbsuite/test/test_categories.py

Index: packages/Python/lldbsuite/test/test_categories.py
===
--- packages/Python/lldbsuite/test/test_categories.py
+++ packages/Python/lldbsuite/test/test_categories.py
@@ -11,9 +11,11 @@
 # Third-party modules
 
 # LLDB modules
+from lldbsuite.support import gmodules
+
 
 debug_info_categories = [
-'dwarf', 'dwo', 'dsym'
+'dwarf', 'dwo', 'dsym', 'gmodules'
 ]
 
 all_categories = {
@@ -21,6 +23,7 @@
 'dwarf' : 'Tests that can be run with DWARF debug information',
 'dwo'   : 'Tests that can be run with DWO debug information',
 'dsym'  : 'Tests that can be run with DSYM debug information',
+'gmodules'  : 'Tests that can be run with -gmodules debug information',
 'expression': 'Tests related to the expression parser',
 'objc'  : 'Tests related to the Objective-C programming language support',
 'pyapi' : 'Tests related to the Python API',
@@ -42,12 +45,26 @@
 candidate = item
 return candidate
 
-def is_supported_on_platform(category, platform):
+
+def is_supported_on_platform(category, platform, compiler_paths):
 if category == "dwo":
 # -gsplit-dwarf is not implemented by clang on Windows.
 return platform in ["linux", "freebsd"]
 elif category == "dsym":
 return platform in ["darwin", "macosx", "ios"]
+elif category == "gmodules":
+# First, check to see if the platform can even support gmodules.
+if platform not in ["linux", "freebsd", "darwin", "macosx", "ios"]:
+return False
+# If all compilers specified support gmodules, we'll enable it.
+for compiler_path in compiler_paths:
+if not gmodules.is_compiler_clang_with_gmodules(compiler_path):
+# Ideally in a multi-compiler scenario during a single test run, this would
+# allow gmodules on compilers that support it and not on ones that don't.
+# However, I didn't see an easy way for all the callers of this to know
+# the compiler being used for a test invocation.
+return False
+return True
 return True
 
 def validate(categories, exact_match):
Index: packages/Python/lldbsuite/test/plugins/builder_base.py
===
--- packages/Python/lldbsuite/test/plugins/builder_base.py
+++ packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -143,6 +143,17 @@
 # True signifies that we can handle building dwo.
 return True
 
+def buildGModules(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+"""Build the binaries with dwarf debug info."""
+commands = []
+if clean:
+commands.append([getMake(), "clean", getCmdLine(dictionary)])
+commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+
+lldbtest.system(commands, sender=sender)
+# True signifies that we can handle building with gmodules.
+return True
+
 def cleanup(sender=None, dictionary=None):
 """Perform a platform-specific cleanup after the test."""
 #import traceback
Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -212,8 +212,13 @@
 	CFLAGS += -gsplit-dwarf
 endif
 
+ifeq "$(MAKE_GMODULES)" "YES"
+	CFLAGS += -fmodules -gmodules
+endif
+
 CXXFLAGS += -std=c++11
-CXXFLAGS += $(CFLAGS)
+# FIXME: C++ modules aren't supported on all platforms.
+CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS)
@@ -519,7 +524,7 @@
 $(PCH_OUTPUT) : $(PCH_CXX_SOURCE)
 	$(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE)
 %.o : %.cpp $(PCH_OUTPUT)
-	$(CXX) $(PCHFLAGS) 

Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Adrian Prantl via lldb-commits
aprantl added a comment.

In http://reviews.llvm.org/D19998#438666, @tfiala wrote:

> In http://reviews.llvm.org/D19998#438614, @zturner wrote:
>
> > So I asked some of the guys here, and they said modules debug info (in 
> > particular -gmodules) will not work anywhere but OSX.
>
>
> I don't think that's right.  I ran all these tests on Linux, and our debug 
> info guy (Adrian Prantl) thinks it is better supported on Linux than OS X.  ? 
>  I'll let Adrian weigh in on that though.  I got all but the one dead code 
> stripping test to run fine on Ubuntu 14.04 x86_64.


Clang modules themselves (-fmodules) can be thought of as almost a build system 
/ preprocessor feature that does not or rather can not have any effect on the 
debugger at all. Darwin (OS X, iOS, ...) supports clang modules for C and 
Objective-C very well. C++ clang modules are not supported on Darwin. On Linux 
clang modules are supported, including C++ modules. I believe I also heard of 
people using clang modules on FreeBSD. On Windows, clang can build and use 
modules, but I don't think anyone is using/testing this actively.

Clang module debugging (-fmodules -gmodules) affects the debugger (debug info 
for module types is emitted only once in the compiled module and referred to by 
reference in the object files). It is fully supported on Darwin. On Linux, can 
in theory support it (there may be some unresolved bugs with DWOs), but nobody 
tested this so far and this patch would make it possible to figure out where 
we're at. I think tests should be XFAIL'ed on an individual basis and 
considered bugs if they don't work on Linux.

- adrian


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

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

Should this be disabled by default unless explicitly requested? Seems like
"run the entire test suite N times" should be opt in, not opt out.

If its opt in, I don't mind removing the os check for Windows.


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-24 Thread Zachary Turner via lldb-commits
Should this be disabled by default unless explicitly requested? Seems like
"run the entire test suite N times" should be opt in, not opt out.

If its opt in, I don't mind removing the os check for Windows.
On Tue, May 24, 2016 at 6:25 PM Adrian Prantl  wrote:

> aprantl added a comment.
>
> In http://reviews.llvm.org/D19998#438666, @tfiala wrote:
>
> > In http://reviews.llvm.org/D19998#438614, @zturner wrote:
> >
> > > So I asked some of the guys here, and they said modules debug info (in
> particular -gmodules) will not work anywhere but OSX.
> >
> >
> > I don't think that's right.  I ran all these tests on Linux, and our
> debug info guy (Adrian Prantl) thinks it is better supported on Linux than
> OS X.  ?  I'll let Adrian weigh in on that though.  I got all but the one
> dead code stripping test to run fine on Ubuntu 14.04 x86_64.
>
>
> Clang modules themselves (-fmodules) can be thought of as almost a build
> system / preprocessor feature that does not or rather can not have any
> effect on the debugger at all. Darwin (OS X, iOS, ...) supports clang
> modules for C and Objective-C very well. C++ clang modules are not
> supported on Darwin. On Linux clang modules are supported, including C++
> modules. I believe I also heard of people using clang modules on FreeBSD.
> On Windows, clang can build and use modules, but I don't think anyone is
> using/testing this actively.
>
> Clang module debugging (-fmodules -gmodules) affects the debugger (debug
> info for module types is emitted only once in the compiled module and
> referred to by reference in the object files). It is fully supported on
> Darwin. On Linux, can in theory support it (there may be some unresolved
> bugs with DWOs), but nobody tested this so far and this patch would make it
> possible to figure out where we're at. I think tests should be XFAIL'ed on
> an individual basis and considered bugs if they don't work on Linux.
>
> - adrian
>
>
> http://reviews.llvm.org/D19998
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r270658 - Add support for arm64 compact unwind tables, used on darwin arm64

2016-05-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue May 24 23:20:28 2016
New Revision: 270658

URL: http://llvm.org/viewvc/llvm-project?rev=270658&view=rev
Log:
Add support for arm64 compact unwind tables, used on darwin arm64
systems (ios, tvos, watchos).  It's a simple format to use now that
I have i386/x86_64 supported already.

The unwind instructions are only valid at call sites -- that is,
when lldb is unwinding a frame in the middle of the stack.  It
cannot be used for the currently executing frame; it has no information
about prologues/epilogues/etc.

 

Modified:
lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h
lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
lldb/trunk/tools/compact-unwind/compact-unwind-dumper.c

Modified: lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h?rev=270658&r1=270657&r2=270658&view=diff
==
--- lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h Tue May 24 23:20:28 2016
@@ -133,6 +133,9 @@ private:
 bool
 CreateUnwindPlan_i386 (Target &target, FunctionInfo &function_info, 
UnwindPlan &unwind_plan, Address pc_or_function_start);
 
+bool
+CreateUnwindPlan_arm64 (Target &target, FunctionInfo &function_info, 
UnwindPlan &unwind_plan, Address pc_or_function_start);
+
 ObjectFile  &m_objfile;
 lldb::SectionSP m_section_sp;
 lldb::DataBufferSP  m_section_contents_if_encrypted; // if the 
binary is encrypted, read the sect contents

Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=270658&r1=270657&r2=270658&view=diff
==
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Tue May 24 23:20:28 2016
@@ -101,6 +101,27 @@ namespace lldb_private {
 UNWIND_X86_64_REG_R15= 5,
 UNWIND_X86_64_REG_RBP= 6,
 };
+
+FLAGS_ANONYMOUS_ENUM()
+{
+   UNWIND_ARM64_MODE_MASK = 0x0F00,
+   UNWIND_ARM64_MODE_FRAMELESS= 0x0200,
+   UNWIND_ARM64_MODE_DWARF= 0x0300,
+   UNWIND_ARM64_MODE_FRAME= 0x0400,
+
+   UNWIND_ARM64_FRAME_X19_X20_PAIR= 0x0001,
+   UNWIND_ARM64_FRAME_X21_X22_PAIR= 0x0002,
+   UNWIND_ARM64_FRAME_X23_X24_PAIR= 0x0004,
+   UNWIND_ARM64_FRAME_X25_X26_PAIR= 0x0008,
+   UNWIND_ARM64_FRAME_X27_X28_PAIR= 0x0010,
+   UNWIND_ARM64_FRAME_D8_D9_PAIR  = 0x0100,
+   UNWIND_ARM64_FRAME_D10_D11_PAIR= 0x0200,
+   UNWIND_ARM64_FRAME_D12_D13_PAIR= 0x0400,
+   UNWIND_ARM64_FRAME_D14_D15_PAIR= 0x0800,
+
+   UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK = 0x00FFF000,
+   UNWIND_ARM64_DWARF_SECTION_OFFSET  = 0x00FF,
+};
 }
 
 
@@ -195,6 +216,10 @@ CompactUnwindInfo::GetUnwindPlan (Target
 {
 return CreateUnwindPlan_x86_64 (target, function_info, 
unwind_plan, addr);
 }
+if (arch.GetTriple().getArch() == llvm::Triple::aarch64)
+{
+return CreateUnwindPlan_arm64 (target, function_info, 
unwind_plan, addr);
+}
 if (arch.GetTriple().getArch() == llvm::Triple::x86)
 {
 return CreateUnwindPlan_i386 (target, function_info, 
unwind_plan, addr);
@@ -1229,3 +1254,166 @@ CompactUnwindInfo::CreateUnwindPlan_i386
 }
 return false;
 }
+
+
+
+// DWARF register numbers from "DWARF for the ARM 64-bit Architecture 
(AArch64)" doc by ARM
+
+enum arm64_eh_regnum {
+x19 = 19,
+x20 = 20,
+x21 = 21,
+x22 = 22,
+x23 = 23,
+x24 = 24,
+x25 = 25,
+x26 = 26,
+x27 = 27,
+x28 = 28,
+
+fp = 29,
+ra = 30,
+sp = 31,
+pc = 32,
+
+// Compact unwind encodes d8-d15 but we don't have eh_frame / dwarf reg 
#'s for the 64-bit
+// fp regs.  Normally in DWARF it's context sensitive - so it knows it is 
fetching a 
+// 32- or 64-bit quantity from reg v8 to indicate s0 or d0 - but the 
unwinder is operating
+// at a lower level and we'd try to fetch 128 bits if we were told that v8 
were stored on
+// the stack...
+   v8  = 72,  
+   v9  = 73,  
+   v10 = 74,
+   v11 = 75,
+   v12 = 76,
+   v13 = 77,
+   v14 = 78,
+   v15 = 79,
+};
+
+bool
+CompactUnwindInfo::CreateUnwindPlan_arm64 (Target &target, FunctionInfo 
&function_info, UnwindPlan &unwind_plan, Address pc_or_function_start)
+{
+unwind_plan.SetSourceName ("compact unwind info");
+unwi

[Lldb-commits] [lldb] r270662 - Include in Process.h - Jim's change in r270593 added a std::mutex

2016-05-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed May 25 00:14:16 2016
New Revision: 270662

URL: http://llvm.org/viewvc/llvm-project?rev=270662&view=rev
Log:
Include  in Process.h - Jim's change in r270593 added a std::mutex
ivar and this header is needed for it to compile on linux, judging by the
build bots.

Modified:
lldb/trunk/include/lldb/Target/Process.h

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=270662&r1=270661&r2=270662&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Wed May 25 00:14:16 2016
@@ -18,6 +18,7 @@
 // C++ Includes
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


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