[Lldb-commits] [lldb] r302027 - Don't attempt to use mpx registers on unsupported platforms

2017-05-03 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Wed May  3 10:00:04 2017
New Revision: 302027

URL: http://llvm.org/viewvc/llvm-project?rev=302027&view=rev
Log:
Don't attempt to use mpx registers on unsupported platforms

Summary:
The existing cpp-level checks using PR_MPX_ENABLE_MANAGEMENT aren't sufficient,
as this isn't defined for linux kernel versions below 3.19.

Reviewers: valentinagiusti, zturner, labath

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp?rev=302027&r1=302026&r2=302027&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
 Wed May  3 10:00:04 2017
@@ -14,6 +14,11 @@
 int
 main(int argc, char const *argv[])
 {
+// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 
3.19
+#ifndef PR_MPX_ENABLE_MANAGEMENT
+return -1;
+#endif
+
 // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
 if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
 return -1;

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp?rev=302027&r1=302026&r2=302027&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
 Wed May  3 10:00:04 2017
@@ -29,6 +29,11 @@ main(int argc, char const *argv[])
   unsigned int rax, rbx, rcx, rdx;
   int array[5];
 
+// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 
3.19
+#ifndef PR_MPX_ENABLE_MANAGEMENT
+return -1;
+#endif
+
   // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
   if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
 return -1;


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


[Lldb-commits] [lldb] r302260 - Add missing 'arch' key to valid qHostInfo keys

2017-05-05 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Fri May  5 12:18:08 2017
New Revision: 302260

URL: http://llvm.org/viewvc/llvm-project?rev=302260&view=rev
Log:
Add missing 'arch' key to valid qHostInfo keys

Summary:
'arch' is a valid qHostInfo key, but the unit
test for qHostInfo did not include it in the set of possible keys.

Reviewers: tfiala, labath

Subscribers: lldb-commits

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

Modified:

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

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py?rev=302260&r1=302259&r2=302260&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
 Fri May  5 12:18:08 2017
@@ -14,6 +14,7 @@ class TestGdbRemoteHostInfo(GdbRemoteTes
 mydir = TestBase.compute_mydir(__file__)
 
 KNOWN_HOST_INFO_KEYS = set([
+"arch",
 "cputype",
 "cpusubtype",
 "distribution_id",


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


[Lldb-commits] [lldb] r313537 - Use ThreadLauncher to launch TaskPool threads

2017-09-18 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Mon Sep 18 08:18:48 2017
New Revision: 313537

URL: http://llvm.org/viewvc/llvm-project?rev=313537&view=rev
Log:
Use ThreadLauncher to launch TaskPool threads

Summary:
This allows for the stack size to be configured, which isn't
possible with std::thread. Prevents overflowing the stack when
performing complex operations in the task pool on darwin,
where the default pthread stack size is only 512kb.

Reviewers: labath, tberghammer, clayborg

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/source/Utility/TaskPool.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TaskPool.cpp?rev=313537&r1=313536&r2=313537&view=diff
==
--- lldb/trunk/source/Utility/TaskPool.cpp (original)
+++ lldb/trunk/source/Utility/TaskPool.cpp Mon Sep 18 08:18:48 2017
@@ -8,6 +8,7 @@
 
//===--===//
 
 #include "lldb/Utility/TaskPool.h"
+#include "lldb/Host/ThreadLauncher.h"
 
 #include  // for uint32_t
 #include// for queue
@@ -23,6 +24,8 @@ public:
 private:
   TaskPoolImpl();
 
+  static lldb::thread_result_t WorkerPtr(void *pool);
+
   static void Worker(TaskPoolImpl *pool);
 
   std::queue> m_tasks;
@@ -45,6 +48,7 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_
 
 void TaskPoolImpl::AddTask(std::function &&task_fn) {
   static const uint32_t max_threads = std::thread::hardware_concurrency();
+  const size_t min_stack_size = 8 * 1024 * 1024;
 
   std::unique_lock lock(m_tasks_mutex);
   m_tasks.emplace(std::move(task_fn));
@@ -54,10 +58,17 @@ void TaskPoolImpl::AddTask(std::function
 // This prevents the thread
 // from exiting prematurely and triggering a linux libc bug
 // (https://sourceware.org/bugzilla/show_bug.cgi?id=19951).
-std::thread(Worker, this).detach();
+lldb_private::ThreadLauncher::LaunchThread("task-pool.worker", WorkerPtr,
+   this, nullptr, min_stack_size)
+.Release();
   }
 }
 
+lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
+  Worker((TaskPoolImpl *)pool);
+  return 0;
+}
+
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
   while (true) {
 std::unique_lock lock(pool->m_tasks_mutex);


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


[Lldb-commits] [lldb] r313539 - Revert "Use ThreadLauncher to launch TaskPool threads"

2017-09-18 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Mon Sep 18 08:43:59 2017
New Revision: 313539

URL: http://llvm.org/viewvc/llvm-project?rev=313539&view=rev
Log:
Revert "Use ThreadLauncher to launch TaskPool threads"

This reverts commit r313537 because it fails to link on linux buildbots

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

Modified: lldb/trunk/source/Utility/TaskPool.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TaskPool.cpp?rev=313539&r1=313538&r2=313539&view=diff
==
--- lldb/trunk/source/Utility/TaskPool.cpp (original)
+++ lldb/trunk/source/Utility/TaskPool.cpp Mon Sep 18 08:43:59 2017
@@ -8,7 +8,6 @@
 
//===--===//
 
 #include "lldb/Utility/TaskPool.h"
-#include "lldb/Host/ThreadLauncher.h"
 
 #include  // for uint32_t
 #include// for queue
@@ -24,8 +23,6 @@ public:
 private:
   TaskPoolImpl();
 
-  static lldb::thread_result_t WorkerPtr(void *pool);
-
   static void Worker(TaskPoolImpl *pool);
 
   std::queue> m_tasks;
@@ -48,7 +45,6 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_
 
 void TaskPoolImpl::AddTask(std::function &&task_fn) {
   static const uint32_t max_threads = std::thread::hardware_concurrency();
-  const size_t min_stack_size = 8 * 1024 * 1024;
 
   std::unique_lock lock(m_tasks_mutex);
   m_tasks.emplace(std::move(task_fn));
@@ -58,17 +54,10 @@ void TaskPoolImpl::AddTask(std::function
 // This prevents the thread
 // from exiting prematurely and triggering a linux libc bug
 // (https://sourceware.org/bugzilla/show_bug.cgi?id=19951).
-lldb_private::ThreadLauncher::LaunchThread("task-pool.worker", WorkerPtr,
-   this, nullptr, min_stack_size)
-.Release();
+std::thread(Worker, this).detach();
   }
 }
 
-lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
-  Worker((TaskPoolImpl *)pool);
-  return 0;
-}
-
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
   while (true) {
 std::unique_lock lock(pool->m_tasks_mutex);


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


[Lldb-commits] [lldb] r313637 - Use ThreadLauncher to launch TaskPool threads

2017-09-19 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Tue Sep 19 08:38:30 2017
New Revision: 313637

URL: http://llvm.org/viewvc/llvm-project?rev=313637&view=rev
Log:
Use ThreadLauncher to launch TaskPool threads

Summary:
This allows for the stack size to be configured, which isn't
possible with std::thread. Prevents overflowing the stack when
performing complex operations in the task pool on darwin,
where the default pthread stack size is only 512kb.

This also moves TaskPool from Utility to Host.

Reviewers: labath, tberghammer, clayborg

Subscribers: lldb-commits

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

Added:
lldb/trunk/include/lldb/Host/TaskPool.h
  - copied, changed from r313540, lldb/trunk/include/lldb/Utility/TaskPool.h
lldb/trunk/source/Host/common/TaskPool.cpp
  - copied, changed from r313540, lldb/trunk/source/Utility/TaskPool.cpp
lldb/trunk/unittests/Host/TaskPoolTest.cpp
  - copied, changed from r313540, 
lldb/trunk/unittests/Utility/TaskPoolTest.cpp
Removed:
lldb/trunk/include/lldb/Utility/TaskPool.h
lldb/trunk/source/Utility/TaskPool.cpp
lldb/trunk/unittests/Utility/TaskPoolTest.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/unittests/Host/CMakeLists.txt
lldb/trunk/unittests/Utility/CMakeLists.txt

Copied: lldb/trunk/include/lldb/Host/TaskPool.h (from r313540, 
lldb/trunk/include/lldb/Utility/TaskPool.h)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/TaskPool.h?p2=lldb/trunk/include/lldb/Host/TaskPool.h&p1=lldb/trunk/include/lldb/Utility/TaskPool.h&r1=313540&r2=313637&rev=313637&view=diff
==
(empty)

Removed: lldb/trunk/include/lldb/Utility/TaskPool.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TaskPool.h?rev=313636&view=auto
==
--- lldb/trunk/include/lldb/Utility/TaskPool.h (original)
+++ lldb/trunk/include/lldb/Utility/TaskPool.h (removed)
@@ -1,92 +0,0 @@
-//===- TaskPool.h ---*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef utility_TaskPool_h_
-#define utility_TaskPool_h_
-
-#include "llvm/ADT/STLExtras.h"
-#include  // for bind, function
-#include 
-#include 
-#include   // for make_shared
-#include// for mutex, unique_lock, condition_variable
-#include  // for forward, result_of, move
-
-// Global TaskPool class for running tasks in parallel on a set of worker 
thread
-// created the first
-// time the task pool is used. The TaskPool provide no guarantee about the 
order
-// the task will be run
-// and about what tasks will run in parallel. None of the task added to the 
task
-// pool should block
-// on something (mutex, future, condition variable) what will be set only by 
the
-// completion of an
-// other task on the task pool as they may run on the same thread sequentally.
-class TaskPool {
-public:
-  // Add a new task to the task pool and return a std::future belonging to the
-  // newly created task.
-  // The caller of this function has to wait on the future for this task to
-  // complete.
-  template 
-  static std::future::type>
-  AddTask(F &&f, Args &&... args);
-
-  // Run all of the specified tasks on the task pool and wait until all of them
-  // are finished
-  // before returning. This method is intended to be used for small number 
tasks
-  // where listing
-  // them as function arguments is acceptable. For running large number of 
tasks
-  // you should use
-  // AddTask for each task and then call wait() on each returned future.
-  template  static void RunTasks(T &&... tasks);
-
-private:
-  TaskPool() = delete;
-
-  template  struct RunTaskImpl;
-
-  static void AddTaskImpl(std::function &&task_fn);
-};
-
-template 
-std::future::type>
-TaskPool::AddTask(F &&f, Args &&... args) {
-  auto task_sp = std::make_shared<
-  std::packaged_task::type()>>(
-  std::bind(std::forward(f), std::forward(args)...));
-
-  AddTaskImpl([task_sp]() { (*task_sp)(); });
-
-  return task_sp->get_future();
-}
-
-template  void TaskPool::RunTasks(T &&... tasks) {
-  RunTaskImpl::Run(std::forward(tasks)...);
-}
-
-template 
-struct TaskPool::RunTaskImpl {
-  static void Run(Head &&h, Tail &&... t) {
-auto f = AddTask(std::forward(h));
-RunTaskImpl::Run(std::forward(t)...);
-f.wait();
-  }
-};
-
-template <> struct TaskPool::RunTaskImpl<> {
-  static void Run() {}
-};
-
-// Run 'func' on every value from begin .. end-1.  Each worker will grab
-// 'batch_size' n

[Lldb-commits] [lldb] r313642 - Fix build of TaskPoolTest with xcodebuild

2017-09-19 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Tue Sep 19 10:13:39 2017
New Revision: 313642

URL: http://llvm.org/viewvc/llvm-project?rev=313642&view=rev
Log:
Fix build of TaskPoolTest with xcodebuild

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=313642&r1=313641&r2=313642&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Sep 19 10:13:39 2017
@@ -3372,6 +3372,7 @@
2321F9391BDD332400BA9A93 /* 
SocketAddressTest.cpp */,
2321F93A1BDD332400BA9A93 /* SocketTest.cpp */,
2321F93B1BDD332400BA9A93 /* SymbolsTest.cpp */,
+   2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
);
path = Host;
sourceTree = "";
@@ -3411,7 +3412,6 @@
2321F9431BDD346100BA9A93 /* CMakeLists.txt */,
23CB15041D66CD9200EDDDE1 /* Inputs */,
2321F9441BDD346100BA9A93 /* 
StringExtractorTest.cpp */,
-   2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */,
2321F9461BDD346100BA9A93 /* UriParserTest.cpp 
*/,
);


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


[Lldb-commits] [lldb] r283491 - Fix GetDisplayName when only a demangled name is available

2016-10-06 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Thu Oct  6 15:41:11 2016
New Revision: 283491

URL: http://llvm.org/viewvc/llvm-project?rev=283491&view=rev
Log:
Fix GetDisplayName when only a demangled name is available

Summary:
GetDisplayDemangledName will already return a ConstString() when
there is neither a mangled name or a demangled name, so we don't need to special
case here. This will fix GetDisplayName in cases where m_mangled contains
only a demangled name and not a mangled name.

Reviewers: clayborg, granata.enrico, sas

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=283491&r1=283490&r2=283491&view=diff
==
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Thu Oct  6 15:41:11 2016
@@ -347,8 +347,6 @@ bool Function::IsTopLevelFunction() {
 }
 
 ConstString Function::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 

Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=283491&r1=283490&r2=283491&view=diff
==
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Thu Oct  6 15:41:11 2016
@@ -117,8 +117,6 @@ bool Symbol::ValueIsAddress() const {
 }
 
 ConstString Symbol::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 


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


[Lldb-commits] [PATCH] D25201: Fix GetDisplayName when only a demangled name is available

2016-10-06 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283491: Fix GetDisplayName when only a demangled name is 
available (authored by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D25201?vs=73307&id=73847#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25201

Files:
  lldb/trunk/source/Symbol/Function.cpp
  lldb/trunk/source/Symbol/Symbol.cpp


Index: lldb/trunk/source/Symbol/Function.cpp
===
--- lldb/trunk/source/Symbol/Function.cpp
+++ lldb/trunk/source/Symbol/Function.cpp
@@ -347,8 +347,6 @@
 }
 
 ConstString Function::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 
Index: lldb/trunk/source/Symbol/Symbol.cpp
===
--- lldb/trunk/source/Symbol/Symbol.cpp
+++ lldb/trunk/source/Symbol/Symbol.cpp
@@ -117,8 +117,6 @@
 }
 
 ConstString Symbol::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 


Index: lldb/trunk/source/Symbol/Function.cpp
===
--- lldb/trunk/source/Symbol/Function.cpp
+++ lldb/trunk/source/Symbol/Function.cpp
@@ -347,8 +347,6 @@
 }
 
 ConstString Function::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 
Index: lldb/trunk/source/Symbol/Symbol.cpp
===
--- lldb/trunk/source/Symbol/Symbol.cpp
+++ lldb/trunk/source/Symbol/Symbol.cpp
@@ -117,8 +117,6 @@
 }
 
 ConstString Symbol::GetDisplayName() const {
-  if (!m_mangled)
-return ConstString();
   return m_mangled.GetDisplayDemangledName(GetLanguage());
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D19557: Use absolute module path when possible if sent in svr4 packets

2016-04-26 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: ovyalov, ADodds, jasonmolenda, clayborg.
fjricci added subscribers: sas, lldb-commits.

If the remote uses svr4 packets to communicate library info,
the LoadUnload tests will fail, as lldb only used the basename
for modules, causing problems when two modules have the same basename.

Using absolute path as sent by the remote will ensure that lldb
locates the module from the correct directory when there are overlapping
basenames. When debugging a remote process, LoadModuleAtAddress will still
fall back to using basename and module_search_paths, so we don't
need to worry about using absolute paths in this case.

http://reviews.llvm.org/D19557

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4863,14 +4863,7 @@
 if (!modInfo.get_link_map (link_map))
 link_map = LLDB_INVALID_ADDRESS;
 
-// hack (cleaner way to get file name only?) (win/unix compat?)
-size_t marker = mod_name.rfind ('/');
-if (marker == std::string::npos)
-marker = 0;
-else
-marker += 1;
-
-FileSpec file (mod_name.c_str()+marker, true);
+FileSpec file (mod_name.c_str(), true);
 lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, 
mod_base,
 mod_base_is_offset);
 


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4863,14 +4863,7 @@
 if (!modInfo.get_link_map (link_map))
 link_map = LLDB_INVALID_ADDRESS;
 
-// hack (cleaner way to get file name only?) (win/unix compat?)
-size_t marker = mod_name.rfind ('/');
-if (marker == std::string::npos)
-marker = 0;
-else
-marker += 1;
-
-FileSpec file (mod_name.c_str()+marker, true);
+FileSpec file (mod_name.c_str(), true);
 lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, mod_base,
 mod_base_is_offset);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r267741 - Use absolute module path when possible if sent in svr4 packets

2016-04-27 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Wed Apr 27 12:10:15 2016
New Revision: 267741

URL: http://llvm.org/viewvc/llvm-project?rev=267741&view=rev
Log:
Use absolute module path when possible if sent in svr4 packets

Summary:
If the remote uses svr4 packets to communicate library info,
the LoadUnload tests will fail, as lldb only used the basename
for modules, causing problems when two modules have the same basename.

Using absolute path as sent by the remote will ensure that lldb
locates the module from the correct directory when there are overlapping
basenames. When debugging a remote process, LoadModuleAtAddress will still
fall back to using basename and module_search_paths, so we don't
need to worry about using absolute paths in this case.

Reviewers: ADodds, jasonmolenda, clayborg, ovyalov

Subscribers: lldb-commits, sas

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

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=267741&r1=267740&r2=267741&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Apr 
27 12:10:15 2016
@@ -4863,14 +4863,7 @@ ProcessGDBRemote::LoadModules (LoadedMod
 if (!modInfo.get_link_map (link_map))
 link_map = LLDB_INVALID_ADDRESS;
 
-// hack (cleaner way to get file name only?) (win/unix compat?)
-size_t marker = mod_name.rfind ('/');
-if (marker == std::string::npos)
-marker = 0;
-else
-marker += 1;
-
-FileSpec file (mod_name.c_str()+marker, true);
+FileSpec file (mod_name.c_str(), true);
 lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, 
mod_base,
 mod_base_is_offset);
 


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


Re: [Lldb-commits] [PATCH] D19557: Use absolute module path when possible if sent in svr4 packets

2016-04-27 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267741: Use absolute module path when possible if sent in 
svr4 packets (authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D19557?vs=55083&id=55253#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19557

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4863,14 +4863,7 @@
 if (!modInfo.get_link_map (link_map))
 link_map = LLDB_INVALID_ADDRESS;
 
-// hack (cleaner way to get file name only?) (win/unix compat?)
-size_t marker = mod_name.rfind ('/');
-if (marker == std::string::npos)
-marker = 0;
-else
-marker += 1;
-
-FileSpec file (mod_name.c_str()+marker, true);
+FileSpec file (mod_name.c_str(), true);
 lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, 
mod_base,
 mod_base_is_offset);
 


Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4863,14 +4863,7 @@
 if (!modInfo.get_link_map (link_map))
 link_map = LLDB_INVALID_ADDRESS;
 
-// hack (cleaner way to get file name only?) (win/unix compat?)
-size_t marker = mod_name.rfind ('/');
-if (marker == std::string::npos)
-marker = 0;
-else
-marker += 1;
-
-FileSpec file (mod_name.c_str()+marker, true);
+FileSpec file (mod_name.c_str(), true);
 lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, mod_base,
 mod_base_is_offset);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D19608: Checkout release_38 branches of llvm and clang when building lldb 3.8

2016-04-27 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, jasonmolenda.
fjricci added subscribers: hans, sas, lldb-commits.

This commit is intended only for the release_38 branch, not for master.

Fixes xcodebuild for the release_38 branch, since llvm and clang must
be on the same branch as lldb when building.

http://reviews.llvm.org/D19608

Files:
  scripts/build-llvm.pl

Index: scripts/build-llvm.pl
===
--- scripts/build-llvm.pl
+++ scripts/build-llvm.pl
@@ -22,10 +22,6 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "HEAD";
-our $clang_revision = "HEAD";
-our $compiler_rt_revision = "HEAD";
-
 our $SRCROOT = "$ENV{SRCROOT}";
 our @archs = split (/\s+/, $ENV{ARCHS});
 my $os_release = 11;
@@ -64,12 +60,12 @@
 }
 else
 {
-print "Checking out llvm sources from revision $llvm_revision...\n";
-do_command ("cd '$SRCROOT' && svn co --quiet --revision $llvm_revision 
http://llvm.org/svn/llvm-project/llvm/trunk llvm", "checking out llvm from 
repository", 1);
-print "Checking out clang sources from revision $clang_revision...\n";
-do_command ("cd '$llvm_srcroot/tools' && svn co --quiet --revision 
$clang_revision http://llvm.org/svn/llvm-project/cfe/trunk clang", "checking 
out clang from repository", 1);
-#print "Checking out compiler-rt sources from revision 
$compiler_rt_revision...\n";
-#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet --revision 
$compiler_rt_revision http://llvm.org/svn/llvm-project/compiler-rt/trunk 
compiler-rt", "checking out compiler-rt from repository", 1);
+print "Checking out llvm sources from release_38...\n";
+do_command ("cd '$SRCROOT' && svn co --quiet 
http://llvm.org/svn/llvm-project/llvm/branches/release_38 llvm", "checking out 
llvm from repository", 1);
+print "Checking out clang sources from release_38...\n";
+do_command ("cd '$llvm_srcroot/tools' && svn co --quiet 
http://llvm.org/svn/llvm-project/cfe/branches/release_38 clang", "checking out 
clang from repository", 1);
+#print "Checking out compiler-rt sources from release_38...\n";
+#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet 
http://llvm.org/svn/llvm-project/compiler-rt/branches/release_38 compiler-rt", 
"checking out compiler-rt from repository", 1);
 print "Applying any local patches to LLVM/Clang...";
 
 my @llvm_patches = bsd_glob("$ENV{SRCROOT}/scripts/llvm.*.diff");


Index: scripts/build-llvm.pl
===
--- scripts/build-llvm.pl
+++ scripts/build-llvm.pl
@@ -22,10 +22,6 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "HEAD";
-our $clang_revision = "HEAD";
-our $compiler_rt_revision = "HEAD";
-
 our $SRCROOT = "$ENV{SRCROOT}";
 our @archs = split (/\s+/, $ENV{ARCHS});
 my $os_release = 11;
@@ -64,12 +60,12 @@
 }
 else
 {
-print "Checking out llvm sources from revision $llvm_revision...\n";
-do_command ("cd '$SRCROOT' && svn co --quiet --revision $llvm_revision http://llvm.org/svn/llvm-project/llvm/trunk llvm", "checking out llvm from repository", 1);
-print "Checking out clang sources from revision $clang_revision...\n";
-do_command ("cd '$llvm_srcroot/tools' && svn co --quiet --revision $clang_revision http://llvm.org/svn/llvm-project/cfe/trunk clang", "checking out clang from repository", 1);
-#print "Checking out compiler-rt sources from revision $compiler_rt_revision...\n";
-#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet --revision $compiler_rt_revision http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt", "checking out compiler-rt from repository", 1);
+print "Checking out llvm sources from release_38...\n";
+do_command ("cd '$SRCROOT' && svn co --quiet http://llvm.org/svn/llvm-project/llvm/branches/release_38 llvm", "checking out llvm from repository", 1);
+print "Checking out clang sources from release_38...\n";
+do_command ("cd '$llvm_srcroot/tools' && svn co --quiet http://llvm.org/svn/llvm-project/cfe/branches/release_38 clang", "checking out clang from repository", 1);
+#print "Checking out compiler-rt sources from release_38...\n";
+#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet http://llvm.org/svn/llvm-project/compiler-rt/branches/release_38 compiler-rt", "checking out compiler-rt from repository", 1);
 print "Applying any local patches to LLVM/Clang...";
 
 my @llvm_patches = bsd_glob("$ENV{SRCROOT}/scripts/llvm.*.diff");
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-27 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: granata.enrico, zturner.
fjricci added subscribers: sas, lldb-commits.

This should make TestCommandScriptImmediateOutput more consistent
with the rest of the test suite.

http://reviews.llvm.org/D19633

Files:
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -13,28 +13,25 @@
 from lldbsuite.test.lldbpexpect import *
 from lldbsuite.test import lldbutil
 
-class CommandScriptImmediateOutputTestCase (PExpectTest):
+class CommandScriptImmediateOutputTestCase (TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
 def setUp(self):
 # Call super's setUp().
-PExpectTest.setUp(self)
+TestBase.setUp(self)
 
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
 def test_command_script_immediate_output (self):
 """Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
-
 script = os.path.join(os.getcwd(), 'custom_command.py')
-prompt = "\(lldb\) "
   
-self.sendline('command script import %s' % script, patterns=[prompt])
-self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
-self.sendline('mycommand', patterns='this is a test string, just a 
test string')
-self.sendline('command script delete mycommand', patterns=[prompt])
+self.runCmd('command script import %s' % script)
+self.runCmd('command script add -f custom_command.command_function 
mycommand')
+self.expect('mycommand', substrs = ['this is a test string, just a 
test string'])
+self.runCmd('command script delete mycommand')
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,15 +47,12 @@
 with open(path, 'w+') as init:
 init.write(starter_string)
 
-self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
+self.runCmd('command script add -f custom_command.write_file mywrite')
+self.runCmd('command script list')
 for path, mode in test_files.iteritems():
-command = 'mywrite "' + path + '" ' + mode
-
-self.sendline(command, patterns=[prompt])
-
-self.sendline('command script delete mywrite', patterns=[prompt])
+self.runCmd('mywrite ' + path + ' ' + mode)
 
-self.quit(gracefully=False)
+self.runCmd('command script delete mywrite')
 
 for path, mode in test_files.iteritems():
 with open(path, 'r') as result:


Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -13,28 +13,25 @@
 from lldbsuite.test.lldbpexpect import *
 from lldbsuite.test import lldbutil
 
-class CommandScriptImmediateOutputTestCase (PExpectTest):
+class CommandScriptImmediateOutputTestCase (TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
 def setUp(self):
 # Call super's setUp().
-PExpectTest.setUp(self)
+TestBase.setUp(self)
 
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
 def test_command_script_immediate_output (self):
 """Test that LLDB correctly allows scripted commands to set an immediate output file."""
-self.launch(timeout=60)
-
 script = os.path.join(os.getcwd(), 'custom_command.py')
-prompt = "\(lldb\) "
   
-self.sendline('command script import %s' % script, patterns=[prompt])
-self.sendline('command script add -f c

Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-27 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 55340.
fjricci added a comment.

Remove windows expected failure


http://reviews.llvm.org/D19633

Files:
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -13,28 +13,24 @@
 from lldbsuite.test.lldbpexpect import *
 from lldbsuite.test import lldbutil
 
-class CommandScriptImmediateOutputTestCase (PExpectTest):
+class CommandScriptImmediateOutputTestCase (TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
 def setUp(self):
 # Call super's setUp().
-PExpectTest.setUp(self)
+TestBase.setUp(self)
 
 @skipIfRemote # test not remote-ready llvm.org/pr24813
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
 def test_command_script_immediate_output (self):
 """Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
-
 script = os.path.join(os.getcwd(), 'custom_command.py')
-prompt = "\(lldb\) "
   
-self.sendline('command script import %s' % script, patterns=[prompt])
-self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
-self.sendline('mycommand', patterns='this is a test string, just a 
test string')
-self.sendline('command script delete mycommand', patterns=[prompt])
+self.runCmd('command script import %s' % script)
+self.runCmd('command script add -f custom_command.command_function 
mycommand')
+self.expect('mycommand', substrs = ['this is a test string, just a 
test string'])
+self.runCmd('command script delete mycommand')
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,15 +46,12 @@
 with open(path, 'w+') as init:
 init.write(starter_string)
 
-self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
+self.runCmd('command script add -f custom_command.write_file mywrite')
+self.runCmd('command script list')
 for path, mode in test_files.iteritems():
-command = 'mywrite "' + path + '" ' + mode
-
-self.sendline(command, patterns=[prompt])
-
-self.sendline('command script delete mywrite', patterns=[prompt])
+self.runCmd('mywrite ' + path + ' ' + mode)
 
-self.quit(gracefully=False)
+self.runCmd('command script delete mywrite')
 
 for path, mode in test_files.iteritems():
 with open(path, 'r') as result:


Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -13,28 +13,24 @@
 from lldbsuite.test.lldbpexpect import *
 from lldbsuite.test import lldbutil
 
-class CommandScriptImmediateOutputTestCase (PExpectTest):
+class CommandScriptImmediateOutputTestCase (TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
 def setUp(self):
 # Call super's setUp().
-PExpectTest.setUp(self)
+TestBase.setUp(self)
 
 @skipIfRemote # test not remote-ready llvm.org/pr24813
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
 def test_command_script_immediate_output (self):
 """Test that LLDB correctly allows scripted commands to set an immediate output file."""
-self.launch(timeout=60)
-
 script = os.path.join(os.getcwd(), 'custom_command.py')
-prompt = "\(lldb\) "
   
-self.sendline('command script import %s' % script, patterns=[prompt])
-self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
-self.sendline('mycommand', patterns='this is a test 

Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-27 Thread Francis Ricci via lldb-commits
fjricci added a comment.

As of r264351, this test already writes to both the console and to files (since 
the file writing is testing the same python file io bugs tested by the console 
writing). I can make another patch to split it out if that's preferable.

However, this patch is intended to move the test off of PExpect, because I 
noticed that sendline() has some issues when running with older versions of 
lldb (like 3.8, for example), regardless of whether we're testing files or the 
console.


http://reviews.llvm.org/D19633



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


Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-28 Thread Francis Ricci via lldb-commits
fjricci abandoned this revision.
fjricci added a comment.

Ok, I'll put up a new revision to split out the test cases.


http://reviews.llvm.org/D19633



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


Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-28 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Would it be acceptable to split it into two test methods inside the same test 
case? Both are testing writing immediate output from a command script, just one 
is immediate output to the console and the other is immediate output to a file.


http://reviews.llvm.org/D19633



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


Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-28 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Oh I see. I don't think the file-writing is going to work in the PExpect mode 
(for some reason, it looks like the sendline calls aren't always being 
received/processed correctly by lldb, while runCmd works fine), so it's 
probably better to split out into a different test case then.


http://reviews.llvm.org/D19633



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


Re: [Lldb-commits] [PATCH] D19633: Move TestCommandScriptImmediateOutput from PExpectTest to TestBase

2016-04-28 Thread Francis Ricci via lldb-commits
fjricci added a comment.

I do observe the sendline() behavior on OSX, but only when I cherry-pick these 
bug-fixes onto the 3.8 branch. It seems to work fine on master.


http://reviews.llvm.org/D19633



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


[Lldb-commits] [PATCH] D19690: Split out console and file writing cases in TestCommandScriptImmediateOutput

2016-04-28 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: zturner, granata.enrico, clayborg.
fjricci added a subscriber: lldb-commits.

As these are really testing separate issues, they should be run as separate
tests.

http://reviews.llvm.org/D19690

Files:
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to the console."""
+self.launch(timeout=5)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a 
test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
+@expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_output_file (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to a file."""
+self.launch(timeout=10)
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,6 +58,11 @@
 with open(path, 'w+') as init:
 init.write(starter_string)
 
+script = os.path.join(os.getcwd(), 'custom_command.py')
+prompt = "\(lldb\) "
+
+self.sendline('command script import %s' % script, patterns=[prompt])
+
 self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
 for path, mode in test_files.iteritems():
 command = 'mywrite "' + path + '" ' + mode


Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate output to the console."""
+self.launch(timeout=5)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+@expectedFailureAll(osl

Re: [Lldb-commits] [PATCH] D19690: Split out console and file writing cases in TestCommandScriptImmediateOutput

2016-04-29 Thread Francis Ricci via lldb-commits
fjricci added inline comments.


Comment at: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py:29
@@ -30,1 +28,3 @@
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to the console."""
+self.launch(timeout=5)
 

granata.enrico wrote:
> Can we raise this a little bit? I worry that going all the way from 60 down 
> to 5 might cause this test to start failing more in load scenarios. Maybe 10 
> would be a better value?
I chose 5 because your original console unit test used 5. I changed it to 60 
when I added the file aspects. I don't have a problem changing it to 10 though


Comment at: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py:43
@@ +42,3 @@
+@expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_output_file (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to a file."""

granata.enrico wrote:
> Feel free to make the file version non pexpect-based if you want
I ended up finding clayborg's sendline bug-fix, so pexpect should be fine 
(actually probably preferred)


http://reviews.llvm.org/D19690



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


Re: [Lldb-commits] [PATCH] D19690: Split out console and file writing cases in TestCommandScriptImmediateOutput

2016-04-29 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 55619.
fjricci added a comment.

Update timeout to 10 seconds for console case


http://reviews.llvm.org/D19690

Files:
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to the console."""
+self.launch(timeout=10)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a 
test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
+@expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_output_file (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to a file."""
+self.launch(timeout=10)
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,6 +58,11 @@
 with open(path, 'w+') as init:
 init.write(starter_string)
 
+script = os.path.join(os.getcwd(), 'custom_command.py')
+prompt = "\(lldb\) "
+
+self.sendline('command script import %s' % script, patterns=[prompt])
+
 self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
 for path, mode in test_files.iteritems():
 command = 'mywrite "' + path + '" ' + mode


Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate output to the console."""
+self.launch(timeout=10)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_out

[Lldb-commits] [lldb] r268397 - Split out console and file writing cases in TestCommandScriptImmediateOutput

2016-05-03 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Tue May  3 11:31:36 2016
New Revision: 268397

URL: http://llvm.org/viewvc/llvm-project?rev=268397&view=rev
Log:
Split out console and file writing cases in TestCommandScriptImmediateOutput

Summary:
As these are really testing separate issues, they should be run as separate
tests.

Reviewers: zturner, granata.enrico, clayborg

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py?rev=268397&r1=268396&r2=268397&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
 Tue May  3 11:31:36 2016
@@ -24,17 +24,25 @@ class CommandScriptImmediateOutputTestCa
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to the console."""
+self.launch(timeout=10)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a 
test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
+@expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_output_file (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to a file."""
+self.launch(timeout=10)
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,6 +58,11 @@ class CommandScriptImmediateOutputTestCa
 with open(path, 'w+') as init:
 init.write(starter_string)
 
+script = os.path.join(os.getcwd(), 'custom_command.py')
+prompt = "\(lldb\) "
+
+self.sendline('command script import %s' % script, patterns=[prompt])
+
 self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
 for path, mode in test_files.iteritems():
 command = 'mywrite "' + path + '" ' + mode


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


Re: [Lldb-commits] [PATCH] D19690: Split out console and file writing cases in TestCommandScriptImmediateOutput

2016-05-03 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268397: Split out console and file writing cases in 
TestCommandScriptImmediateOutput (authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D19690?vs=55619&id=56020#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19690

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to the console."""
+self.launch(timeout=10)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a 
test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need 
a pexpect replacement for windows")
+@expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
+def test_command_script_immediate_output_file (self):
+"""Test that LLDB correctly allows scripted commands to set immediate 
output to a file."""
+self.launch(timeout=10)
 
 test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
   os.path.join(os.getcwd(), 'write.txt')   :'w',
@@ -50,6 +58,11 @@
 with open(path, 'w+') as init:
 init.write(starter_string)
 
+script = os.path.join(os.getcwd(), 'custom_command.py')
+prompt = "\(lldb\) "
+
+self.sendline('command script import %s' % script, patterns=[prompt])
+
 self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
 for path, mode in test_files.iteritems():
 command = 'mywrite "' + path + '" ' + mode


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -24,17 +24,25 @@
 @skipIfRemote # test not remote-ready llvm.org/pr24813
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
 @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139")
-def test_command_script_immediate_output (self):
-"""Test that LLDB correctly allows scripted commands to set an immediate output file."""
-self.launch(timeout=60)
+def test_command_script_immediate_output_console (self):
+"""Test that LLDB correctly allows scripted commands to set immediate output to the console."""
+self.launch(timeout=10)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "\(lldb\) "
-  
+
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+self.quit(gracefully=False)
+
+@skipIfRemote # test not remot

Re: [Lldb-commits] [PATCH] D19608: Checkout release_38 branches of llvm and clang when building lldb 3.8

2016-05-19 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270065: Checkout release_38 branches of llvm and clang when 
building lldb 3.8 (authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D19608?vs=55274&id=57791#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19608

Files:
  lldb/branches/release_38/scripts/build-llvm.pl

Index: lldb/branches/release_38/scripts/build-llvm.pl
===
--- lldb/branches/release_38/scripts/build-llvm.pl
+++ lldb/branches/release_38/scripts/build-llvm.pl
@@ -22,10 +22,6 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "HEAD";
-our $clang_revision = "HEAD";
-our $compiler_rt_revision = "HEAD";
-
 our $SRCROOT = "$ENV{SRCROOT}";
 our @archs = split (/\s+/, $ENV{ARCHS});
 my $os_release = 11;
@@ -64,12 +60,12 @@
 }
 else
 {
-print "Checking out llvm sources from revision $llvm_revision...\n";
-do_command ("cd '$SRCROOT' && svn co --quiet --revision $llvm_revision 
http://llvm.org/svn/llvm-project/llvm/trunk llvm", "checking out llvm from 
repository", 1);
-print "Checking out clang sources from revision $clang_revision...\n";
-do_command ("cd '$llvm_srcroot/tools' && svn co --quiet --revision 
$clang_revision http://llvm.org/svn/llvm-project/cfe/trunk clang", "checking 
out clang from repository", 1);
-#print "Checking out compiler-rt sources from revision 
$compiler_rt_revision...\n";
-#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet --revision 
$compiler_rt_revision http://llvm.org/svn/llvm-project/compiler-rt/trunk 
compiler-rt", "checking out compiler-rt from repository", 1);
+print "Checking out llvm sources from release_38...\n";
+do_command ("cd '$SRCROOT' && svn co --quiet 
http://llvm.org/svn/llvm-project/llvm/branches/release_38 llvm", "checking out 
llvm from repository", 1);
+print "Checking out clang sources from release_38...\n";
+do_command ("cd '$llvm_srcroot/tools' && svn co --quiet 
http://llvm.org/svn/llvm-project/cfe/branches/release_38 clang", "checking out 
clang from repository", 1);
+#print "Checking out compiler-rt sources from release_38...\n";
+#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet 
http://llvm.org/svn/llvm-project/compiler-rt/branches/release_38 compiler-rt", 
"checking out compiler-rt from repository", 1);
 print "Applying any local patches to LLVM/Clang...";
 
 my @llvm_patches = bsd_glob("$ENV{SRCROOT}/scripts/llvm.*.diff");


Index: lldb/branches/release_38/scripts/build-llvm.pl
===
--- lldb/branches/release_38/scripts/build-llvm.pl
+++ lldb/branches/release_38/scripts/build-llvm.pl
@@ -22,10 +22,6 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "HEAD";
-our $clang_revision = "HEAD";
-our $compiler_rt_revision = "HEAD";
-
 our $SRCROOT = "$ENV{SRCROOT}";
 our @archs = split (/\s+/, $ENV{ARCHS});
 my $os_release = 11;
@@ -64,12 +60,12 @@
 }
 else
 {
-print "Checking out llvm sources from revision $llvm_revision...\n";
-do_command ("cd '$SRCROOT' && svn co --quiet --revision $llvm_revision http://llvm.org/svn/llvm-project/llvm/trunk llvm", "checking out llvm from repository", 1);
-print "Checking out clang sources from revision $clang_revision...\n";
-do_command ("cd '$llvm_srcroot/tools' && svn co --quiet --revision $clang_revision http://llvm.org/svn/llvm-project/cfe/trunk clang", "checking out clang from repository", 1);
-#print "Checking out compiler-rt sources from revision $compiler_rt_revision...\n";
-#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet --revision $compiler_rt_revision http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt", "checking out compiler-rt from repository", 1);
+print "Checking out llvm sources from release_38...\n";
+do_command ("cd '$SRCROOT' && svn co --quiet http://llvm.org/svn/llvm-project/llvm/branches/release_38 llvm", "checking out llvm from repository", 1);
+print "Checking out clang sources from release_38...\n";
+do_command ("cd '$llvm_srcroot/tools' && svn co --quiet http://llvm.org/svn/llvm-project/cfe/branches/release_38 clang", "checking out clang from repository", 1);
+#print "Checking out compiler-rt sources from release_38...\n";
+#do_command ("cd '$llvm_srcroot/projects' && svn co --quiet http://llvm.org/svn/llvm-project/compiler-rt/branches/release_38 compiler-rt", "checking out compiler-rt from repository", 1);
 print "Applying any local patches to LLVM/Clang...";
 
 my @llvm_patches = bsd_glob("$ENV{SRCROOT}/scripts/llvm.*.diff");
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2016-05-21 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: vharron, clayborg, jasonmolenda.
fjricci added a subscriber: lldb-commits.

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

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

http://reviews.llvm.org/D20509

Files:
  source/Utility/StringExtractor.cpp

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


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


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

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

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

Repository:
  rL LLVM

http://reviews.llvm.org/D20509

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

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


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


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

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

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

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

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

Reviewers: vharron, jasonmolenda, clayborg

Subscribers: sas, lldb-commits

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

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

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


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


[Lldb-commits] [PATCH] D20990: Don't remove PIE executables when using svr4 packets

2016-06-03 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, ADodds, tfiala.
fjricci added a subscriber: lldb-commits.

Because PIE executables have an e_type of llvm::ELF::ET_DYN,
they are not of type eTypeExecutable, and were being removed
when svr4 packets were used.

http://reviews.llvm.org/D20990

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4878,8 +4878,10 @@
 if (!found)
 {
 lldb_private::ObjectFile * obj = loaded_module->GetObjectFile 
();
-if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable)
+if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable &&
+loaded_module.get() != 
target.GetExecutableModulePointer()) {
 removed_modules.Append (loaded_module);
+}
 }
 }
 


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4878,8 +4878,10 @@
 if (!found)
 {
 lldb_private::ObjectFile * obj = loaded_module->GetObjectFile ();
-if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable)
+if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable &&
+loaded_module.get() != target.GetExecutableModulePointer()) {
 removed_modules.Append (loaded_module);
+}
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D20990: Don't remove PIE executables when using svr4 packets

2016-06-03 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 59633.
fjricci added a comment.

Fix curly-brace style


http://reviews.llvm.org/D20990

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4878,8 +4878,11 @@
 if (!found)
 {
 lldb_private::ObjectFile * obj = loaded_module->GetObjectFile 
();
-if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable)
+if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable &&
+loaded_module.get() != target.GetExecutableModulePointer())
+{
 removed_modules.Append (loaded_module);
+}
 }
 }
 


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4878,8 +4878,11 @@
 if (!found)
 {
 lldb_private::ObjectFile * obj = loaded_module->GetObjectFile ();
-if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable)
+if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable &&
+loaded_module.get() != target.GetExecutableModulePointer())
+{
 removed_modules.Append (loaded_module);
+}
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D20990: Don't remove PIE executables when using svr4 packets

2016-06-03 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 59637.
fjricci added a comment.

Refactor to remove unnecessary object file type checking


http://reviews.llvm.org/D20990

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4875,11 +4875,9 @@
 found = true;
 }
 
-if (!found)
+if (!found && loaded_module.get() != 
target.GetExecutableModulePointer())
 {
-lldb_private::ObjectFile * obj = loaded_module->GetObjectFile 
();
-if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable)
-removed_modules.Append (loaded_module);
+removed_modules.Append (loaded_module);
 }
 }
 


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4875,11 +4875,9 @@
 found = true;
 }
 
-if (!found)
+if (!found && loaded_module.get() != target.GetExecutableModulePointer())
 {
-lldb_private::ObjectFile * obj = loaded_module->GetObjectFile ();
-if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable)
-removed_modules.Append (loaded_module);
+removed_modules.Append (loaded_module);
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r271899 - Don't remove PIE executables when using svr4 packets

2016-06-06 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Mon Jun  6 10:00:50 2016
New Revision: 271899

URL: http://llvm.org/viewvc/llvm-project?rev=271899&view=rev
Log:
Don't remove PIE executables when using svr4 packets

Summary:
Because PIE executables have an e_type of llvm::ELF::ET_DYN,
they are not of type eTypeExecutable, and were being removed
when svr4 packets were used.

Reviewers: clayborg, ADodds, tfiala, sas

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=271899&r1=271898&r2=271899&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jun  
6 10:00:50 2016
@@ -4875,11 +4875,10 @@ ProcessGDBRemote::LoadModules (LoadedMod
 found = true;
 }
 
-if (!found)
+// The main executable will never be included in libraries-svr4, 
don't remove it
+if (!found && loaded_module.get() != 
target.GetExecutableModulePointer())
 {
-lldb_private::ObjectFile * obj = loaded_module->GetObjectFile 
();
-if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable)
-removed_modules.Append (loaded_module);
+removed_modules.Append (loaded_module);
 }
 }
 


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


Re: [Lldb-commits] [PATCH] D20990: Don't remove PIE executables when using svr4 packets

2016-06-06 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271899: Don't remove PIE executables when using svr4 packets 
(authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D20990?vs=59637&id=59723#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20990

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4875,11 +4875,10 @@
 found = true;
 }
 
-if (!found)
+// The main executable will never be included in libraries-svr4, 
don't remove it
+if (!found && loaded_module.get() != 
target.GetExecutableModulePointer())
 {
-lldb_private::ObjectFile * obj = loaded_module->GetObjectFile 
();
-if (obj && obj->GetType () != 
ObjectFile::Type::eTypeExecutable)
-removed_modules.Append (loaded_module);
+removed_modules.Append (loaded_module);
 }
 }
 


Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4875,11 +4875,10 @@
 found = true;
 }
 
-if (!found)
+// The main executable will never be included in libraries-svr4, don't remove it
+if (!found && loaded_module.get() != target.GetExecutableModulePointer())
 {
-lldb_private::ObjectFile * obj = loaded_module->GetObjectFile ();
-if (obj && obj->GetType () != ObjectFile::Type::eTypeExecutable)
-removed_modules.Append (loaded_module);
+removed_modules.Append (loaded_module);
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D21422: Fix typo in eOpenOptionDontFollowSymlinks

2016-06-15 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, labath.
fjricci added a subscriber: lldb-commits.

Fix capitalization

http://reviews.llvm.org/D21422

Files:
  include/lldb/Host/File.h
  source/Host/common/File.cpp
  source/Target/Platform.cpp

Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1431,7 +1431,7 @@
 
 uint32_t source_open_options = File::eOpenOptionRead | 
File::eOpenOptionCloseOnExec;
 if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
-source_open_options |= File::eOpenoptionDontFollowSymlinks;
+source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
 File source_file(source, source_open_options, 
lldb::eFilePermissionsUserRW);
 Error error;
Index: source/Host/common/File.cpp
===
--- source/Host/common/File.cpp
+++ source/Host/common/File.cpp
@@ -238,7 +238,7 @@
 oflag |= O_RDONLY;
 
 #ifndef _WIN32
-if (options & eOpenoptionDontFollowSymlinks)
+if (options & eOpenOptionDontFollowSymlinks)
 oflag |= O_NOFOLLOW;
 #endif
 }
Index: include/lldb/Host/File.h
===
--- include/lldb/Host/File.h
+++ include/lldb/Host/File.h
@@ -45,7 +45,7 @@
 eOpenOptionNonBlocking  = (1u << 4),// File reads
 eOpenOptionCanCreate= (1u << 5),// Create file if 
doesn't already exist
 eOpenOptionCanCreateNewOnly = (1u << 6),// Can create file 
only if it doesn't already exist
-eOpenoptionDontFollowSymlinks   = (1u << 7),
+eOpenOptionDontFollowSymlinks   = (1u << 7),
 eOpenOptionCloseOnExec  = (1u << 8) // Close the file when 
executing a new process
 };
 


Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1431,7 +1431,7 @@
 
 uint32_t source_open_options = File::eOpenOptionRead | File::eOpenOptionCloseOnExec;
 if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
-source_open_options |= File::eOpenoptionDontFollowSymlinks;
+source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
 File source_file(source, source_open_options, lldb::eFilePermissionsUserRW);
 Error error;
Index: source/Host/common/File.cpp
===
--- source/Host/common/File.cpp
+++ source/Host/common/File.cpp
@@ -238,7 +238,7 @@
 oflag |= O_RDONLY;
 
 #ifndef _WIN32
-if (options & eOpenoptionDontFollowSymlinks)
+if (options & eOpenOptionDontFollowSymlinks)
 oflag |= O_NOFOLLOW;
 #endif
 }
Index: include/lldb/Host/File.h
===
--- include/lldb/Host/File.h
+++ include/lldb/Host/File.h
@@ -45,7 +45,7 @@
 eOpenOptionNonBlocking  = (1u << 4),// File reads
 eOpenOptionCanCreate= (1u << 5),// Create file if doesn't already exist
 eOpenOptionCanCreateNewOnly = (1u << 6),// Can create file only if it doesn't already exist
-eOpenoptionDontFollowSymlinks   = (1u << 7),
+eOpenOptionDontFollowSymlinks   = (1u << 7),
 eOpenOptionCloseOnExec  = (1u << 8) // Close the file when executing a new process
 };
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D21422: Fix typo in eOpenOptionDontFollowSymlinks

2016-06-20 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273225: Fix typo in eOpenOptionDontFollowSymlinks (authored 
by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D21422?vs=60937&id=61325#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21422

Files:
  lldb/trunk/include/lldb/Host/File.h
  lldb/trunk/source/Host/common/File.cpp
  lldb/trunk/source/Target/Platform.cpp

Index: lldb/trunk/source/Host/common/File.cpp
===
--- lldb/trunk/source/Host/common/File.cpp
+++ lldb/trunk/source/Host/common/File.cpp
@@ -238,7 +238,7 @@
 oflag |= O_RDONLY;
 
 #ifndef _WIN32
-if (options & eOpenoptionDontFollowSymlinks)
+if (options & eOpenOptionDontFollowSymlinks)
 oflag |= O_NOFOLLOW;
 #endif
 }
Index: lldb/trunk/source/Target/Platform.cpp
===
--- lldb/trunk/source/Target/Platform.cpp
+++ lldb/trunk/source/Target/Platform.cpp
@@ -1431,7 +1431,7 @@
 
 uint32_t source_open_options = File::eOpenOptionRead | 
File::eOpenOptionCloseOnExec;
 if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
-source_open_options |= File::eOpenoptionDontFollowSymlinks;
+source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
 File source_file(source, source_open_options, 
lldb::eFilePermissionsUserRW);
 Error error;
Index: lldb/trunk/include/lldb/Host/File.h
===
--- lldb/trunk/include/lldb/Host/File.h
+++ lldb/trunk/include/lldb/Host/File.h
@@ -45,7 +45,7 @@
 eOpenOptionNonBlocking  = (1u << 4),// File reads
 eOpenOptionCanCreate= (1u << 5),// Create file if 
doesn't already exist
 eOpenOptionCanCreateNewOnly = (1u << 6),// Can create file 
only if it doesn't already exist
-eOpenoptionDontFollowSymlinks   = (1u << 7),
+eOpenOptionDontFollowSymlinks   = (1u << 7),
 eOpenOptionCloseOnExec  = (1u << 8) // Close the file when 
executing a new process
 };
 


Index: lldb/trunk/source/Host/common/File.cpp
===
--- lldb/trunk/source/Host/common/File.cpp
+++ lldb/trunk/source/Host/common/File.cpp
@@ -238,7 +238,7 @@
 oflag |= O_RDONLY;
 
 #ifndef _WIN32
-if (options & eOpenoptionDontFollowSymlinks)
+if (options & eOpenOptionDontFollowSymlinks)
 oflag |= O_NOFOLLOW;
 #endif
 }
Index: lldb/trunk/source/Target/Platform.cpp
===
--- lldb/trunk/source/Target/Platform.cpp
+++ lldb/trunk/source/Target/Platform.cpp
@@ -1431,7 +1431,7 @@
 
 uint32_t source_open_options = File::eOpenOptionRead | File::eOpenOptionCloseOnExec;
 if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
-source_open_options |= File::eOpenoptionDontFollowSymlinks;
+source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
 File source_file(source, source_open_options, lldb::eFilePermissionsUserRW);
 Error error;
Index: lldb/trunk/include/lldb/Host/File.h
===
--- lldb/trunk/include/lldb/Host/File.h
+++ lldb/trunk/include/lldb/Host/File.h
@@ -45,7 +45,7 @@
 eOpenOptionNonBlocking  = (1u << 4),// File reads
 eOpenOptionCanCreate= (1u << 5),// Create file if doesn't already exist
 eOpenOptionCanCreateNewOnly = (1u << 6),// Can create file only if it doesn't already exist
-eOpenoptionDontFollowSymlinks   = (1u << 7),
+eOpenOptionDontFollowSymlinks   = (1u << 7),
 eOpenOptionCloseOnExec  = (1u << 8) // Close the file when executing a new process
 };
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r273225 - Fix typo in eOpenOptionDontFollowSymlinks

2016-06-20 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Mon Jun 20 19:03:57 2016
New Revision: 273225

URL: http://llvm.org/viewvc/llvm-project?rev=273225&view=rev
Log:
Fix typo in eOpenOptionDontFollowSymlinks

Summary: Fix capitalization

Reviewers: labath, sas, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/File.h
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/include/lldb/Host/File.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=273225&r1=273224&r2=273225&view=diff
==
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Mon Jun 20 19:03:57 2016
@@ -45,7 +45,7 @@ public:
 eOpenOptionNonBlocking  = (1u << 4),// File reads
 eOpenOptionCanCreate= (1u << 5),// Create file if 
doesn't already exist
 eOpenOptionCanCreateNewOnly = (1u << 6),// Can create file 
only if it doesn't already exist
-eOpenoptionDontFollowSymlinks   = (1u << 7),
+eOpenOptionDontFollowSymlinks   = (1u << 7),
 eOpenOptionCloseOnExec  = (1u << 8) // Close the file when 
executing a new process
 };
 

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=273225&r1=273224&r2=273225&view=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Mon Jun 20 19:03:57 2016
@@ -238,7 +238,7 @@ File::Open (const char *path, uint32_t o
 oflag |= O_RDONLY;
 
 #ifndef _WIN32
-if (options & eOpenoptionDontFollowSymlinks)
+if (options & eOpenOptionDontFollowSymlinks)
 oflag |= O_NOFOLLOW;
 #endif
 }

Modified: lldb/trunk/source/Target/Platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=273225&r1=273224&r2=273225&view=diff
==
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Mon Jun 20 19:03:57 2016
@@ -1431,7 +1431,7 @@ Platform::PutFile (const FileSpec& sourc
 
 uint32_t source_open_options = File::eOpenOptionRead | 
File::eOpenOptionCloseOnExec;
 if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
-source_open_options |= File::eOpenoptionDontFollowSymlinks;
+source_open_options |= File::eOpenOptionDontFollowSymlinks;
 
 File source_file(source, source_open_options, 
lldb::eFilePermissionsUserRW);
 Error error;


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


[Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, tfiala, zturner.
fjricci added subscribers: lldb-commits, sas.

When running the test suite in platform mode, this test would
use 'platform select host', which would cause the rest of the suite to stop 
running
in platform mode.

Instead, use 'platform select' to select the remote platform, if it exists.

http://reviews.llvm.org/D21648

Files:
  
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Index: 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -39,5 +39,9 @@
 
 self.runCmd("file {}".format(file_name))
 self.match("image list -t -A", [expected_triple_and_arch_regex])
-# Revert to the host platform after all of this is done
-self.runCmd("platform select host")
+
+# Revert to the original platform after all of this is done
+if lldb.remote_platform:
+self.runCmd('platform select %s' % lldb.remote_platform.GetName())
+else:
+self.runCmd("platform select host")


Index: packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -39,5 +39,9 @@
 
 self.runCmd("file {}".format(file_name))
 self.match("image list -t -A", [expected_triple_and_arch_regex])
-# Revert to the host platform after all of this is done
-self.runCmd("platform select host")
+
+# Revert to the original platform after all of this is done
+if lldb.remote_platform:
+self.runCmd('platform select %s' % lldb.remote_platform.GetName())
+else:
+self.runCmd("platform select host")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, jingham, vharron.
fjricci added subscribers: sas, lldb-commits.

When using 'platform select', re-use an existing platform
which matches the remote platform specs, rather than creating a new one.

Without this patch, repeating the following sequence of commands will generate a
large number of platforms which are unused (and inaccessible):
platform select remote-linux
platform connect 
platform select host
platform select remote-linux

http://reviews.llvm.org/D21649

Files:
  source/Commands/CommandObjectPlatform.cpp

Index: source/Commands/CommandObjectPlatform.cpp
===
--- source/Commands/CommandObjectPlatform.cpp
+++ source/Commands/CommandObjectPlatform.cpp
@@ -237,20 +237,41 @@
 {
 const bool select = true;
 m_platform_options.SetPlatformName (platform_name);
-Error error;
-ArchSpec platform_arch;
-PlatformSP platform_sp 
(m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), 
select, error, platform_arch));
-if (platform_sp)
+
+bool found = false;
+PlatformList &list = 
m_interpreter.GetDebugger().GetPlatformList();
+for (size_t i = 0; i <  list.GetSize(); ++i)
 {
-
m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
+PlatformSP platform_sp = list.GetAtIndex(i);
+if (m_platform_options.PlatformMatches(platform_sp))
+{
+list.SetSelectedPlatform(platform_sp);
 
-platform_sp->GetStatus (result.GetOutputStream());
-result.SetStatus (eReturnStatusSuccessFinishResult);
+platform_sp->GetStatus (result.GetOutputStream());
+result.SetStatus (eReturnStatusSuccessFinishResult);
+
+found = true;
+break;
+}
 }
-else
+
+if (!found)
 {
-result.AppendError(error.AsCString());
-result.SetStatus (eReturnStatusFailed);
+Error error;
+ArchSpec platform_arch;
+PlatformSP platform_sp 
(m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), 
select, error, platform_arch));
+if (platform_sp)
+{
+list.SetSelectedPlatform(platform_sp);
+
+platform_sp->GetStatus (result.GetOutputStream());
+result.SetStatus (eReturnStatusSuccessFinishResult);
+}
+else
+{
+result.AppendError(error.AsCString());
+result.SetStatus (eReturnStatusFailed);
+}
 }
 }
 else


Index: source/Commands/CommandObjectPlatform.cpp
===
--- source/Commands/CommandObjectPlatform.cpp
+++ source/Commands/CommandObjectPlatform.cpp
@@ -237,20 +237,41 @@
 {
 const bool select = true;
 m_platform_options.SetPlatformName (platform_name);
-Error error;
-ArchSpec platform_arch;
-PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch));
-if (platform_sp)
+
+bool found = false;
+PlatformList &list = m_interpreter.GetDebugger().GetPlatformList();
+for (size_t i = 0; i <  list.GetSize(); ++i)
 {
-m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
+PlatformSP platform_sp = list.GetAtIndex(i);
+if (m_platform_options.PlatformMatches(platform_sp))
+{
+list.SetSelectedPlatform(platform_sp);
 
-platform_sp->GetStatus (result.GetOutputStream());
-result.SetStatus (eReturnStatusSuccessFinishResult);
+platform_sp->GetStatus (result.GetOutputStream());
+result.SetStatus (eReturnStatusSuccessFinishResult);
+
+found = true;
+break;
+}
 }
-else
+
+if (!found)
 {
-result.AppendError(error.AsCString());
-result.SetStatus (eReturnStatusFailed);
+Error error;
+ArchSpec platform_arch;
+PlatformSP p

Re: [Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci planned changes to this revision.
fjricci added a comment.

This will fail in the case where the remote-platform server dies, as lldb will 
not cleanup its data structures. I'll investigate how to make sure the platform 
is alive before connecting to it.


http://reviews.llvm.org/D21649



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


Re: [Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci added a comment.

As I'm poking through the APIs, I found that platform_sp->IsConnected() will 
return true even if the remote server has been killed since connecting (at 
least on remote-linux with lldb-server in platform mode). Is this the expected 
behavior of that set of functions?


http://reviews.llvm.org/D21649



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


Re: [Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Although, given your comments about the ios platforms, IsConnected() doesn't 
seem like the right API to use anyway...


http://reviews.llvm.org/D21649



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


Re: [Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci abandoned this revision.
fjricci added a comment.

I don't think that we can assume that the user always wants to re-use an 
existing platform, even of the same type. Probably the only way to resolve the 
problem this tries to fix would be to add a command to display all connected 
platforms, and an option to "platform select" to choose an existing platform to 
connect to. But that's outside the scope of this patch, and a bit of a design 
decision.


http://reviews.llvm.org/D21649



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


Re: [Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci planned changes to this revision.
fjricci added a comment.

This fix does not work without something along the lines of 
http://reviews.llvm.org/D21649, I'll re-upload with a better fix.


http://reviews.llvm.org/D21648



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


Re: [Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 61717.
fjricci added a comment.
This revision is now accepted and ready to land.

Disconnect from existing platform connection to prevent extra hanging 
connections

This is good practice on all debug servers, and required for debug servers which
can't handle more than one simultaneous platform mode connection.


http://reviews.llvm.org/D21648

Files:
  
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Index: 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -23,6 +23,10 @@
 @no_debug_info_test
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a 
set of different architecture object files."""
+# Don't leave residual open platform connections
+if lldb.remote_platform:
+lldb.remote_platform.DisconnectRemote()
+
 images = {
 "hello-freebsd-10.0-x86_64-clang-3.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
 "hello-freebsd-10.0-x86_64-gcc-4.7.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
@@ -39,5 +43,11 @@
 
 self.runCmd("file {}".format(file_name))
 self.match("image list -t -A", [expected_triple_and_arch_regex])
-# Revert to the host platform after all of this is done
-self.runCmd("platform select host")
+
+# Revert to the original platform after all of this is done
+if lldb.remote_platform:
+platform_connect_options = 
lldb.SBPlatformConnectOptions(configuration.lldb_platform_url)
+err = lldb.remote_platform.ConnectRemote(platform_connect_options)
+self.assertTrue(err.Success())
+else:
+self.runCmd("platform select host")


Index: packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -23,6 +23,10 @@
 @no_debug_info_test
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a set of different architecture object files."""
+# Don't leave residual open platform connections
+if lldb.remote_platform:
+lldb.remote_platform.DisconnectRemote()
+
 images = {
 "hello-freebsd-10.0-x86_64-clang-3.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
 "hello-freebsd-10.0-x86_64-gcc-4.7.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
@@ -39,5 +43,11 @@
 
 self.runCmd("file {}".format(file_name))
 self.match("image list -t -A", [expected_triple_and_arch_regex])
-# Revert to the host platform after all of this is done
-self.runCmd("platform select host")
+
+# Revert to the original platform after all of this is done
+if lldb.remote_platform:
+platform_connect_options = lldb.SBPlatformConnectOptions(configuration.lldb_platform_url)
+err = lldb.remote_platform.ConnectRemote(platform_connect_options)
+self.assertTrue(err.Success())
+else:
+self.runCmd("platform select host")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci added a comment.

I was wondering that as well. I thought there might be some value to testing 
that the "disconnect->change platform->reconnect" path worked though. I have no 
problem disabling if that doesn't seem useful though.


http://reviews.llvm.org/D21648



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


Re: [Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-23 Thread Francis Ricci via lldb-commits
fjricci planned changes to this revision.
fjricci added a comment.

That's reasonable, will do.


http://reviews.llvm.org/D21648



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


Re: [Lldb-commits] [PATCH] D21648: Make sure to reset to correct platform after TestImageListMultiArchitecture

2016-06-24 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 61803.
fjricci added a comment.
This revision is now accepted and ready to land.

Skip test on remote platforms


http://reviews.llvm.org/D21648

Files:
  
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Index: 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -21,6 +21,7 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfRemote
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a 
set of different architecture object files."""
 images = {


Index: packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -21,6 +21,7 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfRemote
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a set of different architecture object files."""
 images = {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r273720 - Don't run TestImageListMultiArchitecture during remote test suite

2016-06-24 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Fri Jun 24 15:44:23 2016
New Revision: 273720

URL: http://llvm.org/viewvc/llvm-project?rev=273720&view=rev
Log:
Don't run TestImageListMultiArchitecture during remote test suite

Reviewers: zturner, clayborg, tfiala

Subscribers: sas, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py?rev=273720&r1=273719&r2=273720&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
 Fri Jun 24 15:44:23 2016
@@ -21,6 +21,7 @@ class TestImageListMultiArchitecture(Tes
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfRemote
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a 
set of different architecture object files."""
 images = {


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


Re: [Lldb-commits] [PATCH] D21648: Don't run TestImageListMultiArchitecture during remote test suite

2016-06-24 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273720: Don't run TestImageListMultiArchitecture during 
remote test suite (authored by fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D21648?vs=61803&id=61831#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21648

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -21,6 +21,7 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfRemote
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a 
set of different architecture object files."""
 images = {


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -21,6 +21,7 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfRemote
 def test_image_list_shows_multiple_architectures(self):
 """Test that image list properly shows the correct architecture for a set of different architecture object files."""
 images = {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D21906: Skip TestDisassembleRawData when remote

2016-06-30 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, zturner, spyffe.
fjricci added a subscriber: lldb-commits.

As this test will create a new target, it will cause all following tests
to fail when running in platform mode, if the new target does not match
the existing architecture (for example, x86 vs x86_64).

http://reviews.llvm.org/D21906

Files:
  
packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py

Index: 
packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
===
--- 
packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ 
packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -19,6 +19,7 @@
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test
+@skipIfRemote
 def test_disassemble_raw_data(self):
 """Test disassembling raw bytes with the API."""
 # Create a target from the debugger.


Index: packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
===
--- packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -19,6 +19,7 @@
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test
+@skipIfRemote
 def test_disassemble_raw_data(self):
 """Test disassembling raw bytes with the API."""
 # Create a target from the debugger.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r274364 - Skip TestDisassembleRawData when remote

2016-07-01 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Fri Jul  1 11:47:44 2016
New Revision: 274364

URL: http://llvm.org/viewvc/llvm-project?rev=274364&view=rev
Log:
Skip TestDisassembleRawData when remote

Summary:
As this test will create a new target, it will cause all following tests
to fail when running in platform mode, if the new target does not match
the existing architecture (for example, x86 vs x86_64).

Reviewers: zturner, spyffe, clayborg

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=274364&r1=274363&r2=274364&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
 Fri Jul  1 11:47:44 2016
@@ -19,6 +19,7 @@ class DisassembleRawDataTestCase(TestBas
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test
+@skipIfRemote
 def test_disassemble_raw_data(self):
 """Test disassembling raw bytes with the API."""
 # Create a target from the debugger.


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


Re: [Lldb-commits] [PATCH] D21906: Skip TestDisassembleRawData when remote

2016-07-01 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274364: Skip TestDisassembleRawData when remote (authored by 
fjricci).

Changed prior to commit:
  http://reviews.llvm.org/D21906?vs=62406&id=62504#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21906

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -19,6 +19,7 @@
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test
+@skipIfRemote
 def test_disassemble_raw_data(self):
 """Test disassembling raw bytes with the API."""
 # Create a target from the debugger.


Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -19,6 +19,7 @@
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test
+@skipIfRemote
 def test_disassemble_raw_data(self):
 """Test disassembling raw bytes with the API."""
 # Create a target from the debugger.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D22294: Add functionality for rewriting symbols

2016-07-12 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, lattner.
fjricci added subscribers: sas, lldb-commits.
Herald added a subscriber: kubabrecka.

Clang supports symbol rewrites via the -frewrite-map-file flag,
this patch adds complementary functionality in lldb.

Re-written symbols are required when, for example, two versions of the
same library are linked to the same binary, and the user needs to
differentiate the symbols.

The SymbolRewriter implemented in this patch will use a rewrite map
provided via the 'target symbols rewrite' command to lookup the original
symbol names instead of the names re-written by clang.

http://reviews.llvm.org/D22294

Files:
  include/lldb/Core/Module.h
  include/lldb/Core/ModuleList.h
  include/lldb/Symbol/SymbolRewriter.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  include/lldb/lldb-forward.h
  lldb.xcodeproj/project.pbxproj
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/Makefile
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/TestSymbolRewriter.py
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/main.c
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/rewrite.map
  source/API/SBModule.cpp
  source/API/SBTarget.cpp
  source/Breakpoint/BreakpointResolverName.cpp
  source/Commands/CommandObjectSource.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/AddressResolverName.cpp
  source/Core/Disassembler.cpp
  source/Core/Module.cpp
  source/Core/ModuleList.cpp
  source/Core/SourceManager.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  source/Symbol/CMakeLists.txt
  source/Symbol/Symbol.cpp
  source/Symbol/SymbolRewriter.cpp
  source/Symbol/Symtab.cpp
  source/Target/ObjCLanguageRuntime.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -78,6 +78,7 @@
   m_mutex(),
   m_arch(target_arch),
   m_images(this),
+  m_symbol_rewriter(),
   m_section_load_history(),
   m_breakpoint_list(false),
   m_internal_breakpoint_list(true),
Index: source/Target/ObjCLanguageRuntime.cpp
===
--- source/Target/ObjCLanguageRuntime.cpp
+++ source/Target/ObjCLanguageRuntime.cpp
@@ -105,6 +105,7 @@
 
 SymbolContextList sc_list;
 const size_t matching_symbols = modules.FindSymbolsWithNameAndType (name,
+m_process->GetTarget().GetSymbolRewriter(),
 eSymbolTypeObjCClass,
 sc_list);
 
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -18,6 +18,7 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/SymbolRewriter.h"
 #include "lldb/Symbol/Symtab.h"
 #include "Plugins/Language/ObjC/ObjCLanguage.h"
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -806,11 +807,14 @@
 }
 
 size_t
-Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, std::vector& symbol_indexes)
+Symtab::FindAllSymbolsWithNameAn

Re: [Lldb-commits] [PATCH] D22294: Add functionality for rewriting symbols

2016-07-13 Thread Francis Ricci via lldb-commits
fjricci marked 3 inline comments as done.


Comment at: 
packages/Python/lldbsuite/test/lang/c/symbol_rewriter/TestSymbolRewriter.py:28
@@ +27,3 @@
+# Clang does not rewrite dwarf debug info, so it must be stripped
+subprocess.check_call(['strip', '-g', exe])
+

labath wrote:
> This is not going to work for remote targets on different architectures. If 
> you don't need debug info, could you just avoid generating it in the first 
> place (-g0 ?). Maybe then you would be able to get this working on windows as 
> well.
> If it doesn't work, then we should wire up this call to go through the 
> Makefile, as it already knows how to find the right toolchain for 
> cross-compilation.
Unfortunately, the '-g0' override will only work for dwarf tests. However, 
based on TestWithLimitDebugInfo, it looks like we can skip the test for 
non-dwarf symbols (`@skipIf(debug_info=no_match(["dwarf"]))`). I think this is 
probably the cleanest way to go.


http://reviews.llvm.org/D22294



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


Re: [Lldb-commits] [PATCH] D22294: Add functionality for rewriting symbols

2016-07-13 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 63816.
fjricci marked an inline comment as done.
fjricci added a comment.

Fix const SP and update unit test

Will now only run the unit test as a dwarf test (with -g0),
but since we don't want to test the debug data anyway,
this shouldn't be an issue, and avoids the use of strip.


http://reviews.llvm.org/D22294

Files:
  include/lldb/Core/Module.h
  include/lldb/Core/ModuleList.h
  include/lldb/Symbol/SymbolRewriter.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  include/lldb/lldb-forward.h
  lldb.xcodeproj/project.pbxproj
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/Makefile
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/TestSymbolRewriter.py
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/main.c
  packages/Python/lldbsuite/test/lang/c/symbol_rewriter/rewrite.map
  source/API/SBModule.cpp
  source/API/SBTarget.cpp
  source/Breakpoint/BreakpointResolverName.cpp
  source/Commands/CommandObjectSource.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/AddressResolverName.cpp
  source/Core/Disassembler.cpp
  source/Core/Module.cpp
  source/Core/ModuleList.cpp
  source/Core/SourceManager.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  source/Symbol/CMakeLists.txt
  source/Symbol/Symbol.cpp
  source/Symbol/SymbolRewriter.cpp
  source/Symbol/Symtab.cpp
  source/Target/ObjCLanguageRuntime.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -78,6 +78,7 @@
   m_mutex(),
   m_arch(target_arch),
   m_images(this),
+  m_symbol_rewriter(),
   m_section_load_history(),
   m_breakpoint_list(false),
   m_internal_breakpoint_list(true),
Index: source/Target/ObjCLanguageRuntime.cpp
===
--- source/Target/ObjCLanguageRuntime.cpp
+++ source/Target/ObjCLanguageRuntime.cpp
@@ -105,6 +105,7 @@
 
 SymbolContextList sc_list;
 const size_t matching_symbols = modules.FindSymbolsWithNameAndType (name,
+m_process->GetTarget().GetSymbolRewriter(),
 eSymbolTypeObjCClass,
 sc_list);
 
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -18,6 +18,7 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/SymbolRewriter.h"
 #include "lldb/Symbol/Symtab.h"
 #include "Plugins/Language/ObjC/ObjCLanguage.h"
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -806,11 +807,14 @@
 }
 
 size_t
-Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, std::vector& symbol_indexes)
+Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, const SymbolRewriterSP &rewriter, SymbolType symbol_type, std::vector& symbol_indexes)
 {
 std::lock_guard guard(m_mutex);
 
 Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
+
+ConstString rewrittenName = RewriteName(rewriter, name);
+
 // Initialize

Re: [Lldb-commits] [PATCH] D22294: Add functionality for rewriting symbols

2016-07-13 Thread Francis Ricci via lldb-commits
fjricci added a comment.

@clayborg: As you saw when running the test with debug info enabled, we might 
end up calling the non-rewritten `putchar()`, which is due to the compiler 
emitting debug symbols with the non-rewritten name. The `-g0` option is just a 
workaround until we can fix that.

I suppose Adrian Prantl's idea of modifying the emitted DWARF to add a linkage 
name attached to the function would work. Does that mean we would only add an 
entry for the rewritten symbol when lldb parses the DWARF, and ignore the 
non-rewritten function name?


http://reviews.llvm.org/D22294



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


[Lldb-commits] [lldb] r276166 - Fix typo in test runner

2016-07-20 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Wed Jul 20 14:37:31 2016
New Revision: 276166

URL: http://llvm.org/viewvc/llvm-project?rev=276166&view=rev
Log:
Fix typo in test runner

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

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=276166&r1=276165&r2=276166&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Wed Jul 20 14:37:31 
2016
@@ -486,7 +486,7 @@ def skipUnlessPlatform(oslist):
 # This decorator cannot be ported to `skipIf` yet because it is used on 
entire
 # classes, which `skipIf` explicitly forbids.
 return unittest2.skipUnless(lldbplatformutil.getPlatform() in oslist,
-"requires on of %s" % (", ".join(oslist)))
+"requires one of %s" % (", ".join(oslist)))
 
 def skipIfTargetAndroid(api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.


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


[Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-15 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: zturner, labath, tfiala.
fjricci added subscribers: lldb-commits, sas.

The current implementation of the test suite allows the user to run
a certain subset of tests using '-p', but does not allow the inverse,
where a user wants to run all but some number of known failing tests.
Implement this functionality.

https://reviews.llvm.org/D24629

Files:
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/test_result.py

Index: packages/Python/lldbsuite/test/test_result.py
===
--- packages/Python/lldbsuite/test/test_result.py
+++ packages/Python/lldbsuite/test/test_result.py
@@ -18,6 +18,8 @@
 # Third-party modules
 import unittest2
 
+from unittest2.util import strclass
+
 # LLDB Modules
 from . import configuration
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -124,10 +126,23 @@
 test,
 test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
 
+def checkExclusion(self, exclusion_list, name):
+if exclusion_list:
+import re
+for item in exclusion_list:
+if re.search(item, name):
+return True
+return False
+
 def startTest(self, test):
 if configuration.shouldSkipBecauseOfCategories(
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
+if self.checkExclusion(
+configuration.skip_methods,
+test._testMethodName):
+self.hardMarkAsSkipped(test)
+
 configuration.setCrashInfoHook(
 "%s at %s" %
 (str(test), inspect.getfile(
@@ -145,6 +160,15 @@
 EventBuilder.event_for_start(test))
 
 def addSuccess(self, test):
+if self.checkExclusion(
+configuration.xfail_files,
+strclass(
+test.__class__)) or self.checkExclusion(
+configuration.xfail_methods,
+test._testMethodName):
+self.addUnexpectedSuccess(test, None)
+return
+
 super(LLDBTestResult, self).addSuccess(test)
 if configuration.parsable:
 self.stream.write(
@@ -214,6 +238,15 @@
 test, err))
 
 def addFailure(self, test, err):
+if self.checkExclusion(
+configuration.xfail_files,
+strclass(
+test.__class__)) or self.checkExclusion(
+configuration.xfail_methods,
+test._testMethodName):
+self.addExpectedFailure(test, err, None)
+return
+
 configuration.sdir_has_content = True
 super(LLDBTestResult, self).addFailure(test, err)
 method = getattr(test, "markFailure", None)
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -96,6 +96,9 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
+group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+'''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
+with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
 '-G',
 '--category',
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -202,6 +202,48 @@
 sys.exit(0)
 
 
+def parseExclusion(exclusion_file):
+"""Parse an exclusion file, of the following format, where
+   'skip files', 'skip methods', 'xfail files', and 'xfail methods'
+   are the possible list heading values:
+
+   skip files
+   
+   
+
+   xfail methods
+   
+"""
+excl_type = None
+case_type = None
+
+with open(exclusion_file) as f:
+for line in f:
+if not excl_type:
+[excl_type, case_type] = line.split()
+continue
+
+line = line.strip()
+if not line:
+excl_type = None
+elif excl_type == 'skip' and case_type == 'files':
+if not configuration.skip_files:
+configuration.skip_files = []
+configuration.skip_files.append(line)
+elif excl_type == 'skip' and case_type == 'methods':
+if not configuration.skip

Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-15 Thread Francis Ricci via lldb-commits
fjricci added a comment.

The issue is that you can only commit a patch to xfail a test that fails when 
you run the test suite on master with no local changes.

The problem is that if you run into test failures on other branches or in 
unconventional configurations, there is no good way to disable failing tests, 
other than carrying local patches to xfail the tests which fail. Carrying these 
sorts of local patches is tedious, prone to breakages, and requires many manual 
changes whenever test suite sources changes.

I'm particular, we run into this with ds2, since it fails some tests passed by 
lldb-server (and passes some tests xfail-ed by lldb-server).

I also find that I fail different tests on master (with lldb-server) between 
Ubuntu and CentOS, for example, and I'm not sure that it makes sense to xfail 
in those cases.


https://reviews.llvm.org/D24629



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


Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-16 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 71651.
fjricci added a comment.

Refactor re


https://reviews.llvm.org/D24629

Files:
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/test_result.py

Index: packages/Python/lldbsuite/test/test_result.py
===
--- packages/Python/lldbsuite/test/test_result.py
+++ packages/Python/lldbsuite/test/test_result.py
@@ -18,6 +18,8 @@
 # Third-party modules
 import unittest2
 
+from unittest2.util import strclass
+
 # LLDB Modules
 from . import configuration
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -124,10 +126,23 @@
 test,
 test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
 
+def checkExclusion(self, exclusion_list, name):
+if exclusion_list:
+import re
+for item in exclusion_list:
+if re.search(item, name):
+return True
+return False
+
 def startTest(self, test):
 if configuration.shouldSkipBecauseOfCategories(
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
+if self.checkExclusion(
+configuration.skip_methods,
+test._testMethodName):
+self.hardMarkAsSkipped(test)
+
 configuration.setCrashInfoHook(
 "%s at %s" %
 (str(test), inspect.getfile(
@@ -145,6 +160,15 @@
 EventBuilder.event_for_start(test))
 
 def addSuccess(self, test):
+if self.checkExclusion(
+configuration.xfail_files,
+strclass(
+test.__class__)) or self.checkExclusion(
+configuration.xfail_methods,
+test._testMethodName):
+self.addUnexpectedSuccess(test, None)
+return
+
 super(LLDBTestResult, self).addSuccess(test)
 if configuration.parsable:
 self.stream.write(
@@ -214,6 +238,15 @@
 test, err))
 
 def addFailure(self, test, err):
+if self.checkExclusion(
+configuration.xfail_files,
+strclass(
+test.__class__)) or self.checkExclusion(
+configuration.xfail_methods,
+test._testMethodName):
+self.addExpectedFailure(test, err, None)
+return
+
 configuration.sdir_has_content = True
 super(LLDBTestResult, self).addFailure(test, err)
 method = getattr(test, "markFailure", None)
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -96,6 +96,9 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
+group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+'''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
+with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
 '-G',
 '--category',
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -26,6 +26,7 @@
 import os
 import errno
 import platform
+import re
 import signal
 import socket
 import subprocess
@@ -202,6 +203,48 @@
 sys.exit(0)
 
 
+def parseExclusion(exclusion_file):
+"""Parse an exclusion file, of the following format, where
+   'skip files', 'skip methods', 'xfail files', and 'xfail methods'
+   are the possible list heading values:
+
+   skip files
+   
+   
+
+   xfail methods
+   
+"""
+excl_type = None
+case_type = None
+
+with open(exclusion_file) as f:
+for line in f:
+if not excl_type:
+[excl_type, case_type] = line.split()
+continue
+
+line = line.strip()
+if not line:
+excl_type = None
+elif excl_type == 'skip' and case_type == 'files':
+if not configuration.skip_files:
+configuration.skip_files = []
+configuration.skip_files.append(line)
+elif excl_type == 'skip' and case_type == 'methods':
+if not configuration.skip_methods:
+configuration.skip_methods = []
+configuration.skip_methods.append(line)
+elif excl_type == 'xfail' and

Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-16 Thread Francis Ricci via lldb-commits
fjricci added a comment.

I do understand the complexity problem, and it was one of my concerns with this 
as well. For my cases, the complexity here is significantly less than the 
alternatives, but I also do understand if you don't think that's generally true.

It probably comes down to how often we think that people are running the test 
suite in cases where this sort of functionality would be useful. I don't really 
have a good sense for how other people tend to use the test suite, so I'm 
personally not sure.  For our case, it's a big deal, but if we're the only 
people who this patch helps, I know it doesn't make sense to merge it.


https://reviews.llvm.org/D24629



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


Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-23 Thread Francis Ricci via lldb-commits
fjricci added a comment.

In https://reviews.llvm.org/D24629#550823, @tfiala wrote:

> > > There is no reasonable thing we can base the expectation as the exact 
> > > same device with a different cpu revision could support watchpoints just 
> > > fine, so we could just define the list of these tests externally (in this 
> > > case, I would probably annotate them with the watchpoint category and 
> > > then do the skips based on categories instead).
>
> > 
>
>
> Tangential: most chips I've worked on that had hardware watchpoint support 
> had an instruction that could be called to find out if such a feature exists. 
>  I think ARM does this.  I would think we could expose an API that says 
> whether watchpoints are supported or not, and use that info in LLDB and the 
> test suite to enable or disable them.


I believe that PTRACE_GETHBPREGS with a value of 0 returns that hardware 
stoppoint info on arm, and the byte representing the number of available 
hardware watchpoints will be 0 if they aren't supported. Not sure if there's a 
simpler way.


https://reviews.llvm.org/D24629



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


Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-23 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Ok. Barring objections from anyone else, I'll merge this later on today then, 
with the understanding that if it causes issues like the ones you describe, it 
should be reverted.


https://reviews.llvm.org/D24629



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


Re: [Lldb-commits] [PATCH] D24629: Allow for tests to be disabled at runtime

2016-09-23 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282298: Allow for tests to be disabled at runtime (authored 
by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D24629?vs=71651&id=72360#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24629

Files:
  lldb/trunk/packages/Python/lldbsuite/test/configuration.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
  lldb/trunk/packages/Python/lldbsuite/test/test_result.py

Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py
@@ -101,6 +101,12 @@
 # our test cases.
 regexp = None
 
+# Sets of tests which are excluded at runtime
+skip_files = None
+skip_methods = None
+xfail_files = None
+xfail_methods = None
+
 # By default, recorded session info for errored/failed test are dumped into its
 # own file under a session directory named after the timestamp of the test suite
 # run.  Use '-s session-dir-name' to specify a specific dir name.
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -26,6 +26,7 @@
 import os
 import errno
 import platform
+import re
 import signal
 import socket
 import subprocess
@@ -202,6 +203,48 @@
 sys.exit(0)
 
 
+def parseExclusion(exclusion_file):
+"""Parse an exclusion file, of the following format, where
+   'skip files', 'skip methods', 'xfail files', and 'xfail methods'
+   are the possible list heading values:
+
+   skip files
+   
+   
+
+   xfail methods
+   
+"""
+excl_type = None
+case_type = None
+
+with open(exclusion_file) as f:
+for line in f:
+if not excl_type:
+[excl_type, case_type] = line.split()
+continue
+
+line = line.strip()
+if not line:
+excl_type = None
+elif excl_type == 'skip' and case_type == 'files':
+if not configuration.skip_files:
+configuration.skip_files = []
+configuration.skip_files.append(line)
+elif excl_type == 'skip' and case_type == 'methods':
+if not configuration.skip_methods:
+configuration.skip_methods = []
+configuration.skip_methods.append(line)
+elif excl_type == 'xfail' and case_type == 'files':
+if not configuration.xfail_files:
+configuration.xfail_files = []
+configuration.xfail_files.append(line)
+elif excl_type == 'xfail' and case_type == 'methods':
+if not configuration.xfail_methods:
+configuration.xfail_methods = []
+configuration.xfail_methods.append(line)
+
+
 def parseOptionsAndInitTestdirs():
 """Initialize the list of directories containing our unittest scripts.
 
@@ -331,6 +374,9 @@
 if args.executable:
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
+if args.excluded:
+parseExclusion(args.excluded)
+
 if args.p:
 if args.p.startswith('-'):
 usage(parser)
@@ -749,11 +795,15 @@
 def visit_file(dir, name):
 # Try to match the regexp pattern, if specified.
 if configuration.regexp:
-import re
 if not re.search(configuration.regexp, name):
 # We didn't match the regex, we're done.
 return
 
+if configuration.skip_files:
+for file_regexp in configuration.skip_files:
+if re.search(file_regexp, name):
+return
+
 # We found a match for our test.  Add it to the suite.
 
 # Update the sys.path first.
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
@@ -96,6 +96,9 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
+group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+'''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
+with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
 '-G',
 '--category',
Index: lldb/trunk/packages/Python/lldbsuite/test/test_result.py
===

[Lldb-commits] [lldb] r282298 - Allow for tests to be disabled at runtime

2016-09-23 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Fri Sep 23 16:32:47 2016
New Revision: 282298

URL: http://llvm.org/viewvc/llvm-project?rev=282298&view=rev
Log:
Allow for tests to be disabled at runtime

Summary:
The current implementation of the test suite allows the user to run
a certain subset of tests using '-p', but does not allow the inverse,
where a user wants to run all but some number of known failing tests.
Implement this functionality.

Reviewers: labath, zturner, tfiala

Subscribers: jingham, sas, lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/configuration.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
lldb/trunk/packages/Python/lldbsuite/test/test_result.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=282298&r1=282297&r2=282298&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Fri Sep 23 
16:32:47 2016
@@ -101,6 +101,12 @@ parsable = False
 # our test cases.
 regexp = None
 
+# Sets of tests which are excluded at runtime
+skip_files = None
+skip_methods = None
+xfail_files = None
+xfail_methods = None
+
 # By default, recorded session info for errored/failed test are dumped into its
 # own file under a session directory named after the timestamp of the test 
suite
 # run.  Use '-s session-dir-name' to specify a specific dir name.

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=282298&r1=282297&r2=282298&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Fri Sep 23 16:32:47 2016
@@ -26,6 +26,7 @@ import atexit
 import os
 import errno
 import platform
+import re
 import signal
 import socket
 import subprocess
@@ -202,6 +203,48 @@ o GDB_REMOTE_LOG: if defined, specifies
 sys.exit(0)
 
 
+def parseExclusion(exclusion_file):
+"""Parse an exclusion file, of the following format, where
+   'skip files', 'skip methods', 'xfail files', and 'xfail methods'
+   are the possible list heading values:
+
+   skip files
+   
+   
+
+   xfail methods
+   
+"""
+excl_type = None
+case_type = None
+
+with open(exclusion_file) as f:
+for line in f:
+if not excl_type:
+[excl_type, case_type] = line.split()
+continue
+
+line = line.strip()
+if not line:
+excl_type = None
+elif excl_type == 'skip' and case_type == 'files':
+if not configuration.skip_files:
+configuration.skip_files = []
+configuration.skip_files.append(line)
+elif excl_type == 'skip' and case_type == 'methods':
+if not configuration.skip_methods:
+configuration.skip_methods = []
+configuration.skip_methods.append(line)
+elif excl_type == 'xfail' and case_type == 'files':
+if not configuration.xfail_files:
+configuration.xfail_files = []
+configuration.xfail_files.append(line)
+elif excl_type == 'xfail' and case_type == 'methods':
+if not configuration.xfail_methods:
+configuration.xfail_methods = []
+configuration.xfail_methods.append(line)
+
+
 def parseOptionsAndInitTestdirs():
 """Initialize the list of directories containing our unittest scripts.
 
@@ -331,6 +374,9 @@ def parseOptionsAndInitTestdirs():
 if args.executable:
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
+if args.excluded:
+parseExclusion(args.excluded)
+
 if args.p:
 if args.p.startswith('-'):
 usage(parser)
@@ -749,11 +795,15 @@ def setupSysPath():
 def visit_file(dir, name):
 # Try to match the regexp pattern, if specified.
 if configuration.regexp:
-import re
 if not re.search(configuration.regexp, name):
 # We didn't match the regex, we're done.
 return
 
+if configuration.skip_files:
+for file_regexp in configuration.skip_files:
+if re.search(file_regexp, name):
+return
+
 # We found a match for our test.  Add it to the suite.
 
 # Update the sys.path first.

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py

[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-09-27 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: zturner, labath, tfiala, jingham.
fjricci added subscribers: sas, lldb-commits.

This patch is necessary because individual test cases are not required
to have unique names. Therefore, test cases must now
be specified explicitly in the form ..
Because it works by regex matching, passing just  will
still disable an entire file.

This also allows for multiple exclusion files to be specified.

https://reviews.llvm.org/D24988

Files:
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/test_result.py

Index: packages/Python/lldbsuite/test/test_result.py
===
--- packages/Python/lldbsuite/test/test_result.py
+++ packages/Python/lldbsuite/test/test_result.py
@@ -139,8 +139,8 @@
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
 if self.checkExclusion(
-configuration.skip_methods,
-test._testMethodName):
+configuration.skip_tests,
+strclass(test.__class__) + '.' + test._testMethodName):
 self.hardMarkAsSkipped(test)
 
 configuration.setCrashInfoHook(
@@ -161,11 +161,8 @@
 
 def addSuccess(self, test):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests,
+strclass(test.__class__) + '.' + test._testMethodName):
 self.addUnexpectedSuccess(test, None)
 return
 
@@ -239,11 +236,8 @@
 
 def addFailure(self, test, err):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests,
+strclass(test.__class__) + '.' + test._testMethodName):
 self.addExpectedFailure(test, err, None)
 return
 
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -96,7 +96,7 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
-group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+group.add_argument('--excluded', metavar='exclusion-file', action='append', help=textwrap.dedent(
 '''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
 with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -216,33 +216,24 @@

 """
 excl_type = None
-case_type = None
 
 with open(exclusion_file) as f:
 for line in f:
+line = line.strip()
 if not excl_type:
-[excl_type, case_type] = line.split()
+excl_type = line
 continue
 
-line = line.strip()
 if not line:
 excl_type = None
-elif excl_type == 'skip' and case_type == 'files':
-if not configuration.skip_files:
-configuration.skip_files = []
-configuration.skip_files.append(line)
-elif excl_type == 'skip' and case_type == 'methods':
-if not configuration.skip_methods:
-configuration.skip_methods = []
-configuration.skip_methods.append(line)
-elif excl_type == 'xfail' and case_type == 'files':
-if not configuration.xfail_files:
-configuration.xfail_files = []
-configuration.xfail_files.append(line)
-elif excl_type == 'xfail' and case_type == 'methods':
-if not configuration.xfail_methods:
-configuration.xfail_methods = []
-configuration.xfail_methods.append(line)
+elif excl_type == 'skip':
+if not configuration.skip_tests:
+configuration.skip_tests = []
+configuration.skip_tests.append(line)
+elif excl_type == 'xfail':
+if not configuration.xfail_tests:
+

[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Since this is strictly an improvement and simplification, and won't break 
anyone's workflow because it's still a new feature, I'll plan on merging this 
tomorrow unless I hear any objections.


https://reviews.llvm.org/D24988



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


[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci added a comment.

The problem with the existing code is that file names are required to be 
unique, but method names are not. So if the user wants to disable an individual 
test method with a non-unique name, there is no way to do so. This patch still 
allows the tests to be disabled by file name, but removes the ability to 
disable by only method name, instead requiring the method name as a modifier to 
the file.

I may have used the wrong terminology when I said .. 
Here, I meant essentially what is printed by the test runner when a test fails. 
So, for example:

`BadAddressBreakpointTestCase.test_bad_address_breakpoints_dwarf`
`LldbGdbServerTestCase.test_Hc_then_Csignal_signals_correct_thread_launch_llgs`

These names are guaranteed to be unique, and so I think they're the better way 
to go. The user can still disable an entire file, by passing something 
something like:

`TestConcurrentEvents`


https://reviews.llvm.org/D24988



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


[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci added a comment.

For an example of something that couldn't be disabled with the original 
implementation, consider a test like:

`CreateDuringStepTestCase.test_step_inst`

Disabling by method name (`test_step_inst`) would also disable 
`CreateDuringInstructionStepTestCase.test_step_inst`.


https://reviews.llvm.org/D24988



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


[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci added a comment.

In https://reviews.llvm.org/D24988#559775, @tfiala wrote:

> In https://reviews.llvm.org/D24988#559314, @fjricci wrote:
>
> > For an example of something that couldn't be disabled with the original 
> > implementation, consider a test like:
> >
> > `CreateDuringStepTestCase.test_step_inst`
> >
> > Disabling by method name (`test_step_inst`) would also disable 
> > `CreateDuringInstructionStepTestCase.test_step_inst`.
>
>
> I see what you're saying there.
>
> The part you're missing is that the Test Case class name itself does not have 
> to be unique, either.  i.e. You *can* have two CreateDuringStepTestCase 
> classes in different files.  Nothing uniquifies at that level.


Ahh, I see. I didn't realize that we could have duplication in the test case 
names as well.

> That is why I'm saying you need to include the module name, which comes from 
> the filename, or have it be something like FileBaseName:TestCase.test_method. 
> I have to do this in the test runner architecture for this very reason. And 
> you will find at least some test cases that are cut and pasted and therefore 
> have duplicate test case names (at least, they used to exist, and nothing 
> enforces them being different in the runner logic).

I'll try this then.


https://reviews.llvm.org/D24988



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


[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 73362.
fjricci added a comment.

Match against filename + test case + method name


https://reviews.llvm.org/D24988

Files:
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/test_result.py

Index: packages/Python/lldbsuite/test/test_result.py
===
--- packages/Python/lldbsuite/test/test_result.py
+++ packages/Python/lldbsuite/test/test_result.py
@@ -18,8 +18,6 @@
 # Third-party modules
 import unittest2
 
-from unittest2.util import strclass
-
 # LLDB Modules
 from . import configuration
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -139,8 +137,7 @@
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
 if self.checkExclusion(
-configuration.skip_methods,
-test._testMethodName):
+configuration.skip_tests, test.id()):
 self.hardMarkAsSkipped(test)
 
 configuration.setCrashInfoHook(
@@ -161,11 +158,7 @@
 
 def addSuccess(self, test):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.skip_tests, test.id()):
 self.addUnexpectedSuccess(test, None)
 return
 
@@ -239,11 +232,7 @@
 
 def addFailure(self, test, err):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.skip_tests, test.id()):
 self.addExpectedFailure(test, err, None)
 return
 
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -96,7 +96,7 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
-group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+group.add_argument('--excluded', metavar='exclusion-file', action='append', help=textwrap.dedent(
 '''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
 with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -216,33 +216,24 @@

 """
 excl_type = None
-case_type = None
 
 with open(exclusion_file) as f:
 for line in f:
+line = line.strip()
 if not excl_type:
-[excl_type, case_type] = line.split()
+excl_type = line
 continue
 
-line = line.strip()
 if not line:
 excl_type = None
-elif excl_type == 'skip' and case_type == 'files':
-if not configuration.skip_files:
-configuration.skip_files = []
-configuration.skip_files.append(line)
-elif excl_type == 'skip' and case_type == 'methods':
-if not configuration.skip_methods:
-configuration.skip_methods = []
-configuration.skip_methods.append(line)
-elif excl_type == 'xfail' and case_type == 'files':
-if not configuration.xfail_files:
-configuration.xfail_files = []
-configuration.xfail_files.append(line)
-elif excl_type == 'xfail' and case_type == 'methods':
-if not configuration.xfail_methods:
-configuration.xfail_methods = []
-configuration.xfail_methods.append(line)
+elif excl_type == 'skip':
+if not configuration.skip_tests:
+configuration.skip_tests = []
+configuration.skip_tests.append(line)
+elif excl_type == 'xfail':
+if not configuration.xfail_tests:
+configuration.xfail_tests = []
+configuration.xfail_tests.append(line)
 
 
 def parseOptionsAndInitTestdirs():
@@ -375,7 +366,8 @@
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.excluded:
-parseExclusion(args.excluded)
+for e

[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-03 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 73363.
fjricci added a comment.

Fix typo


https://reviews.llvm.org/D24988

Files:
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/test_result.py

Index: packages/Python/lldbsuite/test/test_result.py
===
--- packages/Python/lldbsuite/test/test_result.py
+++ packages/Python/lldbsuite/test/test_result.py
@@ -18,8 +18,6 @@
 # Third-party modules
 import unittest2
 
-from unittest2.util import strclass
-
 # LLDB Modules
 from . import configuration
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -139,8 +137,7 @@
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
 if self.checkExclusion(
-configuration.skip_methods,
-test._testMethodName):
+configuration.skip_tests, test.id()):
 self.hardMarkAsSkipped(test)
 
 configuration.setCrashInfoHook(
@@ -161,11 +158,7 @@
 
 def addSuccess(self, test):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests, test.id()):
 self.addUnexpectedSuccess(test, None)
 return
 
@@ -239,11 +232,7 @@
 
 def addFailure(self, test, err):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests, test.id()):
 self.addExpectedFailure(test, err, None)
 return
 
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -96,7 +96,7 @@
 '-p',
 metavar='pattern',
 help='Specify a regexp filename pattern for inclusion in the test suite')
-group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
+group.add_argument('--excluded', metavar='exclusion-file', action='append', help=textwrap.dedent(
 '''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
 with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
 group.add_argument(
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -216,33 +216,24 @@

 """
 excl_type = None
-case_type = None
 
 with open(exclusion_file) as f:
 for line in f:
+line = line.strip()
 if not excl_type:
-[excl_type, case_type] = line.split()
+excl_type = line
 continue
 
-line = line.strip()
 if not line:
 excl_type = None
-elif excl_type == 'skip' and case_type == 'files':
-if not configuration.skip_files:
-configuration.skip_files = []
-configuration.skip_files.append(line)
-elif excl_type == 'skip' and case_type == 'methods':
-if not configuration.skip_methods:
-configuration.skip_methods = []
-configuration.skip_methods.append(line)
-elif excl_type == 'xfail' and case_type == 'files':
-if not configuration.xfail_files:
-configuration.xfail_files = []
-configuration.xfail_files.append(line)
-elif excl_type == 'xfail' and case_type == 'methods':
-if not configuration.xfail_methods:
-configuration.xfail_methods = []
-configuration.xfail_methods.append(line)
+elif excl_type == 'skip':
+if not configuration.skip_tests:
+configuration.skip_tests = []
+configuration.skip_tests.append(line)
+elif excl_type == 'xfail':
+if not configuration.xfail_tests:
+configuration.xfail_tests = []
+configuration.xfail_tests.append(line)
 
 
 def parseOptionsAndInitTestdirs():
@@ -375,7 +366,8 @@
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.excluded:
-parseExclusion(args.excluded)
+for excl_file in args.excluded:
+  

[Lldb-commits] [lldb] r283238 - Improvements to testing blacklist

2016-10-04 Thread Francis Ricci via lldb-commits
Author: fjricci
Date: Tue Oct  4 13:48:00 2016
New Revision: 283238

URL: http://llvm.org/viewvc/llvm-project?rev=283238&view=rev
Log:
Improvements to testing blacklist

Summary:
This patch is necessary because individual test cases are not required
to have unique names. Therefore, test cases must now
be specified explicitly in the form ..
Because it works by regex matching, passing just  will
still disable an entire file.

This also allows for multiple exclusion files to be specified.

Reviewers: zturner, labath, jingham, tfiala

Subscribers: lldb-commits, sas

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/configuration.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
lldb/trunk/packages/Python/lldbsuite/test/test_result.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=283238&r1=283237&r2=283238&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Tue Oct  4 
13:48:00 2016
@@ -102,10 +102,8 @@ parsable = False
 regexp = None
 
 # Sets of tests which are excluded at runtime
-skip_files = None
-skip_methods = None
-xfail_files = None
-xfail_methods = None
+skip_tests = None
+xfail_tests = None
 
 # By default, recorded session info for errored/failed test are dumped into its
 # own file under a session directory named after the timestamp of the test 
suite

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=283238&r1=283237&r2=283238&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Oct  4 13:48:00 2016
@@ -216,33 +216,24 @@ def parseExclusion(exclusion_file):

 """
 excl_type = None
-case_type = None
 
 with open(exclusion_file) as f:
 for line in f:
+line = line.strip()
 if not excl_type:
-[excl_type, case_type] = line.split()
+excl_type = line
 continue
 
-line = line.strip()
 if not line:
 excl_type = None
-elif excl_type == 'skip' and case_type == 'files':
-if not configuration.skip_files:
-configuration.skip_files = []
-configuration.skip_files.append(line)
-elif excl_type == 'skip' and case_type == 'methods':
-if not configuration.skip_methods:
-configuration.skip_methods = []
-configuration.skip_methods.append(line)
-elif excl_type == 'xfail' and case_type == 'files':
-if not configuration.xfail_files:
-configuration.xfail_files = []
-configuration.xfail_files.append(line)
-elif excl_type == 'xfail' and case_type == 'methods':
-if not configuration.xfail_methods:
-configuration.xfail_methods = []
-configuration.xfail_methods.append(line)
+elif excl_type == 'skip':
+if not configuration.skip_tests:
+configuration.skip_tests = []
+configuration.skip_tests.append(line)
+elif excl_type == 'xfail':
+if not configuration.xfail_tests:
+configuration.xfail_tests = []
+configuration.xfail_tests.append(line)
 
 
 def parseOptionsAndInitTestdirs():
@@ -375,7 +366,8 @@ def parseOptionsAndInitTestdirs():
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.excluded:
-parseExclusion(args.excluded)
+for excl_file in args.excluded:
+parseExclusion(excl_file)
 
 if args.p:
 if args.p.startswith('-'):
@@ -799,8 +791,8 @@ def visit_file(dir, name):
 # We didn't match the regex, we're done.
 return
 
-if configuration.skip_files:
-for file_regexp in configuration.skip_files:
+if configuration.skip_tests:
+for file_regexp in configuration.skip_tests:
 if re.search(file_regexp, name):
 return
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=283238&r1=283237&r2=283238&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lld

[Lldb-commits] [PATCH] D24988: Improvements to testing blacklist

2016-10-04 Thread Francis Ricci via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283238: Improvements to testing blacklist (authored by 
fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D24988?vs=73363&id=73525#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24988

Files:
  lldb/trunk/packages/Python/lldbsuite/test/configuration.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
  lldb/trunk/packages/Python/lldbsuite/test/test_result.py

Index: lldb/trunk/packages/Python/lldbsuite/test/test_result.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/test_result.py
+++ lldb/trunk/packages/Python/lldbsuite/test/test_result.py
@@ -18,8 +18,6 @@
 # Third-party modules
 import unittest2
 
-from unittest2.util import strclass
-
 # LLDB Modules
 from . import configuration
 from lldbsuite.test_event.event_builder import EventBuilder
@@ -139,8 +137,7 @@
 self.getCategoriesForTest(test)):
 self.hardMarkAsSkipped(test)
 if self.checkExclusion(
-configuration.skip_methods,
-test._testMethodName):
+configuration.skip_tests, test.id()):
 self.hardMarkAsSkipped(test)
 
 configuration.setCrashInfoHook(
@@ -161,11 +158,7 @@
 
 def addSuccess(self, test):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests, test.id()):
 self.addUnexpectedSuccess(test, None)
 return
 
@@ -239,11 +232,7 @@
 
 def addFailure(self, test, err):
 if self.checkExclusion(
-configuration.xfail_files,
-strclass(
-test.__class__)) or self.checkExclusion(
-configuration.xfail_methods,
-test._testMethodName):
+configuration.xfail_tests, test.id()):
 self.addExpectedFailure(test, err, None)
 return
 
Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py
@@ -102,10 +102,8 @@
 regexp = None
 
 # Sets of tests which are excluded at runtime
-skip_files = None
-skip_methods = None
-xfail_files = None
-xfail_methods = None
+skip_tests = None
+xfail_tests = None
 
 # By default, recorded session info for errored/failed test are dumped into its
 # own file under a session directory named after the timestamp of the test suite
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -216,33 +216,24 @@

 """
 excl_type = None
-case_type = None
 
 with open(exclusion_file) as f:
 for line in f:
+line = line.strip()
 if not excl_type:
-[excl_type, case_type] = line.split()
+excl_type = line
 continue
 
-line = line.strip()
 if not line:
 excl_type = None
-elif excl_type == 'skip' and case_type == 'files':
-if not configuration.skip_files:
-configuration.skip_files = []
-configuration.skip_files.append(line)
-elif excl_type == 'skip' and case_type == 'methods':
-if not configuration.skip_methods:
-configuration.skip_methods = []
-configuration.skip_methods.append(line)
-elif excl_type == 'xfail' and case_type == 'files':
-if not configuration.xfail_files:
-configuration.xfail_files = []
-configuration.xfail_files.append(line)
-elif excl_type == 'xfail' and case_type == 'methods':
-if not configuration.xfail_methods:
-configuration.xfail_methods = []
-configuration.xfail_methods.append(line)
+elif excl_type == 'skip':
+if not configuration.skip_tests:
+configuration.skip_tests = []
+configuration.skip_tests.append(line)
+elif excl_type == 'xfail':
+if not configuration.xfail_tests:
+configuration.xfail_tests = []
+configuration.xfail_tests.append(line)
 
 
 def parseOptionsAndInitTestdirs():
@@ -375,7 +366,8 @@
 lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.excluded:
-  

[Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-07 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, jingham.
fjricci added subscribers: lldb-commits, sas.

When we construct AppleObjCTrampolineHandler, if m_impl_fn_addr is invalid, we 
call CanJIT(). If the gdb remote process does not support allocating and 
deallocating memory, this call stack will include a call to the 
AppleObjCRuntime constructor. The AppleObjCRuntime constructor will then call 
the AppleObjCTrampolineHandler constructor, creating a recursive call loop that 
eventually overflows the stack and segfaults.

Avoid this call loop by not constructing the AppleObjCTrampolineHandler within 
AppleObjCRuntime until we actually need to use it.

http://reviews.llvm.org/D15978

Files:
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -50,7 +50,6 @@
 m_objc_trampoline_handler_ap (),
 m_Foundation_major()
 {
-ReadObjCLibraryIfNeeded (process->GetTarget().GetImages());
 }
 
 bool
@@ -76,6 +75,7 @@
 bool
 AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, 
ExecutionContextScope *exe_scope)
 {
+ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages());
 if (!m_read_objc_library)
 return false;
 
@@ -369,6 +369,7 @@
 AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool 
stop_others)
 {
 ThreadPlanSP thread_plan_sp;
+ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages());
 if (m_objc_trampoline_handler_ap.get())
 thread_plan_sp = 
m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others);
 return thread_plan_sp;


Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -50,7 +50,6 @@
 m_objc_trampoline_handler_ap (),
 m_Foundation_major()
 {
-ReadObjCLibraryIfNeeded (process->GetTarget().GetImages());
 }
 
 bool
@@ -76,6 +75,7 @@
 bool
 AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionContextScope *exe_scope)
 {
+ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages());
 if (!m_read_objc_library)
 return false;
 
@@ -369,6 +369,7 @@
 AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)
 {
 ThreadPlanSP thread_plan_sp;
+ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages());
 if (m_objc_trampoline_handler_ap.get())
 thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others);
 return thread_plan_sp;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-07 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Here's a paste of the end of the backtrace.

pastebin.com/3VkF3Biq


http://reviews.llvm.org/D15978



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


[Lldb-commits] [PATCH] D15979: Fix dwarf sequence insertions

2016-01-07 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, andrew.w.kaylor.
fjricci added subscribers: lldb-commits, sas.

If two dwarf sequences begin with entries that have identical addresses,
it is possible for the comparator to order the first entry of the new
sequence between the first and second entries of the existing sequence.

This will result in an attempted insertion of the second sequence inside
of the first sequence, which is invalid.

Ensure that insertions only occur in between existing sequences.

http://reviews.llvm.org/D15979

Files:
  source/Symbol/LineTable.cpp

Index: source/Symbol/LineTable.cpp
===
--- source/Symbol/LineTable.cpp
+++ source/Symbol/LineTable.cpp
@@ -143,6 +143,13 @@
 entry_collection::iterator end_pos = m_entries.end();
 LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
 entry_collection::iterator pos = upper_bound(begin_pos, end_pos, entry, 
less_than_bp);
+
+// We should never insert a sequence in the middle of another sequence
+if (pos != begin_pos) {
+while (pos < end_pos && !((pos - 1)->is_terminal_entry))
+pos++;
+}
+
 #ifdef LLDB_CONFIGURATION_DEBUG
 // If we aren't inserting at the beginning, the previous entry should
 // terminate a sequence.


Index: source/Symbol/LineTable.cpp
===
--- source/Symbol/LineTable.cpp
+++ source/Symbol/LineTable.cpp
@@ -143,6 +143,13 @@
 entry_collection::iterator end_pos = m_entries.end();
 LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
 entry_collection::iterator pos = upper_bound(begin_pos, end_pos, entry, less_than_bp);
+
+// We should never insert a sequence in the middle of another sequence
+if (pos != begin_pos) {
+while (pos < end_pos && !((pos - 1)->is_terminal_entry))
+pos++;
+}
+
 #ifdef LLDB_CONFIGURATION_DEBUG
 // If we aren't inserting at the beginning, the previous entry should
 // terminate a sequence.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-07 Thread Francis Ricci via lldb-commits
fjricci added a comment.

@jingham - your suggestion does avoid the recursion as well, and seems a lot 
cleaner.


http://reviews.llvm.org/D15978



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


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-07 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 44305.
fjricci added a comment.

Follow suggestion by @jingham to avoid setting up ObjC runtime for low-level 
POSIX memory allocations


http://reviews.llvm.org/D15978

Files:
  source/Plugins/Process/Utility/InferiorCallPOSIX.cpp

Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -72,6 +72,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);
 
 addr_t prot_arg, flags_arg = 0;
 if (prot == eMmapProtNone)


Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -72,6 +72,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);
 
 addr_t prot_arg, flags_arg = 0;
 if (prot == eMmapProtNone)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-08 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Would you still like me to make the parameter change to InferiorCallMmap before 
merging?


http://reviews.llvm.org/D15978



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


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-08 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Sounds good, will do.


http://reviews.llvm.org/D15978



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


Re: [Lldb-commits] [PATCH] D15978: Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor

2016-01-08 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 44361.
fjricci added a comment.

Disable exception trapping by default on all functions in InferiorCallPOSIX


http://reviews.llvm.org/D15978

Files:
  source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
  source/Plugins/Process/Utility/InferiorCallPOSIX.h

Index: source/Plugins/Process/Utility/InferiorCallPOSIX.h
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.h
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.h
@@ -31,7 +31,8 @@
 
 bool InferiorCallMunmap(Process *proc, lldb::addr_t addr, lldb::addr_t length);
 
-bool InferiorCall(Process *proc, const Address *address, lldb::addr_t 
&returned_func);
+bool InferiorCall(Process *proc, const Address *address, lldb::addr_t 
&returned_func,
+  bool trap_exceptions = false);
 
 }   // namespace lldb_private
 
Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -72,6 +72,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);
 
 addr_t prot_arg, flags_arg = 0;
 if (prot == eMmapProtNone)
@@ -172,6 +173,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);

 AddressRange munmap_range;
 if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, 
munmap_range))
@@ -214,7 +216,8 @@
 bool
 lldb_private::InferiorCall (Process *process,
 const Address *address,
-addr_t &returned_func)
+addr_t &returned_func,
+bool trap_exceptions)
 {
 Thread *thread = process->GetThreadList().GetSelectedThread().get();
 if (thread == NULL || address == NULL)
@@ -227,6 +230,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(trap_exceptions);
 
 ClangASTContext *clang_ast_context = 
process->GetTarget().GetScratchClangASTContext();
 CompilerType clang_void_ptr_type = 
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();


Index: source/Plugins/Process/Utility/InferiorCallPOSIX.h
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.h
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.h
@@ -31,7 +31,8 @@
 
 bool InferiorCallMunmap(Process *proc, lldb::addr_t addr, lldb::addr_t length);
 
-bool InferiorCall(Process *proc, const Address *address, lldb::addr_t &returned_func);
+bool InferiorCall(Process *proc, const Address *address, lldb::addr_t &returned_func,
+  bool trap_exceptions = false);
 
 }   // namespace lldb_private
 
Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -72,6 +72,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);
 
 addr_t prot_arg, flags_arg = 0;
 if (prot == eMmapProtNone)
@@ -172,6 +173,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(false);

 AddressRange munmap_range;
 if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, munmap_range))
@@ -214,7 +216,8 @@
 bool
 lldb_private::InferiorCall (Process *process,
 const Address *address,
-addr_t &returned_func)
+addr_t &returned_func,
+bool trap_exceptions)
 {
 Thread *thread = process->GetThreadList().GetSelectedThread().get();
 if (thread == NULL || address == NULL)
@@ -227,6 +230,7 @@
 options.SetTryAllThreads(true);
 options.SetDebug (false);
 options.SetTimeoutUsec(50);
+options.SetTrapExceptions(trap_exceptions);
 
 ClangASTContext *clang_ast_context = process->GetTarget().GetScratchClangASTContext();
 CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-10 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: tberghammer, clayborg, jasonmolenda.
fjricci added subscribers: lldb-commits, sas.

Add an optional "reverse" option to the gdb-remote command,
which causes lldb to listen on the specified [host:]port,
waiting for the remote server to reverse-connect back to lldb.

http://reviews.llvm.org/D17099

Files:
  packages/Python/lldbsuite/test/decorators.py

Index: packages/Python/lldbsuite/test/decorators.py
===
--- packages/Python/lldbsuite/test/decorators.py
+++ packages/Python/lldbsuite/test/decorators.py
@@ -391,18 +391,6 @@
 return "skip on remote platform" if lldb.remote_platform else None
 return skipTestIfFn(is_remote)(func)
 
-def skipUnlessListedRemote(remote_list=None):
-def is_remote_unlisted(self):
-if remote_list and lldb.remote_platform:
-triple = self.dbg.GetSelectedPlatform().GetTriple()
-for r in remote_list:
-if r in triple:
-return None
-return "skipping because remote is not listed"
-else:
-return None
-return skipTestIfFn(is_remote_unlisted)
-
 def skipIfRemoteDueToDeadlock(func):
 """Decorate the item to skip tests if testing remotely due to the test 
deadlocking."""
 def is_remote():


Index: packages/Python/lldbsuite/test/decorators.py
===
--- packages/Python/lldbsuite/test/decorators.py
+++ packages/Python/lldbsuite/test/decorators.py
@@ -391,18 +391,6 @@
 return "skip on remote platform" if lldb.remote_platform else None
 return skipTestIfFn(is_remote)(func)
 
-def skipUnlessListedRemote(remote_list=None):
-def is_remote_unlisted(self):
-if remote_list and lldb.remote_platform:
-triple = self.dbg.GetSelectedPlatform().GetTriple()
-for r in remote_list:
-if r in triple:
-return None
-return "skipping because remote is not listed"
-else:
-return None
-return skipTestIfFn(is_remote_unlisted)
-
 def skipIfRemoteDueToDeadlock(func):
 """Decorate the item to skip tests if testing remotely due to the test deadlocking."""
 def is_remote():
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-10 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 47524.
fjricci added a comment.
Herald added subscribers: danalbert, tberghammer, emaste.

Accidentally uploaded the wrong commit. Sorry about that


http://reviews.llvm.org/D17099

Files:
  include/lldb/Target/Platform.h
  include/lldb/Target/Process.h
  source/Commands/CommandObjectProcess.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Platform.cpp
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -3496,15 +3496,15 @@
 }
 
 Error
-Process::ConnectRemote (Stream *strm, const char *remote_url)
+Process::ConnectRemote (Stream *strm, const char *remote_url, bool reverse)
 {
 m_abi_sp.reset();
 m_process_input_reader.reset();
 
 // Find the process and its architecture.  Make sure it matches the architecture
 // of the current Target, and if not adjust it.
 
-Error error (DoConnectRemote (strm, remote_url));
+Error error (DoConnectRemote (strm, remote_url, reverse));
 if (error.Success())
 {
 if (GetID() != LLDB_INVALID_PROCESS_ID)
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -2047,7 +2047,8 @@
  const char* plugin_name,
  lldb_private::Debugger &debugger,
  lldb_private::Target *target,
- lldb_private::Error &error)
+ lldb_private::Error &error,
+ bool reverse)
 {
 error.Clear();
 
@@ -2074,7 +2075,7 @@
 if (!process_sp)
 return nullptr;
 
-error = process_sp->ConnectRemote(debugger.GetOutputFile().get(), connect_url);
+error = process_sp->ConnectRemote(debugger.GetOutputFile().get(), connect_url, reverse);
 if (error.Fail())
 return nullptr;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -97,7 +97,7 @@
 WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) override;
 
 Error
-DoConnectRemote (Stream *strm, const char *remote_url) override;
+DoConnectRemote (Stream *strm, const char *remote_url, bool reverse = false) override;
 
 Error
 WillLaunchOrAttach ();
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -715,16 +715,21 @@
 }
 
 Error
-ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url)
+ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url, bool reverse)
 {
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
 Error error (WillLaunchOrAttach ());
 
 if (error.Fail())
 return error;
 
+if (reverse) {
+error = m_gdb_comm.WaitForDebugserver(remote_url);
+if (error.Fail())
+return error;
+}
+
 error = ConnectToDebugserver (remote_url);
-
 if (error.Fail())
 return error;
 StartAsyncThread ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -161,6 +161,9 @@
 return m_packet_timeout * TimeValue::MicroSecPerSec;
 }
 
+Error
+WaitForDebugserver (const char *url);
+
 //--
 // Start a debugserver instance on the current host using the
 // supplied connection URL.
@@ -339,7 +342,7 @@
 DecompressPacket ();
 
 Error
-StartListenThread (const char *hostname = "127.0.0.1", uint16_t port = 0);
+StartListenThread (const char *listen_url = "listen://127.0.0.1:0");
 
 bool
 JoinListenThread ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-10 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 47534.
fjricci added a comment.
Herald added a subscriber: srhines.

Apply clang-format


http://reviews.llvm.org/D17099

Files:
  include/lldb/Target/Platform.h
  include/lldb/Target/Process.h
  source/Commands/CommandObjectProcess.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Platform.cpp
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -3496,15 +3496,15 @@
 }
 
 Error
-Process::ConnectRemote (Stream *strm, const char *remote_url)
+Process::ConnectRemote(Stream *strm, const char *remote_url, bool reverse)
 {
 m_abi_sp.reset();
 m_process_input_reader.reset();
 
 // Find the process and its architecture.  Make sure it matches the architecture
 // of the current Target, and if not adjust it.
-
-Error error (DoConnectRemote (strm, remote_url));
+
+Error error(DoConnectRemote(strm, remote_url, reverse));
 if (error.Success())
 {
 if (GetID() != LLDB_INVALID_PROCESS_ID)
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -2043,11 +2043,8 @@
 }
 
 lldb::ProcessSP
-Platform::ConnectProcess(const char* connect_url,
- const char* plugin_name,
- lldb_private::Debugger &debugger,
- lldb_private::Target *target,
- lldb_private::Error &error)
+Platform::ConnectProcess(const char *connect_url, const char *plugin_name, lldb_private::Debugger &debugger,
+ lldb_private::Target *target, lldb_private::Error &error, bool reverse)
 {
 error.Clear();
 
@@ -2074,7 +2071,7 @@
 if (!process_sp)
 return nullptr;
 
-error = process_sp->ConnectRemote(debugger.GetOutputFile().get(), connect_url);
+error = process_sp->ConnectRemote(debugger.GetOutputFile().get(), connect_url, reverse);
 if (error.Fail())
 return nullptr;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -97,8 +97,8 @@
 WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) override;
 
 Error
-DoConnectRemote (Stream *strm, const char *remote_url) override;
-
+DoConnectRemote(Stream *strm, const char *remote_url, bool reverse = false) override;
+
 Error
 WillLaunchOrAttach ();
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -715,16 +715,22 @@
 }
 
 Error
-ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url)
+ProcessGDBRemote::DoConnectRemote(Stream *strm, const char *remote_url, bool reverse)
 {
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
 Error error (WillLaunchOrAttach ());
 
 if (error.Fail())
 return error;
 
-error = ConnectToDebugserver (remote_url);
+if (reverse)
+{
+error = m_gdb_comm.WaitForDebugserver(remote_url);
+if (error.Fail())
+return error;
+}
 
+error = ConnectToDebugserver(remote_url);
 if (error.Fail())
 return error;
 StartAsyncThread ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -161,6 +161,9 @@
 return m_packet_timeout * TimeValue::MicroSecPerSec;
 }
 
+Error
+WaitForDebugserver(const char *url);
+
 //--
 // Start a debugserver instance on the current host using the
 // supplied connection URL.
@@ -339,7 +342,7 @@
 DecompressPacket ();
 
 Error
-StartListenThread (const char *hostname = "127.0.0.1", uint16_t port = 0);
+StartListenThread(con

Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-10 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Perhaps I ran clang-format in the wrong configuration, but it looks like it 
made the function declaration style in include/lldb/Target/Platform.h a bit 
inconsistent. Is this the desired behavior?


http://reviews.llvm.org/D17099



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


Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-11 Thread Francis Ricci via lldb-commits
fjricci added a comment.

Would it be better to add a test in the same commit or a separate one?



Comment at: source/Interpreter/CommandInterpreter.cpp:638
@@ +637,3 @@
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+) 
reverse$",
+   "process connect 
--plugin gdb-remote connect://%1 reverse") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+) 
reverse$",

labath wrote:
> how about just using `listen://...` to mean reverse connection?
My concern with doing it this way was that 
ProcessGDBRemote::ConnectToDebugserver() seems to implicitly require a 
`connect://...` url, and I didn't want to risk breaking future changes. 
However, it still works correctly if I pass a `listen://...` url, so it seems 
like a reasonable change.


Comment at: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h:222
@@ -226,1 +221,3 @@
+ConnectProcess(const char *connect_url, const char *plugin_name, 
lldb_private::Debugger &debugger,
+   lldb_private::Target *target, lldb_private::Error &error, 
bool reverse = false) override;
 

labath wrote:
> I don't think we need to pass this `reverse=false` around everywhere. We 
> already support `listen://host:port` url scheme (see e.g. 
> ConnectionFileDescriptor::Connect`). Could you use that to specify connection 
> direction?
I had considered that, but wasn't sure whether parsing the direction out of the 
url string every time it was needed would be better or worse than passing it 
around as a bool. I'll make the change.


http://reviews.llvm.org/D17099



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


Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-11 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 47681.
fjricci added a comment.

Refactor to use listen urls


http://reviews.llvm.org/D17099

Files:
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -723,10 +723,28 @@
 if (error.Fail())
 return error;
 
-error = ConnectToDebugserver (remote_url);
+if (strncmp(remote_url, "listen", strlen("listen")) == 0)
+{
+error = m_gdb_comm.WaitForDebugserver(remote_url);
+if (error.Fail())
+return error;
 
-if (error.Fail())
+error = ConnectToDebugserver(nullptr);
+if (error.Fail())
+return error;
+}
+else if (strncmp(remote_url, "connect", strlen("connect")) == 0)
+{
+error = ConnectToDebugserver(remote_url);
+if (error.Fail())
+return error;
+}
+else
+{
+error.SetErrorStringWithFormat ("Invalid connection url: %s", remote_url);
 return error;
+}
+
 StartAsyncThread ();
 
 lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -161,6 +161,9 @@
 return m_packet_timeout * TimeValue::MicroSecPerSec;
 }
 
+Error
+WaitForDebugserver(const char *url);
+
 //--
 // Start a debugserver instance on the current host using the
 // supplied connection URL.
@@ -339,7 +342,7 @@
 DecompressPacket ();
 
 Error
-StartListenThread (const char *hostname = "127.0.0.1", uint16_t port = 0);
+StartListenThread(const char *listen_url = "listen://127.0.0.1:0");
 
 bool
 JoinListenThread ();
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1066,20 +1066,15 @@
 }
 
 Error
-GDBRemoteCommunication::StartListenThread (const char *hostname, uint16_t port)
+GDBRemoteCommunication::StartListenThread(const char *listen_url)
 {
 Error error;
 if (m_listen_thread.IsJoinable())
 {
 error.SetErrorString("listen thread already running");
 }
 else
 {
-char listen_url[512];
-if (hostname && hostname[0])
-snprintf(listen_url, sizeof(listen_url), "listen://%s:%i", hostname, port);
-else
-snprintf(listen_url, sizeof(listen_url), "listen://%i", port);
 m_listen_url = listen_url;
 SetConnection(new ConnectionFileDescriptor());
 m_listen_thread = ThreadLauncher::LaunchThread(listen_url, GDBRemoteCommunication::ListenThread, this, &error);
@@ -1112,11 +1107,37 @@
 }
 
 Error
-GDBRemoteCommunication::StartDebugserverProcess (const char *url,
- Platform *platform,
- ProcessLaunchInfo &launch_info,
- uint16_t *port,
- const Args& inferior_args)
+GDBRemoteCommunication::WaitForDebugserver(const char *url)
+{
+Error error;
+Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+if (log)
+log->Printf("GDBRemoteCommunication::%s(url=%s)", __FUNCTION__, url ? url : "");
+
+error = StartListenThread(url);
+if (error.Fail())
+{
+if (log)
+log->Printf("GDBRemoteCommunication::%s() unable to start listen thread: %s", __FUNCTION__,
+error.AsCString());
+return error;
+}
+
+// Make sure we actually connect with the debugserver...
+JoinListenThread();
+
+if (error.Fail())
+{
+if (log)
+log->Printf("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__, error.AsCString());
+}
+
+return error;
+}
+
+Error
+GDBRemoteCommunication::StartDebugserverProcess(const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
+uint16_t *port, const Args &inferior_args)
 {
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
 if (log)
@@ -1258,7 +1279,7 @@
 {
 // No host and port given, so lets listen on our end and make the debu

Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-12 Thread Francis Ricci via lldb-commits
fjricci added a comment.

It looks like passing a `listen://` url to `ConnectToDebugserver` actually 
works "out of the box". Thanks! I'll work on writing a unit test.


http://reviews.llvm.org/D17099



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


Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-02-12 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 47806.
fjricci added a comment.

Remove unnecessary special-case logic for reverse connecting


http://reviews.llvm.org/D17099

Files:
  source/Interpreter/CommandInterpreter.cpp

Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -624,18 +624,21 @@
 }
 }
 
-std::unique_ptr
-connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
- "gdb-remote",
- "Connect to a 
remote GDB server.  If no hostname is provided, localhost is assumed.",
- "gdb-remote 
[:]",
- 2,
- 0,
- false));
+std::unique_ptr connect_gdb_remote_cmd_ap(
+new CommandObjectRegexCommand(*this, "gdb-remote", "Connect to a 
remote GDB server.  If no "
+   "hostname is 
provided, localhost is assumed.",
+  "gdb-remote [:] 
[reverse]", 2, 0, false));
 if (connect_gdb_remote_cmd_ap.get())
 {
-if 
(connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process 
connect --plugin gdb-remote connect://%1") &&
-connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", 
"process connect --plugin gdb-remote connect://localhost:%1"))
+if 
(connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$",
+   "process connect 
--plugin gdb-remote connect://%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$",
+   "process connect 
--plugin gdb-remote connect://localhost:%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+) 
reverse$",
+   "process connect 
--plugin gdb-remote listen://%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+) 
reverse$",
+   "process connect 
--plugin gdb-remote "
+   
"listen://localhost:%1"))
 {
 CommandObjectSP command_sp(connect_gdb_remote_cmd_ap.release());
 m_command_dict[command_sp->GetCommandName ()] = command_sp;


Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -624,18 +624,21 @@
 }
 }
 
-std::unique_ptr
-connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
- "gdb-remote",
- "Connect to a remote GDB server.  If no hostname is provided, localhost is assumed.",
- "gdb-remote [:]",
- 2,
- 0,
- false));
+std::unique_ptr connect_gdb_remote_cmd_ap(
+new CommandObjectRegexCommand(*this, "gdb-remote", "Connect to a remote GDB server.  If no "
+   "hostname is provided, localhost is assumed.",
+  "gdb-remote [:] [reverse]", 2, 0, false));
 if (connect_gdb_remote_cmd_ap.get())
 {
-if (connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process connect --plugin gdb-remote connect://%1") &&
-connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "process connect --plugin gdb-remote connect://localhost:%1"))
+if (connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$",
+   "process connect --plugin gdb-remote connect://%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$",
+   "process connect --plugin gdb-remote connect://localhost:%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+) reverse$",
+   "process connect --plugin gdb-remote listen://%1") &&
+connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+) reverse$",
+   

[Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: jingham, clayborg, andrew.w.kaylor.
fjricci added subscribers: lldb-commits, sas.

The gdb-remote async thread cannot modify thread state while the main thread
holds a lock on the state. Don't use locking thread iteration for bt all.

Specifically, the deadlock manifests when lldb attempts to JIT code to
symbolicate objective c while backtracing. As part of this code path,
SetPrivateState() is called on an async thread. This async thread will
block waiting for the thread_list lock held by the main thread in
CommandObjectIterateOverThreads. The main thread will also block on the
async thread during DoResume (although with a timeout), leading to a
deadlock. Due to the timeout, the deadlock is not immediately apparent,
but the inferior will be left in an invalid state after the bt all completes,
and objective-c symbols will not be successfully resolved in the backtrace.

http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -73,8 +73,13 @@
 {
 Process *process = m_exe_ctx.GetProcessPtr();
 uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t i = 0; i < thread_list.GetSize(); ++i)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(i);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -73,8 +73,13 @@
 {
 Process *process = m_exe_ctx.GetProcessPtr();
 uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t i = 0; i < thread_list.GetSize(); ++i)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(i);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 50387.
fjricci added a comment.

Remove duplication of index variable


http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
 else if (command.GetArgumentCount() == 1 && ::strcmp 
(command.GetArgumentAtIndex(0), "all") == 0)
 {
 Process *process = m_exe_ctx.GetProcessPtr();
-uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
 if (!HandleOneThread(*(thread_sp.get()), result))
 return false;
-++idx;
 }
 }
 else


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
 else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
 {
 Process *process = m_exe_ctx.GetProcessPtr();
-uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
 if (!HandleOneThread(*(thread_sp.get()), result))
 return false;
-++idx;
 }
 }
 else
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-11 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 50454.
fjricci added a comment.

Use vector of tids for iteration, rather than iterating over unlocked threadlist


http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -66,61 +66,65 @@
 if (command.GetArgumentCount() == 0)
 {
 Thread *thread = m_exe_ctx.GetThreadPtr();
-if (!HandleOneThread (*thread, result))
+if (!HandleOneThread (thread->GetID(), result))
 return false;
+return result.Succeeded();
 }
-else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
+
+// Use tids instead of ThreadSPs to prevent deadlocking problems which result from JIT-ing
+// code while iterating over the (locked) ThreadSP list.
+std::vector tids;
+
+if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
 {
 Process *process = m_exe_ctx.GetProcessPtr();
-uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
-{
-if (idx != 0 && m_add_return)
-result.AppendMessage("");
 
-if (!HandleOneThread(*(thread_sp.get()), result))
-return false;
-++idx;
-}
+for (ThreadSP thread_sp : process->Threads())
+tids.push_back(thread_sp->GetID());
 }
 else
 {
 const size_t num_args = command.GetArgumentCount();
 Process *process = m_exe_ctx.GetProcessPtr();
+
 Mutex::Locker locker (process->GetThreadList().GetMutex());
-std::vector thread_sps;
 
 for (size_t i = 0; i < num_args; i++)
 {
 bool success;
-
+
 uint32_t thread_idx = StringConvert::ToUInt32(command.GetArgumentAtIndex(i), 0, 0, &success);
 if (!success)
 {
 result.AppendErrorWithFormat ("invalid thread specification: \"%s\"\n", command.GetArgumentAtIndex(i));
 result.SetStatus (eReturnStatusFailed);
 return false;
 }
-
-thread_sps.push_back(process->GetThreadList().FindThreadByIndexID(thread_idx));
-
-if (!thread_sps[i])
+
+ThreadSP thread = process->GetThreadList().FindThreadByIndexID(thread_idx);
+
+if (!thread)
 {
 result.AppendErrorWithFormat ("no thread with index: \"%s\"\n", command.GetArgumentAtIndex(i));
 result.SetStatus (eReturnStatusFailed);
 return false;
 }
-}
-
-for (uint32_t i = 0; i < num_args; i++)
-{
-if (!HandleOneThread (*(thread_sps[i].get()), result))
-return false;
 
-if (i < num_args - 1 && m_add_return)
-result.AppendMessage("");
+tids.push_back(thread->GetID());
 }
 }
+
+uint32_t idx = 0;
+for (const lldb::tid_t &tid : tids)
+{
+if (idx != 0 && m_add_return)
+result.AppendMessage("");
+
+if (!HandleOneThread (tid, result))
+return false;
+
+++idx;
+}
 return result.Succeeded();
 }
 
@@ -133,7 +137,7 @@
 // If m_add_return is true, a blank line will be inserted between each of the listings (except the last one.)
 
 virtual bool
-HandleOneThread (Thread &thread, CommandReturnObject &result) = 0;
+HandleOneThread (lldb::tid_t, CommandReturnObject &result) = 0;
 
 ReturnStatus m_success_return = eReturnStatusSuccessFinishResult;
 bool m_add_return = true;
@@ -275,25 +279,35 @@
 }
 
 bool
-HandleOneThread (Thread &thread, CommandReturnObject &result) override
+HandleOneThread (lldb::tid_t tid, CommandReturnObject &result) override
 {
+ThreadSP thread_sp = m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid);
+if (!thread_sp)
+{
+result.AppendErrorWithFormat ("thread disappeared while computing backtraces: 0x%" PRIx64 "\n", tid);
+result.SetStatus (eReturnStatusFailed);
+return false;
+}
+
+Thread *thread = thread_sp.get();
+
 Stream &strm = result.GetOutputStream();
 
 // Don't show source context when doing backtraces.
 const uint32_t num_frames_with_source = 0;
 
-if (!thread.GetStatus (strm,
-   m_options.m_start,
- 

Re: [Lldb-commits] [PATCH] D17099: Add reverse-connect functionality to the gdb-remote command

2016-03-14 Thread Francis Ricci via lldb-commits
fjricci abandoned this revision.
fjricci added a comment.

This functionality can already be accessed by using the "process connect" 
command with a listen url directly.


http://reviews.llvm.org/D17099



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


Re: [Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-18 Thread Francis Ricci via lldb-commits
fjricci added a comment.

That makes sense. Will do.


http://reviews.llvm.org/D18228



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


Re: [Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-19 Thread Francis Ricci via lldb-commits
fjricci added a comment.

So this was definitely a decision that I was debating. But I assume that the 
Append flag must imply the Write flag, since you can't open a file for Append 
without also opening it for write ("a" and "a+" both include write privileges). 
So I figured that having both "Append" and "Write" was redundant. And since "a" 
was previously using "Append" while "a+" was previously using "Write", I think 
that one of them needed to be changed to be consistent with the other. I can do 
it the other way around though if that's preferable.


http://reviews.llvm.org/D18228



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


Re: [Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-19 Thread Francis Ricci via lldb-commits
fjricci added a comment.

I want to add this testing to 
functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py,
 since that test is already very basic coverage of the same functionality.

However, it appears that TestCommandScriptImmediateOutput is an expected fail 
on FreeBSD, Linux, and Windows. And when I run it on the master branch on OSX, 
fails as ERROR. So it might be that the test doesn't actually pass on any 
platform.

When I run locally on Linux, the test succeeds, so I extended the test and made 
sure it passes Linux locally. But I'm not sure how useful that is, since the 
test is currently disabled on Linux.

I'll upload the test I wrote and we can go from there.


http://reviews.llvm.org/D18228



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


Re: [Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-19 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 51113.
fjricci added a comment.

Added unit test for python file api


http://reviews.llvm.org/D18228

Files:
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
  
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1252,10 +1252,10 @@
 return llvm::StringSwitch(mode.str().c_str())
 .Case("r",   File::eOpenOptionRead)
 .Case("w",   File::eOpenOptionWrite)
-.Case("a",   File::eOpenOptionAppend|File::eOpenOptionCanCreate)
+.Case("a",   
File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Case("r+",  File::eOpenOptionRead|File::eOpenOptionWrite)
 .Case("w+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
-.Case("a+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
+.Case("a+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Default(0);
 }
 
Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
@@ -6,3 +6,12 @@
 result.SetImmediateOutputFile(sys.__stdout__)
 print('this is a test string, just a test string', file=result)
 
+def write_file(debugger, command, exe_ctx, result, internal_dict):
+args = command.split(' ')
+path = args[0]
+mode = args[1]
+
+with open(path, mode) as f:
+result.SetImmediateOutputFile(f)
+if not mode in ['r']:
+print('writing to file with mode: ' + mode, file=result)
Index: 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -26,13 +26,47 @@
 @expectedFailureAll(oslist=["freebsd","linux"], 
bugnumber="llvm.org/pr26139")
 def test_command_script_immediate_output (self):
 """Test that LLDB correctly allows scripted commands to set an 
immediate output file."""
-self.launch(timeout=5)
+self.launch(timeout=60)
 
 script = os.path.join(os.getcwd(), 'custom_command.py')
 prompt = "(lldb)"
 
 self.sendline('command script import %s' % script, patterns=[prompt])
 self.sendline('command script add -f custom_command.command_function 
mycommand', patterns=[prompt])
 self.sendline('mycommand', patterns='this is a test string, just a 
test string')
 self.sendline('command script delete mycommand', patterns=[prompt])
+
+test_files = {os.path.join(os.getcwd(), 'read.txt'):'r',
+  os.path.join(os.getcwd(), 'write.txt')   :'w',
+  os.path.join(os.getcwd(), 'append.txt')  :'a',
+  os.path.join(os.getcwd(), 'write_plus.txt')  :'w+',
+  os.path.join(os.getcwd(), 'read_plus.txt')   :'r+',
+  os.path.join(os.getcwd(), 'append_plus.txt') :'a+'}
+
+starter_string = 'Starter Garbage\n'
+write_string   = 'writing to file with mode: '
+
+for path, mode in test_files.iteritems():
+with open(path, 'w+') as init:
+init.write(starter_string)
+
+self.sendline('command script add -f custom_command.write_file 
mywrite', patterns=[prompt])
+for path, mode in test_files.iteritems():
+command = 'mywrite ' + path + ' ' + mode
+
+self.sendline(command, patterns=[prompt])
+
+self.sendline('command script delete mywrite', patterns=[prompt])
+
 self.quit(gracefully=False)
+
+for path, mode in test_files.iteritems():
+with open(path, 'r') as result:
+if mode in ['r', 'a', 'a+']:
+self.assertEquals(result.readline(), starter_string)
+if mode in ['w', 'w+', 'r+', 'a', 'a+']:
+self.assertEquals(result.readline(), write_string + mode + 
'\n')
+
+self.assertTrue(os.path.isf

Re: [Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-19 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 51005.
fjricci added a comment.

Always use write flag, even in append mode


http://reviews.llvm.org/D18228

Files:
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1252,10 +1252,10 @@
 return llvm::StringSwitch(mode.str().c_str())
 .Case("r",   File::eOpenOptionRead)
 .Case("w",   File::eOpenOptionWrite)
-.Case("a",   File::eOpenOptionAppend|File::eOpenOptionCanCreate)
+.Case("a",   
File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Case("r+",  File::eOpenOptionRead|File::eOpenOptionWrite)
 .Case("w+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
-.Case("a+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
+.Case("a+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Default(0);
 }
 


Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1252,10 +1252,10 @@
 return llvm::StringSwitch(mode.str().c_str())
 .Case("r",   File::eOpenOptionRead)
 .Case("w",   File::eOpenOptionWrite)
-.Case("a",   File::eOpenOptionAppend|File::eOpenOptionCanCreate)
+.Case("a",   File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Case("r+",  File::eOpenOptionRead|File::eOpenOptionWrite)
 .Case("w+",  File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
-.Case("a+",  File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
+.Case("a+",  File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Default(0);
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D18228: Make File option flags consistent for Python API

2016-03-19 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: clayborg, granata.enrico, Eugene.Zelenko, jingham.
fjricci added subscribers: sas, lldb-commits.

Fixes SBCommandReturnObject::SetImmediateOutputFile() and
SBCommandReturnObject::SetImmediateOutputFile() for files opened
with "a" or "a+" by resolving inconsistencies between File and
our Python parsing of file objects.

http://reviews.llvm.org/D18228

Files:
  source/Host/common/File.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1255,7 +1255,7 @@
 .Case("a",   File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Case("r+",  File::eOpenOptionRead|File::eOpenOptionWrite)
 .Case("w+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
-.Case("a+",  
File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
+.Case("a+",  
File::eOpenOptionAppend|File::eOpenOptionRead|File::eOpenOptionCanCreate)
 .Default(0);
 }
 
Index: source/Host/common/File.cpp
===
--- source/Host/common/File.cpp
+++ source/Host/common/File.cpp
@@ -45,7 +45,7 @@
 else
 return "a+";
 }
-else if (options & File::eOpenOptionWrite)
+else
 {
 if (options & File::eOpenOptionCanCreateNewOnly)
 return "ax";


Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1255,7 +1255,7 @@
 .Case("a",   File::eOpenOptionAppend|File::eOpenOptionCanCreate)
 .Case("r+",  File::eOpenOptionRead|File::eOpenOptionWrite)
 .Case("w+",  File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
-.Case("a+",  File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
+.Case("a+",  File::eOpenOptionAppend|File::eOpenOptionRead|File::eOpenOptionCanCreate)
 .Default(0);
 }
 
Index: source/Host/common/File.cpp
===
--- source/Host/common/File.cpp
+++ source/Host/common/File.cpp
@@ -45,7 +45,7 @@
 else
 return "a+";
 }
-else if (options & File::eOpenOptionWrite)
+else
 {
 if (options & File::eOpenOptionCanCreateNewOnly)
 return "ax";
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


  1   2   >