[Lldb-commits] [PATCH] D20193: test infra: catch bad decorators and import errors

2016-05-11 Thread Todd Fiala via lldb-commits
tfiala created this revision.
tfiala added reviewers: labath, zturner.
tfiala added subscribers: lldb-commits, zturner.

This change enhances the LLDB test infrastructure to convert
load-time exceptions in a given Python test module into errors.
Before this change, specifying a non-existent test decorator,
or otherwise having some load-time error in a python test module,
would not get flagged as an error.

With this change, typos and other load-time errors in a python
test file get converted to errors and reported by the
test runner.

This change also includes test infrastructure tests that include
covering the new work here.  I'm going to wait until we have
these infrastructure tests runnable on the main platforms before
I try to work that into all the normal testing workflows.

The test infrastructure tests can be run by using the standard python module 
testing practice of doing the following:

cd packages/Python/lldbsuite/test_event
python -m unittest discover -s test/src -p 'Test*.py'

Those tests run the dotest inferior with a known broken test and verify that 
the errors are caught.  These tests did not pass until I modified dotest.py to 
capture them properly.

@zturner, if you have the chance, if you could try those steps above (the 
python -m unittest ... line) on Windows, that would be great if we can address 
any python2/3/Windows bits there.  I don't think there's anything fancy, but I 
didn't want to hook it into test flow until I know it works there.

I'll be slowly adding more tests that cover some of the other breakage I've 
occasionally seen that didn't get collected as part of the summarization.  This 
is the biggest one I'm aware of.

http://reviews.llvm.org/D20193

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/issue_verification/TestInvalidDecorator.py.park
  packages/Python/lldbsuite/test_event/event_builder.py
  packages/Python/lldbsuite/test_event/formatter/pickled.py
  
packages/Python/lldbsuite/test_event/test/resources/invalid_decorator/TestInvalidDecorator.py
  packages/Python/lldbsuite/test_event/test/src/TestCatchInvalidDecorator.py
  packages/Python/lldbsuite/test_event/test/src/event_collector.py

Index: packages/Python/lldbsuite/test_event/test/src/event_collector.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test_event/test/src/event_collector.py
@@ -0,0 +1,83 @@
+from __future__ import absolute_import
+from __future__ import print_function
+
+import os
+import subprocess
+import sys
+
+from six.moves import cPickle
+
+
+def path_to_dotest_py():
+return os.path.join(
+os.path.dirname(__file__),
+os.path.pardir,
+os.path.pardir,
+os.path.pardir,
+os.path.pardir,
+os.path.pardir,
+os.path.pardir,
+"test",
+"dotest.py")
+
+
+def pickled_events_filename():
+return "/tmp/lldb_test_event_pickled_event_output.dat"
+
+
+def _collect_events_with_command(command):
+# Delete the events file if it exists
+if os.path.exists(pickled_events_filename()):
+os.remove(pickled_events_filename())
+
+if os.path.exists(pickled_events_filename()):
+raise Exception("pickled events filename should not exist!")
+
+# Run the single test with dotest.py, outputting
+# the raw pickled events to a temp file.
+with open(os.devnull, 'w') as dev_null_file:
+status = subprocess.call(
+command,
+stdout=dev_null_file,
+stderr=dev_null_file)
+
+# Unpickle the events
+events = []
+if os.path.exists(pickled_events_filename()):
+with open(pickled_events_filename(), "rb") as events_file:
+while True:
+try:
+# print("reading event")
+event = cPickle.load(events_file)
+# print("read event: {}".format(event))
+if event:
+events.append(event)
+except EOFError:
+# This is okay.
+break
+return events
+
+def collect_events_whole_file(test_filename):
+command = [
+sys.executable,
+path_to_dotest_py(),
+"--inferior",
+"--results-formatter=lldbsuite.test_event.formatter.pickled.RawPickledFormatter",
+"--results-file={}".format(pickled_events_filename()),
+"-p", os.path.basename(test_filename),
+os.path.dirname(test_filename)
+]
+return _collect_events_with_command(command)
+
+
+def collect_events_for_directory_with_filter(test_filename, filter):
+command = [
+sys.executable,
+path_to_dotest_py(),
+"--inferior",
+"--results-formatter=lldbsuite.test_event.formatter.pickled.RawPickledFormatter",
+"--results-file={}".format(pickled_events_filename()),
+"-f", filter,
+os.path.dirname(test_filename)
+]
+return 

[Lldb-commits] [PATCH] D20188: Turn on LLDB_EDITLINE_USE_WCHAR on NetBSD

2016-05-11 Thread Kamil Rytarowski via lldb-commits
krytarowski created this revision.
krytarowski added reviewers: emaste, clayborg.
krytarowski added subscribers: lldb-commits, joerg.
krytarowski set the repository for this revision to rL LLVM.

The editline(3) library in NetBSD is by default internally wide.

Repository:
  rL LLVM

http://reviews.llvm.org/D20188

Files:
  include/lldb/Host/Editline.h

Index: include/lldb/Host/Editline.h
===
--- include/lldb/Host/Editline.h
+++ include/lldb/Host/Editline.h
@@ -27,11 +27,12 @@
 
 #include 
 #include 
+#include 
 
 // components needed to handle wide characters ( , codecvt_utf8, 
libedit built with '--enable-widec' )
-// are not consistenly available on non-OSX platforms.  The wchar_t versions 
of libedit functions will only be
+// are available on OSX and NetBSD. The wchar_t versions of libedit functions 
will only be
 // used in cases where this is true.  This is a compile time dependecy, for 
now selected per target Platform
-#if defined (__APPLE__)
+#if defined (__APPLE__) || defined(__NetBSD__)
 #define LLDB_EDITLINE_USE_WCHAR 1
 #include 
 #else


Index: include/lldb/Host/Editline.h
===
--- include/lldb/Host/Editline.h
+++ include/lldb/Host/Editline.h
@@ -27,11 +27,12 @@
 
 #include 
 #include 
+#include 
 
 // components needed to handle wide characters ( , codecvt_utf8, libedit built with '--enable-widec' )
-// are not consistenly available on non-OSX platforms.  The wchar_t versions of libedit functions will only be
+// are available on OSX and NetBSD. The wchar_t versions of libedit functions will only be
 // used in cases where this is true.  This is a compile time dependecy, for now selected per target Platform
-#if defined (__APPLE__)
+#if defined (__APPLE__) || defined(__NetBSD__)
 #define LLDB_EDITLINE_USE_WCHAR 1
 #include 
 #else
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15067: Add CMake bits necessary for standalone build

2016-05-11 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Updated. Can I commit it this way as it is?


Repository:
  rL LLVM

http://reviews.llvm.org/D15067



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


Re: [Lldb-commits] [PATCH] D15067: Add CMake bits necessary for standalone build

2016-05-11 Thread Kamil Rytarowski via lldb-commits
krytarowski retitled this revision from "Design building out of sources" to 
"Add CMake bits necessary for standalone build".
krytarowski updated this revision to Diff 56970.

Repository:
  rL LLVM

http://reviews.llvm.org/D15067

Files:
  cmake/modules/LLDBStandalone.cmake
  scripts/CMakeLists.txt

Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -9,6 +9,8 @@
   ${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h
 )
 
+include(FindPythonInterp)
+
 find_package(SWIG REQUIRED)
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -6,57 +6,78 @@
 
   option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
 
-  set(LLDB_PATH_TO_LLVM_SOURCE "" CACHE PATH
-"Path to LLVM source code. Not necessary if using an installed LLVM.")
-  set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH
-"Path to the directory where LLVM was built or installed.")
-
-  set(LLDB_PATH_TO_CLANG_SOURCE "" CACHE PATH
-"Path to Clang source code. Not necessary if using an installed Clang.")
-  set(LLDB_PATH_TO_CLANG_BUILD "" CACHE PATH
-"Path to the directory where Clang was built or installed.")
-
-  if (LLDB_PATH_TO_LLVM_SOURCE)
-if (NOT EXISTS "${LLDB_PATH_TO_LLVM_SOURCE}/cmake/config-ix.cmake")
-  message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_SOURCE to the root "
-  "directory of LLVM source code.")
+  # Rely on llvm-config.
+  set(CONFIG_OUTPUT)
+  find_program(LLVM_CONFIG "llvm-config")
+  if(LLVM_CONFIG)
+message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
+set(CONFIG_COMMAND ${LLVM_CONFIG}
+  "--assertion-mode"
+  "--bindir"
+  "--libdir"
+  "--includedir"
+  "--prefix"
+  "--src-root")
+execute_process(
+  COMMAND ${CONFIG_COMMAND}
+  RESULT_VARIABLE HAD_ERROR
+  OUTPUT_VARIABLE CONFIG_OUTPUT
+)
+if(NOT HAD_ERROR)
+  string(REGEX REPLACE
+"[ \t]*[\r\n]+[ \t]*" ";"
+CONFIG_OUTPUT ${CONFIG_OUTPUT})
+
 else()
-  get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE}
- ABSOLUTE)
-  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
-  list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
+  string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
+  message(STATUS "${CONFIG_COMMAND_STR}")
+  message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
 endif()
+  else()
+message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
   endif()
 
-  if (LLDB_PATH_TO_CLANG_SOURCE)
-  get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE}
- ABSOLUTE)
-  set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
+  list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
+  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
+  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
+  list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
+  list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
+  list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
+
+  if(NOT MSVC_IDE)
+set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
+  CACHE BOOL "Enable assertions")
+# Assertions should follow llvm-config's.
+mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
   endif()
 
-  list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
+  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
+  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
+  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
 
-  if (LLDB_PATH_TO_LLVM_BUILD)
-get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
-   ABSOLUTE)
-  else()
-message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_BUILD to the root "
-"directory of LLVM build or install site.")
-  endif()
+  find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+NO_DEFAULT_PATH)
 
-  if (LLDB_PATH_TO_CLANG_BUILD)
-get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
-   ABSOLUTE)
+  set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+  if(EXISTS ${LLVMCONFIG_FILE})
+list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+include(${LLVMCONFIG_FILE})
   else()
-message(FATAL_ERROR "Please set LLDB_PATH_TO_CLANG_BUILD to the root "
-"directory of Clang build or install site.")
+message(FATAL_ERROR 

Re: [Lldb-commits] [PATCH] D20135: Keep original source path and mapped path in LineEntry

2016-05-11 Thread Jim Ingham via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Looks good to me.


http://reviews.llvm.org/D20135



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


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

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

Oh right, I recall there was an action item on me.

I'll catch up with you on that in a bit.


http://reviews.llvm.org/D19998



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


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

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

I still need some expertise on how to disable the configuration on platforms 
with older versions of clang (or different compilers like gcc).


http://reviews.llvm.org/D19998



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


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

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

Hi Adrian,

I think this has stalled.  What do we need to resolve now?


http://reviews.llvm.org/D19998



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


Re: [Lldb-commits] [PATCH] D20106: Generalize child process monitoring functions

2016-05-11 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269205: Generalize child process monitoring functions 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D20106?vs=56903=56932#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20106

Files:
  lldb/trunk/include/lldb/Host/Host.h
  lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
  lldb/trunk/include/lldb/Host/HostProcess.h
  lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h
  lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Host/common/HostProcess.cpp
  lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/trunk/source/Host/macosx/Host.mm
  lldb/trunk/source/Host/posix/HostProcessPosix.cpp
  lldb/trunk/source/Host/windows/Host.cpp
  lldb/trunk/source/Host/windows/HostProcessWindows.cpp
  lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
  lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/trunk/source/Target/Process.cpp
  lldb/trunk/source/Target/ProcessLaunchInfo.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
@@ -3584,6 +3584,8 @@
 Error
 ProcessGDBRemote::LaunchAndConnectToDebugserver (const ProcessInfo _info)
 {
+using namespace std::placeholders; // For _1, _2, etc.
+
 Error error;
 if (m_debugserver_pid == LLDB_INVALID_PROCESS_ID)
 {
@@ -3595,7 +3597,8 @@
 // special terminal key sequences (^C) don't affect debugserver.
 debugserver_launch_info.SetLaunchInSeparateProcessGroup(true);
 
-debugserver_launch_info.SetMonitorProcessCallback (MonitorDebugserverProcess, this, false);
+debugserver_launch_info.SetMonitorProcessCallback(std::bind(MonitorDebugserverProcess, this, _1, _2, _3, _4),
+  false);
 debugserver_launch_info.SetUserID(process_info.GetUserID());
 
 #if defined (__APPLE__) && (defined (__arm__) || defined (__arm64__) || defined (__aarch64__))
@@ -3657,14 +3660,11 @@
 }
 
 bool
-ProcessGDBRemote::MonitorDebugserverProcess
-(
-void *callback_baton,
-lldb::pid_t debugserver_pid,
-bool exited,// True if the process did exit
-int signo,  // Zero for no signal
-int exit_status // Exit value of process if signal is zero
-)
+ProcessGDBRemote::MonitorDebugserverProcess(ProcessGDBRemote *process, lldb::pid_t debugserver_pid,
+bool exited,// True if the process did exit
+int signo,  // Zero for no signal
+int exit_status // Exit value of process if signal is zero
+)
 {
 // The baton is a "ProcessGDBRemote *". Now this class might be gone
 // and might not exist anymore, so we need to carefully try to get the
@@ -3680,15 +3680,14 @@
 // debugserver that we are tracking...
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
-ProcessGDBRemote *process = (ProcessGDBRemote *)callback_baton;
-
 // Get a shared pointer to the target that has a matching process pointer.
 // This target could be gone, or the target could already have a new process
 // object inside of it
 TargetSP target_sp (Debugger::FindTargetWithProcess(process));
 
 if (log)
-log->Printf ("ProcessGDBRemote::MonitorDebugserverProcess (baton=%p, pid=%" PRIu64 ", signo=%i (0x%x), exit_status=%i)", callback_baton, debugserver_pid, signo, signo, exit_status);
+log->Printf("ProcessGDBRemote::%s(process=%p, pid=%" PRIu64 ", signo=%i (0x%x), exit_status=%i)", __FUNCTION__,
+process, debugserver_pid, signo, signo, exit_status);
 
 if (target_sp)
 {
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
@@ -121,13 +121,6 @@
 bool
 DebugserverProcessReaped (lldb::pid_t pid);
 
-static bool

[Lldb-commits] [lldb] r269205 - Generalize child process monitoring functions

2016-05-11 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 11 11:59:04 2016
New Revision: 269205

URL: http://llvm.org/viewvc/llvm-project?rev=269205=rev
Log:
Generalize child process monitoring functions

Summary:
This replaces the C-style "void *" baton of the child process monitoring 
functions with a more
C++-like API taking a std::function. The motivation for this was that it was 
very difficult to
handle the ownership of the object passed into the callback function -- each 
caller ended up
implementing his own way of doing it, some doing it better than others. With 
the new API, one can
just pass a smart pointer into the callback and all of the lifetime management 
will be handled
automatically.

This has enabled me to simplify the rather complicated handshake in 
Host::RunShellCommand. I have
left handling of MonitorDebugServerProcess (my original motivation for this 
change) to a separate
commit to reduce the scope of this change.

Reviewers: clayborg, zturner, emaste, krytarowski

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
lldb/trunk/include/lldb/Host/HostProcess.h
lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h
lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/common/HostProcess.cpp
lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/posix/HostProcessPosix.cpp
lldb/trunk/source/Host/windows/Host.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ProcessLaunchInfo.cpp

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=269205=269204=269205=diff
==
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Wed May 11 11:59:04 2016
@@ -38,12 +38,10 @@ class ProcessLaunchInfo;
 class Host
 {
 public:
-
-typedef bool (*MonitorChildProcessCallback) (void *callback_baton,
- lldb::pid_t pid,
- bool exited,
- int signal,// Zero for no 
signal
- int status);   // Exit value 
of process if signal is zero
+typedef std::function // Exit value of process if signal 
is zero
+MonitorChildProcessCallback;
 
 //--
 /// Start monitoring a child process.
@@ -65,10 +63,6 @@ public:
 /// A function callback to call when a child receives a signal
 /// (if \a monitor_signals is true) or a child exits.
 ///
-/// @param[in] callback_baton
-/// A void * of user data that will be pass back when
-/// \a callback is called.
-///
 /// @param[in] pid
 /// The process ID of a child process to monitor, -1 for all
 /// processes.
@@ -84,8 +78,8 @@ public:
 ///
 /// @see static void Host::StopMonitoringChildProcess (uint32_t)
 //--
-static HostThread StartMonitoringChildProcess(MonitorChildProcessCallback 
callback, void *callback_baton, lldb::pid_t pid,
-  bool monitor_signals);
+static HostThread
+StartMonitoringChildProcess(const MonitorChildProcessCallback , 
lldb::pid_t pid, bool monitor_signals);
 
 enum SystemLogType
 {

Modified: lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeProcessBase.h?rev=269205=269204=269205=diff
==
--- lldb/trunk/include/lldb/Host/HostNativeProcessBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostNativeProcessBase.h Wed May 11 11:59:04 
2016
@@ 

Re: [Lldb-commits] [PATCH] D15067: Design building out of sources

2016-05-11 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

In http://reviews.llvm.org/D15067#419964, @labath wrote:

> Good question. I don't really have an opinion on that... Is it just that 
> single line? (this would be simpler if you uploaded the final version :) ). 
> If it just that single line, then I think it's fine. If you also need to play 
> with the ADDITIONAL_VERSIONS and such, then we should think about making a 
> macro or doing something else to avoid code duplication (there is already a 
> FIXME in scripts/Python/modules/readline mentioning the additional versions).


Sorry for delay. I'm going to update the diff.


Repository:
  rL LLVM

http://reviews.llvm.org/D15067



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


Re: [Lldb-commits] [lldb] r269025 - Fix race in TestExitDuringStep and unify pseudo_barrier handling

2016-05-11 Thread Pavel Labath via lldb-commits
Hmm.. So you actually needed to insert the additional "continue"
command. That is not good. I was hoping it would be enough to just
remove the strict check for the location numbers.

Working around it this way is quite ugly. Let's try something else.
Would getting rid of the do{}while loop in the macro fix the problem?
I added it to make the macro a bit more safe, but I don't think it's
really necessary...

It may be worth making this into a separate test case though, as this
should just work.

pl


On 11 May 2016 at 16:24, Ed Maste  wrote:
> On 11 May 2016 at 10:10, Pavel Labath  wrote:
>> Hi,
>>
>> so I think this is our old "compiler generates unpredictable number of
>> source locations for a line" friend again, which got triggered by a
>> random code reshuffle. Assuming the test still passes for you after
>> that, can you prepare a change to remove the "num_expected_locations =
>> 1" from the relevant lines?
>
> Indeed. I'm able to get the test passing with this ugly workaround:
>
> --- 
> a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
> +++ 
> b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
> @@ -31,16 +31,18 @@ class ThreadExitTestCase(TestBase):
>  self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
>
>  # This should create a breakpoint with 1 location.
> +   # Note, Clang 3.4.1 on FreeBSD 10 produces debug info with two 
> locations
> +   # for breakpoint 3. Work around that by requiring at least one 
> location.
>  bp1_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_1, num_expected_locations=1)
>  bp2_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_2, num_expected_locations=1)
> -bp3_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_3, num_expected_locations=1)
> +bp3_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_3, num_expected_locations=-1)
>  bp4_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_4, num_expected_locations=1)
>
>  # The breakpoint list should show 1 locations.
>  self.expect("breakpoint list -f", "Breakpoint location shown
> correctly",
>  substrs = ["1: file = 'main.cpp', line = %d, exact_match
> = 0, locations = 1" % self.break_1,
> "2: file = 'main.cpp', line = %d, exact_match
> = 0, locations = 1" % self.break_2,
> -   "3: file = 'main.cpp', line = %d, exact_match
> = 0, locations = 1" % self.break_3,
> +   "3: file = 'main.cpp', line = %d, exact_match
> = 0, locations = " % self.break_3,
> "4: file = 'main.cpp', line = %d, exact_match
> = 0, locations = 1" % self.break_4])
>
>  # Run the program.
> @@ -76,6 +78,10 @@ class ThreadExitTestCase(TestBase):
>
>  # Run to the fourth breakpoint
>  self.runCmd("continue")
> +   # bp3 may have multiple locations. Continue if we're still
> stopped there.
> +if lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp3_id):
> +self.runCmd("continue")
> +
>  stopped_thread =
> lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp4_id)
>  self.assertIsNotNone(stopped_thread, "Process is not stopped
> at breakpoint 4")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r269025 - Fix race in TestExitDuringStep and unify pseudo_barrier handling

2016-05-11 Thread Pavel Labath via lldb-commits
Hi,

so I think this is our old "compiler generates unpredictable number of
source locations for a line" friend again, which got triggered by a
random code reshuffle. Assuming the test still passes for you after
that, can you prepare a change to remove the "num_expected_locations =
1" from the relevant lines?

If that doesn't fix it, then we'll need to think harder about this.

pl

On 10 May 2016 at 21:25, Ed Maste  wrote:
> On 10 May 2016 at 03:54, Pavel Labath via lldb-commits
>  wrote:
>> Author: labath
>> Date: Tue May 10 02:54:25 2016
>> New Revision: 269025
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=269025=rev
>> Log:
>> Fix race in TestExitDuringStep and unify pseudo_barrier handling
>
> After this change TestThreadExit is failing on FreeBSD 10 with:
> ...
>   File 
> "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py",
> line 36, in test
> bp3_id = lldbutil.run_break_set_by_file_and_line (self,
> "main.cpp", self.break_3, num_expected_locations=1)
>   File 
> "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbutil.py",
> line 342, in run_break_set_by_file_and_line
> check_breakpoint_result (test, break_results, num_locations =
> num_expected_locations)
>   File 
> "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbutil.py",
> line 474, in check_breakpoint_result
> test.assertTrue (num_locations == out_num_locations, "Expecting %d
> locations, got %d."%(num_locations, out_num_locations))
> AssertionError: False is not True : Expecting 1 locations, got 2.
> ...
>
> "breakpoint list" shows:
>
> 3: file = 
> '/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp',
> line = 67, locations = 2
>   3.1: where = a.out`main + 1437 at main.cpp:67, address =
> 0x004018bd, unresolved, hit count = 0
>   3.2: where = a.out`main + 1846 at main.cpp:67, address =
> 0x00401a56, unresolved, hit count = 0
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r269187 - Xfail failing watchpoint tests on aarch64-linux

2016-05-11 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Wed May 11 08:57:20 2016
New Revision: 269187

URL: http://llvm.org/viewvc/llvm-project?rev=269187=rev
Log:
Xfail failing watchpoint tests on aarch64-linux

Some watchpoint tests fail on aarch64-linux as it lacks support for intalling 
watchpoints which are not alligned at 8bytes boundary.

Marking them as xfail for now. 


Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py?rev=269187=269186=269187=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
 Wed May 11 08:57:20 2016
@@ -30,6 +30,7 @@ class WatchpointLLDBCommandTestCase(Test
 self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
 
 @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not 
supported
+@expectedFailureAll(oslist=["linux"], archs=["aarch64"], 
bugnumber="llvm.org/pr27710")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: 
WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
 def test_watchpoint_command(self):
 """Test 'watchpoint command'."""
@@ -84,6 +85,7 @@ class WatchpointLLDBCommandTestCase(Test
 substrs = ['(int32_t)', 'cookie = 777'])
 
 @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not 
supported
+@expectedFailureAll(oslist=["linux"], archs=["aarch64"], 
bugnumber="llvm.org/pr27710")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: 
WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
 def test_watchpoint_command_can_disable_a_watchpoint(self):
 """Test that 'watchpoint command' action can disable a watchpoint 
after it is triggered."""

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=269187=269186=269187=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
 Wed May 11 08:57:20 2016
@@ -32,6 +32,7 @@ class WatchpointPythonCommandTestCase(Te
 @skipIfFreeBSD # timing out on buildbot
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: 
WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
 @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not 
supported
+@expectedFailureAll(oslist=["linux"], archs=["aarch64"], 
bugnumber="llvm.org/pr27710")
 def test_watchpoint_command(self):
 """Test 'watchpoint command'."""
 self.build(dictionary=self.d)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py?rev=269187=269186=269187=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
 Wed May 11 08:57:20 2016
@@ -30,6 +30,7 @@ class WatchpointConditionCmdTestCase(Tes
 self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
 
 @expectedFailureAndroid(archs=['arm', 'aarch64']) # 

Re: [Lldb-commits] [PATCH] D20106: Generalize child process monitoring functions

2016-05-11 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 56903.
labath marked 3 inline comments as done.
labath added a comment.
Herald added a subscriber: emaste.

Remove the typedef and add changes to windows, osx, and freebsd-specific code. 
I didn't
try building NetBSD, but given that there is no Plugins/Process/NetBSD, I don't 
think I
need to do any changes there at all. I'll keep an eye out on the buildbots after
submitting this.

I'd like to draw attention to the osx change in Host.mm in particular, as I not 
too
familiar with objjective c, but making a copy there made the thing work for me 
(without
that, I was getting errors, presumably because the block was only capturing the
reference, which was not enough if to keep the function object alive).


http://reviews.llvm.org/D20106

Files:
  include/lldb/Host/Host.h
  include/lldb/Host/HostNativeProcessBase.h
  include/lldb/Host/HostProcess.h
  include/lldb/Host/posix/HostProcessPosix.h
  include/lldb/Host/windows/HostProcessWindows.h
  include/lldb/Target/Process.h
  include/lldb/Target/ProcessLaunchInfo.h
  source/Host/common/Host.cpp
  source/Host/common/HostProcess.cpp
  source/Host/common/MonitoringProcessLauncher.cpp
  source/Host/macosx/Host.mm
  source/Host/posix/HostProcessPosix.cpp
  source/Host/windows/Host.cpp
  source/Host/windows/HostProcessWindows.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.h
  source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  source/Target/ProcessLaunchInfo.cpp

Index: source/Target/ProcessLaunchInfo.cpp
===
--- source/Target/ProcessLaunchInfo.cpp
+++ source/Target/ProcessLaunchInfo.cpp
@@ -244,12 +244,9 @@
 }
 
 void
-ProcessLaunchInfo::SetMonitorProcessCallback (Host::MonitorChildProcessCallback callback,
-   void *baton,
-   bool monitor_signals)
+ProcessLaunchInfo::SetMonitorProcessCallback(const Host::MonitorChildProcessCallback , bool monitor_signals)
 {
 m_monitor_callback = callback;
-m_monitor_callback_baton = baton;
 m_monitor_signals = monitor_signals;
 }
 
@@ -259,7 +256,6 @@
 if (m_monitor_callback && ProcessIDIsValid())
 {
 Host::StartMonitoringChildProcess (m_monitor_callback,
-   m_monitor_callback_baton,
GetProcessID(),
m_monitor_signals);
 return true;
Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -1512,21 +1512,15 @@
 // found in the global target list (we want to be completely sure that the
 // lldb_private::Process doesn't go away before we can deliver the signal.
 bool
-Process::SetProcessExitStatus (void *callback_baton,
-   lldb::pid_t pid,
-   bool exited,
-   int signo,  // Zero for no signal
-   int exit_status // Exit value of process if signal is zero
-)
+Process::SetProcessExitStatus(lldb::pid_t pid, bool exited,
+  int signo,  // Zero for no signal
+  int exit_status // Exit value of process if signal is zero
+  )
 {
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS));
 if (log)
-log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n",
- callback_baton,
- pid,
- exited,
- signo,
- exit_status);
+log->Printf("Process::SetProcessExitStatus (pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n", pid,
+exited, signo, exit_status);
 
 if (exited)
 {
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -405,11 +405,7 @@
 AsyncThread (void *arg);
 
 static bool
-MonitorDebugserverProcess (void *callback_baton,
-   lldb::pid_t pid,
-   bool exited,
-   int signo,
-   int exit_status);
+MonitorDebugserverProcess(ProcessGDBRemote *process, lldb::pid_t pid, bool exited, int signo, int exit_status);
 
 lldb::StateType
   

[Lldb-commits] [lldb] r269181 - [LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI

2016-05-11 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Wed May 11 08:08:29 2016
New Revision: 269181

URL: http://llvm.org/viewvc/llvm-project?rev=269181=rev
Log:
[LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI

Patch by Nitesh Jain.

Summary: The ArchSpec::m_flags will be set based on ELF flag ABI.

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan
Differential: D18858

Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=269181=269180=269181=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Wed May 11 08:08:29 2016
@@ -69,6 +69,9 @@ public:
 eMIPSABI_O32= 0x2000,
 eMIPSABI_N32= 0x4000,
 eMIPSABI_N64= 0x8000,
+eMIPSABI_O64= 0x0002,
+eMIPSABI_EABI32 = 0x0004,
+eMIPSABI_EABI64 = 0x0008,
 eMIPSABI_mask   = 0x000ff000
 };
 
@@ -289,6 +292,14 @@ public:
 const char *
 GetArchitectureName () const;
 
+//-
+/// if MIPS architecture return true.
+///
+///  @return a boolean value.
+//-
+bool
+IsMIPS() const;
+
 //--
 /// Returns a string representing current architecture as a target CPU
 /// for tools like compiler, disassembler etc.

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=269181=269180=269181=diff
==
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Wed May 11 08:08:29 2016
@@ -507,6 +507,18 @@ ArchSpec::GetArchitectureName () const
 return "unknown";
 }
 
+bool 
+ArchSpec::IsMIPS() const
+{
+const llvm::Triple::ArchType machine = GetMachine();
+if(machine == llvm::Triple::mips ||
+   machine == llvm::Triple::mipsel ||
+   machine == llvm::Triple::mips64 ||
+   machine == llvm::Triple::mips64el)
+   return true;
+return false;
+}
+
 std::string
 ArchSpec::GetClangTargetCPU ()
 {

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=269181=269180=269181=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed May 11 
08:08:29 2016
@@ -1697,8 +1697,7 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
 
 I->section_name = name;
 
-if (arch_spec.GetMachine() == llvm::Triple::mips || 
arch_spec.GetMachine() == llvm::Triple::mipsel
-|| arch_spec.GetMachine() == llvm::Triple::mips64 || 
arch_spec.GetMachine() == llvm::Triple::mips64el)
+if (arch_spec.IsMIPS())
 {
 uint32_t arch_flags = arch_spec.GetFlags ();
 DataExtractor data;
@@ -1712,13 +1711,27 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
 }
 }
 // Settings appropriate ArchSpec ABI Flags
-if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
+switch(header.e_flags & llvm::ELF::EF_MIPS_ABI)
 {
-arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
-}
-else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
-{
- arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
+case llvm::ELF::EF_MIPS_ABI_O32:
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
+break;
+case EF_MIPS_ABI_O64:
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_O64;
+break;
+case EF_MIPS_ABI_EABI32:
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_EABI32;
+break;
+case EF_MIPS_ABI_EABI64:
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_EABI64;
+break;
+default:
+// ABI Mask doesn't cover N32 and N64 ABI.
+

Re: [Lldb-commits] [PATCH] D18858: [LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI

2016-05-11 Thread Nitesh Jain via lldb-commits
nitesh.jain updated this revision to Diff 56891.
nitesh.jain added a comment.

Added IsMIPS() method.


Repository:
  rL LLVM

http://reviews.llvm.org/D18858

Files:
  include/lldb/Core/ArchSpec.h
  source/Core/ArchSpec.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1697,8 +1697,7 @@
 
 I->section_name = name;
 
-if (arch_spec.GetMachine() == llvm::Triple::mips || 
arch_spec.GetMachine() == llvm::Triple::mipsel
-|| arch_spec.GetMachine() == llvm::Triple::mips64 || 
arch_spec.GetMachine() == llvm::Triple::mips64el)
+if (arch_spec.IsMIPS())
 {
 uint32_t arch_flags = arch_spec.GetFlags ();
 DataExtractor data;
@@ -1712,13 +1711,27 @@
 }
 }
 // Settings appropriate ArchSpec ABI Flags
-if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
+switch(header.e_flags & llvm::ELF::EF_MIPS_ABI)
 {
-arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
-}
-else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
-{
- arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
+case llvm::ELF::EF_MIPS_ABI_O32:
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
+break;
+case EF_MIPS_ABI_O64:
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_O64;
+break;
+case EF_MIPS_ABI_EABI32:
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_EABI32;
+break;
+case EF_MIPS_ABI_EABI64:
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_EABI64;
+break;
+default:
+// ABI Mask doesn't cover N32 and N64 ABI.
+if (header.e_ident[EI_CLASS] == 
llvm::ELF::ELFCLASS64)
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_N64;
+else if (header.e_flags && llvm::ELF::EF_MIPS_ABI2)
+arch_flags |= 
lldb_private::ArchSpec::eMIPSABI_N32;
+break;
 }
 arch_spec.SetFlags (arch_flags);
 }
Index: source/Core/ArchSpec.cpp
===
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -507,6 +507,18 @@
 return "unknown";
 }
 
+bool 
+ArchSpec::IsMIPS() const
+{
+const llvm::Triple::ArchType machine = GetMachine();
+if(machine == llvm::Triple::mips ||
+   machine == llvm::Triple::mipsel ||
+   machine == llvm::Triple::mips64 ||
+   machine == llvm::Triple::mips64el)
+   return true;
+return false;
+}
+
 std::string
 ArchSpec::GetClangTargetCPU ()
 {
Index: include/lldb/Core/ArchSpec.h
===
--- include/lldb/Core/ArchSpec.h
+++ include/lldb/Core/ArchSpec.h
@@ -69,6 +69,9 @@
 eMIPSABI_O32= 0x2000,
 eMIPSABI_N32= 0x4000,
 eMIPSABI_N64= 0x8000,
+eMIPSABI_O64= 0x0002,
+eMIPSABI_EABI32 = 0x0004,
+eMIPSABI_EABI64 = 0x0008,
 eMIPSABI_mask   = 0x000ff000
 };
 
@@ -289,6 +292,14 @@
 const char *
 GetArchitectureName () const;
 
+//-
+/// if MIPS architecture return true.
+///
+///  @return a boolean value.
+//-
+bool
+IsMIPS() const;
+
 //--
 /// Returns a string representing current architecture as a target CPU
 /// for tools like compiler, disassembler etc.


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1697,8 +1697,7 @@
 
 I->section_name = name;
 
-if (arch_spec.GetMachine() == llvm::Triple::mips || arch_spec.GetMachine() == llvm::Triple::mipsel
-|| arch_spec.GetMachine() == llvm::Triple::mips64 || arch_spec.GetMachine() == llvm::Triple::mips64el)
+if 

Re: [Lldb-commits] [PATCH] D20091: Rewriting TestMultithreaded.py to solve flakyness on Linux

2016-05-11 Thread Ravitheja Addepally via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269168: Rewriting TestMultithreaded.py to solve flakyness on 
Linux (authored by ravitheja).

Changed prior to commit:
  http://reviews.llvm.org/D20091?vs=56671=56870#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20091

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp

Index: 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
+++ 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
@@ -18,7 +18,6 @@
 // listener thread control
 extern atomic g_done;
 
-multithreaded_queue g_thread_descriptions;
 multithreaded_queue g_frame_functions;
 
 extern SBListener g_listener;
@@ -30,39 +29,30 @@
 if (got_event) {
   if (!event.IsValid())
 throw Exception("event is not valid in listener thread");
-
-  // send process description
-  SBProcess process = SBProcess::GetProcessFromEvent(event);
-  SBStream description;
-
-  for (int i = 0; i < process.GetNumThreads(); ++i) {
-// send each thread description
-description.Clear();
-SBThread thread = process.GetThreadAtIndex(i);
-thread.GetDescription(description);
-g_thread_descriptions.push(description.GetData());
-
-// send each frame function name
-uint32_t num_frames = thread.GetNumFrames();
-for(int j = 0; j < num_frames; ++j) {
-  const char* function_name = 
thread.GetFrameAtIndex(j).GetSymbol().GetName();
-  if (function_name)
-g_frame_functions.push(function_name);
+// send process description
+SBProcess process = SBProcess::GetProcessFromEvent(event);
+SBStream description;
+
+for (int i = 0; i < process.GetNumThreads(); ++i) {
+// send each thread description
+SBThread thread = process.GetThreadAtIndex(i);
+// send each frame function name
+uint32_t num_frames = thread.GetNumFrames();
+for(int j = 0; j < num_frames; ++j) {
+const char* function_name = 
thread.GetFrameAtIndex(j).GetSymbol().GetName();
+if (function_name)
+g_frame_functions.push(string(function_name));
+}
 }
-  }
 }
   }
 }
 
 void check_listener(SBDebugger ) {
   // check thread description
   bool got_description = false;
-  string desc = g_thread_descriptions.pop(5, got_description);
-  if (!got_description)
-throw Exception("Expected at least one thread description string");
-
-  // check at least one frame has a function name
-  desc = g_frame_functions.pop(5, got_description);
-  if (!got_description)
-throw Exception("Expected at least one frame function name string");
+  string func_name = g_frame_functions.pop(5, got_description);
+  
+  if(got_description == false)
+throw Exception("Expected at least one frame function");
 }
Index: 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
@@ -37,7 +37,6 @@
 @skipIfNoSBHeaders
 @skipIfWindows # clang-cl does not support throw or catch 
(llvm.org/pr24538)
 @expectedFlakeyFreeBSD
-@expectedFlakeyLinux # Driver occasionally returns '1' as exit status
 @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", 
compiler_version=[">=","4.9"], archs=["x86_64"])
 def test_sb_api_listener_event_process_state(self):
 """ Test that a registered SBListener receives events when a process


Index: lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
@@ -18,7 +18,6 @@
 // listener thread control
 extern atomic g_done;
 
-multithreaded_queue g_thread_descriptions;
 multithreaded_queue g_frame_functions;
 
 extern SBListener g_listener;
@@ -30,39 +29,30 @@
 if (got_event) {
   if (!event.IsValid())
 throw Exception("event is not valid in listener thread");
-
-  // send process description
-  SBProcess process = SBProcess::GetProcessFromEvent(event);
-  SBStream description;
-
-  for (int i = 0; i < 

Re: [Lldb-commits] [PATCH] D20091: Rewriting TestMultithreaded.py to solve flakyness on Linux

2016-05-11 Thread Ravitheja Addepally via lldb-commits
ravitheja added a comment.

@labath, Well the other tests in TestMultithreaded.py are not flaky and I see 
the only difference as an extra push operation, so I thought the push operation 
could be potential bottleneck.


http://reviews.llvm.org/D20091



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


Re: [Lldb-commits] [PATCH] D20091: Rewriting TestMultithreaded.py to solve flakyness on Linux

2016-05-11 Thread Pavel Labath via lldb-commits
labath accepted this revision.
labath added a comment.

I am somewhat surprised that this solves anything (I mean, you claim that the 
problem is the ordering between the push and pop, but I don't see how this 
could change that ordering). If the problem was that the check_listener was not 
waiting long enough, then it should be sufficient to increase the timeout...

That said, I don't think it should make things any worse either, so I'm ready 
to give it a go...


http://reviews.llvm.org/D20091



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