[Lldb-commits] [lldb] r346684 - Remove the last CURRENT_ARCH reference in Xcode's build scripts.

2018-11-12 Thread Frederic Riss via lldb-commits
Author: friss
Date: Mon Nov 12 09:59:30 2018
New Revision: 346684

URL: http://llvm.org/viewvc/llvm-project?rev=346684&view=rev
Log:
Remove the last CURRENT_ARCH reference in Xcode's build scripts.

In the same spirit as r346443.

Modified:
lldb/trunk/scripts/Xcode/lldbbuild.py

Modified: lldb/trunk/scripts/Xcode/lldbbuild.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/lldbbuild.py?rev=346684&r1=346683&r2=346684&view=diff
==
--- lldb/trunk/scripts/Xcode/lldbbuild.py (original)
+++ lldb/trunk/scripts/Xcode/lldbbuild.py Mon Nov 12 09:59:30 2018
@@ -190,4 +190,4 @@ def package_build_path():
 return os.path.join(
 llvm_build_dirtree(),
 os.environ["LLVM_CONFIGURATION"],
-os.environ["CURRENT_ARCH"])
+"x86_64")


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


[Lldb-commits] [lldb] r347109 - Rewrite stop-hook tests as a couple of FileCheck tests

2018-11-16 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Nov 16 15:07:28 2018
New Revision: 347109

URL: http://llvm.org/viewvc/llvm-project?rev=347109&view=rev
Log:
Rewrite stop-hook tests as a couple of FileCheck tests

Those tests were using pexpect and being flaky on some of ours bots.
This patch reimplmeents the tests usinf FileCheck, and it also
extends the test coverage to a few more stop-hook options.

Added:
lldb/trunk/lit/ExecControl/
lldb/trunk/lit/ExecControl/StopHook/
lldb/trunk/lit/ExecControl/StopHook/Inputs/
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
  - copied, changed from r347104, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c
  - copied, changed from r347104, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp
lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
Removed:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp

Copied: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp (from 
r347104, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp?p2=lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp&p1=lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp&r1=347104&r2=347109&rev=347109&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/main.cpp
 (original)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp Fri Nov 16 
15:07:28 2018
@@ -14,7 +14,7 @@
 #include 
 
 std::default_random_engine g_random_engine{std::random_device{}()};
-std::uniform_int_distribution<> g_distribution{0, 300};
+std::uniform_int_distribution<> g_distribution{0, 3000};
 
 uint32_t g_val = 0;
 
@@ -42,14 +42,14 @@ thread_func (uint32_t thread_index)
 
 uint32_t count = 0;
 uint32_t val;
-while (count++ < 15)
+while (count++ < 4)
 {
-// random micro second sleep from zero to 3 seconds
+// random micro second sleep from zero to .3 seconds
 int usec = g_distribution(g_random_engine);
 printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, 
thread_index, usec);
-std::this_thread::sleep_for(std::chrono::microseconds{usec});
+std::this_thread::sleep_for(std::chrono::microseconds{usec}); // Set 
break point at this line
 
-if (count < 7)
+if (count < 2)
 val = access_pool ();
 else
 val = access_pool (true);
@@ -64,7 +64,6 @@ int main (int argc, char const *argv[])
 {
 std::thread threads[3];
 
-printf ("Before turning all three threads loose...\n"); // Set break point 
at this line, and add a stop-hook.
 // Create 3 threads
 for (auto &thread : threads)
 thread = std::thread{thread_func, std::distance(threads, &thread)};

Copied: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c (from r347104, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c?p2=lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook.c&p1=lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/main.cpp&r1=347104&r2=347109&rev=347109&view=diff
==
(empty)

Added: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test?rev=347109&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test (added)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test Fri Nov 16 
15:07:28 2018
@@ -0,0 +1,44 @@
+# RUN: %cxx %p/Inputs/stop-hook-threads.cpp -g -o %t
+# RUN: %lldb -b -s %s -O 'target create %t' \
+# RUN: -O 'break set -f stop-hook-threads.cpp -p "Break here to test that 
the stop-hook"' \
+# RUN: -O run \
+# RUN

[Lldb-commits] [lldb] r347117 - Make TestAppleSimulatorOSType.py more flexible

2018-11-16 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Nov 16 16:40:31 2018
New Revision: 347117

URL: http://llvm.org/viewvc/llvm-project?rev=347117&view=rev
Log:
Make TestAppleSimulatorOSType.py more flexible

Different versions of Xcode have different outputs for the simctl command

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=347117&r1=347116&r2=347117&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Fri Nov 16 16:40:31 2018
@@ -19,7 +19,13 @@ class TestAppleSimulatorOSType(gdbremote
 sim_devices = json.loads(sim_devices_str)['devices']
 # Find an available simulator for the requested platform
 deviceUDID = None
-for (runtime,devices) in sim_devices.items():
+for simulator in sim_devices:
+if isinstance(simulator,dict):
+runtime = simulator['name']
+devices = simulator['devices']
+else:
+runtime = simulator
+devices = sim_devices[simulator]
 if not platform in runtime.lower():
 continue
 for device in devices:


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


[Lldb-commits] [lldb] r348710 - Remove some UB in RegisterContextDarwin_arm64.cpp

2018-12-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Sat Dec  8 18:35:19 2018
New Revision: 348710

URL: http://llvm.org/viewvc/llvm-project?rev=348710&view=rev
Log:
Remove some UB in RegisterContextDarwin_arm64.cpp

Modified:
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp

Modified: 
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=348710&r1=348709&r2=348710&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Sat 
Dec  8 18:35:19 2018
@@ -90,7 +90,7 @@ static inline uint64_t
 AddWithCarry(uint32_t N, uint64_t x, uint64_t y, bit carry_in,
  EmulateInstructionARM64::ProcState &proc_state) {
   uint64_t unsigned_sum = UInt(x) + UInt(y) + UInt(carry_in);
-  int64_t signed_sum = SInt(x) + SInt(y) + UInt(carry_in);
+  int64_t signed_sum = 0;//SInt(x) + SInt(y) + UInt(carry_in);
   uint64_t result = unsigned_sum;
   if (N < 64)
 result = Bits64(result, N - 1, 0);

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp?rev=348710&r1=348709&r2=348710&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp 
Sat Dec  8 18:35:19 2018
@@ -338,12 +338,22 @@ bool RegisterContextDarwin_arm64::ReadRe
   case gpr_x26:
   case gpr_x27:
   case gpr_x28:
+value.SetUInt64(gpr.x[reg - gpr_x0]);
+break;
   case gpr_fp:
+value.SetUInt64(gpr.fp);
+break;
   case gpr_sp:
+value.SetUInt64(gpr.sp);
+break;
   case gpr_lr:
+value.SetUInt64(gpr.lr);
+break;
   case gpr_pc:
+value.SetUInt64(gpr.pc);
+break;
   case gpr_cpsr:
-value.SetUInt64(gpr.x[reg - gpr_x0]);
+value.SetUInt64(gpr.cpsr);
 break;
 
   case gpr_w0:


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


[Lldb-commits] [lldb] r348711 - Revert a hunk that shouldn't have been included in the last commit.

2018-12-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Sat Dec  8 18:38:04 2018
New Revision: 348711

URL: http://llvm.org/viewvc/llvm-project?rev=348711&view=rev
Log:
Revert a hunk that shouldn't have been included in the last commit.

I've seen this line trigger UB, but that's obviously not the correct fix...

Modified:
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp

Modified: 
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=348711&r1=348710&r2=348711&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Sat 
Dec  8 18:38:04 2018
@@ -90,7 +90,7 @@ static inline uint64_t
 AddWithCarry(uint32_t N, uint64_t x, uint64_t y, bit carry_in,
  EmulateInstructionARM64::ProcState &proc_state) {
   uint64_t unsigned_sum = UInt(x) + UInt(y) + UInt(carry_in);
-  int64_t signed_sum = 0;//SInt(x) + SInt(y) + UInt(carry_in);
+  int64_t signed_sum = SInt(x) + SInt(y) + UInt(carry_in);
   uint64_t result = unsigned_sum;
   if (N < 64)
 result = Bits64(result, N - 1, 0);


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


[Lldb-commits] [lldb] r348805 - Reflow a multi-line string and add a newline

2018-12-10 Thread Frederic Riss via lldb-commits
Author: friss
Date: Mon Dec 10 14:30:19 2018
New Revision: 348805

URL: http://llvm.org/viewvc/llvm-project?rev=348805&view=rev
Log:
Reflow a multi-line string and add a newline

Modified:
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=348805&r1=348804&r2=348805&view=diff
==
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Dec 10 14:30:19 2018
@@ -367,9 +367,8 @@ protected:
   "continuing: %s.",
   m_should_stop ? "true" : "false");
 process->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
-"Warning: hit breakpoint while "
-"running function, skipping commands and conditions to prevent 
"
-"recursion.");
+"Warning: hit breakpoint while running function, skipping "
+"commands and conditions to prevent recursion.\n");
 return;
   }
 


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


[Lldb-commits] [lldb] r332115 - Add a lock to PlatformPOSIX::DoLoadImage

2018-05-11 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri May 11 11:21:11 2018
New Revision: 332115

URL: http://llvm.org/viewvc/llvm-project?rev=332115&view=rev
Log:
Add a lock to PlatformPOSIX::DoLoadImage

Summary:
Multiple threads could be calling into DoLoadImage concurrently,
only one should be allowed to create the UtilityFunction.

Reviewers: jingham

Subscribers: emaste, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.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=332115&r1=332114&r2=332115&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri May 11 11:21:11 2018
@@ -804,7 +804,7 @@ public:
   }
 
   //--
-  // FUTURE WORK: {Set,Get}LoadImageUtilityFunction are the first use we've
+  // FUTURE WORK: GetLoadImageUtilityFunction are the first use we've
   // had of having other plugins cache data in the Process.  This is handy for
   // long-living plugins - like the Platform - which manage interactions whose
   // lifetime is governed by the Process lifetime.  If we find we need to do
@@ -820,34 +820,23 @@ public:
   // We are postponing designing this till we have at least a second use case.
   //--
   //--
-  /// Set the cached UtilityFunction that assists in loading binary images
-  /// into the process.
-  ///
-  /// This UtilityFunction is maintained in the Process since the Platforms
-  /// don't track the lifespan of the Targets/Processes that use them.   But
-  /// it is not intended to be comprehended by the Process, it's up to the
-  /// Platform that set it to do it right.
-  ///
-  /// @param[in] utility_func_up
-  /// The incoming utility_function.  The process will manage the 
function's
-  /// lifetime.
-  ///
-  //--
-  void SetLoadImageUtilityFunction(std::unique_ptr 
-   utility_func_up);
-  
-  //--
   /// Get the cached UtilityFunction that assists in loading binary images
   /// into the process.
   ///
   /// @param[in] platform
   /// The platform fetching the UtilityFunction.
-  /// 
+  /// @param[in] factory
+  /// A function that will be called only once per-process in a
+  /// thread-safe way to create the UtilityFunction if it has not
+  /// been initialized yet.
+  ///
   /// @return
   /// The cached utility function or null if the platform is not the
   /// same as the target's platform.
   //--
-  UtilityFunction *GetLoadImageUtilityFunction(Platform *platform);
+  UtilityFunction *GetLoadImageUtilityFunction(
+  Platform *platform,
+  llvm::function_ref()> factory);
 
   //--
   /// Get the dynamic loader plug-in for this process.
@@ -3127,6 +3116,7 @@ protected:
   enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit;
   
   std::unique_ptr m_dlopen_utility_func_up;
+  std::once_flag m_dlopen_utility_func_flag_once;
 
   size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size,
uint8_t *buf) const;

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=332115&r1=332114&r2=332115&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Fri May 11 
11:21:11 2018
@@ -929,10 +929,9 @@ Status PlatformPOSIX::EvaluateLibdlExpre
   return Status();
 }
 
-UtilityFunction *
-PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx, 
-Status &error)
-{
+std::unique_ptr
+PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
+Status &error) {
   // Remember to prepend this with the prefix from
   // GetLibdlFunctionDeclarations. The returned values are all in
   // __lldb_dlopen_result for consistency. The wrapper returns a void * but
@@ -982,7 +981,6 @@ PlatformPOSIX::MakeLoadImageUtilityFunct
   Value value;
   ValueList arguments;
   FunctionCaller *do_dlopen_functio

[Lldb-commits] [lldb] r333786 - Fix Module::FindTypes to return the correct number of matches.

2018-06-01 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Jun  1 13:14:21 2018
New Revision: 333786

URL: http://llvm.org/viewvc/llvm-project?rev=333786&view=rev
Log:
Fix Module::FindTypes to return the correct number of matches.

In r331719, I changed Module::FindTypes not to limit the amount
of types returned by the Symbol provider, because we want all
possible matches to be able to filter them. In one code path,
the filtering was applied to the TypeList without changing the
number of types that gets returned. This is turn could cause
consumers to access beyond the end of the TypeList.

This patch fixes this case and also adds an assertion to
TypeList::GetTypeAtIndex to catch those obvious programming
mistakes.

Triggering the condition in which we performed the incorrect
access was not easy. It happened a lot in mixed Swift/ObjectiveC
code, but I was able to trigger it in pure Objective C++ although
in a contrieved way.

rdar://problem/40254997

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/

lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/TestNameClash.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/main.mm

lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/myobject.mm
Modified:
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Symbol/TypeList.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/Makefile?rev=333786&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/Makefile 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/Makefile 
Fri Jun  1 13:14:21 2018
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+OBJCXX_SOURCES := main.mm myobject.mm
+include $(LEVEL)/Makefile.rules
+
+# myobject.o needs to be built without debug info
+myobject.o: myobject.mm
+   $(CXX) -c -o $@ $<

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/TestNameClash.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/TestNameClash.py?rev=333786&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/TestNameClash.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/TestNameClash.py
 Fri Jun  1 13:14:21 2018
@@ -0,0 +1,6 @@
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(
+__file__, globals(), [
+decorators.skipIfFreeBSD, decorators.skipIfLinux, 
decorators.skipIfWindows])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/main.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/main.mm?rev=333786&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/main.mm 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/main.mm 
Fri Jun  1 13:14:21 2018
@@ -0,0 +1,21 @@
+#import 
+
+namespace NS {
+  class MyObject { int i = 42; };
+  NS::MyObject globalObject;
+}
+
+@interface MyObject: NSObject
+@end
+
+int main ()
+{
+  @autoreleasepool
+  {
+MyObject *o = [MyObject alloc];
+return 0; //% self.expect("fr var o", DATA_TYPES_DISPLAYED_CORRECTLY, 
substrs = ["(MyObject"]);
+  //% self.expect("fr var globalObject", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"]);
+  }
+}
+
+

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/myobject.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/myobject.mm?rev=333786&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/myobject.mm
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/class-name-clash/myobject.mm
 Fri Jun  1 13:14:21 2018
@@ -0,0 +1,7 @@
+#import 
+
+@interface MyObject : NSObject
+@end
+
+@implementation MyObject
+@end

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=333786&r1=333785&r2=333786&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Jun  1 13:14:21 2018
@@ -1030,6 +1030,7 @@ size_t Module::FindTypes(
 std::string name_str(name.

[Lldb-commits] [lldb] r334743 - Add a script to setup codesigning on macOS.

2018-06-14 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Jun 14 11:04:13 2018
New Revision: 334743

URL: http://llvm.org/viewvc/llvm-project?rev=334743&view=rev
Log:
Add a script to setup codesigning on macOS.

I've been using this script on a couple machines and it seems to work
so I'm putting it out there, maybe other people will find it useful.
It is strongly inspired from a similar script in the delve project.

Added:
lldb/trunk/scripts/macos-setup-codesign.sh   (with props)

Added: lldb/trunk/scripts/macos-setup-codesign.sh
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/macos-setup-codesign.sh?rev=334743&view=auto
==
--- lldb/trunk/scripts/macos-setup-codesign.sh (added)
+++ lldb/trunk/scripts/macos-setup-codesign.sh Thu Jun 14 11:04:13 2018
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+CERT="lldb_codesign"
+
+function error() {
+echo error: "$@"
+exit 1
+}
+
+function cleanup {
+# Remove generated files
+rm -f "$TMPDIR/$CERT.tmpl" "$TMPDIR/$CERT.cer" "$TMPDIR/$CERT.key" > 
/dev/null 2>&1
+}
+
+trap cleanup EXIT
+
+# Check if the certificate is already present in the system keychain
+security find-certificate -Z -p -c "$CERT" /Library/Keychains/System.keychain 
> /dev/null 2>&1
+if [ $? -eq 0 ]; then
+echo Certificate has already been generated and installed
+exit 0
+fi
+
+# Create the certificate template
+cat <$TMPDIR/$CERT.tmpl
+[ req ]
+default_bits   = 2048# RSA key size
+encrypt_key= no  # Protect private key
+default_md = sha512  # MD to use
+prompt = no  # Prompt for DN
+distinguished_name = codesign_dn # DN template
+[ codesign_dn ]
+commonName = "$CERT"
+[ codesign_reqext ]
+keyUsage   = critical,digitalSignature
+extendedKeyUsage   = critical,codeSigning
+EOF
+
+echo Generating and installing lldb_codesign certificate
+
+# Generate a new certificate
+openssl req -new -newkey rsa:2048 -x509 -days 3650 -nodes -config 
"$TMPDIR/$CERT.tmpl" -extensions codesign_reqext -batch -out 
"$TMPDIR/$CERT.cer" -keyout "$TMPDIR/$CERT.key" > /dev/null 2>&1
+[ $? -eq 0 ] || error Something went wrong when generating the certificate
+
+# Install the certificate in the system keychain
+sudo security add-trusted-cert -d -r trustRoot -p codeSign -k 
/Library/Keychains/System.keychain "$TMPDIR/$CERT.cer" > /dev/null 2>&1
+[ $? -eq 0 ] || error Something went wrong when installing the certificate
+
+# Install the key for the certificate in the system keychain
+sudo security import "$TMPDIR/$CERT.key" -A -k 
/Library/Keychains/System.keychain > /dev/null 2>&1
+[ $? -eq 0 ] || error Something went wrong when installing the key
+
+# Kill task_for_pid access control daemon
+sudo pkill -f /usr/libexec/taskgated > /dev/null 2>&1
+
+# Exit indicating the certificate is now generated and installed
+exit 0

Propchange: lldb/trunk/scripts/macos-setup-codesign.sh
--
svn:executable = *


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


[Lldb-commits] [lldb] r334772 - Add an entitlement to debugserver

2018-06-14 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Jun 14 14:17:59 2018
New Revision: 334772

URL: http://llvm.org/viewvc/llvm-project?rev=334772&view=rev
Log:
Add an entitlement to debugserver

On macOS 10.14, debugserver needs to have an entitlement do be
allowed to debug processes. Adding this to both the Xcode and
cmake build system. This shouldn't have any impact on previous
OSs.

Added:
lldb/trunk/resources/debugserver-macosx-entitlements.plist
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/source/CMakeLists.txt

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=334772&r1=334771&r2=334772&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jun 14 14:17:59 2018
@@ -7335,7 +7335,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
-   shellScript = "if [ \"${CONFIGURATION}\" != 
BuildAndIntegration ]\nthen\nif [ \"${DEBUGSERVER_USE_FROM_SYSTEM}\" == 
\"\" ]\nthen\nif [ \"${DEBUGSERVER_DISABLE_CODESIGN}\" == \"\" ]\n  
  then\ncodesign -f -s lldb_codesign 
\"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nfi\nfi\nfi\n";
+   shellScript = "if [ \"${CONFIGURATION}\" != 
BuildAndIntegration ]\nthen\nif [ \"${DEBUGSERVER_USE_FROM_SYSTEM}\" == 
\"\" ]\nthen\nif [ \"${DEBUGSERVER_DISABLE_CODESIGN}\" == \"\" ]\n  
  then\ncodesign -f -s lldb_codesign --entitlements 
${SRCROOT}/resources/debugserver-macosx-entitlements.plist 
\"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nfi\nfi\nfi\n";
};
940B04E21A89871F0045D5F7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;

Added: lldb/trunk/resources/debugserver-macosx-entitlements.plist
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/debugserver-macosx-entitlements.plist?rev=334772&view=auto
==
--- lldb/trunk/resources/debugserver-macosx-entitlements.plist (added)
+++ lldb/trunk/resources/debugserver-macosx-entitlements.plist Thu Jun 14 
14:17:59 2018
@@ -0,0 +1,8 @@
+
+http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+
+
+com.apple.security.cs.debugger
+
+
+

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=334772&r1=334771&r2=334772&view=diff
==
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj 
(original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Thu Jun 
14 14:17:59 2018
@@ -570,7 +570,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
-   shellScript = "if [ \"${CONFIGURATION}\" != 
BuildAndIntegration ]\nthen\nif [ -n \"${DEBUGSERVER_USE_FROM_SYSTEM}\" ]\n 
   then\n\t\tditto 
\"${DEVELOPER_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver\" 
\"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nelif [ 
\"${DEBUGSERVER_DISABLE_CODESIGN}\" == \"\" ]\nthen\ncodesign -f -s 
lldb_codesign \"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nfi\nfi\n";
+   shellScript = "if [ \"${CONFIGURATION}\" != 
BuildAndIntegration ]\nthen\nif [ -n \"${DEBUGSERVER_USE_FROM_SYSTEM}\" ]\n 
   then\n\t\tditto 
\"${DEVELOPER_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver\" 
\"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nelif [ 
\"${DEBUGSERVER_DISABLE_CODESIGN}\" == \"\" ]\nthen\ncodesign -f -s 
lldb_codesign --entitlements 
${SRCROOT}/../../resources/debugserver-macosx-entitlements.plist 
\"${TARGET_BUILD_DIR}/${TARGET_NAME}\"\nfi\nfi\n";
};
 /* End PBXShellScriptBuildPhase section */
 

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=334772&r1=334771&r2=334772&view=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Thu Jun 14 14:17:59 2018
@@ -209,12 +209,11 @@ endif()
 set(entitlements_xml 
${CMAKE_CURRENT_SOURCE_DIR}/debugserver-macosx-entitlements.plist)
 if(IOS)
   set(entitlements_xml 
${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
+else()
+  set(entitlements_xml 
${CMAKE_CURRENT_SOURC

[Lldb-commits] [lldb] r334784 - Add support for PLATFORM_*SIMULATOR

2018-06-14 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Jun 14 19:50:45 2018
New Revision: 334784

URL: http://llvm.org/viewvc/llvm-project?rev=334784&view=rev
Log:
Add support for PLATFORM_*SIMULATOR

The toolchain in Xcode 10 uses a new LC_BUILD_VERSION entry to identify
simulator binaries. Add support for reading those to debugserver.

The exisitng test testing that code is currently failling when run
with Xcode 10, no need for a new test.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=334784&r1=334783&r2=334784&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Thu Jun 14 
19:50:45 2018
@@ -607,6 +607,11 @@ const char *MachProcess::GetDeploymentIn
 }
   }
 #if defined (LC_BUILD_VERSION)
+#ifndef PLATFORM_IOSSIMULATOR
+#define PLATFORM_IOSSIMULATOR 7
+#define PLATFORM_TVOSSIMULATOR 8
+#define PLATFORM_WATCHOSSIMULATOR 9
+#endif
   if (cmd == LC_BUILD_VERSION) {
 struct build_version_command build_vers;
 if (ReadMemory(load_command_address, sizeof(struct build_version_command),
@@ -621,10 +626,13 @@ const char *MachProcess::GetDeploymentIn
 case PLATFORM_MACOS:
   return "macosx";
 case PLATFORM_IOS:
+case PLATFORM_IOSSIMULATOR:
   return "ios";
 case PLATFORM_TVOS:
+case PLATFORM_TVOSSIMULATOR:
   return "tvos";
 case PLATFORM_WATCHOS:
+case PLATFORM_WATCHOSSIMULATOR:
   return "watchos";
 case PLATFORM_BRIDGEOS:
   return "bridgeos";


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


[Lldb-commits] [lldb] r334861 - Fix TestExec after r334783

2018-06-15 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Jun 15 13:36:03 2018
New Revision: 334861

URL: http://llvm.org/viewvc/llvm-project?rev=334861&view=rev
Log:
Fix TestExec after r334783

The second makefile that was added has implicit rules which meant
that secondprog.cpp would be built once into a secondprog binary,
but it would also be compiled as a.out overwriting the main binary.
This lead to spurious failures.

This commit simplifies the Makefile to build only once with the correct
executable name.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk?rev=334861&r1=334860&r2=334861&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk 
Fri Jun 15 13:36:03 2018
@@ -1,13 +1,6 @@
 LEVEL = ../../make
 
 CXX_SOURCES := secondprog.cpp
-
-all: secondprog
-
-secondprog:
-   $(CXX) $(CXXFLAGS) -o secondprog $(SRCDIR)/secondprog.cpp
-
-clean::
-   rm -rf secondprog secondprog.dSYM
+EXE = secondprog
 
 include $(LEVEL)/Makefile.rules


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


[Lldb-commits] [lldb] r334921 - Fix the 'tb' alias command

2018-06-17 Thread Frederic Riss via lldb-commits
Author: friss
Date: Sun Jun 17 21:34:33 2018
New Revision: 334921

URL: http://llvm.org/viewvc/llvm-project?rev=334921&view=rev
Log:
Fix the 'tb' alias command

No idea when this broke or if it ever worked. Added a small test
for one-shot breakpoints while I was there.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py?rev=334921&r1=334920&r2=334921&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
 Sun Jun 17 21:34:33 2018
@@ -22,6 +22,31 @@ class BreakpointHitCountTestCase(TestBas
 self.build()
 self.do_test_breakpoint_location_hit_count()
 
+def test_breakpoint_one_shot(self):
+"""Check that one-shot breakpoints trigger only once."""
+self.build()
+
+exe = self.getBuildArtifact("a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+self.runCmd("tb a")
+process = target.LaunchSimple(
+None, None, self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+
+from lldbsuite.test.lldbutil import get_stopped_thread
+thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+self.assertTrue(
+thread.IsValid(),
+"There should be a thread stopped due to breakpoint")
+
+frame0 = thread.GetFrameAtIndex(0)
+self.assertEqual(frame0.GetFunctionName(), "a(int)");
+
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited)
+
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=334921&r1=334920&r2=334921&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sun Jun 17 21:34:33 
2018
@@ -543,7 +543,7 @@ void CommandInterpreter::LoadCommandDict
   // sure to increase the size of this buffer.
   char buffer[1024];
   int num_printed =
-  snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o");
+  snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o 1");
   lldbassert(num_printed < 1024);
   UNUSED_IF_ASSERT_DISABLED(num_printed);
   success =


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


[Lldb-commits] [lldb] r335313 - Remove dead code

2018-06-21 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Jun 21 17:22:50 2018
New Revision: 335313

URL: http://llvm.org/viewvc/llvm-project?rev=335313&view=rev
Log:
Remove dead code

Our DWARF parsing code had a workaorund for Objective-C "self" not
being marked as artifial by the compiler. Clang has been doing this
since 2010, so let's just drop the workaround.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=335313&r1=335312&r2=335313&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Thu Jun 
21 17:22:50 2018
@@ -3486,51 +3486,29 @@ size_t DWARFASTParserClang::ParseChildPa
 }
 
 bool skip = false;
-if (skip_artificial) {
-  if (is_artificial) {
-// In order to determine if a C++ member function is "const" we
-// have to look at the const-ness of "this"... Ugly, but that
-if (arg_idx == 0) {
-  if (DeclKindIsCXXClass(containing_decl_ctx->getDeclKind())) {
-// Often times compilers omit the "this" name for the
-// specification DIEs, so we can't rely upon the name being in
-// the formal parameter DIE...
-if (name == NULL || ::strcmp(name, "this") == 0) {
-  Type *this_type =
-  die.ResolveTypeUID(DIERef(param_type_die_form));
-  if (this_type) {
-uint32_t encoding_mask = this_type->GetEncodingMask();
-if (encoding_mask & Type::eEncodingIsPointerUID) {
-  is_static = false;
+if (skip_artificial && is_artificial) {
+  // In order to determine if a C++ member function is "const" we
+  // have to look at the const-ness of "this"...
+  if (arg_idx == 0 &&
+  DeclKindIsCXXClass(containing_decl_ctx->getDeclKind()) &&
+  // Often times compilers omit the "this" name for the
+  // specification DIEs, so we can't rely upon the name being in
+  // the formal parameter DIE...
+  (name == NULL || ::strcmp(name, "this") == 0)) {
+Type *this_type = die.ResolveTypeUID(DIERef(param_type_die_form));
+if (this_type) {
+  uint32_t encoding_mask = this_type->GetEncodingMask();
+  if (encoding_mask & Type::eEncodingIsPointerUID) {
+is_static = false;
 
-  if (encoding_mask & (1u << Type::eEncodingIsConstUID))
-type_quals |= clang::Qualifiers::Const;
-  if (encoding_mask & (1u << Type::eEncodingIsVolatileUID))
-type_quals |= clang::Qualifiers::Volatile;
-}
-  }
-}
-  }
-}
-skip = true;
-  } else {
-
-// HACK: Objective-C formal parameters "self" and "_cmd"
-// are not marked as artificial in the DWARF...
-CompileUnit *comp_unit = die.GetLLDBCompileUnit();
-if (comp_unit) {
-  switch (comp_unit->GetLanguage()) {
-  case eLanguageTypeObjC:
-  case eLanguageTypeObjC_plus_plus:
-if (name && name[0] &&
-(strcmp(name, "self") == 0 || strcmp(name, "_cmd") == 0))
-  skip = true;
-break;
-  default:
-break;
+if (encoding_mask & (1u << Type::eEncodingIsConstUID))
+  type_quals |= clang::Qualifiers::Const;
+if (encoding_mask & (1u << Type::eEncodingIsVolatileUID))
+  type_quals |= clang::Qualifiers::Volatile;
   }
 }
   }
+  skip = true;
 }
 
 if (!skip) {


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


[Lldb-commits] [lldb] r337029 - Fix TestAttachDenied on macOS Mojave

2018-07-13 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Jul 13 10:45:43 2018
New Revision: 337029

URL: http://llvm.org/viewvc/llvm-project?rev=337029&view=rev
Log:
Fix TestAttachDenied on macOS Mojave

TestAttachDenied tries to attach to a process that is ptracing itself and
verifies that we error out. Starting with macOS Mojave, processes need
an entitlement to be able to ptrace. This commit adds the entitlement for
the test binary when building on Darwin.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile?rev=337029&r1=337028&r2=337029&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
 Fri Jul 13 10:45:43 2018
@@ -4,4 +4,11 @@ CXX_SOURCES := main.cpp
 
 EXE := AttachDenied
 
+all: AttachDenied sign
+
 include $(LEVEL)/Makefile.rules
+
+sign: entitlements.plist AttachDenied
+ifeq ($(OS),Darwin)
+   codesign -s - -f --entitlements $^
+endif

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist?rev=337029&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
 Fri Jul 13 10:45:43 2018
@@ -0,0 +1,8 @@
+
+http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+
+
+com.apple.security.cs.debugger
+
+
+


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


[Lldb-commits] [lldb] r340676 - Disable exceptions for TestDataFormatterLibcxxOptional.py

2018-08-24 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Aug 24 18:25:24 2018
New Revision: 340676

URL: http://llvm.org/viewvc/llvm-project?rev=340676&view=rev
Log:
Disable exceptions for TestDataFormatterLibcxxOptional.py
On macOS, some of the  APIs used by the test are available only
starting on macOS 10.14 when using exceptions. Build the test with
-fno-exceptions so that the test builds on older systems too.

rdar://problem/43700544

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile?rev=340676&r1=340675&r2=340676&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
 Fri Aug 24 18:25:24 2018
@@ -4,4 +4,4 @@ CXX_SOURCES := main.cpp
 
 USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-CXXFLAGS += -std=c++17
+CXXFLAGS += -std=c++17 -fno-exceptions


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


[Lldb-commits] [lldb] r340880 - Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield accesses.

2018-08-28 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Aug 28 15:50:01 2018
New Revision: 340880

URL: http://llvm.org/viewvc/llvm-project?rev=340880&view=rev
Log:
Allow IRInterpreter to deal with non-power-of-2 sized types to support some 
bitfield accesses.

Summary:
For some bitfield patterns (like the one added by this commit), Clang will
generate non-regular data types like i24 or i48. This patch follows a
pretty naive approach of just bumping the type size to the next power of 2.
DataExtractor know how to deal with weird sizes. The operations on Scalar
do not know how to deal with those types though, so we have to legalize the
size when creating a Scalar.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py?rev=340880&r1=340879&r2=340880&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py 
Tue Aug 28 15:50:01 2018
@@ -116,6 +116,38 @@ class BitfieldsTestCase(TestBase):
 self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
 substrs=['uint32_t', "7112233"])
 
+for bit in range(1,18):
+expected = "1" if bit in [1, 5, 7, 13] else "0"
+self.expect("expr even_more_bits.b" + str(bit), 
VARIABLES_DISPLAYED_CORRECTLY,
+substrs=['uint8_t', expected])
+
+for bit in [3, 10, 14]:
+self.expect("expr even_more_bits.b" + str(bit) + " = 1", 
VARIABLES_DISPLAYED_CORRECTLY,
+substrs=['uint8_t', "1"])
+
+self.expect(
+"frame variable --show-types even_more_bits",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+'(uint8_t:1) b1 = \'\\x01\'',
+'(uint8_t:1) b2 = \'\\0\'',
+'(uint8_t:1) b3 = \'\\x01\'',
+'(uint8_t:1) b4 = \'\\0\'',
+'(uint8_t:1) b5 = \'\\x01\'',
+'(uint8_t:1) b6 = \'\\0\'',
+'(uint8_t:1) b7 = \'\\x01\'',
+'(uint8_t:1) b8 = \'\\0\'',
+'(uint8_t:1) b9 = \'\\0\'',
+'(uint8_t:1) b10 = \'\\x01\'',
+'(uint8_t:1) b12 = \'\\0\'',
+'(uint8_t:1) b13 = \'\\x01\'',
+'(uint8_t:1) b14 = \'\\x01\'',
+'(uint8_t:1) b15 = \'\\0\'',
+'(uint8_t:1) b16 = \'\\0\'',
+'(uint8_t:1) b17 = \'\\0\'',
+])
+
+
 @add_test_categories(['pyapi'])
 # BitFields exhibit crashes in record layout on Windows
 # (http://llvm.org/pr21800)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/main.c?rev=340880&r1=340879&r2=340880&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/main.c (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/main.c Tue Aug 
28 15:50:01 2018
@@ -8,6 +8,7 @@
 
//===--===//
 #include 
 #include 
+#include 
 
 int main (int argc, char const *argv[])
 {
@@ -63,6 +64,20 @@ int main (int argc, char const *argv[])
 more_bits.c = 1;
 more_bits.d = 0;
 
+struct EvenMoreBits
+{
+uint8_t b1  : 1, b2  : 1, b3  : 1, b4  : 1, b5  : 1, b6  : 1,
+b7  : 1, b8  : 1, b9  : 1, b10 : 1, b11 : 1, b12 : 1,
+b13 : 1, b14 : 1, b15 : 1, b16 : 1, b17 : 1;
+};
+
+struct EvenMoreBits even_more_bits;
+memset(&even_more_bits, 0, sizeof(even_more_bits));
+even_more_bits.b1 = 1;
+even_more_bits.b5 = 1;
+even_more_bits.b7 = 1;
+even_more_bits.b13 = 1;
+
 #pragma pack(1)
 struct PackedBits
 {

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=340880&r1=340879&r2=340880&view=diff
==
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Aug 28 15:50:01 2018
@@ -152,17 +152,13 @@ public:
  Type *type) {
 size_t type_size = m_target_data.getTypeStoreSize(type);
 
-switch (type_size) {
-case 1:
-cas

[Lldb-commits] [lldb] r341006 - Provide a default implementation of TypeSystem::GetNumTemplateArguments

2018-08-29 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Aug 29 17:37:23 2018
New Revision: 341006

URL: http://llvm.org/viewvc/llvm-project?rev=341006&view=rev
Log:
Provide a default implementation of TypeSystem::GetNumTemplateArguments

... and remove the dummy implementations from the languages that do not
support it.

Modified:
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/JavaASTContext.h
lldb/trunk/include/lldb/Symbol/OCamlASTContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Symbol/JavaASTContext.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/GoASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/GoASTContext.h?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/include/lldb/Symbol/GoASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/GoASTContext.h Wed Aug 29 17:37:23 2018
@@ -310,10 +310,6 @@ public:
 const char *name, bool omit_empty_base_classes,
 std::vector &child_indexes) override;
 
-  size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override {
-return 0;
-  }
-
   //--
   // Dumping types
   //--

Modified: lldb/trunk/include/lldb/Symbol/JavaASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/JavaASTContext.h?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/include/lldb/Symbol/JavaASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/JavaASTContext.h Wed Aug 29 17:37:23 2018
@@ -201,8 +201,6 @@ public:
 
   unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
 
-  size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
-
   int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
 
   CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t 
type,

Modified: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/OCamlASTContext.h?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/OCamlASTContext.h Wed Aug 29 17:37:23 2018
@@ -227,10 +227,6 @@ public:
 const char *name, bool omit_empty_base_classes,
 std::vector &child_indexes) override;
 
-  size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override {
-return 0;
-  }
-
   void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
  Stream *s, lldb::Format format, const DataExtractor &data,
  lldb::offset_t data_offset, size_t data_byte_size,

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Wed Aug 29 17:37:23 2018
@@ -347,7 +347,7 @@ public:
 const char *name, bool omit_empty_base_classes,
 std::vector &child_indexes) = 0;
 
-  virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) = 
0;
+  virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type);
 
   virtual lldb::TemplateArgumentKind
   GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx);

Modified: lldb/trunk/source/Symbol/JavaASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/JavaASTContext.cpp?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/source/Symbol/JavaASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/JavaASTContext.cpp Wed Aug 29 17:37:23 2018
@@ -878,11 +878,6 @@ JavaASTContext::ConvertStringToFloatValu
   return 0;
 }
 
-size_t
-JavaASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) {
-  return 0;
-}
-
 uint32_t JavaASTContext::GetNumFields(lldb::opaque_compiler_type_t type) {
   if (JavaObjectType *obj =
   llvm::dyn_cast(static_cast(type))) {

Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=341006&r1=341005&r2=341006&view=diff
==
--- lldb/trunk/source/Symbol/Type

[Lldb-commits] [lldb] r341233 - Fix a comment to use the correct variable name.

2018-08-31 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Aug 31 11:14:53 2018
New Revision: 341233

URL: http://llvm.org/viewvc/llvm-project?rev=341233&view=rev
Log:
Fix a comment to use the correct variable name.

Modified:
lldb/trunk/include/lldb/API/SBProcess.h

Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=341233&r1=341232&r2=341233&view=diff
==
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Fri Aug 31 11:14:53 2018
@@ -320,9 +320,9 @@ public:
   ///
   /// @param[in] image_spec
   /// The name of the shared library that you want to load.  
-  /// If local_spec is a relative path, the relative path will be
+  /// If image_spec is a relative path, the relative path will be
   /// appended to the search paths.
-  /// If the local_spec is an absolute path, just the basename is used.
+  /// If the image_spec is an absolute path, just the basename is used.
   ///
   /// @param[in] paths
   /// A list of paths to search for the library whose basename is 


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


[Lldb-commits] [lldb] r341268 - File completion bugfix

2018-08-31 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Aug 31 16:03:28 2018
New Revision: 341268

URL: http://llvm.org/viewvc/llvm-project?rev=341268&view=rev
Log:
File completion bugfix

If you tried to complete somwthing like ~/., lldb would come up with a lot
of non-existent filenames by concatenating every exisitng file in the directory
with an initial '.'.

This was due to a workaround for an llvm::fs::path::filename behavior that
was not applied selectively enough.

Modified:
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/unittests/Interpreter/TestCompletion.cpp

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=341268&r1=341267&r2=341268&view=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Fri Aug 31 16:03:28 2018
@@ -166,7 +166,11 @@ static int DiskFilesOrDirectories(const
   size_t FullPrefixLen = CompletionBuffer.size();
 
   PartialItem = path::filename(CompletionBuffer);
-  if (PartialItem == ".")
+
+  // path::filename() will return "." when the passed path ends with a
+  // directory separator. We have to filter those out, but only when the
+  // "." doesn't come from the completion request itself.
+  if (PartialItem == "." && path::is_separator(CompletionBuffer.back()))
 PartialItem = llvm::StringRef();
 
   if (SearchDir.empty()) {

Modified: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/TestCompletion.cpp?rev=341268&r1=341267&r2=341268&view=diff
==
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp (original)
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp Fri Aug 31 16:03:28 2018
@@ -174,6 +174,11 @@ TEST_F(CompletionTest, DirCompletionAbso
   ASSERT_EQ(Count, Results.GetSize());
   EXPECT_TRUE(HasEquivalentFile(BaseDir, Results));
 
+  Count =
+CommandCompletions::DiskDirectories(Twine(BaseDir) + "/.", Results, 
Resolver);
+  ASSERT_EQ(0u, Count);
+  ASSERT_EQ(Count, Results.GetSize());
+
   // When the same directory ends with a slash, it finds all children.
   Count = CommandCompletions::DiskDirectories(Prefixes[0], Results, Resolver);
   ASSERT_EQ(7u, Count);


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


[Lldb-commits] [lldb] r341425 - Change TestCompletion to only ever look inside of BaseDir

2018-09-04 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Sep  4 16:09:49 2018
New Revision: 341425

URL: http://llvm.org/viewvc/llvm-project?rev=341425&view=rev
Log:
Change TestCompletion to only ever look inside of BaseDir

TestCompletion was failing quite frequently on our Linux bots. Some tracing
revealed that when we are iterating BaseDir we are not getting all the entries.
More specifically, we are sometimes missing the entry corresponding to the
TestCompletion directory that the first test in DirCompletionAbsolute is
looking for. BaseDir is the directory where lit is creating all the temporary
files. The semantics of opendir/readdir are unclear when it comes to iterating
over a directory that changes contents, but it seems like on Linux you might
fail to list an entry even if it was there before opendir and is still present
throughout the iteration. Changing the test to only look inside of the test-
specific directory seems to fix the instability.

This commit also removes some assertions that were added to try to track down
this issue.

Modified:
lldb/trunk/unittests/Interpreter/TestCompletion.cpp

Modified: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/TestCompletion.cpp?rev=341425&r1=341424&r2=341425&view=diff
==
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp (original)
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp Tue Sep  4 16:09:49 2018
@@ -164,15 +164,11 @@ TEST_F(CompletionTest, DirCompletionAbso
   // When a directory is specified that doesn't end in a slash, it searches
   // for that directory, not items under it.
   // Sanity check that the path we complete on exists and isn't too long.
-  ASSERT_TRUE(llvm::sys::fs::exists(BaseDir));
-#ifdef PATH_MAX
-  ASSERT_LE(BaseDir.size(), static_cast(PATH_MAX));
-#endif
-  size_t Count =
-  CommandCompletions::DiskDirectories(BaseDir, Results, Resolver);
+  size_t Count = CommandCompletions::DiskDirectories(Twine(BaseDir) + "/fooa",
+ Results, Resolver);
   ASSERT_EQ(1u, Count);
   ASSERT_EQ(Count, Results.GetSize());
-  EXPECT_TRUE(HasEquivalentFile(BaseDir, Results));
+  EXPECT_TRUE(HasEquivalentFile(DirFooA, Results));
 
   Count =
 CommandCompletions::DiskDirectories(Twine(BaseDir) + "/.", Results, 
Resolver);


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


[Lldb-commits] [lldb] r325666 - Fix TestAppleTypesIsProduced after r324226

2018-02-20 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Feb 20 22:20:03 2018
New Revision: 325666

URL: http://llvm.org/viewvc/llvm-project?rev=325666&view=rev
Log:
Fix TestAppleTypesIsProduced after r324226

This test was accessing self.debug_info, which doesn't exist anymore. For
some reason the macOS bots are skipping this test because they think the
compiler is not clang. We'll look into this separately.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py?rev=325666&r1=325665&r2=325666&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
 Tue Feb 20 22:20:03 2018
@@ -27,7 +27,7 @@ class AppleTypesTestCase(TestBase):
 self.skipTest("clang compiler only test")
 
 self.build()
-if self.debug_info == "dsym":
+if self.getDebugInfo() == "dsym":
 exe = self.getBuildArtifact(
"a.out.dSYM/Contents/Resources/DWARF/a.out")
 else:


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


[Lldb-commits] [lldb] r325858 - Fix TestMultithreaded when specifying an alternative debugserver.

2018-02-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Feb 22 21:03:09 2018
New Revision: 325858

URL: http://llvm.org/viewvc/llvm-project?rev=325858&view=rev
Log:
Fix TestMultithreaded when specifying an alternative debugserver.

Summary:
This test launches a helper that uses the debugserver. The environment
variable sepcifying the debug server wasn't passed to this helper, thus
it was using the default one.

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py?rev=325858&r1=325857&r2=325858&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
 Thu Feb 22 21:03:09 2018
@@ -101,6 +101,8 @@ class SBBreakpointCallbackCase(TestBase)
 exe = [test_exe, self.getBuildArtifact(self.inferior)]
 
 env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
+if os.environ['LLDB_DEBUGSERVER_PATH']:
+env['LLDB_DEBUGSERVER_PATH'] = os.environ['LLDB_DEBUGSERVER_PATH']
 if self.TraceOn():
 print("Running test %s" % " ".join(exe))
 check_call(exe, env=env)


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


[Lldb-commits] [lldb] r325859 - Fix TestUbsanBasic

2018-02-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Feb 22 21:03:10 2018
New Revision: 325859

URL: http://llvm.org/viewvc/llvm-project?rev=325859&view=rev
Log:
Fix TestUbsanBasic

Summary:
Potentially due to the recent testuite refactorings, this test now reports
a full absolute path but expect just the filename. For some reason this
test is skipped on GreenDragon so we've never seen the issue.

Reviewers: vsk

Subscribers: kubamracek, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py?rev=325859&r1=325858&r2=325859&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py
 Thu Feb 22 21:03:10 2018
@@ -84,7 +84,7 @@ class UbsanBasicTestCase(TestBase):
 
 self.assertEqual(data["instrumentation_class"], 
"UndefinedBehaviorSanitizer")
 self.assertEqual(data["description"], "misaligned-pointer-use")
-self.assertEqual(data["filename"], "main.c")
+self.assertEqual(os.path.basename(data["filename"]), "main.c")
 self.assertEqual(data["line"], self.line_align)
 
 self.runCmd("continue")


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


[Lldb-commits] [lldb] r325862 - Fix TestMultithreaded when there's no debugserver specified

2018-02-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Feb 22 21:29:27 2018
New Revision: 325862

URL: http://llvm.org/viewvc/llvm-project?rev=325862&view=rev
Log:
Fix TestMultithreaded when there's no debugserver specified

r325858 was bogus and would error out with a KeyError when --server
was not passed to dotest.py.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py?rev=325862&r1=325861&r2=325862&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
 Thu Feb 22 21:29:27 2018
@@ -101,7 +101,7 @@ class SBBreakpointCallbackCase(TestBase)
 exe = [test_exe, self.getBuildArtifact(self.inferior)]
 
 env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
-if os.environ['LLDB_DEBUGSERVER_PATH']:
+if 'LLDB_DEBUGSERVER_PATH' in os.environ:
 env['LLDB_DEBUGSERVER_PATH'] = os.environ['LLDB_DEBUGSERVER_PATH']
 if self.TraceOn():
 print("Running test %s" % " ".join(exe))


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


[Lldb-commits] [lldb] r327750 - [DWARFASTParserClang] Complete external record types before using them as a decl context.

2018-03-16 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar 16 15:12:22 2018
New Revision: 327750

URL: http://llvm.org/viewvc/llvm-project?rev=327750&view=rev
Log:
[DWARFASTParserClang] Complete external record types before using them as a 
decl context.

Summary:
When in a gmodules-like debugging scenario, you can have a parent decl context
that gets imported from an external AST. When this happens, we must be careful
to complete this type before adding children to it, otherwise it sometimes
results in a crash.

Reviewers: clayborg, jingham

Subscribers: aprantl, JDevlieghere, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/pch.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py?rev=327750&r1=327749&r2=327750&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
 Fri Mar 16 15:12:22 2018
@@ -69,3 +69,26 @@ class TestWithGmodulesDebugInfo(TestBase
 42,
 memberValue.GetValueAsSigned(),
 "Member value incorrect")
+
+testValue = frame.EvaluateExpression("bar")
+self.assertTrue(
+testValue.GetError().Success(),
+"Test expression value invalid: %s" %
+(testValue.GetError().GetCString()))
+self.assertTrue(
+testValue.GetTypeName() == "Foo::Bar",
+"Test expression type incorrect")
+
+memberValue = testValue.GetChildMemberWithName("i")
+self.assertTrue(
+memberValue.GetError().Success(),
+"Member value missing or invalid: %s" %
+(testValue.GetError().GetCString()))
+self.assertTrue(
+memberValue.GetTypeName() == "int",
+"Member type incorrect")
+self.assertEqual(
+123,
+memberValue.GetValueAsSigned(),
+"Member value incorrect")
+

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/main.cpp?rev=327750&r1=327749&r2=327750&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/main.cpp Fri 
Mar 16 15:12:22 2018
@@ -1,5 +1,8 @@
+class Foo::Bar { int i = 123; };
+
 int main(int argc, const char * argv[])
 {
 IntContainer test(42);
+Foo::Bar bar;
 return 0; // break here
 }

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/pch.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/pch.h?rev=327750&r1=327749&r2=327750&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/pch.h (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/pch.h Fri Mar 
16 15:12:22 2018
@@ -10,3 +10,8 @@ class GenericContainer {
 };
 
 typedef GenericContainer IntContainer;
+
+struct Foo {
+  class Bar;
+  Bar *bar;
+};

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=327750&r1=327749&r2=327750&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Mar 
16 15:12:22 2018
@@ -205,6 +205,33 @@ TypeSP DWARFASTParserClang::ParseTypeFro
   return type_sp;
 }
 
+static void CompleteExternalTagDeclType(ClangASTImporter &ast_importer,
+clang::DeclContext *decl_ctx,
+DWARFDIE die,
+const char *type_name_cstr) {
+  auto *tag_decl_ctx = clang::dyn_cast(decl_ctx);
+  if (!tag_decl_ctx)
+return;
+
+  // If this type was not imported from an external AST, there's
+  // nothing to do.
+  CompilerType type = ClangASTContext::GetTypeForDecl(tag_decl_ctx);
+  if (!type || !ast_importer.CanImport(type))
+return;
+
+  auto qual_type = ClangUtil::GetQualType(type);
+  if

[Lldb-commits] [lldb] r327753 - Fix the Windows build after r327750

2018-03-16 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar 16 15:19:58 2018
New Revision: 327753

URL: http://llvm.org/viewvc/llvm-project?rev=327753&view=rev
Log:
Fix the Windows build after r327750

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=327753&r1=327752&r2=327753&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Mar 
16 15:19:58 2018
@@ -224,7 +224,7 @@ static void CompleteExternalTagDeclType(
 die.GetDWARF()->GetObjectFile()->GetModule()->ReportError(
 "Unable to complete the Decl context for DIE '%s' at offset "
 "0x%8.8x.\nPlease file a bug report.",
-type_name_cstr ?: "", die.GetOffset());
+type_name_cstr ? type_name_cstr : "", die.GetOffset());
 // We need to make the type look complete otherwise, we
 // might crash in Clang when adding children.
 if (ClangASTContext::StartTagDeclarationDefinition(type))


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


[Lldb-commits] [lldb] r328761 - Prevent double release of mach ports

2018-03-28 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Mar 28 20:49:41 2018
New Revision: 328761

URL: http://llvm.org/viewvc/llvm-project?rev=328761&view=rev
Log:
Prevent double release of mach ports

Summary:
When a MIG routine returns KERN_FAILURE, the demux function will release any 
OOL resources like ports. In this case, task_port and thread_port will be 
released twice, potentially resulting in use after free of the ports.

I don't think we can test this in any useful way
rdar://problem/37331387

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp

Modified: lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp?rev=328761&r1=328760&r2=328761&view=diff
==
--- lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp Wed Mar 28 
20:49:41 2018
@@ -92,8 +92,6 @@ extern "C" kern_return_t catch_mach_exce
 (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
 (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
   }
-  mach_port_deallocate(mach_task_self(), task_port);
-  mach_port_deallocate(mach_task_self(), thread_port);
 
   return KERN_FAILURE;
 }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp?rev=328761&r1=328760&r2=328761&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp Wed Mar 28 
20:49:41 2018
@@ -86,8 +86,6 @@ extern "C" kern_return_t catch_mach_exce
(uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
(uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
   }
-  mach_port_deallocate(mach_task_self(), task_port);
-  mach_port_deallocate(mach_task_self(), thread_port);
 
   return KERN_FAILURE;
 }


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


[Lldb-commits] [lldb] r328984 - Support template template parameters

2018-04-02 Thread Frederic Riss via lldb-commits
Author: friss
Date: Mon Apr  2 09:18:32 2018
New Revision: 328984

URL: http://llvm.org/viewvc/llvm-project?rev=328984&view=rev
Log:
Support template template parameters

Summary:
We would fail to resolve (and thus display the value of) any
templated type which contained a template template argument even
though we don't really use template arguments.

This patch adds minimal support for template template arguments,
but I doubt we need any more than that.

Reviewers: clayborg, jingham

Subscribers: JDevlieghere, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/main.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=328984&r1=328983&r2=328984&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Apr  2 09:18:32 2018
@@ -305,6 +305,9 @@ public:
   lldb::AccessType access_type, const char *class_name,
   int kind, const TemplateParameterInfos &infos);
 
+  clang::TemplateTemplateParmDecl *
+  CreateTemplateTemplateParmDecl(const char *template_name);
+
   clang::ClassTemplateSpecializationDecl 
*CreateClassTemplateSpecializationDecl(
   clang::DeclContext *decl_ctx,
   clang::ClassTemplateDecl *class_template_decl, int kind,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py?rev=328984&r1=328983&r2=328984&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py 
Mon Apr  2 09:18:32 2018
@@ -83,6 +83,34 @@ class TemplateArgsTestCase(TestBase):
 expr_result.GetType().GetName() == "int",
 'expr_result.GetType().GetName() == "int"')
 
+def test_template_template_args(self):
+frame = self.prepareProcess()
+
+c1 = frame.FindVariable('c1')
+self.assertTrue(
+c1.IsValid(),
+'make sure we find a local variabble named "c1"')
+self.assertTrue(c1.GetType().GetName() == 'C')
+f1 = 
c1.GetChildMemberWithName("V").GetChildAtIndex(0).GetChildMemberWithName("f")
+self.assertTrue(f1.GetType().GetName() == 'float')
+self.assertTrue(f1.GetValue() == '1.5')
+
+c2 = frame.FindVariable('c2')
+self.assertTrue(
+c2.IsValid(),
+'make sure we find a local variabble named "c2"')
+self.assertTrue(c2.GetType().GetName() == 'C')
+f2 = 
c2.GetChildMemberWithName("V").GetChildAtIndex(0).GetChildMemberWithName("f")
+self.assertTrue(f2.GetType().GetName() == 'double')
+self.assertTrue(f2.GetValue() == '1.5')
+f3 = 
c2.GetChildMemberWithName("V").GetChildAtIndex(1).GetChildMemberWithName("f")
+self.assertTrue(f3.GetType().GetName() == 'double')
+self.assertTrue(f3.GetValue() == '2.5')
+f4 = 
c2.GetChildMemberWithName("V").GetChildAtIndex(1).GetChildMemberWithName("i")
+self.assertTrue(f4.GetType().GetName() == 'int')
+self.assertTrue(f4.GetValue() == '42')
+
+
 # Gcc does not generate the necessary DWARF attribute for enum template
 # parameters.
 @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc")

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/main.cpp?rev=328984&r1=328983&r2=328984&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/main.cpp Mon 
Apr  2 09:18:32 2018
@@ -6,6 +6,7 @@
 // License. See LICENSE.TXT for details.
 //
 
//===--===//
+#include 
 
 template 
 class TestObj
@@ -62,11 +63,17 @@ public:
 }
 };
 
+template  struct T1 { FLOAT f = 1.5; };
+template  struct T2 { FLOAT f = 2.5; int i = 42; };
+template  class ...Args> class C { 
std::tuple...> V; };
+
 int main(int argc, char **argv)
 {
   TestObj<1> testpos;
   TestObj<-1> testneg;
   EnumTemplate member(123

[Lldb-commits] [lldb] r329374 - [debugserver] Fix LC_BUILD_VERSION load command handling.

2018-04-05 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Apr  5 21:28:12 2018
New Revision: 329374

URL: http://llvm.org/viewvc/llvm-project?rev=329374&view=rev
Log:
[debugserver] Fix LC_BUILD_VERSION load command handling.

Summary:
In one of the 2 places the LC_BUILD_VERSION load command is handled, there
is a bug preventing us from actually handling them (the address where to
read the load command was not updated). This patch factors reading the
deployment target load commands into a helper and adds testing for the 2
code paths calling the helper.

The testing is a little bit complicated because the only times those load
commands matter is when debugging a simulator process. I added a new
decorator to check that a specific SDK is available. The actual testing was
fairly easy once I knew how to run a simulated process.

Reviewers: jasonmolenda, labath

Subscribers: lldb-commits

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/decorators.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=329374&r1=329373&r2=329374&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Apr  5 21:28:12 
2018
@@ -344,6 +344,28 @@ def no_debug_info_test(func):
 wrapper.__no_debug_info_test__ = True
 return wrapper
 
+def apple_simulator_test(platform):
+"""
+Decorate the test as a test requiring a simulator for a specific platform.
+
+Consider that a simulator is available if you have the corresponding SDK 
installed.
+The SDK identifiers for simulators are iphonesimulator, appletvsimulator, 
watchsimulator
+"""
+def should_skip_simulator_test():
+if lldbplatformutil.getHostPlatform() != 'darwin':
+return "simulator tests are run only on darwin hosts"
+try:
+DEVNULL = open(os.devnull, 'w')
+output = subprocess.check_output(["xcodebuild", "-showsdks"], 
stderr=DEVNULL)
+if re.search('%ssimulator' % platform, output):
+return None
+else:
+return "%s simulator is not supported on this system." % 
platform
+except subprocess.CalledProcessError:
+return "%s is not supported on this system (xcodebuild failed)." % 
feature
+
+return skipTestIfFn(should_skip_simulator_test)
+
 
 def debugserver_test(func):
 """Decorate the item as a debugserver test."""

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=329374&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Thu Apr  5 21:28:12 2018
@@ -0,0 +1,112 @@
+from __future__ import print_function
+
+
+import gdbremote_testcase
+import lldbgdbserverutils
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+import json
+
+class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def check_simulator_ostype(self, sdk, platform_names, arch='x86_64'):
+sim_devices_str = subprocess.check_output(['xcrun', 'simctl', 'list',
+   '-j', 'devices'])
+sim_devices = json.loads(sim_devices_str)['devices']
+# Find an available simulator for the requested platform
+deviceUDID = None
+for (runtime,devices) in sim_devices.items():
+if not any(p in runtime.lower() for p in platform_names):
+continue
+for device in devices:
+if device['availability'] != '(available)':
+continue
+deviceUDID = device['udid']
+break
+if deviceUDID != None:
+break
+
+# Launch the process using simctl
+self.assertIsNotNone(deviceUDID)
+exe_name = 'test_simulator_platform_{}'.format(platform_names[0])
+sdkroot = subprocess.che

[Lldb-commits] [lldb] r330877 - [debugserver] Return 'ios' instead of 'iphoneos' for the ostype.

2018-04-25 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Apr 25 15:12:12 2018
New Revision: 330877

URL: http://llvm.org/viewvc/llvm-project?rev=330877&view=rev
Log:
[debugserver] Return 'ios' instead of 'iphoneos' for the ostype.

When I merged the 2 codepaths that return an OS type, I hade
checked that the places accepting 'iphoneos' would also accept
'ios', but then I got it backwards and return 'iphoneos'.

We use this value to build triples, and there 'iphoneos' is
invalid.

This also makes the test slightly simpler.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=330877&r1=330876&r2=330877&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Wed Apr 25 15:12:12 2018
@@ -13,14 +13,14 @@ class TestAppleSimulatorOSType(gdbremote
 
 mydir = TestBase.compute_mydir(__file__)
 
-def check_simulator_ostype(self, sdk, platform_names, arch='x86_64'):
+def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
 sim_devices_str = subprocess.check_output(['xcrun', 'simctl', 'list',
'-j', 'devices'])
 sim_devices = json.loads(sim_devices_str)['devices']
 # Find an available simulator for the requested platform
 deviceUDID = None
 for (runtime,devices) in sim_devices.items():
-if not any(p in runtime.lower() for p in platform_names):
+if not platform in runtime.lower():
 continue
 for device in devices:
 if device['availability'] != '(available)':
@@ -32,7 +32,7 @@ class TestAppleSimulatorOSType(gdbremote
 
 # Launch the process using simctl
 self.assertIsNotNone(deviceUDID)
-exe_name = 'test_simulator_platform_{}'.format(platform_names[0])
+exe_name = 'test_simulator_platform_{}'.format(platform)
 sdkroot = subprocess.check_output(['xcrun', '--show-sdk-path', '--sdk',
sdk])
 self.build(dictionary={ 'EXE': exe_name, 'SDKROOT': sdkroot.strip(),
@@ -75,7 +75,7 @@ class TestAppleSimulatorOSType(gdbremote
 self.assertIsNotNone(process_info)
 
 # Check that ostype is correct
-self.assertTrue(process_info['ostype'] in platform_names)
+self.assertEquals(process_info['ostype'], platform)
 
 # Now for dylibs
 dylib_info_raw = context.get("dylib_info_raw")
@@ -90,23 +90,23 @@ class TestAppleSimulatorOSType(gdbremote
 break
 
 self.assertIsNotNone(image_info)
-self.assertTrue(image['min_version_os_name'] in platform_names)
+self.assertEquals(image['min_version_os_name'], platform)
 
 
 @apple_simulator_test('iphone')
 @debugserver_test
 def test_simulator_ostype_ios(self):
 self.check_simulator_ostype(sdk='iphonesimulator',
-platform_names=['iphoneos', 'ios'])
+platform='ios')
 
 @apple_simulator_test('appletv')
 @debugserver_test
 def test_simulator_ostype_tvos(self):
 self.check_simulator_ostype(sdk='appletvsimulator',
-platform_names=['tvos'])
+platform='tvos')
 
 @apple_simulator_test('watch')
 @debugserver_test
 def test_simulator_ostype_watchos(self):
 self.check_simulator_ostype(sdk='watchsimulator',
-platform_names=['watchos'], arch='i386')
+platform='watchos', arch='i386')

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=330877&r1=330876&r2=330877&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Wed Apr 25 
15:12:12 2018
@@ -595,7 +595,7 @@ const char *MachProcess::GetDeploymentIn
 
 switch (cmd) {
 case LC_VERSION_MIN_IPHONEOS:
-  return "iphoneos";
+  return "ios";
 case LC_VERSION_MIN_MACOSX:
   return "macosx";
 case LC_VERSION_MIN_TVOS:
@@ -621,7 +621,7 @@ const char *MachProcess::GetDeploymentIn
 case PLATFORM_MACOS:
   return "macosx";
 case PLATFORM_IOS:
-  return "iphoneos";
+  return "ios";
 case PLATFO

[Lldb-commits] [lldb] r331004 - [debugserver] Fix handling of the 'g' packet

2018-04-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Apr 26 17:09:04 2018
New Revision: 331004

URL: http://llvm.org/viewvc/llvm-project?rev=331004&view=rev
Log:
[debugserver] Fix handling of the 'g' packet

LLDB doesn't use this packet so we never hit this, but it looks like
some other projects talk to debugserver and are hitting an assert
(https://github.com/derekparker/delve/issues/1015).

We had an off by 1 in the accounting of the FPU structure sizes.
I added a test that basically just check that 'g' doesn't return
an error (currently it assert in debug builds). I didn't make
it an lldb-server test because it looks like lldb-server doesn't
implement the g packet.

Added:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py?rev=331004&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 Thu Apr 26 17:09:04 2018
@@ -0,0 +1,30 @@
+from __future__ import print_function
+
+
+import gdbremote_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def run_test_g_packet(self):
+self.build()
+self.prep_debug_monitor_and_inferior()
+self.test_sequence.add_log_lines(
+["read packet: $g#67",
+ {"direction": "send", "regex": r"^\$(.+)#[0-9a-fA-F]{2}$",
+  "capture": {1: "register_bank"}}],
+True)
+self.connect_to_debug_monitor()
+context = self.expect_gdbremote_sequence()
+register_bank = context.get("register_bank")
+self.assertTrue(register_bank[0] != 'E')
+
+@debugserver_test
+def test_g_packet_debugserver(self):
+self.init_debugserver_test()
+self.run_test_g_packet()

Modified: 
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=331004&r1=331003&r2=331004&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp 
(original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Thu 
Apr 26 17:09:04 2018
@@ -2633,7 +2633,9 @@ nub_size_t DNBArchImplX86_64::GetRegiste
 
   // Walk around the gaps in the FPU regs
   memcpy(p, &m_state.context.fpu.no_avx.__fpu_fcw, 5);
-  p += 5;
+  // We read 5 bytes, but we skip 6 to account for __fpu_rsrv1
+  // to match the g_fpu_registers_* tables.
+  p += 6;
   memcpy(p, &m_state.context.fpu.no_avx.__fpu_fop, 8);
   p += 8;
   memcpy(p, &m_state.context.fpu.no_avx.__fpu_dp, 6);


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


[Lldb-commits] [lldb] r331043 - Mark test as @skipIfOutOfTreeDebugserver

2018-04-27 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 27 08:30:09 2018
New Revision: 331043

URL: http://llvm.org/viewvc/llvm-project?rev=331043&view=rev
Log:
Mark test as @skipIfOutOfTreeDebugserver

This test will currently fail for people using the system debugserver.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py?rev=331043&r1=331042&r2=331043&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 Fri Apr 27 08:30:09 2018
@@ -24,6 +24,7 @@ class TestGdbRemoteGPacket(gdbremote_tes
 register_bank = context.get("register_bank")
 self.assertTrue(register_bank[0] != 'E')
 
+@skipIfOutOfTreeDebugserver
 @debugserver_test
 def test_g_packet_debugserver(self):
 self.init_debugserver_test()


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


[Lldb-commits] [lldb] r331073 - [debugserver] Fix the G packet handling.

2018-04-27 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 27 12:59:42 2018
New Revision: 331073

URL: http://llvm.org/viewvc/llvm-project?rev=331073&view=rev
Log:
[debugserver] Fix the G packet handling.

Of course r331004 needed a counterpart on the write side.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py?rev=331073&r1=331072&r2=331073&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
 Fri Apr 27 12:59:42 2018
@@ -24,6 +24,15 @@ class TestGdbRemoteGPacket(gdbremote_tes
 register_bank = context.get("register_bank")
 self.assertTrue(register_bank[0] != 'E')
 
+self.test_sequence.add_log_lines(
+["read packet: $G" + register_bank + "#00",
+ {"direction": "send", "regex": r"^\$(.+)#[0-9a-fA-F]{2}$",
+  "capture": {1: "G_reply"}}],
+True)
+context = self.expect_gdbremote_sequence()
+self.assertTrue(context.get("G_reply")[0] != 'E')
+
+
 @skipIfOutOfTreeDebugserver
 @debugserver_test
 def test_g_packet_debugserver(self):

Modified: 
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=331073&r1=331072&r2=331073&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp 
(original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Fri 
Apr 27 12:59:42 2018
@@ -2717,7 +2717,9 @@ nub_size_t DNBArchImplX86_64::SetRegiste
 
 // Copy fcw through mxcsrmask as there is no padding
 memcpy(&m_state.context.fpu.no_avx.__fpu_fcw, p, 5);
-p += 5;
+// We wrote 5 bytes, but we skip 6 to account for __fpu_rsrv1
+// to match the g_fpu_registers_* tables.
+p += 6;
 memcpy(&m_state.context.fpu.no_avx.__fpu_fop, p, 8);
 p += 8;
 memcpy(&m_state.context.fpu.no_avx.__fpu_dp, p, 6);


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


[Lldb-commits] [lldb] r331719 - Really test type lookup in TestCppTypeLookup.py

2018-05-07 Thread Frederic Riss via lldb-commits
Author: friss
Date: Mon May  7 20:08:46 2018
New Revision: 331719

URL: http://llvm.org/viewvc/llvm-project?rev=331719&view=rev
Log:
Really test type lookup in TestCppTypeLookup.py

Summary:
... and fix one bug found this way. Currently, the test works not because
types are looked up correctly, but because by injecting local variables
we also materialize the types for Clang. If we disable the local variable
injection, then one check fails.

The reason of the failure is that FindTypes is run with max_matches==1
and this value is passed down to the symbol lookup functions. When the
search is performed only on the basename (like it's the case for an
entity defined in the root namespace), then the search will stop after
having found one match on the basename. But that match might be in a
namespace, we were really just looking up the basename in the accelerator
tables.

The solution is to not pass max_matches down, but to search without a
limit and let RemoveMismatchedTypes do its job afterwards. Note the
patch includes 2 hunks with the same change, but only the latter is
tested. I couldn't find a way to create a testcase for the other
branch of the if ('image lookup -t' allows me to get there, but it
only ever returns one type anyway).

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
lldb/trunk/source/Core/Module.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py?rev=331719&r1=331718&r2=331719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
 Mon May  7 20:08:46 2018
@@ -38,6 +38,11 @@ class TestCppTypeLookup(TestBase):
 # Get frame for current thread
 frame = thread.GetSelectedFrame()
 
+# We are testing LLDB's type lookup machinery, but if we inject local
+# variables, the types for those will be found because they have been
+# imported through the variable, not because the type lookup worked.
+self.runCmd("settings set target.experimental.inject-local-vars false")
+
 # Make sure we don't accidentally accept structures that exist only
 # in namespaces when evaluating expressions with top level types.
 # Prior to the revision that added this test, we would accidentally

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=331719&r1=331718&r2=331719&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon May  7 20:08:46 2018
@@ -997,6 +997,7 @@ size_t Module::FindTypes(
   const bool append = true;
   TypeClass type_class = eTypeClassAny;
   TypeMap typesmap;
+
   if (Type::GetTypeScopeAndBasename(type_name_cstr, type_scope, type_basename,
 type_class)) {
 // Check if "name" starts with "::" which means the qualified type starts
@@ -1019,12 +1020,12 @@ size_t Module::FindTypes(
   // The "type_name_cstr" will have been modified if we have a valid type
   // class prefix (like "struct", "class", "union", "typedef" etc).
   FindTypes_Impl(sc, ConstString(type_basename), nullptr, append,
- max_matches, searched_symbol_files, typesmap);
+ UINT_MAX, searched_symbol_files, typesmap);
   typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
  exact_match);
   num_matches = typesmap.GetSize();
 } else {
-  num_matches = FindTypes_Impl(sc, name, nullptr, append, max_matches,
+  num_matches = FindTypes_Impl(sc, name, nullptr, append, UINT_MAX,
searched_symbol_files, typesmap);
   if (exact_match) {
 std::string name_str(name.AsCString(""));


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


[Lldb-commits] [lldb] r354047 - [dotest] Fix compiler version number comparison

2019-02-14 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Feb 14 10:48:05 2019
New Revision: 354047

URL: http://llvm.org/viewvc/llvm-project?rev=354047&view=rev
Log:
[dotest] Fix compiler version number comparison

dotest's version comparision function is just a lexicographical compare
of the version strings. This is obviously wrong. This patch implements
the comparison using distutils.version.LooseVersion as suggested by
Zachary.

Reviewers: zturner, labath, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=354047&r1=354046&r2=354047&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Thu Feb 14 10:48:05 
2019
@@ -37,6 +37,7 @@ from __future__ import print_function
 # System modules
 import abc
 import collections
+from distutils.version import LooseVersion
 from functools import wraps
 import gc
 import glob
@@ -1352,13 +1353,13 @@ class Base(unittest2.TestCase):
 if (version is None):
 return True
 if (operator == '>'):
-return self.getCompilerVersion() > version
+return LooseVersion(self.getCompilerVersion()) > 
LooseVersion(version)
 if (operator == '>=' or operator == '=>'):
-return self.getCompilerVersion() >= version
+return LooseVersion(self.getCompilerVersion()) >= 
LooseVersion(version)
 if (operator == '<'):
-return self.getCompilerVersion() < version
+return LooseVersion(self.getCompilerVersion()) < 
LooseVersion(version)
 if (operator == '<=' or operator == '=<'):
-return self.getCompilerVersion() <= version
+return LooseVersion(self.getCompilerVersion()) <= 
LooseVersion(version)
 if (operator == '!=' or operator == '!' or operator == 'not'):
 return str(version) not in str(self.getCompilerVersion())
 return str(version) in str(self.getCompilerVersion())


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


[Lldb-commits] [lldb] r355555 - [debugserver] Fix IsUserReady thread filtering

2019-03-06 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Mar  6 13:56:14 2019
New Revision: 35

URL: http://llvm.org/viewvc/llvm-project?rev=35&view=rev
Log:
[debugserver] Fix IsUserReady thread filtering

Summary:
In 2010 (r118866), filtering code was added to debugserver to avoid reporting 
threads
that were "not ready to be displayed to the user". This code inspects the 
thread's
state and discards threads marked 'uninterruptible'. Turns out, this state is 
pretty
common and not only a characterisitic of 'user-readiness'. This filtering was 
tracked
down as the source of the flakiness of TestQueues and TestConcurrent* with the 
symptom
of missing threads.

We discussed with the kernel team and there should be no need for us to filter 
the
restult of task_threads(). Everything that is returned from there can be 
examined.
So I went on and tried to remove the filtering completely. This produces other 
test
failures, where we were reporting more theads than expected. Always threads 
that had
been terminated, but weren't removed from the task bookkeeping structures yet. 
Those
threads always had a PC of 0.

This patch changes the heuristic to make the filtering a little less strict and 
only
rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven 
to be
solid in my testing.

Reviewers: jasonmolenda, clayborg, jingham

Subscribers: jdoerfert, lldb-commits

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

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=35&r1=34&r2=35&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Wed Mar  6 
13:56:14 2019
@@ -243,7 +243,7 @@ bool MachThread::IsUserReady() {
   case TH_STATE_HALTED:
 return true;
   }
-  return false;
+  return GetPC(0) != 0;
 }
 
 struct thread_basic_info *MachThread::GetBasicInfo() {


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


[Lldb-commits] [lldb] r355644 - Fix TestAppleSimulatorOSType.py with Xcode 10.2

2019-03-07 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Mar  7 14:12:03 2019
New Revision: 355644

URL: http://llvm.org/viewvc/llvm-project?rev=355644&view=rev
Log:
Fix TestAppleSimulatorOSType.py with Xcode 10.2

It looks like the simctl tool shipped in Xcode10.2 changed the format of
its json output.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=355644&r1=355643&r2=355644&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Thu Mar  7 14:12:03 2019
@@ -29,7 +29,9 @@ class TestAppleSimulatorOSType(gdbremote
 if not platform in runtime.lower():
 continue
 for device in devices:
-if device['availability'] != '(available)':
+if 'availability' in device and device['availability'] != 
'(available)':
+continue
+if 'isAvailable' in device and device['isAvailable'] != True:
 continue
 deviceUDID = device['udid']
 break


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


[Lldb-commits] [lldb] r355647 - Add logging to TestQueues.py

2019-03-07 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Mar  7 14:28:01 2019
New Revision: 355647

URL: http://llvm.org/viewvc/llvm-project?rev=355647&view=rev
Log:
Add logging to TestQueues.py

In an attempt to understand why the test is still failing after r35,
add some logging.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355647&r1=355646&r2=355647&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Thu 
Mar  7 14:28:01 2019
@@ -56,7 +56,23 @@ class TestQueues(TestBase):
  expected_running,
  (queue.GetNumRunningItems(
 
+def describe_threads(self):
+desc = []
+for x in self.inferior_process:
+id = x.GetIndexID()
+reason_str = lldbutil.stop_reason_to_str(x.GetStopReason())
+
+location = "\t".join([lldbutil.get_description(
+x.GetFrameAtIndex(i)) for i in range(x.GetNumFrames())])
+desc.append(
+"thread %d: %s at\n\t%s" %
+(id, reason_str, location))
+print('\n'.join(desc))
+
 def check_number_of_threads_owned_by_queue(self, queue, number_threads):
+if (queue.GetNumThreads() != number_threads):
+self.describe_threads()
+
 self.assertTrue(
 queue.GetNumThreads() == number_threads,
 "queue %s should have %d thread executing, but has %d" %
@@ -125,6 +141,8 @@ class TestQueues(TestBase):
 if len(threads) != 1:
 self.fail("Failed to stop at breakpoint 1.")
 
+self.inferior_process = process
+
 queue_submittor_1 = lldb.SBQueue()
 queue_performer_1 = lldb.SBQueue()
 queue_performer_2 = lldb.SBQueue()
@@ -291,6 +309,8 @@ class TestQueues(TestBase):
 if len(threads) != 1:
 self.fail("Failed to stop at breakpoint 1.")
 
+self.inferior_process = process
+
 libbtr_module_filespec = lldb.SBFileSpec("libBacktraceRecording.dylib")
 libbtr_module = target.FindModule(libbtr_module_filespec)
 if not libbtr_module.IsValid():


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


[Lldb-commits] [lldb] r355706 - Add more logging to TestQueues.py

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 09:09:13 2019
New Revision: 355706

URL: http://llvm.org/viewvc/llvm-project?rev=355706&view=rev
Log:
Add more logging to TestQueues.py

The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355706&r1=355705&r2=355706&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 09:09:13 2019
@@ -65,8 +65,8 @@ class TestQueues(TestBase):
 location = "\t".join([lldbutil.get_description(
 x.GetFrameAtIndex(i)) for i in range(x.GetNumFrames())])
 desc.append(
-"thread %d: %s at\n\t%s" %
-(id, reason_str, location))
+"thread %d: %s (queue id: %s) at\n\t%s" %
+(id, reason_str, x.GetQueueID(), location))
 print('\n'.join(desc))
 
 def check_number_of_threads_owned_by_queue(self, queue, number_threads):
@@ -327,6 +327,8 @@ class TestQueues(TestBase):
 queue_performer_3 = lldb.SBQueue()
 for idx in range(0, process.GetNumQueues()):
 q = process.GetQueueAtIndex(idx)
+if "LLDB_COMMAND_TRACE" in os.environ:
+print("Queue  with id %s has name %s" % (q.GetQueueID(), 
q.GetName()))
 if q.GetName() == "com.apple.work_submittor_1":
 queue_submittor_1 = q
 if q.GetName() == "com.apple.work_performer_1":


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


[Lldb-commits] [lldb] r355764 - Try to workaround the TestQueues.py flakyness

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 17:23:47 2019
New Revision: 355764

URL: http://llvm.org/viewvc/llvm-project?rev=355764&view=rev
Log:
Try to workaround the TestQueues.py flakyness

This is not a fix, but if I understand enough of the issue, it should
bail out early of the test when in a situation that would result in
a failure down the road.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355764&r1=355763&r2=355764&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 17:23:47 2019
@@ -357,6 +357,11 @@ class TestQueues(TestBase):
 queue_performer_2, 1, )
 self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
 
+for th in process.threads:
+if th.GetThreadID() == lldb.LLDB_INVALID_QUEUE_ID:
+print("Cannot get thread <=> queue associations")
+return
+
 self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)


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


[Lldb-commits] [lldb] r355766 - Actually implement the TestQueues.py workaround

2019-03-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Mar  8 17:34:44 2019
New Revision: 355766

URL: http://llvm.org/viewvc/llvm-project?rev=355766&view=rev
Log:
Actually implement the TestQueues.py workaround

The code commited in r355764 didn't do what I want as I typed GetThreadID
instead of GetQueueID. This commit contains a (hopefully) better version
of the workaround.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=355766&r1=355765&r2=355766&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Fri 
Mar  8 17:34:44 2019
@@ -337,6 +337,10 @@ class TestQueues(TestBase):
 queue_performer_2 = q
 if q.GetName() == "com.apple.work_performer_3":
 queue_performer_3 = q
+if q.GetName() == "com.apple.main-thread":
+if q.GetNumThreads() == 0:
+print("Cannot get thread <=> queue associations")
+return
 
 self.assertTrue(
 queue_submittor_1.IsValid() and queue_performer_1.IsValid() and 
queue_performer_2.IsValid() and queue_performer_3.IsValid(),
@@ -357,11 +361,6 @@ class TestQueues(TestBase):
 queue_performer_2, 1, )
 self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
 
-for th in process.threads:
-if th.GetThreadID() == lldb.LLDB_INVALID_QUEUE_ID:
-print("Cannot get thread <=> queue associations")
-return
-
 self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
 self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)


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


[Lldb-commits] [lldb] r358525 - [debugserver] Relax the codesigning identity check

2019-04-16 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Apr 16 13:54:42 2019
New Revision: 358525

URL: http://llvm.org/viewvc/llvm-project?rev=358525&view=rev
Log:
[debugserver] Relax the codesigning identity check

In an effort to help new LLDB developers, we added checks and messaging around
the selection of your codesigning identity on macOS. While helpful, it is not
actually correct. It's perfectly valid to codesign with an identity that is
not named lldb_codesign. Currently this fails the build.

This patch keeps a warning that informs developers how to setup lldb_codesign
and how to pass it to cmake, but it allows the build to proceed with a
different identity.

Modified:
lldb/trunk/tools/debugserver/source/CMakeLists.txt

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=358525&r1=358524&r2=358525&view=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Apr 16 13:54:42 2019
@@ -93,18 +93,14 @@ elseif(NOT LLDB_NO_DEBUGSERVER)
   # Default case: on Darwin we need the right code signing ID.
   # See lldb/docs/code-signing.txt for details.
   if(CMAKE_HOST_APPLE AND NOT LLVM_CODESIGNING_IDENTITY STREQUAL 
"lldb_codesign")
-set(problem "Cannot code sign debugserver with LLVM_CODESIGNING_IDENTITY 
'${LLVM_CODESIGNING_IDENTITY}'.")
-set(advice "Pass -DLLDB_CODESIGN_IDENTITY=lldb_codesign to override the 
LLVM value for debugserver.")
-if(system_debugserver)
-  set(effect "Will fall back to system's debugserver.")
-  set(use_system_debugserver ON)
-else()
-  set(effect "debugserver will not be available.")
-endif()
-message(WARNING "${problem} ${effect} ${advice}")
-  else()
-set(build_and_sign_debugserver ON)
+message(WARNING "Codesigning debugserver with identity 
${LLVM_CODESIGNING_IDENTITY}. "
+"The usual setup uses the \"lldb_codesign\" identity 
created with "
+"scripts/macos-setup-codesign.sh. As a result your 
debugserver might "
+"not be able to attach to processes.\n"
+"Pass -DLLDB_CODESIGN_IDENTITY=lldb_codesign to use the 
development "
+"signing identity.")
   endif()
+  set(build_and_sign_debugserver ON)
 endif()
 
 # TODO: We don't use the $ generator expression here,


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


[Lldb-commits] [lldb] r358604 - [CMake] Remove Apple-specific version logic.

2019-04-17 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Apr 17 11:23:22 2019
New Revision: 358604

URL: http://llvm.org/viewvc/llvm-project?rev=358604&view=rev
Log:
[CMake] Remove Apple-specific version logic.

We were using the LLDB-Info.plist as the canonical holder of the
version number, but there is really no good reason to do this. If
anything the plist should be generated using the information provided
to CMake.

For now just remove the logic extracting the version from the plist
and rely on LLDB_VERSION_STRING.

Removed:
lldb/trunk/cmake/modules/EmbedAppleVersion.cmake
Modified:
lldb/trunk/source/CMakeLists.txt
lldb/trunk/source/lldb.cpp

Removed: lldb/trunk/cmake/modules/EmbedAppleVersion.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/EmbedAppleVersion.cmake?rev=358603&view=auto
==
--- lldb/trunk/cmake/modules/EmbedAppleVersion.cmake (original)
+++ lldb/trunk/cmake/modules/EmbedAppleVersion.cmake (removed)
@@ -1,11 +0,0 @@
-execute_process(COMMAND /usr/libexec/PlistBuddy -c "Print:CFBundleVersion" 
${LLDB_INFO_PLIST}
-OUTPUT_VARIABLE BundleVersion
-OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-file(APPEND "${HEADER_FILE}.tmp"
-"#define LLDB_VERSION_STRING lldb-${BundleVersion}\n")
-
-execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
-  "${HEADER_FILE}.tmp" "${HEADER_FILE}")
-
-file(REMOVE "${HEADER_FILE}.tmp")

Modified: lldb/trunk/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=358604&r1=358603&r2=358604&view=diff
==
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Wed Apr 17 11:23:22 2019
@@ -39,29 +39,7 @@ set_property(SOURCE lldb.cpp APPEND PROP
 
 list(APPEND lldbBase_SOURCES ${version_inc})
 
-if(APPLE)
-  set(apple_version_inc "${CMAKE_CURRENT_BINARY_DIR}/AppleVersion.inc")
-  set(apple_version_script 
"${LLDB_SOURCE_DIR}/cmake/modules/EmbedAppleVersion.cmake")
-  set(info_plist ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist)
-
-  # Create custom target to generate the VC revision include.
-  add_custom_command(OUTPUT "${apple_version_inc}"
-DEPENDS "${apple_version_script}" "${info_plist}"
-COMMAND
-${CMAKE_COMMAND} "-DLLDB_INFO_PLIST=${info_plist}"
- "-DHEADER_FILE=${apple_version_inc}"
- -P "${apple_version_script}")
-
-  # Mark the generated header as being generated.
-  set_source_files_properties("${apple_version_inc}"
-PROPERTIES GENERATED TRUE
-   HEADER_FILE_ONLY TRUE)
-
-  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
-  set_property(SOURCE lldb.cpp APPEND PROPERTY 
-   COMPILE_DEFINITIONS "HAVE_APPLE_VERSION_INC")
-  list(APPEND lldbBase_SOURCES ${apple_version_inc})
-elseif(LLDB_VERSION_STRING)
+if(LLDB_VERSION_STRING)
   set_property(SOURCE lldb.cpp APPEND PROPERTY
COMPILE_DEFINITIONS 
"LLDB_VERSION_STRING=${LLDB_VERSION_STRING}")
 endif()

Modified: lldb/trunk/source/lldb.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=358604&r1=358603&r2=358604&view=diff
==
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Wed Apr 17 11:23:22 2019
@@ -17,10 +17,6 @@ using namespace lldb_private;
 #include "VCSVersion.inc"
 #endif
 
-#ifdef HAVE_APPLE_VERSION_INC
-#include "AppleVersion.inc"
-#endif
-
 static const char *GetLLDBRevision() {
 #ifdef LLDB_REVISION
   return LLDB_REVISION;


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


Re: [Lldb-commits] [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-18 Thread Frederic Riss via lldb-commits
friss added inline comments.


Comment at: docs/Proposals/GitHub.rst:220
@@ +219,3 @@
+8. Tell people living downstream to pick up commits from the official git
+   repository.
+9. Give things time to settle. We could play some games like disabling the SVN

vsk wrote:
> This is tricky. CC'ing @friss to comment on how we'd need to update our 
> internal auto-merger.
This is not an issue. We were already consuming the llvm.org git repos, so we'd 
just need to point to the new git repos (given the git history is preserved, I 
don't think I've read this anywhere in this document, but I think it's safe to 
make this assumption)


https://reviews.llvm.org/D22463



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


[Lldb-commits] [lldb] r374066 - Extract and simplify DumpEnumValue

2019-10-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Oct  8 08:35:58 2019
New Revision: 374066

URL: http://llvm.org/viewvc/llvm-project?rev=374066&view=rev
Log:
Extract and simplify DumpEnumValue

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=374066&r1=374065&r2=374066&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct  8 08:35:58 2019
@@ -9351,6 +9351,32 @@ void ClangASTContext::DumpValue(
   }
 }
 
+static bool DumpEnumValue(const clang::QualType &qual_type, Stream *s,
+  const DataExtractor &data, lldb::offset_t 
byte_offset,
+  size_t byte_size, uint32_t bitfield_bit_offset,
+  uint32_t bitfield_bit_size) {
+  const clang::EnumType *enutype =
+  llvm::cast(qual_type.getTypePtr());
+  const clang::EnumDecl *enum_decl = enutype->getDecl();
+  assert(enum_decl);
+  clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
+  const bool is_signed = qual_type->isSignedIntegerOrEnumerationType();
+  lldb::offset_t offset = byte_offset;
+  const int64_t enum_value = data.GetMaxS64Bitfield(
+  &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
+
+  for (auto enumerator : enum_decl->enumerators()) {
+if (enumerator->getInitVal().getSExtValue() == enum_value) {
+  s->PutCString(enumerator->getNameAsString());
+  return true;
+}
+  }
+  // If we have gotten here we didn't get find the enumerator in the
+  // enum decl, so just print the integer.
+  s->Printf("%" PRIi64, enum_value);
+  return true;
+}
+
 bool ClangASTContext::DumpTypeValue(
 lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format,
 const DataExtractor &data, lldb::offset_t byte_offset, size_t byte_size,
@@ -9394,45 +9420,9 @@ bool ClangASTContext::DumpTypeValue(
   // If our format is enum or default, show the enumeration value as its
   // enumeration string value, else just display it as requested.
   if ((format == eFormatEnum || format == eFormatDefault) &&
-  GetCompleteType(type)) {
-const clang::EnumType *enutype =
-llvm::cast(qual_type.getTypePtr());
-const clang::EnumDecl *enum_decl = enutype->getDecl();
-assert(enum_decl);
-clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
-const bool is_signed = qual_type->isSignedIntegerOrEnumerationType();
-lldb::offset_t offset = byte_offset;
-if (is_signed) {
-  const int64_t enum_svalue = data.GetMaxS64Bitfield(
-  &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
-  for (enum_pos = enum_decl->enumerator_begin(),
-  enum_end_pos = enum_decl->enumerator_end();
-   enum_pos != enum_end_pos; ++enum_pos) {
-if (enum_pos->getInitVal().getSExtValue() == enum_svalue) {
-  s->PutCString(enum_pos->getNameAsString());
-  return true;
-}
-  }
-  // If we have gotten here we didn't get find the enumerator in the
-  // enum decl, so just print the integer.
-  s->Printf("%" PRIi64, enum_svalue);
-} else {
-  const uint64_t enum_uvalue = data.GetMaxU64Bitfield(
-  &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
-  for (enum_pos = enum_decl->enumerator_begin(),
-  enum_end_pos = enum_decl->enumerator_end();
-   enum_pos != enum_end_pos; ++enum_pos) {
-if (enum_pos->getInitVal().getZExtValue() == enum_uvalue) {
-  s->PutCString(enum_pos->getNameAsString());
-  return true;
-}
-  }
-  // If we have gotten here we didn't get find the enumerator in the
-  // enum decl, so just print the integer.
-  s->Printf("%" PRIu64, enum_uvalue);
-}
-return true;
-  }
+  GetCompleteType(type))
+return DumpEnumValue(qual_type, s, data, byte_offset, byte_size,
+ bitfield_bit_offset, bitfield_bit_size);
   // format was not enum, just fall through and dump the value as
   // requested
   LLVM_FALLTHROUGH;


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


[Lldb-commits] [lldb] r374067 - Add pretty printing of Clang "bitfield" enums

2019-10-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Oct  8 08:35:59 2019
New Revision: 374067

URL: http://llvm.org/viewvc/llvm-project?rev=374067&view=rev
Log:
Add pretty printing of Clang "bitfield" enums

Summary:
Using enumerators as flags is standard practice. This patch adds
support to LLDB to display such enum values symbolically, eg:

(E) e1 = A | B

If enumerators don't cover the whole value, the remaining bits are
displayed as hexadecimal:

(E) e4 = A | 0x10

Detecting whether an enum is used as a bitfield or not is
complicated. This patch implements a heuristic that assumes that such
enumerators will either have only 1 bit set or will be a combination
of previous values.

This patch doesn't change the way we currently display enums which the
above heuristic would not consider as bitfields.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

Modified:
lldb/trunk/lit/SymbolFile/DWARF/debug-types-missing-signature.test
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/lit/SymbolFile/DWARF/debug-types-missing-signature.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug-types-missing-signature.test?rev=374067&r1=374066&r2=374067&view=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug-types-missing-signature.test 
(original)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-types-missing-signature.test Tue Oct  
8 08:35:59 2019
@@ -22,5 +22,5 @@ PRINTEC: use of undeclared identifier 'E
 
 RUN: %lldb %t -b -o "target variable a e ec" | FileCheck --check-prefix=VARS %s
 VARS: (const (anonymous struct)) a = {}
-VARS: (const (anonymous enum)) e = 1
-VARS: (const (anonymous enum)) ec = 1
+VARS: (const (anonymous enum)) e = 0x1
+VARS: (const (anonymous enum)) ec = 0x1

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py?rev=374067&r1=374066&r2=374067&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py 
Tue Oct  8 08:35:59 2019
@@ -25,11 +25,35 @@ class EnumTypesTestCase(TestBase):
 exe = self.getBuildArtifact("a.out")
 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
+lldbutil.run_to_source_breakpoint(
+self, '// Breakpoint for bitfield', lldb.SBFileSpec("main.c"))
+
+self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = A$'])
+self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = B$'])
+self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = C$'])
+self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = AB$'])
+self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = A | C$'])
+self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = ALL$'])
+# Test that an enum that doesn't match the heuristic we use in
+# ClangASTContext::DumpEnumValue, gets printed as a raw integer.
+self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = 7$'])
+# Test the behavior in case have a variable of a type considered
+# 'bitfield' by the heuristic, but the value isn't actually fully
+# covered by the enumerators.
+self.expect("p (enum bitfield)nonsense", 
DATA_TYPES_DISPLAYED_CORRECTLY,
+patterns=[' = B | C | 0x10$'])
+
 # Break inside the main.
 bkpt_id = lldbutil.run_break_set_by_file_and_line(
 self, "main.c", self.line, num_expected_locations=1, 
loc_exact=True)
-
-self.runCmd("run", RUN_SUCCEEDED)
+self.runCmd("c", RUN_SUCCEEDED)
 
 # The stop reason of the thread should be breakpoint.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c?rev=374067&r1=374066&r2=374067&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c Tue Oct  
8 08:35:59 2019
@@ -18,6 +18,20 @@ struct foo {
 
 int main (int argc, char const *argv[

[Lldb-commits] [lldb] r374076 - [Testsuite] Get rid of most of the recursive shared library Makefiles

2019-10-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Oct  8 09:23:28 2019
New Revision: 374076

URL: http://llvm.org/viewvc/llvm-project?rev=374076&view=rev
Log:
[Testsuite] Get rid of most of the recursive shared library Makefiles

Most of the secondary Makefiles we have are just a couple variable
definitions and then an include of Makefile.rules. This patch removes
most of the secondary Makefiles and replaces them with a direct
invocation of Makefile.rules in the main Makefile. The specificities
of each sub-build are listed right there on the recursive $(MAKE)
call. All the variables that matter are being passed automagically by
make as they have been passed on the command line. The only things you
need to specify are the variables customizating the Makefile.rules
logic for each image.

This patch also removes most of the clean logic from those Makefiles
and from Makefile.rules. The clean rule is not required anymore now
that we run the testsuite in a separate build directory that is wiped
with each run. The patch leaves a very crude version of clean in
Makefile.rules which removes everything inside of $(BUILDDIR). It does
this only when the $(BUILDDIR) looks like a sub-directory of our
standard testsuite build directory to be extra safe.

Reviewers: aprantl, labath

Subscribers: lldb-commits

Tags: #lldb

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

Removed:

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/dummy.mk
lldb/trunk/packages/Python/lldbsuite/test/commands/target/create-deps/a.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk

lldb/trunk/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/create-empty-corefile.mk
lldb/trunk/packages/Python/lldbsuite/test/macosx/macabi/dylib.mk

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.mk

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.mk
Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/Makefile
lldb/trunk/packages/Python/lldbsuite/test/macosx/macabi/Makefile
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile?rev=374076&r1=374075&r2=374076&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile
 Tue Oct  8 09:23:28 2019
@@ -1,11 +1,10 @@
 CXX_SOURCES := main.cpp test.cpp
 
-include Makefile.rules
+all: dummy
 
-a.out: dummy
+include Makefile.rules
 
-dummy:
-   $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk
+dummy: dummy.cpp
+   $(MAKE) -f $(MAKEFILE_RULES) \
+   CXX_SOURCES=dummy.cpp EXE=dummy
 
-clean::
-   $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk clean

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/dummy.mk
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/top-level/dummy.mk?rev=374075&view=auto
==
--- 
lldb/t

[Lldb-commits] [lldb] r374095 - Fix sign extension handling in DumpEnumValue

2019-10-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Oct  8 10:59:02 2019
New Revision: 374095

URL: http://llvm.org/viewvc/llvm-project?rev=374095&view=rev
Log:
Fix sign extension handling in DumpEnumValue

When an enumerator has an unsigned type and its high bit set, the
code introduced in r374067 would fail to match it due to a sign
extension snafu. This commit fixes this aspec of the code and should
fix the bots.

I think it's not a complete fix though, I'll add more test coverage
and additional tweaks in a follow-up commit.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=374095&r1=374094&r2=374095&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct  8 10:59:02 2019
@@ -9374,6 +9374,7 @@ static bool DumpEnumValue(const clang::Q
   // flags.
   for (auto enumerator : enum_decl->enumerators()) {
 uint64_t val = enumerator->getInitVal().getSExtValue();
+val = llvm::SignExtend64(val, 8*byte_size);
 if (llvm::countPopulation(val) != 1 && (val & ~covered_bits) != 0)
   can_be_bitfield = false;
 covered_bits |= val;


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


[Lldb-commits] [lldb] r374108 - Add test coverage to printing of enums and fix display of unsigned values

2019-10-08 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Oct  8 12:52:01 2019
New Revision: 374108

URL: http://llvm.org/viewvc/llvm-project?rev=374108&view=rev
Log:
Add test coverage to printing of enums and fix display of unsigned values

TestCPP11EnumTypes.py should have covered all our bases when it comes
to typed enums, but it missed the regression introduced in r374066.
The reason it didn't catch it is somewhat funny: the test was copied
over from another test that recompiled a source file with a different
base type every time, but neither the test source nor the python code
was adapted for testing enums. As a result, this test was just running
8 times the exact same checks on the exact same binary.

This commit fixes the coverage and addresses the issue revealed by
the new tests.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py?rev=374108&r1=374107&r2=374108&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
 Tue Oct  8 12:52:01 2019
@@ -19,8 +19,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as int8_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int8_t"'})
+self.image_lookup_for_enum_type(True)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -28,8 +28,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as int16_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int16_t"'})
+self.image_lookup_for_enum_type(True)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -37,8 +37,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as int32_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int32_t"'})
+self.image_lookup_for_enum_type(True)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -46,8 +46,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as int64_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int64_t"'})
+self.image_lookup_for_enum_type(True)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -55,8 +55,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as uint8_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint8_t"'})
+self.image_lookup_for_enum_type(False)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -64,8 +64,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as uint16_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'})
-self.image_lookup_for_enum_type()
+'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint16_t"'})
+self.image_lookup_for_enum_type(False)
 
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
 @skipIf(dwarf_version=['<', '4'])
@@ -73,8 +73,8 @@ class CPP11EnumTypesTestCase(TestBase):
 """Test C++11 enumeration class types as uint32_t types."""
 self.build(
 dictionary={
-'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'})
-self.image_lookup_for_enu

[Lldb-commits] [lldb] r374217 - Skip Apple simulator test for all remote testing scenarios.

2019-10-09 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Oct  9 13:39:04 2019
New Revision: 374217

URL: http://llvm.org/viewvc/llvm-project?rev=374217&view=rev
Log:
Skip Apple simulator test for all remote testing scenarios.

The test makes no sense to run remotely, period. The architecture of
the target is not the discriminant here.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=374217&r1=374216&r2=374217&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Wed Oct  9 13:39:04 2019
@@ -103,21 +103,21 @@ class TestAppleSimulatorOSType(gdbremote
 
 @apple_simulator_test('iphone')
 @debugserver_test
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_simulator_ostype_ios(self):
 self.check_simulator_ostype(sdk='iphonesimulator',
 platform='ios')
 
 @apple_simulator_test('appletv')
 @debugserver_test
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_simulator_ostype_tvos(self):
 self.check_simulator_ostype(sdk='appletvsimulator',
 platform='tvos')
 
 @apple_simulator_test('watch')
 @debugserver_test
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_simulator_ostype_watchos(self):
 self.check_simulator_ostype(sdk='watchsimulator',
 platform='watchos', arch='i386')


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


[Lldb-commits] [lldb] r374234 - TestHelloWorld: Make compatible with remote testing

2019-10-09 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Oct  9 14:41:02 2019
New Revision: 374234

URL: http://llvm.org/viewvc/llvm-project?rev=374234&view=rev
Log:
TestHelloWorld: Make compatible with remote testing

The synchronization token handling was not remote-friendly.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py?rev=374234&r1=374233&r2=374234&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
 Wed Oct  9 14:41:02 2019
@@ -78,17 +78,19 @@ class HelloWorldTestCase(TestBase):
 @expectedFailureNetBSD
 def test_with_attach_to_process_with_id_api(self):
 """Create target, spawn a process, and attach to it with process id."""
-exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
+exe = '%s_%d'%(self.testMethodName, os.getpid())
 d = {'EXE': exe}
 self.build(dictionary=d)
 self.setTearDownCleanup(dictionary=d)
-target = self.dbg.CreateTarget(exe)
+target = self.dbg.CreateTarget(self.getBuildArtifact(exe))
 
 # Spawn a new process
 token = exe+'.token'
-if os.path.exists(token):
-os.remove(token)
-popen = self.spawnSubprocess(exe, [token])
+if not lldb.remote_platform:
+token = self.getBuildArtifact(token)
+if os.path.exists(token):
+os.remove(token)
+popen = self.spawnSubprocess(self.getBuildArtifact(exe), [token])
 self.addTearDownHook(self.cleanupSubprocesses)
 lldbutil.wait_for_file_on_target(self, token)
 
@@ -110,17 +112,19 @@ class HelloWorldTestCase(TestBase):
 @expectedFailureNetBSD
 def test_with_attach_to_process_with_name_api(self):
 """Create target, spawn a process, and attach to it with process 
name."""
-exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
+exe = '%s_%d'%(self.testMethodName, os.getpid())
 d = {'EXE': exe}
 self.build(dictionary=d)
 self.setTearDownCleanup(dictionary=d)
-target = self.dbg.CreateTarget(exe)
+target = self.dbg.CreateTarget(self.getBuildArtifact(exe))
 
 # Spawn a new process.
 token = exe+'.token'
-if os.path.exists(token):
-os.remove(token)
-popen = self.spawnSubprocess(exe, [token])
+if not lldb.remote_platform:
+token = self.getBuildArtifact(token)
+if os.path.exists(token):
+os.remove(token)
+popen = self.spawnSubprocess(self.getBuildArtifact(exe), [token])
 self.addTearDownHook(self.cleanupSubprocesses)
 lldbutil.wait_for_file_on_target(self, token)
 


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


[Lldb-commits] [lldb] r374251 - Makefile.rules: add missing CODESIGN call

2019-10-09 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Oct  9 15:35:56 2019
New Revision: 374251

URL: http://llvm.org/viewvc/llvm-project?rev=374251&view=rev
Log:
Makefile.rules: add missing CODESIGN call

When building an executable and a shared library at the same time (yes,
Makefile.rules is setup to do this!) the executable was not codesigned.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=374251&r1=374250&r2=374251&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Wed Oct  9 
15:35:56 2019
@@ -609,6 +609,9 @@ ifneq "$(DYLIB_NAME)" ""
 ifeq "$(DYLIB_ONLY)" ""
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME)
$(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o 
"$(EXE)"
+ifneq "$(CODESIGN)" ""
+   $(CODESIGN) -s - "$(EXE)"
+endif
 else
 EXE = $(DYLIB_FILENAME)
 endif


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


[Lldb-commits] [lldb] r374256 - TestIndirectSymbols: Modernize the Makefile

2019-10-09 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Oct  9 15:47:28 2019
New Revision: 374256

URL: http://llvm.org/viewvc/llvm-project?rev=374256&view=rev
Log:
TestIndirectSymbols: Modernize the Makefile

This old test used a completely hand-rolled Makefile. Modernize so that
it's able to cross-compile. And XFAIL the test as it fails on embedded
targets...

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile?rev=374256&r1=374255&r2=374256&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile 
Wed Oct  9 15:47:28 2019
@@ -1,38 +1,16 @@
-include Makefile.rules
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
-   CFLAGS += -arch $(ARCH)
-   DS := dsymutil
-   LD_FLAGS := -dynamiclib
-   LIB_INDIRECT := $(LIB_PREFIX)indirect.dylib
-   LIB_REEXPORT := $(LIB_PREFIX)reexport.dylib
-   EXEC_PATH := "@executable_path"
-   EXEC_PATH_INDIRECT := -install_name $(EXEC_PATH)/$(LIB_INDIRECT)
-   EXEC_PATH_REEXPORT := -install_name $(EXEC_PATH)/$(LIB_REEXPORT)
-endif
-
-all: a.out $(LIB_INDIRECT) $(LIB_REEXPORT)
+C_SOURCES := main.c
+LD_EXTRAS := -L. -lindirect -lreexport
 
-a.out: main.o $(LIB_INDIRECT) $(LIB_REEXPORT)
-   $(CC) $(CFLAGS) -o a.out main.o -L. $(LIB_INDIRECT) $(LIB_REEXPORT)
+.PHONY: build-libindirect build-libreepxoprt
+all: build-libindirect build-libreepxoprt a.out
 
-main.o: $(SRCDIR)/main.c
-   $(CC) $(CFLAGS) -c $(SRCDIR)/main.c
-
-$(LIB_INDIRECT): indirect.o
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_INDIRECT) -o $(LIB_INDIRECT) 
indirect.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_INDIRECT); fi
-
-indirect.o: $(SRCDIR)/indirect.c
-   $(CC) $(CFLAGS) -c $(SRCDIR)/indirect.c
-
-$(LIB_REEXPORT): reexport.o $(LIB_INDIRECT)
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) 
reexport.o -L. -lindirect -Wl,-alias_list,$(SRCDIR)/alias.list
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_REEXPORT); fi
+include Makefile.rules
 
-reexport.o: $(SRCDIR)/reexport.c
-   $(CC) $(CFLAGS) -c $(SRCDIR)/reexport.c
-clean::
-   rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
+build-libindirect: indirect.c
+   $(MAKE) -f $(MAKEFILE_RULES) \
+   DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES
+
+build-libreepxoprt: reexport.c
+   $(MAKE) -f $(MAKEFILE_RULES) \
+   DYLIB_C_SOURCES=reexport.c DYLIB_NAME=reexport DYLIB_ONLY=YES \
+   LD_EXTRAS="-L. -lindirect -Wl,-alias_list,$(SRCDIR)/alias.list"

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py?rev=374256&r1=374255&r2=374256&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
 Wed Oct  9 15:47:28 2019
@@ -20,6 +20,7 @@ class TestIndirectFunctions(TestBase):
 self.main_source = "main.c"
 
 @skipUnlessDarwin
+@expectedFailureAll(oslist=no_match(["macosx"]), 
bugnumber="rdar://55952764")
 @add_test_categories(['pyapi'])
 def test_with_python_api(self):
 """Test stepping and setting breakpoints in indirect and re-exported 
symbols."""
@@ -61,8 +62,7 @@ class TestIndirectFunctions(TestBase):
 # indirect function.
 thread.StepInto()
 curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
-self.assertTrue(
-curr_function == "call_through_indirect_hidden",
+self.assertEqual(curr_function, "call_through_indirect_hidden",
 "Stepped into indirect symbols.")
 
 # Now set a breakpoint using the indirect symbol name, and make sure we


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


[Lldb-commits] [lldb] r374262 - TestMTCSimple.py: allow the test to run on Darwin embedded platforms

2019-10-09 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Oct  9 16:52:31 2019
New Revision: 374262

URL: http://llvm.org/viewvc/llvm-project?rev=374262&view=rev
Log:
TestMTCSimple.py: allow the test to run on Darwin embedded platforms

The test needed some updates to run using a different UI toolkit
and with a different libMTC, but it should run fine on a device.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py?rev=374262&r1=374261&r2=374262&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
 Wed Oct  9 16:52:31 2019
@@ -15,19 +15,12 @@ class MTCSimpleTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipUnlessDarwin
-@skipIfDarwinEmbedded  # Test file depends on AppKit which is not present 
on iOS etc.
 def test(self):
 self.mtc_dylib_path = findMainThreadCheckerDylib()
-if self.mtc_dylib_path == "":
-self.skipTest("This test requires libMainThreadChecker.dylib.")
-
+self.assertTrue(self.mtc_dylib_path != "")
 self.build()
 self.mtc_tests()
 
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-
 @skipIf(archs=['i386'])
 def mtc_tests(self):
 # Load the test
@@ -41,7 +34,11 @@ class MTCSimpleTestCase(TestBase):
 thread = process.GetSelectedThread()
 frame = thread.GetSelectedFrame()
 
-self.expect("thread info", substrs=['stop reason = -[NSView superview] 
must be used from main thread only'])
+view = "NSView" if lldbplatformutil.getPlatform() == "macosx" else 
"UIView"
+
+self.expect("thread info",
+substrs=['stop reason = -[' + view +
+ ' superview] must be used from main thread only'])
 
 self.expect(
 "thread info -s",
@@ -51,7 +48,7 @@ class MTCSimpleTestCase(TestBase):
 json_line = '\n'.join(output_lines[2:])
 data = json.loads(json_line)
 self.assertEqual(data["instrumentation_class"], "MainThreadChecker")
-self.assertEqual(data["api_name"], "-[NSView superview]")
-self.assertEqual(data["class_name"], "NSView")
+self.assertEqual(data["api_name"], "-[" + view + " superview]")
+self.assertEqual(data["class_name"], view)
 self.assertEqual(data["selector"], "superview")
-self.assertEqual(data["description"], "-[NSView superview] must be 
used from main thread only")
+self.assertEqual(data["description"], "-[" + view + " superview] must 
be used from main thread only")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m?rev=374262&r1=374261&r2=374262&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m 
Wed Oct  9 16:52:31 2019
@@ -1,8 +1,14 @@
 #import 
+#if __has_include()
 #import 
+#define XXView NSView
+#else
+#import 
+#define XXView UIView
+#endif
 
 int main() {
-  NSView *view = [[NSView alloc] init];
+  XXView *view = [[XXView alloc] init];
   dispatch_group_t g = dispatch_group_create();
   dispatch_group_enter(g);
   [NSThread detachNewThreadWithBlock:^{

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py?rev=374262&r1=374261&r2=374262&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py Wed Oct  9 
16:52:31 2019
@@ -17,6 +17,7 @@ from six.moves.urllib import parse as ur
 # LLDB modules
 from . import configuration
 import lldb
+import lldbsuite.test.lldbplatform as lldbplatform
 
 
 def check_first_register_readable(test_case):
@@ -145,6 +146,9 @@ def findMainThreadCheckerDylib():
 if not platformIsDarwin():
 return ""
 
+if getPlatform() in lldbplatform.translate(lldbplatform.darwin_embedded):
+return "/Developer/usr/lib/libMainThreadChecker.dylib"
+
 with os.popen('xcode-select -p'

[Lldb-commits] [lldb] r374451 - TestMTCSimple: Make Makefile portable.

2019-10-10 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Oct 10 14:21:16 2019
New Revision: 374451

URL: http://llvm.org/viewvc/llvm-project?rev=374451&view=rev
Log:
TestMTCSimple: Make Makefile portable.

r374262 left out the Makefile changes needed to cross compile this test.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile?rev=374451&r1=374450&r2=374451&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile 
Thu Oct 10 14:21:16 2019
@@ -1,4 +1,9 @@
 OBJC_SOURCES := main.m
-LD_EXTRAS := -lobjc -framework Foundation -framework AppKit
+ifeq ($(findstring MacOSX.platform,$(shell xcrun 
--show-sdk-path)),MacOSX.platform)
+UI_FRAMEWORK = AppKit
+else
+UI_FRAMEWORK = UIKit
+endif
+LD_EXTRAS = -lobjc -framework Foundation -framework $(UI_FRAMEWORK)
 
 include Makefile.rules


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


[Lldb-commits] [lldb] r369709 - TestAppleSimulatorOSType: Pass the --standalone argument to simctl

2019-08-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Aug 22 14:44:10 2019
New Revision: 369709

URL: http://llvm.org/viewvc/llvm-project?rev=369709&view=rev
Log:
TestAppleSimulatorOSType: Pass the --standalone argument to simctl

It looks like running without this argument was supported
for legacy reasons, but a Xcode 11 beta made the argument
mandatory for our usecase.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=369709&r1=369708&r2=369709&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Thu Aug 22 14:44:10 2019
@@ -46,7 +46,7 @@ class TestAppleSimulatorOSType(gdbremote
 self.build(dictionary={ 'EXE': exe_name, 'SDKROOT': sdkroot.strip(),
 'ARCH': arch })
 exe_path = self.getBuildArtifact(exe_name)
-sim_launcher = subprocess.Popen(['xcrun', 'simctl', 'spawn',
+sim_launcher = subprocess.Popen(['xcrun', 'simctl', 'spawn', '-s',
  deviceUDID, exe_path,
  'print-pid', 'sleep:10'],
 stderr=subprocess.PIPE)


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


[Lldb-commits] [lldb] r369930 - TestFunctionStarts.py: add synchronization

2019-08-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Mon Aug 26 10:14:05 2019
New Revision: 369930

URL: http://llvm.org/viewvc/llvm-project?rev=369930&view=rev
Log:
TestFunctionStarts.py: add synchronization

We have started to see the no_binary version of this test
fail. The reason is that the binary was being removed
before the spawn actually launched the inferior. Add a
simple filesystem based synchronization to avoid this race.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py?rev=369930&r1=369929&r2=369930&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
 Mon Aug 26 10:14:05 2019
@@ -43,8 +43,20 @@ class FunctionStartsTestCase(TestBase):
 except CalledProcessError as cmd_error:
 self.fail("Strip failed: %d"%(cmd_error.returncode))
 
-popen = self.spawnSubprocess(exe)
+# Use a file as a synchronization point between test and inferior.
+pid_file_path = lldbutil.append_to_process_working_directory(self,
+"token_pid_%d" % (int(os.getpid(
+self.addTearDownHook(
+lambda: self.run_platform_command(
+"rm %s" %
+(pid_file_path)))
+
+popen = self.spawnSubprocess(exe, [pid_file_path])
 self.addTearDownHook(self.cleanupSubprocesses)
+
+# Wait until process has fully started up.
+pid = lldbutil.wait_for_file_on_target(self, pid_file_path)
+
 if in_memory:
   remove_file(exe)
 
@@ -68,7 +80,8 @@ class FunctionStartsTestCase(TestBase):
 thread = threads[0]
 self.assertTrue(thread.num_frames > 1, "Couldn't backtrace.")
 name = thread.frame[1].GetFunctionName()
-self.assertEqual("___lldb_unnamed_symbol1$$StripMe", name, "Frame name 
not synthetic")
+self.assertTrue(name.startswith("___lldb_unnamed_symbol"))
+self.assertTrue(name.endswith("$$StripMe"))
 
 
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp?rev=369930&r1=369929&r2=369930&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp 
Mon Aug 26 10:14:05 2019
@@ -2,6 +2,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 extern void dont_strip_me()
@@ -21,6 +22,11 @@ static void *a_function()
 
 int main(int argc, char const *argv[])
 {
+{
+// Create file to signal that this process has started up.
+std::ofstream f;
+f.open(argv[1]);
+}
 a_function();
 return 0;
 }


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


[Lldb-commits] [lldb] r370916 - Workaround TestConcurrentMany* flakiness in a more pricipled way

2019-09-04 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Sep  4 09:13:12 2019
New Revision: 370916

URL: http://llvm.org/viewvc/llvm-project?rev=370916&view=rev
Log:
Workaround TestConcurrentMany* flakiness in a more pricipled way

The flakiness on our local machines seems to come for a race in the kernel
between task_suspend and the creation of the Mach exceptions for the threads
that hit breakpoints. The debugserver code is written with the assumption
that the kernel will be able to provide us with all the exceptions for a
given task once task_suspend returns. On machines with higher core counts,
this seems not to be the case. The first batch of exceptions we get after
task_suspend does not contain exceptions for all the threads that have hit
a breakpoint, thus they get misreprorted in the first stop packet.

Adding a 1ms timeout to the call that retrieves the batch of exceptions
seems to workaround the issue reliably on our machines, and it shoulnd't
impact standard debugging scenarios too much (a stop will incur an additional
1ms delay). We'll be talking to the kernel team to figure out the right
contract for those APIs.

This patch also reverts part of Jonas' previous workaround for the
issue (r370785).

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h?rev=370916&r1=370915&r2=370916&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h Wed Sep  4 
09:13:12 2019
@@ -7,7 +7,6 @@ static inline void pseudo_barrier_wait(p
   --barrier;
   while (barrier > 0)
 std::this_thread::yield();
-  std::this_thread::sleep_for(std::chrono::milliseconds(100));
 }
 
 static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm?rev=370916&r1=370915&r2=370916&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm Wed Sep  4 09:13:12 
2019
@@ -754,7 +754,7 @@ void *MachTask::ExceptionThread(void *ar
   // to get all currently available exceptions for this task
   err = exception_message.Receive(
   mach_task->ExceptionPort(),
-  MACH_RCV_MSG | MACH_RCV_INTERRUPT | MACH_RCV_TIMEOUT, 0);
+  MACH_RCV_MSG | MACH_RCV_INTERRUPT | MACH_RCV_TIMEOUT, 1);
 } else if (periodic_timeout > 0) {
   // We need to stop periodically in this loop, so try and get a mach
   // message with a valid timeout (ms)


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


[Lldb-commits] [lldb] r359028 - Lock accesses to OptionValueFileSpecList objects

2019-04-23 Thread Frederic Riss via lldb-commits
Author: friss
Date: Tue Apr 23 13:17:04 2019
New Revision: 359028

URL: http://llvm.org/viewvc/llvm-project?rev=359028&view=rev
Log:
Lock accesses to OptionValueFileSpecList objects

Before a Debugger gets a Target, target settings are routed to a global set
of settings. Even without this, some part of the LLDB which exist independently
of the Debugger object (the Module cache, the Symbol vendors, ...) access
directly the global default store for those settings.

Of course, if you modify one of those global settings while they are being read,
bad things happen. We see this quite a bit with FileSpecList settings. In
particular, we see many cases where one debug session changes
target.exec-search-paths while another session starts up and it crashes when
one of those accesses invalid FileSpecs.

This patch addresses the specific FileSpecList issue by adding locking to
OptionValueFileSpecList and never returning by reference.

Reviewers: clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=359028&r1=359027&r2=359028&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Tue Apr 23 
13:17:04 2019
@@ -9,6 +9,8 @@
 #ifndef liblldb_OptionValueFileSpecList_h_
 #define liblldb_OptionValueFileSpecList_h_
 
+#include 
+
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Interpreter/OptionValue.h"
 
@@ -49,13 +51,23 @@ public:
 
   // Subclass specific functions
 
-  FileSpecList &GetCurrentValue() { return m_current_value; }
+  FileSpecList GetCurrentValue() const {
+std::lock_guard lock(m_mutex);
+return m_current_value;
+  }
 
-  const FileSpecList &GetCurrentValue() const { return m_current_value; }
+  void SetCurrentValue(const FileSpecList &value) {
+std::lock_guard lock(m_mutex);
+m_current_value = value;
+  }
 
-  void SetCurrentValue(const FileSpecList &value) { m_current_value = value; }
+  void AppendCurrentValue(const FileSpec &value) {
+std::lock_guard lock(m_mutex);
+m_current_value.Append(value);
+  }
 
 protected:
+  mutable std::mutex m_mutex;
   FileSpecList m_current_value;
 };
 

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=359028&r1=359027&r2=359028&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Apr 23 13:17:04 2019
@@ -119,11 +119,13 @@ public:
 
   PathMappingList &GetSourcePathMap() const;
 
-  FileSpecList &GetExecutableSearchPaths();
+  FileSpecList GetExecutableSearchPaths();
 
-  FileSpecList &GetDebugFileSearchPaths();
+  void AppendExecutableSearchPaths(const FileSpec&);
 
-  FileSpecList &GetClangModuleSearchPaths();
+  FileSpecList GetDebugFileSearchPaths();
+
+  FileSpecList GetClangModuleSearchPaths();
 
   bool GetEnableAutoImportClangModules() const;
 

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=359028&r1=359027&r2=359028&view=diff
==
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Tue Apr 23 13:17:04 2019
@@ -43,7 +43,7 @@ public:
   ///
   const RegularExpression *GetSymbolsToAvoidRegexp();
 
-  FileSpecList &GetLibrariesToAvoid() const;
+  FileSpecList GetLibrariesToAvoid() const;
 
   bool GetTraceEnabledState() const;
 

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=359028&r1=359027&r2=359028&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)

[Lldb-commits] [lldb] r359140 - Fix infinite recursion when calling C++ template functions

2019-04-24 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Apr 24 14:04:23 2019
New Revision: 359140

URL: http://llvm.org/viewvc/llvm-project?rev=359140&view=rev
Log:
Fix infinite recursion when calling C++ template functions

Summary:
When we encounter a templated function in the debug information, we
were creating an AST that looked like this:

FunctionTemplateDecl 0x12980ab90 <>  foo
|-TemplateTypeParmDecl 0x12980aad0 <>  class depth 
0 index 0 T
|-FunctionDecl 0x12980aa30 <>  foo 'int (int)' 
extern
| |-TemplateArgument type 'int'
| `-ParmVarDecl 0x12980a998 <>  t1 'int'
`-FunctionDecl 0x12980aa30 <>  foo 'int (int)' 
extern
  |-TemplateArgument type 'int'
  `-ParmVarDecl 0x12980a998 <>  t1 'int'

Note that the FunctionTemplateDecl has 2 children which are identical (as
in have the same address). This is not what Clang is doing:

FunctionTemplateDecl 0x7f89d206c6f8  line:2:5 
foo
|-TemplateTypeParmDecl 0x7f89d206c4a8  col:19 referenced 
typename depth 0 index 0 T
|-FunctionDecl 0x7f89d206c660  line:2:5 foo 'int (T)'
| `-ParmVarDecl 0x7f89d206c570  col:11 t1 'T'
`-FunctionDecl 0x7f89d206cb60  line:2:5 used foo 'int (int)'
  |-TemplateArgument type 'int'
  `-ParmVarDecl 0x7f89d206ca68  col:11 t1 'int':'int'

The 2 chidlren are different and actually repesent different things: the first
one is the unspecialized version and the second one is specialized. (Just 
looking
at the names shows another major difference which is that we create the parent
with a name of "foo" when it should be just "foo".)

The fact that we have those 2 identical children confuses the ClangImporter
and generates an infinite recursion (reported in https://llvm.org/pr41473).
We cannot create the unspecialized version as the debug information doesn't
contain a mapping from the template parameters to their use in the prototype.

This patch just creates 2 different FunctionDecls for those 2 children of the
FunctionTemplateDecl. This avoids the infinite recursion and allows us to
call functions. As the XFAILs in the added test show, we've still got issues
in our handling of templates. I believe they are mostly centered on the fact
that we create do not register "foo" as a template, but "foo". This is
a bigger change that will need changes to the debug information generation.
I believe this change makes sense on its own.

Reviewers: shafik, clayborg, jingham

Subscribers: aprantl, javed.absar, kristof.beyls, lldb-commits

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/main.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/Makefile?rev=359140&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/Makefile 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/Makefile 
Wed Apr 24 14:04:23 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py?rev=359140&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
 Wed Apr 24 14:04:23 2019
@@ -0,0 +1,30 @@
+"""
+Test that we can call C++ template fucntions.
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TemplateFunctionsTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def do_test_template_function(self, add_cast):
+self.build()
+(_, _, thread, _) = lldbutil.run_to_name_breakpoint(self, "main")
+frame = thread.GetSelectedFrame()
+expr = "foo(42)"
+if add_cast:
+expr = "(int)" + expr
+expr_result = frame.EvaluateExpression(expr)
+self.assertTrue(expr_result.IsValid())
+self.assertEqual(expr_result.GetValue(), "42")
+
+def test_template_function_with_cast(self):
+self.do_test_template_function(True)
+
+@expectedFailureAll(debug_info=["dwarf", "gmodules"])
+def test_template_function_without_cas

[Lldb-commits] [lldb] r359145 - Skip test introduced in r359140 on windows

2019-04-24 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed Apr 24 15:00:01 2019
New Revision: 359145

URL: http://llvm.org/viewvc/llvm-project?rev=359145&view=rev
Log:
Skip test introduced in r359140 on windows

Not sure what is or is not supposed to work on Windows and I have
no way to investigate this.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py?rev=359145&r1=359144&r2=359145&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template-function/TestTemplateFunctions.py
 Wed Apr 24 15:00:01 2019
@@ -22,9 +22,11 @@ class TemplateFunctionsTestCase(TestBase
 self.assertTrue(expr_result.IsValid())
 self.assertEqual(expr_result.GetValue(), "42")
 
+@skipIfWindows
 def test_template_function_with_cast(self):
 self.do_test_template_function(True)
 
+@skipIfWindows
 @expectedFailureAll(debug_info=["dwarf", "gmodules"])
 def test_template_function_without_cast(self):
 self.do_test_template_function(False)


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


[Lldb-commits] [lldb] r359347 - TestZMMRegister: use an integer division as intended

2019-04-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 26 13:23:55 2019
New Revision: 359347

URL: http://llvm.org/viewvc/llvm-project?rev=359347&view=rev
Log:
TestZMMRegister: use an integer division as intended

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py?rev=359347&r1=359346&r2=359347&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
 Fri Apr 26 13:23:55 2019
@@ -62,7 +62,7 @@ class TestYMMRegister(TestBase):
 else:
 register_range = 8
 for i in range(register_range):
-j = i - ((i / 8) * 8)
+j = i - ((i // 8) * 8)
 self.runCmd("thread step-inst")
 
 register_byte = (byte_pattern1 | j)
@@ -104,7 +104,7 @@ class TestYMMRegister(TestBase):
 else:
 register_range = 8
 for i in range(register_range):
-j = i - ((i / 8) * 8)
+j = i - ((i // 8) * 8)
 self.runCmd("thread step-inst")
 self.runCmd("thread step-inst")
 


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


[Lldb-commits] [lldb] r359349 - Pass explicit C++ version to test

2019-04-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 26 14:16:15 2019
New Revision: 359349

URL: http://llvm.org/viewvc/llvm-project?rev=359349&view=rev
Log:
Pass explicit C++ version to test

stop-hook-threads.cpp uses C++11 features, so ask for C++11 explicitely.
This isn't broken on mainstream because clang defaults to a newer C++
version now, but it breaks if testing against an older compiler.

Modified:
lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test

Modified: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test?rev=359349&r1=359348&r2=359349&view=diff
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test (original)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test Fri Apr 26 
14:16:15 2019
@@ -1,4 +1,4 @@
-# RUN: %clangxx %p/Inputs/stop-hook-threads.cpp -g -o %t
+# RUN: %clangxx -std=c++11 %p/Inputs/stop-hook-threads.cpp -g -o %t
 # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
 # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \


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


[Lldb-commits] [lldb] r361440 - Actaully lock accesses to OptionValueFileSpecList objects

2019-05-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Wed May 22 14:58:52 2019
New Revision: 361440

URL: http://llvm.org/viewvc/llvm-project?rev=361440&view=rev
Log:
Actaully lock accesses to OptionValueFileSpecList objects

The patch in r359029 missed a few accessors and mutators. This patch
also changes the lock to a recursive one as OptionValueFileSpecList::Clear()
can be invoked from some of the other methods.

Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=361440&r1=361439&r2=361440&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Wed May 22 
14:58:52 2019
@@ -40,6 +40,7 @@ public:
  VarSetOperationType = eVarSetOperationAssign) = delete;
 
   bool Clear() override {
+std::lock_guard lock(m_mutex);
 m_current_value.Clear();
 m_value_was_set = false;
 return true;
@@ -52,22 +53,22 @@ public:
   // Subclass specific functions
 
   FileSpecList GetCurrentValue() const {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 return m_current_value;
   }
 
   void SetCurrentValue(const FileSpecList &value) {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 m_current_value = value;
   }
 
   void AppendCurrentValue(const FileSpec &value) {
-std::lock_guard lock(m_mutex);
+std::lock_guard lock(m_mutex);
 m_current_value.Append(value);
   }
 
 protected:
-  mutable std::mutex m_mutex;
+  mutable std::recursive_mutex m_mutex;
   FileSpecList m_current_value;
 };
 

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=361440&r1=361439&r2=361440&view=diff
==
--- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp Wed May 22 
14:58:52 2019
@@ -17,6 +17,7 @@ using namespace lldb_private;
 
 void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
 Stream &strm, uint32_t dump_mask) {
+  std::lock_guard lock(m_mutex);
   if (dump_mask & eDumpOptionType)
 strm.Printf("(%s)", GetTypeAsCString());
   if (dump_mask & eDumpOptionValue) {
@@ -43,6 +44,7 @@ void OptionValueFileSpecList::DumpValue(
 
 Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
+  std::lock_guard lock(m_mutex);
   Status error;
   Args args(value.str());
   const size_t argc = args.GetArgumentCount();
@@ -163,6 +165,6 @@ Status OptionValueFileSpecList::SetValue
 }
 
 lldb::OptionValueSP OptionValueFileSpecList::DeepCopy() const {
-  std::lock_guard lock(m_mutex);
+  std::lock_guard lock(m_mutex);
   return OptionValueSP(new OptionValueFileSpecList(m_current_value));
 }


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