Re: [Lldb-commits] [PATCH] fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD

2014-11-20 Thread Shawn Best
Closed by commit rL222511 (authored by @sbest).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D5837

Files:
  lldb/trunk/test/api/multithreaded/TestMultithreaded.py
  lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp
Index: lldb/trunk/test/api/multithreaded/TestMultithreaded.py
===
--- lldb/trunk/test/api/multithreaded/TestMultithreaded.py
+++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py
@@ -28,7 +28,6 @@
 self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
 'test_breakpoint_callback')
 
-@expectedFailureFreeBSD(llvm.org/21211)
 @skipIfi386
 @skipIfRemote
 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
Index: lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp
===
--- lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp
+++ lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp
@@ -16,16 +16,17 @@
 using namespace std;
 
 // listener thread control
-extern atomicbool g_done; 
+extern atomicbool g_done;
+extern SBListener g_listener;
 
 multithreaded_queuestring g_event_descriptions;
-
-extern SBListener g_listener;
+string g_error_desc;
 
 void listener_func() {
   while (!g_done) {
 SBEvent event;
 bool got_event = g_listener.WaitForEvent(1, event);
+
 if (got_event) {
   if (!event.IsValid())
 throw Exception(event is not valid in listener thread);
@@ -38,27 +39,59 @@
   }
 }
 
-void check_listener(SBDebugger dbg) {
-  arraystring, 2 expected_states = {running, stopped};
-  for(string  state : expected_states) {
-bool got_description = false;
-string desc = g_event_descriptions.pop(5, got_description);
-
-if (!got_description)
-  throw Exception(Did not get expected event description);
-
+bool check_state(string state, string desc, bool got_description)
+{
+g_error_desc.clear();
+
+if(!got_description)
+{
+g_error_desc.append(Did not get expected event description);
+return false;
+}
 
 if (desc.find(state-changed) == desc.npos)
-  throw Exception(Event description incorrect: missing 'state-changed');
+g_error_desc.append(Event description incorrect: missing 'state-changed' );
+
+if (desc.find(pid = ) == desc.npos)
+g_error_desc.append(Event description incorrect: missing process pid );
 
 string state_search_str = state =  + state;
 if (desc.find(state_search_str) == desc.npos)
-  throw Exception(Event description incorrect: expected state 
+{
+string errString = (Event description incorrect: expected state 
   + state
   +  but desc was 
   + desc);
+g_error_desc.append(errString);
+}
 
-if (desc.find(pid = ) == desc.npos)
-  throw Exception(Event description incorrect: missing process pid);
-  }
+if (g_error_desc.length()  0)
+return false;
+
+cout  check_state:   stateOK\n;
+return true;
+}
+
+void check_listener(SBDebugger dbg)
+{
+bool got_description;
+string state;
+
+// check for launching state, this may or may not be present
+string desc = g_event_descriptions.pop(5, got_description);
+state = launching;
+if (check_state(state, desc, got_description))
+{
+// found a 'launching' state, pop next one from queue
+desc = g_event_descriptions.pop(5, got_description);
+}
+
+state = running;
+if( !check_state(state, desc, got_description) )
+throw Exception(g_error_desc);
+
+desc = g_event_descriptions.pop(5, got_description);
+state = stopped;
+if( !check_state(state, desc, got_description) )
+throw Exception(g_error_desc);
 }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r222511 - fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD

2014-11-20 Thread Shawn Best
Author: sbest
Date: Fri Nov 21 00:49:39 2014
New Revision: 222511

URL: http://llvm.org/viewvc/llvm-project?rev=222511view=rev
Log:
fix Bug21211 : reworked 
test/api/multithreaded/test_listener_event_description.cpp to work properly on 
Linux/FreeBSD

Issue D5632 fixed an issue where linux would dump spurious output to tty on 
startup (due to a broadcast stop event). After the checkin, it was noticed on 
FreeBSD a unit test was now failing. On closer investigation I found the test 
was using the C++ API to launch an inferior while using an SBListener to 
monitor the public state changes. As on OSx, it was expecting to see:

eStateRunning
eStateStopped

On Linux/FreeBSD, there is an extra state change

eStateLaunching
eStateRunning
eStateStopped

I reworked the test to work for both cases and re-enabled the test of FreeBSD.

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

Modified:
lldb/trunk/test/api/multithreaded/TestMultithreaded.py
lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp

Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/TestMultithreaded.py?rev=222511r1=222510r2=222511view=diff
==
--- lldb/trunk/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py Fri Nov 21 00:49:39 
2014
@@ -28,7 +28,6 @@ class SBBreakpointCallbackCase(TestBase)
 self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
 'test_breakpoint_callback')
 
-@expectedFailureFreeBSD(llvm.org/21211)
 @skipIfi386
 @skipIfRemote
 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with 
c++11

Modified: lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp?rev=222511r1=222510r2=222511view=diff
==
--- lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp 
(original)
+++ lldb/trunk/test/api/multithreaded/test_listener_event_description.cpp Fri 
Nov 21 00:49:39 2014
@@ -16,16 +16,17 @@ using namespace lldb;
 using namespace std;
 
 // listener thread control
-extern atomicbool g_done; 
+extern atomicbool g_done;
+extern SBListener g_listener;
 
 multithreaded_queuestring g_event_descriptions;
-
-extern SBListener g_listener;
+string g_error_desc;
 
 void listener_func() {
   while (!g_done) {
 SBEvent event;
 bool got_event = g_listener.WaitForEvent(1, event);
+
 if (got_event) {
   if (!event.IsValid())
 throw Exception(event is not valid in listener thread);
@@ -38,27 +39,59 @@ void listener_func() {
   }
 }
 
-void check_listener(SBDebugger dbg) {
-  arraystring, 2 expected_states = {running, stopped};
-  for(string  state : expected_states) {
-bool got_description = false;
-string desc = g_event_descriptions.pop(5, got_description);
-
-if (!got_description)
-  throw Exception(Did not get expected event description);
-
+bool check_state(string state, string desc, bool got_description)
+{
+g_error_desc.clear();
+
+if(!got_description)
+{
+g_error_desc.append(Did not get expected event description);
+return false;
+}
 
 if (desc.find(state-changed) == desc.npos)
-  throw Exception(Event description incorrect: missing 'state-changed');
+g_error_desc.append(Event description incorrect: missing 
'state-changed' );
+
+if (desc.find(pid = ) == desc.npos)
+g_error_desc.append(Event description incorrect: missing process pid 
);
 
 string state_search_str = state =  + state;
 if (desc.find(state_search_str) == desc.npos)
-  throw Exception(Event description incorrect: expected state 
+{
+string errString = (Event description incorrect: expected state 
   + state
   +  but desc was 
   + desc);
+g_error_desc.append(errString);
+}
 
-if (desc.find(pid = ) == desc.npos)
-  throw Exception(Event description incorrect: missing process pid);
-  }
+if (g_error_desc.length()  0)
+return false;
+
+cout  check_state:   stateOK\n;
+return true;
+}
+
+void check_listener(SBDebugger dbg)
+{
+bool got_description;
+string state;
+
+// check for launching state, this may or may not be present
+string desc = g_event_descriptions.pop(5, got_description);
+state = launching;
+if (check_state(state, desc, got_description))
+{
+// found a 'launching' state, pop next one from queue
+desc = g_event_descriptions.pop(5, got_description);
+}
+
+state = running;
+if( !check_state(state, desc, got_description) )
+throw 

Re: [Lldb-commits] [lldb] r222163 - Complete rewrite of interactive editing support for single- and multi-line input.

2014-11-18 Thread Shawn Best
I can confirm the two issues you cite also started failing on linux 
around the time of this changes. Greg's checkin yesterday fixed 
TestCommandRegex, but TestGlobalVariables is still failing.


On 11/17/2014 11:46 AM, Ed Maste wrote:

On 17 November 2014 14:07, Kate Stone katherine.st...@apple.com wrote:

Author: kate
Date: Mon Nov 17 13:06:59 2014
New Revision: 222163

URL: http://llvm.org/viewvc/llvm-project?rev=222163view=rev
Log:
Complete rewrite of interactive editing support for single- and multi-line 
input.

FYI, two new test failures appeared on FreeBSD after this change. I'm
curious if the Linux guys see similar behaviour.


FAIL: LLDB (/usr/bin/clang-x86_64) :: test_with_dwarf
(TestGlobalVariables.GlobalVariablesTestCase)
==
FAIL: test_with_dwarf (TestGlobalVariables.GlobalVariablesTestCase)
Test 'frame variable --scope --no-args' which omits args and shows scopes.
--
Traceback (most recent call last):
   File /tank/emaste/src/llvm/tools/lldb/test/lldbtest.py, line 382, in 
wrapper
 return func(self, *args, **kwargs)
   File 
/tank/emaste/src/llvm/tools/lldb/test/lang/c/global_variables/TestGlobalVariables.py,
line 24, in test_with_dwarf
 self.global_variables()
   File 
/tank/emaste/src/llvm/tools/lldb/test/lang/c/global_variables/TestGlobalVariables.py,
line 60, in global_variables
 'stop reason = breakpoint'])
   File /tank/emaste/src/llvm/tools/lldb/test/lldbtest.py, line 1886, in 
expect
 self.runCmd(str, msg=msg, trace = (True if trace else False),
check = not error, inHistory=inHistory)
   File /tank/emaste/src/llvm/tools/lldb/test/lldbtest.py, line 1812, in 
runCmd
 msg if msg else CMD_MSG(cmd))
AssertionError: False is not True : Process should be stopped due to breakpoint
Config=x86_64-/usr/bin/clang
--
Ran 2 tests in 0.200s

FAILED (failures=1, skipped=1)


FAIL: LLDB (/usr/bin/clang-x86_64) :: test_command_regex
(TestCommandRegex.CommandRegexTestCase)
==
ERROR: test_command_regex (TestCommandRegex.CommandRegexTestCase)
Test a simple scenario of 'command regex' invocation and subsequent use.
--
Traceback (most recent call last):
   File 
/tank/emaste/src/llvm/tools/lldb/test/functionalities/command_regex/TestCommandRegex.py,
line 38, in test_command_regex
 child.expect('The following is a list of built-in, permanent
debugger commands:')
   File /tank/emaste/src/llvm/tools/lldb/test/pexpect-2.4/pexpect.py,
line 1316, in expect
 return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
   File /tank/emaste/src/llvm/tools/lldb/test/pexpect-2.4/pexpect.py,
line 1330, in expect_list
 return self.expect_loop(searcher_re(pattern_list), timeout,
searchwindowsize)
   File /tank/emaste/src/llvm/tools/lldb/test/pexpect-2.4/pexpect.py,
line 1414, in expect_loop
 raise TIMEOUT (str(e) + '\n' + str(self))
TIMEOUT: Timeout exceeded in read_nonblocking().
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r222031 - add Makefile rule for test program CREATE_STD_THREADS

2014-11-14 Thread Shawn Best
Author: sbest
Date: Fri Nov 14 13:41:33 2014
New Revision: 222031

URL: http://llvm.org/viewvc/llvm-project?rev=222031view=rev
Log:
add Makefile rule for test program CREATE_STD_THREADS

Effectively removes -lpthreads from linux/gcc build of test programs in 
test/api/multithreaded. This was done due to that combination causing a test 
program to hang due, likely due to an issue with gcc linker and libstdc++ 
conflicting pthreads code in test program and pthread used by lldb.  Issue has 
been documented at:
http://llvm.org/bugs/show_bug.cgi?id=21553

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

Modified:
lldb/trunk/test/api/multithreaded/Makefile
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/api/multithreaded/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/Makefile?rev=222031r1=222030r2=222031view=diff
==
--- lldb/trunk/test/api/multithreaded/Makefile (original)
+++ lldb/trunk/test/api/multithreaded/Makefile Fri Nov 14 13:41:33 2014
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
+ENABLE_STD_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=222031r1=222030r2=222031view=diff
==
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Nov 14 13:41:33 2014
@@ -120,9 +120,23 @@ LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS)
 ifneq $(OS) Windows_NT
-   ifeq $(ENABLE_THREADS) YES
-   LDFLAGS += -lpthread
-   endif
+ifeq $(ENABLE_THREADS) YES
+LDFLAGS += -lpthread
+else 
+ifeq $(ENABLE_STD_THREADS) YES
+# with the specific combination of Linux, g++, std=c++11, adding 
the 
+# linker flag -lpthread, will cause a program to hang when a 
std::conditional_variable
+# is used in a program that links lldb (see bugzilla 21553)
+ifeq $(OS) Linux
+ifeq (,$(findstring gcc,$(CC))) 
+# Linux, but not gcc
+LDFLAGS += -lpthread
+endif
+else
+LDFLAGS += -lpthread
+endif
+endif
+endif
 endif
 OBJECTS =
 EXE ?= a.out


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile

2014-11-14 Thread Shawn Best
Closed by commit rL222031 (authored by @sbest).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D5838

Files:
  lldb/trunk/test/api/multithreaded/Makefile
  lldb/trunk/test/make/Makefile.rules
Index: lldb/trunk/test/api/multithreaded/Makefile
===
--- lldb/trunk/test/api/multithreaded/Makefile
+++ lldb/trunk/test/api/multithreaded/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
+ENABLE_STD_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/test/make/Makefile.rules
===
--- lldb/trunk/test/make/Makefile.rules
+++ lldb/trunk/test/make/Makefile.rules
@@ -120,9 +120,23 @@
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS)
 ifneq $(OS) Windows_NT
-	ifeq $(ENABLE_THREADS) YES
-		LDFLAGS += -lpthread
-	endif
+ifeq $(ENABLE_THREADS) YES
+LDFLAGS += -lpthread
+else 
+ifeq $(ENABLE_STD_THREADS) YES
+# with the specific combination of Linux, g++, std=c++11, adding the 
+# linker flag -lpthread, will cause a program to hang when a std::conditional_variable
+# is used in a program that links lldb (see bugzilla 21553)
+ifeq $(OS) Linux
+ifeq (,$(findstring gcc,$(CC))) 
+# Linux, but not gcc
+LDFLAGS += -lpthread
+endif
+else
+LDFLAGS += -lpthread
+endif
+endif
+endif
 endif
 OBJECTS =
 EXE ?= a.out
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD

2014-11-14 Thread Shawn Best
friendly ping.  I was waiting until the other change (D5838 ENABLE_STD_THREADS) 
landed and I could run the tests in api/multithreaded again.  This is a rework 
of the test program logic to accommodate the fact that OSx and linux broadcast 
a different sequence of public events due to their different inferior launching.

I can confirm the test passes on Linux, and OSx.  I assume it now will pass 
correctly on FreeBSD since it exhibited a similar failure to Linux when it got 
broken by D5632.

http://reviews.llvm.org/D5837



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile

2014-11-13 Thread Shawn Best
I have added another flag to test/Makefile.rules ENABLE_STD_THREADS and used it 
the api/Multithreaded unit tests.  This can be used to selectively omit 
'-lpthreads' option for certain systems.  All platforms except linux/gcc should 
behave as before.

I have also made a Bugzilla report for simple program that hangs on linux ( 
http://llvm.org/bugs/show_bug.cgi?id=21553 )

I see there has been some recent activity in this area with r215562 omitting 
-lpthreads on windows, and r218899 recently adding -lpthreads as it was needed 
for FreeBSD.

http://reviews.llvm.org/D5838

Files:
  test/api/multithreaded/Makefile
  test/make/Makefile.rules
Index: test/api/multithreaded/Makefile
===
--- test/api/multithreaded/Makefile
+++ test/api/multithreaded/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
+ENABLE_STD_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
Index: test/make/Makefile.rules
===
--- test/make/Makefile.rules
+++ test/make/Makefile.rules
@@ -120,9 +120,23 @@
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS)
 ifneq $(OS) Windows_NT
-	ifeq $(ENABLE_THREADS) YES
-		LDFLAGS += -lpthread
-	endif
+ifeq $(ENABLE_THREADS) YES
+LDFLAGS += -lpthread
+else 
+ifeq $(ENABLE_STD_THREADS) YES
+# with the specific combination of Linux, g++, std=c++11, adding the 
+# linker flag -lpthread, will cause a program to hang when a std::conditional_variable
+# is used in a program that links lldb (see bugzilla 21553)
+ifeq $(OS) Linux
+ifeq (,$(findstring gcc,$(CC))) 
+# Linux, but not gcc
+LDFLAGS += -lpthread
+endif
+else
+LDFLAGS += -lpthread
+endif
+endif
+endif
 endif
 OBJECTS =
 EXE ?= a.out
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r221692 - Substitute cc with c++ when compiling c++ test files for Siva Chandra : http://reviews.llvm.org/D6199

2014-11-11 Thread Shawn Best
Author: sbest
Date: Tue Nov 11 11:34:58 2014
New Revision: 221692

URL: http://llvm.org/viewvc/llvm-project?rev=221692view=rev
Log:
Substitute cc with c++ when compiling c++ test files for Siva Chandra : 
http://reviews.llvm.org/D6199

Modified:
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=221692r1=221691r2=221692view=diff
==
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Tue Nov 11 11:34:58 2014
@@ -130,11 +130,27 @@ ifneq $(DYLIB_NAME) 
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), $(subst 
clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if 
$(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst 
gcc,g++,$(1)
+cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
+   $(subst clang,clang++,$(1)), \
+   $(if $(findstring icc,$(1)), \
+$(subst icc,icpc,$(1)), \
+$(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+  $(subst gcc,g++,$(1)), \
+  $(subst cc,c++,$(1))
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), $(subst 
clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if 
$(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst 
gcc,g++,$(1)
+cxx_linker_notdir = $(if $(findstring clang,$(1)), \
+ $(subst clang,clang++,$(1)), \
+ $(if $(findstring icc,$(1)), \
+  $(subst icc,icpc,$(1)), \
+  $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,g++,$(1)), \
+$(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 #--


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r221694 - Add -std=c99 for building the test case of TestValueVarUpdate - for Siva Chandra : http://reviews.llvm.org/D6201

2014-11-11 Thread Shawn Best
Author: sbest
Date: Tue Nov 11 11:45:00 2014
New Revision: 221694

URL: http://llvm.org/viewvc/llvm-project?rev=221694view=rev
Log:
Add -std=c99 for building the test case of TestValueVarUpdate - for Siva 
Chandra : http://reviews.llvm.org/D6201

Modified:
lldb/trunk/test/python_api/value_var_update/Makefile

Modified: lldb/trunk/test/python_api/value_var_update/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/Makefile?rev=221694r1=221693r2=221694view=diff
==
--- lldb/trunk/test/python_api/value_var_update/Makefile (original)
+++ lldb/trunk/test/python_api/value_var_update/Makefile Tue Nov 11 11:45:00 
2014
@@ -1,6 +1,7 @@
 LEVEL = ../../make
 
 C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
 # See TestHelloWorld.py, which specifies the executable name with a dictionary.
 EXE := hello_world
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r221593 - LLGS Android target support (r221570) missed adding some files: http://reviews.llvm.org/D6166

2014-11-10 Thread Shawn Best
Author: sbest
Date: Mon Nov 10 09:06:15 2014
New Revision: 221593

URL: http://llvm.org/viewvc/llvm-project?rev=221593view=rev
Log:
LLGS Android target support (r221570) missed adding some files: 
http://reviews.llvm.org/D6166

Added:
lldb/trunk/cmake/
lldb/trunk/cmake/LLDBDependencies.cmake
lldb/trunk/cmake/platforms/
lldb/trunk/cmake/platforms/Android.cmake
lldb/trunk/include/lldb/Host/android/
lldb/trunk/include/lldb/Host/android/Android.h
lldb/trunk/include/lldb/Host/android/Config.h

Added: lldb/trunk/cmake/LLDBDependencies.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=221593view=auto
==
--- lldb/trunk/cmake/LLDBDependencies.cmake (added)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Mon Nov 10 09:06:15 2014
@@ -0,0 +1,175 @@
+set( LLDB_USED_LIBS
+  lldbBreakpoint
+  lldbCommands
+  lldbDataFormatters
+  lldbHost
+  lldbCore
+  lldbExpression
+  lldbInterpreter
+  lldbSymbol
+  lldbTarget
+  lldbUtility
+
+  # Plugins
+  lldbPluginDisassemblerLLVM
+  lldbPluginSymbolFileDWARF
+  lldbPluginSymbolFileSymtab
+  lldbPluginDynamicLoaderStatic
+  lldbPluginDynamicLoaderPosixDYLD
+  lldbPluginDynamicLoaderHexagonDYLD
+
+  lldbPluginObjectFileMachO
+  lldbPluginObjectFileELF
+  lldbPluginObjectFileJIT
+  lldbPluginSymbolVendorELF
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginProcessGDBRemote
+  lldbPluginProcessMachCore
+  lldbPluginProcessUtility
+  lldbPluginPlatformGDB
+  lldbPluginPlatformFreeBSD
+  lldbPluginPlatformKalimba
+  lldbPluginPlatformLinux
+  lldbPluginPlatformPOSIX
+  lldbPluginPlatformWindows
+  lldbPluginObjectFileMachO
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginPlatformMacOSX
+  lldbPluginDynamicLoaderMacOSXDYLD
+  lldbPluginUnwindAssemblyInstEmulation
+  lldbPluginUnwindAssemblyX86
+  lldbPluginAppleObjCRuntime
+  lldbPluginCXXItaniumABI
+  lldbPluginABIMacOSX_arm
+  lldbPluginABIMacOSX_arm64
+  lldbPluginABIMacOSX_i386
+  lldbPluginABISysV_x86_64
+  lldbPluginABISysV_hexagon
+  lldbPluginABISysV_ppc
+  lldbPluginABISysV_ppc64
+  lldbPluginInstructionARM
+  lldbPluginInstructionARM64
+  lldbPluginObjectFilePECOFF
+  lldbPluginOSPython
+  lldbPluginMemoryHistoryASan
+  lldbPluginInstrumentationRuntimeAddressSanitizer
+  )
+
+# Need to export the API in the liblldb.dll for Windows
+# The lldbAPI source files are added directly in liblldb
+if (NOT CMAKE_SYSTEM_NAME MATCHES Windows )
+  list(APPEND LLDB_USED_LIBS
+lldbAPI
+)
+endif ()
+
+# Windows-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES Windows )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessWindows
+lldbPluginProcessElfCore
+lldbPluginJITLoaderGDB
+Ws2_32
+)
+endif ()
+
+# Linux-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES Linux )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessLinux
+lldbPluginProcessPOSIX
+lldbPluginProcessElfCore
+lldbPluginJITLoaderGDB
+   )
+endif ()
+
+# FreeBSD-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES FreeBSD )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessFreeBSD
+lldbPluginProcessPOSIX
+lldbPluginProcessElfCore
+lldbPluginJITLoaderGDB
+)
+endif ()
+
+# Darwin-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES Darwin )
+  set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
+  add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
+COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
+ ${LLDB_VERS_GENERATED_FILE})
+
+  set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 
1)
+  list(APPEND LLDB_USED_LIBS
+lldbPluginDynamicLoaderDarwinKernel
+lldbPluginProcessMacOSXKernel
+lldbPluginSymbolVendorMacOSX
+lldbPluginSystemRuntimeMacOSX
+lldbPluginProcessElfCore
+lldbPluginJITLoaderGDB
+)
+endif()
+
+set( CLANG_USED_LIBS
+  clangAnalysis
+  clangAST
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangEdit
+  clangFrontend
+  clangLex
+  clangParse
+  clangRewrite
+  clangRewriteFrontend
+  clangSema
+  clangSerialization
+  )
+
+set(LLDB_SYSTEM_LIBS)
+if (NOT CMAKE_SYSTEM_NAME MATCHES Windows AND NOT __ANDROID_NDK__)
+  list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses)
+endif()
+# On FreeBSD backtrace() is provided by libexecinfo, not libc.
+if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)
+  list(APPEND LLDB_SYSTEM_LIBS execinfo)
+endif()
+
+if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
+endif()
+
+list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
+
+set( LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
+  interpreter
+  asmparser
+  bitreader
+  bitwriter
+  codegen
+  ipo
+  selectiondag
+  bitreader
+  mc
+  mcjit
+  core
+  mcdisassembler
+  executionengine
+  option
+  )
+
+if ( NOT LLDB_DISABLE_PYTHON )
+  

[Lldb-commits] [PATCH] R220718 broke some unit tests on linux

2014-11-07 Thread Shawn Best
Hi granata.enrico,

R220718 changed the path libtest.py goes looking for the file LLDB.h.  This 
will cause all unit tests decorated with @skipIfNoSBHeaders to skip the test 
on linux (and I suspect all non-Apple platforms).

http://reviews.llvm.org/D6177

Files:
  test/lldbtest.py
Index: test/lldbtest.py
===
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -565,7 +565,10 @@
 def wrapper(*args, **kwargs):
 from unittest2 import case
 self = args[0]
-header = os.path.join(self.lib_dir, 'LLDB.framework', 'Versions','Current','Headers','LLDB.h')
+if sys.platform.startswith(darwin):
+header = os.path.join(self.lib_dir, 'LLDB.framework', 'Versions','Current','Headers','LLDB.h')
+else:
+header = os.path.join(os.environ[LLDB_SRC], include, lldb, API, LLDB.h)
 platform = sys.platform
 if not os.path.exists(header):
 self.skipTest(skip because LLDB.h header not found)
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r221570 - LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166

2014-11-07 Thread Shawn Best
Author: sbest
Date: Fri Nov  7 19:41:49 2014
New Revision: 221570

URL: http://llvm.org/viewvc/llvm-project?rev=221570view=rev
Log:
LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/include/lldb/Core/RegularExpression.h
lldb/trunk/include/lldb/Host/Config.h
lldb/trunk/include/lldb/Host/Editline.h
lldb/trunk/include/lldb/lldb-private.h
lldb/trunk/scripts/Python/modules/CMakeLists.txt
lldb/trunk/source/CMakeLists.txt
lldb/trunk/source/Core/ConnectionSharedMemory.cpp
lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/common/Socket.cpp
lldb/trunk/source/Host/linux/Host.cpp

lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp

lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
lldb/trunk/source/Utility/PseudoTerminal.cpp
lldb/trunk/tools/CMakeLists.txt
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Platform.h
lldb/trunk/tools/lldb-gdbserver/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=221570r1=221569r2=221570view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Nov  7 19:41:49 2014
@@ -7,9 +7,15 @@ if ( CMAKE_SYSTEM_NAME MATCHES Windows
 set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1)
   endif()
 else()
-  set(LLDB_DEFAULT_DISABLE_PYTHON 0)
-  set(LLDB_DEFAULT_DISABLE_CURSES 0)
-  set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 0)
+  if ( __ANDROID_NDK__ )
+set(LLDB_DEFAULT_DISABLE_PYTHON 1)
+set(LLDB_DEFAULT_DISABLE_CURSES 1)
+set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 0)
+  else()
+set(LLDB_DEFAULT_DISABLE_PYTHON 0)
+set(LLDB_DEFAULT_DISABLE_CURSES 0)
+set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 0)
+  endif()
 endif()
 set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
   Disables the Python scripting integration.)
@@ -115,8 +121,14 @@ macro(add_lldb_definitions)
 endmacro(add_lldb_definitions)
 
 if (NOT LLDB_DISABLE_PYTHON)
-find_package(PythonLibs REQUIRED)
-include_directories(${PYTHON_INCLUDE_DIRS})
+  if(UNIX)
+# This is necessary for crosscompile on Ubuntu 14.04 64bit. Need a proper 
fix.
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  set(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)
+endif()
+  endif()
+  find_package(PythonLibs REQUIRED)
+  include_directories(${PYTHON_INCLUDE_DIRS})
 endif()
 
 include_directories(../clang/include)

Modified: lldb/trunk/include/lldb/Core/RegularExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegularExpression.h?rev=221570r1=221569r2=221570view=diff
==
--- lldb/trunk/include/lldb/Core/RegularExpression.h (original)
+++ lldb/trunk/include/lldb/Core/RegularExpression.h Fri Nov  7 19:41:49 2014
@@ -39,6 +39,9 @@ inline void regfree(llvm_regex_t * a)
 }
 
 #else
+#if __ANDROID_NDK__
+#include regex
+#endif
 #include regex.h
 #endif
 #include stdint.h

Modified: lldb/trunk/include/lldb/Host/Config.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=221570r1=221569r2=221570view=diff
==
--- lldb/trunk/include/lldb/Host/Config.h (original)
+++ lldb/trunk/include/lldb/Host/Config.h Fri Nov  7 19:41:49 2014
@@ -14,6 +14,10 @@
 
 #include lldb/Host/macosx/Config.h
 
+#elif defined(__ANDROID_NDK__)
+
+#include lldb/Host/android/Config.h
+
 #elif defined(__linux__) || defined(__GNU__)
 
 #include lldb/Host/linux/Config.h

Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=221570r1=221569r2=221570view=diff
==
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Fri Nov  7 19:41:49 2014
@@ -14,11 +14,13 @@
 #include lldb/lldb-private.h
 
 #include stdio.h
-#ifdef _WIN32
+#if defined(_WIN32)
 #include lldb/Host/windows/editlinewin.h
 #else
+#if !defined(__ANDROID_NDK__)
 #include histedit.h
 #endif
+#endif
 
 #include string
 #include vector

Modified: lldb/trunk/include/lldb/lldb-private.h
URL: 

[Lldb-commits] [lldb] r221467 - fixed minor code indenting http://reviews.llvm.org/D6127

2014-11-06 Thread Shawn Best
Author: sbest
Date: Thu Nov  6 11:52:15 2014
New Revision: 221467

URL: http://llvm.org/viewvc/llvm-project?rev=221467view=rev
Log:
fixed minor code indenting  http://reviews.llvm.org/D6127

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=221467r1=221466r2=221467view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Nov  6 11:52:15 2014
@@ -1019,10 +1019,9 @@ class Base(unittest2.TestCase):
 except (ValueError, pexpect.ExceptionPexpect):
 # child is already terminated
 pass
-   finally:
-   # Give it one final blow to make sure the child is terminated.
-   self.child.close()
-
+finally:
+# Give it one final blow to make sure the child is terminated.
+self.child.close()
 
 def tearDown(self):
 Fixture for unittest test case teardown.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix compilation of DataFormatters/StringPrinter.cpp with GCC.

2014-11-04 Thread Shawn Best
Builds and runs fine on OSX/clang as well as Linux/gcc.  I will go ahead 
and commit.


On 11/4/2014 1:14 PM, Enrico Granata wrote:

Did you check if this compiles with both GCC and clang?
If it compiles with both, I have no objection to it

It's unfortunate to hit such GCC limitations every so often - but it 
is what it is..


On Nov 4, 2014, at 12:08 PM, Siva Chandra sivachan...@google.com 
mailto:sivachan...@google.com wrote:


I got the wrong enrico in my first attempt.

http://reviews.llvm.org/D6122



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Thanks,
/- Enrico/
? egranata@?.com ?? 27683






___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r221324 - for Oleksiy Vyalov - Redirect stdin, stdout and stderr to /dev/null when launching LLGS process. Differential Revision: http://reviews.llvm.org/D6105

2014-11-04 Thread Shawn Best
Author: sbest
Date: Tue Nov  4 18:58:55 2014
New Revision: 221324

URL: http://llvm.org/viewvc/llvm-project?rev=221324view=rev
Log:
for Oleksiy Vyalov - Redirect stdin, stdout and stderr to /dev/null when 
launching LLGS process. Differential Revision: http://reviews.llvm.org/D6105

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=221324r1=221323r2=221324view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue 
Nov  4 18:58:55 2014
@@ -863,11 +863,15 @@ GDBRemoteCommunication::StartDebugserver
 }
 } while (has_env_var);
 
-// Close STDIN, STDOUT and STDERR. We might need to redirect them
-// to /dev/null if we run into any problems.
+// Close STDIN, STDOUT and STDERR.
 launch_info.AppendCloseFileAction (STDIN_FILENO);
 launch_info.AppendCloseFileAction (STDOUT_FILENO);
 launch_info.AppendCloseFileAction (STDERR_FILENO);
+
+// Redirect STDIN, STDOUT and STDERR to /dev/null.
+launch_info.AppendSuppressFileAction (STDIN_FILENO, true, false);
+launch_info.AppendSuppressFileAction (STDOUT_FILENO, false, true);
+launch_info.AppendSuppressFileAction (STDERR_FILENO, false, true);
 
 error = Host::LaunchProcess(launch_info);
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r220983 - commit on behalf of Oleksiy Vyalov Fix junk content handling within GDBRemoteCOmmunication::CheckForPacket 1. Avoid removing of an extra symbol from m_bytes. 2. iterate

2014-10-31 Thread Shawn Best
Author: sbest
Date: Fri Oct 31 13:18:23 2014
New Revision: 220983

URL: http://llvm.org/viewvc/llvm-project?rev=220983view=rev
Log:
commit on behalf of Oleksiy Vyalov Fix junk content handling within 
GDBRemoteCOmmunication::CheckForPacket  1. Avoid removing of an extra symbol 
from m_bytes.  2. iterate over m_bytes until useful content is found.  
Differential Revision: http://reviews.llvm.org/D6042

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=220983r1=220982r2=220983view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri 
Oct 31 13:18:23 2014
@@ -411,74 +411,77 @@ GDBRemoteCommunication::CheckForPacket (
 // it off with an invalid value that is the same as the current
 // index.
 size_t content_start = 0;
-size_t content_length = 0;
+size_t content_length = std::string::npos;
 size_t total_length = 0;
 size_t checksum_idx = std::string::npos;
 
-switch (m_bytes[0])
+while (!m_bytes.empty()  content_length == std::string::npos)
 {
-case '+':   // Look for ack
-case '-':   // Look for cancel
-case '\x03':// ^C to halt target
-content_length = total_length = 1;  // The command is one byte 
long...
-break;
-
-case '$':
-// Look for a standard gdb packet?
-{
-size_t hash_pos = m_bytes.find('#');
-if (hash_pos != std::string::npos)
+switch (m_bytes[0])
+{
+case '+':   // Look for ack
+case '-':   // Look for cancel
+case '\x03':// ^C to halt target
+content_length = total_length = 1;  // The command is one 
byte long...
+break;
+
+case '$':
+// Look for a standard gdb packet?
 {
-if (hash_pos + 2  m_bytes.size())
-{
-checksum_idx = hash_pos + 1;
-// Skip the dollar sign
-content_start = 1; 
-// Don't include the # in the content or the $ in 
the content length
-content_length = hash_pos - 1;  
-
-total_length = hash_pos + 3; // Skip the # and the 
two hex checksum bytes
-}
-else
+size_t hash_pos = m_bytes.find('#');
+if (hash_pos != std::string::npos)
 {
-// Checksum bytes aren't all here yet
-content_length = std::string::npos;
+if (hash_pos + 2  m_bytes.size())
+{
+checksum_idx = hash_pos + 1;
+// Skip the dollar sign
+content_start = 1;
+// Don't include the # in the content or the $ 
in the content length
+content_length = hash_pos - 1;
+
+total_length = hash_pos + 3; // Skip the # and 
the two hex checksum bytes
+}
+else
+{
+// Checksum bytes aren't all here yet
+content_length = std::string::npos;
+}
 }
 }
-}
-break;
+break;
 
-default:
-{
-// We have an unexpected byte and we need to flush all bad 
-// data that is in m_bytes, so we need to find the first
-// byte that is a '+' (ACK), '-' (NACK), \x03 (CTRL+C 
interrupt),
-// or '$' character (start of packet header) or of course,
-// the end of the data in m_bytes...
-const size_t bytes_len = m_bytes.size();
-bool done = false;
-uint32_t idx;
-for (idx = 1; !done  idx  bytes_len; ++idx)
+default:
 {
-switch (m_bytes[idx])
+// We have an unexpected byte and we need to flush all 
bad
+ 

[Lldb-commits] [PATCH] TOT broken by R220956

2014-10-31 Thread Shawn Best
R220956 broke lldb TOT.  In the file clang/include/clang/AST/Decl.h, there were 
some typedef's inside VarDecl, FunctionDecl classes mapping clang::StorageClass 
to StorageClass.  R220956 removed these typedefs.

In ClangASTContext.cpp, there were a few places using the old typedefs so I 
switched to use properly scoped name.

http://reviews.llvm.org/D6066

Files:
  source/Symbol/ClangASTContext.cpp
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1739,7 +1739,7 @@
   DeclarationName (ast-Idents.get(name)),
   function_clang_type.GetQualType(),
   nullptr,
-  (FunctionDecl::StorageClass)storage,
+  (clang::StorageClass)storage,
   is_inline,
   hasWrittenPrototype,
   isConstexprSpecified);
@@ -1753,7 +1753,7 @@
   DeclarationName (),
   function_clang_type.GetQualType(),
   nullptr,
-  (FunctionDecl::StorageClass)storage,
+  (clang::StorageClass)storage,
   is_inline,
   hasWrittenPrototype,
   isConstexprSpecified);
@@ -1805,7 +1805,7 @@
 name  name[0] ? ast-Idents.get(name) : nullptr,
 param_type.GetQualType(),
 nullptr,
-(VarDecl::StorageClass)storage,
+(clang::StorageClass)storage,
 nullptr);
 }
 
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix junk content handling within GDBRemoteCommunication::CheckForPacket.

2014-10-30 Thread Shawn Best
Hey Oleksiy, can you rebase the patch for me, I got HUNK Failed when applying.  
It could be related to the whitespace stripping you did for Greg. Also, I 
notice something weird with the block of code you wrapped with the while() 
loop.  It appears to be indented only 2 spaces instead of 4.

http://reviews.llvm.org/D6042



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r220406 - Sort unit test failures by name - submitted for Vince Harron http://reviews.llvm.org/D5904

2014-10-22 Thread Shawn Best
Author: sbest
Date: Wed Oct 22 14:29:00 2014
New Revision: 220406

URL: http://llvm.org/viewvc/llvm-project?rev=220406view=rev
Log:
Sort unit test failures by name - submitted for Vince Harron 
http://reviews.llvm.org/D5904

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=220406r1=220405r2=220406view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Oct 22 14:29:00 2014
@@ -111,6 +111,7 @@ Run lldb test suite using a separate pro
 
 print Ran %d tests. % num_tests
 if len(failed)  0:
+failed.sort()
 print Failing Tests (%d) % len(failed)
 for f in failed:
   print FAIL: LLDB (suite) :: %s (%s) % (f, system_info)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD

2014-10-16 Thread Shawn Best
Hi emaste,

Issue D5632 fixed an issue where linux would dump spurious output to tty on 
startup (due to a broadcast stop event).  After the checkin, it was noticed on 
FreeBSD a unit test was now failing.  On closer investigation I found the test 
was using the C++ API to launch an inferior while using an SBListener to 
monitor the public state changes. It was expecting to see:

eStateRunning
eStateStopped

On Linux/FreeBSD, there is an extra state change

eStateLaunching
eStateRunning
eStateStopped

I reworked the test to work for both cases.

http://reviews.llvm.org/D5837

Files:
  test/api/multithreaded/TestMultithreaded.py
  test/api/multithreaded/test_listener_event_description.cpp
Index: test/api/multithreaded/TestMultithreaded.py
===
--- test/api/multithreaded/TestMultithreaded.py
+++ test/api/multithreaded/TestMultithreaded.py
@@ -28,7 +28,6 @@
 self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
 'test_breakpoint_callback')
 
-@expectedFailureFreeBSD(llvm.org/21211)
 @skipIfi386
 @skipIfRemote
 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
Index: test/api/multithreaded/test_listener_event_description.cpp
===
--- test/api/multithreaded/test_listener_event_description.cpp
+++ test/api/multithreaded/test_listener_event_description.cpp
@@ -16,16 +16,17 @@
 using namespace std;
 
 // listener thread control
-extern atomicbool g_done; 
+extern atomicbool g_done;
+extern SBListener g_listener;
 
 multithreaded_queuestring g_event_descriptions;
-
-extern SBListener g_listener;
+string g_error_desc;
 
 void listener_func() {
   while (!g_done) {
 SBEvent event;
 bool got_event = g_listener.WaitForEvent(1, event);
+
 if (got_event) {
   if (!event.IsValid())
 throw Exception(event is not valid in listener thread);
@@ -38,27 +39,59 @@
   }
 }
 
-void check_listener(SBDebugger dbg) {
-  arraystring, 2 expected_states = {running, stopped};
-  for(string  state : expected_states) {
-bool got_description = false;
-string desc = g_event_descriptions.pop(5, got_description);
-
-if (!got_description)
-  throw Exception(Did not get expected event description);
+bool check_state(string state, string desc, bool got_description)
+{
+g_error_desc.clear();
 
+if(!got_description)
+{
+g_error_desc.append(Did not get expected event description);
+return false;
+}
 
 if (desc.find(state-changed) == desc.npos)
-  throw Exception(Event description incorrect: missing 'state-changed');
+g_error_desc.append(Event description incorrect: missing 'state-changed' );
+
+if (desc.find(pid = ) == desc.npos)
+g_error_desc.append(Event description incorrect: missing process pid );
 
 string state_search_str = state =  + state;
 if (desc.find(state_search_str) == desc.npos)
-  throw Exception(Event description incorrect: expected state 
+{
+string errString = (Event description incorrect: expected state 
   + state
   +  but desc was 
   + desc);
+g_error_desc.append(errString);
+}
 
-if (desc.find(pid = ) == desc.npos)
-  throw Exception(Event description incorrect: missing process pid);
-  }
+if (g_error_desc.length()  0)
+return false;
+
+cout  check_state:   stateOK\n;
+return true;
+}
+
+void check_listener(SBDebugger dbg)
+{
+bool got_description;
+string state;
+
+// check for launching state, this may or may not be present
+string desc = g_event_descriptions.pop(5, got_description);
+state = launching;
+if (check_state(state, desc, got_description))
+{
+// found a 'launching' state, pop next one from queue
+desc = g_event_descriptions.pop(5, got_description);
+}
+
+state = running;
+if( !check_state(state, desc, got_description) )
+throw Exception(g_error_desc);
+
+desc = g_event_descriptions.pop(5, got_description);
+state = stopped;
+if( !check_state(state, desc, got_description) )
+throw Exception(g_error_desc);
 }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile

2014-10-16 Thread Shawn Best
This flag triggers a '-lpthead' during the linking stage.  Technically this is 
not needed since the multithreading is handled by std library, triggered by 
'-std=c++11' in build command line.

The **real** reason I want to remove the '-lpthread' is it was causing a 
(linux/gcc built) test program to hang in a destructor for the 
std::condition_variable

http://reviews.llvm.org/D5838

Files:
  test/api/multithreaded/Makefile
Index: test/api/multithreaded/Makefile
===
--- test/api/multithreaded/Makefile
+++ test/api/multithreaded/Makefile
@@ -1,6 +1,5 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r219269 - Minor comment change to test out svn access

2014-10-07 Thread Shawn Best
Author: sbest
Date: Tue Oct  7 20:50:37 2014
New Revision: 219269

URL: http://llvm.org/viewvc/llvm-project?rev=219269view=rev
Log:
Minor comment change to test out svn access

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

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=219269r1=219268r2=219269view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Oct  7 20:50:37 2014
@@ -941,7 +941,7 @@ Process::SyncIOHandler (uint64_t timeout
 log-Printf (Process::%s pid % PRIu64 : SUCCESS, 
__FUNCTION__, GetID ());
 }
 
-// reset sync one-shot so it will be ready for next time
+// reset sync one-shot so it will be ready for next launch
 m_iohandler_sync.SetValue(false, eBroadcastNever);
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Moved PlatformDarwin::GetEnvironment() to PlatformPOSIX

2014-09-24 Thread Shawn Best
Hi tfiala, clayborg,

I was tracking a problem where llgs on linux would not pick up any environment 
variables.  On OSX there is a virtual function PlatformDarwin::GetEnvironment() 
which correctly sets up the list of environment variables.  On linux llgs it 
defaults to a base class default implementation which clears the list.

I  moved the OSX implementation down to PlatformPOSIX.  This fixes my problem 
on linux still works properly on OSX.

http://reviews.llvm.org/D5486

Files:
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
Index: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===
--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1212,17 +1212,6 @@
 return bp_sp;
 }
 
-size_t
-PlatformDarwin::GetEnvironment (StringList env)
-{
-if (IsRemote())
-{
-if (m_remote_platform_sp)
-return m_remote_platform_sp-GetEnvironment(env);
-return 0;
-}
-return Host::GetEnvironment(env);
-}
 
 int32_t
 PlatformDarwin::GetResumeCountForLaunchInfo (ProcessLaunchInfo launch_info)
Index: source/Plugins/Platform/MacOSX/PlatformDarwin.h
===
--- source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -78,9 +78,6 @@
 virtual bool
 ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target target, const lldb::ModuleSP module_sp);
 
-virtual size_t
-GetEnvironment (lldb_private::StringList environment);
-
 bool
 ARMGetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec arch);
 
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -634,6 +634,18 @@
 return false;
 }
 
+size_t
+PlatformPOSIX::GetEnvironment (StringList env)
+{
+if (IsRemote())
+{
+if (m_remote_platform_sp)
+return m_remote_platform_sp-GetEnvironment(env);
+return 0;
+}
+return Host::GetEnvironment(env);
+}
+
 bool
 PlatformPOSIX::GetRemoteOSKernelDescription (std::string s)
 {
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.h
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -101,6 +101,9 @@
 lldb_private::ArchSpec
 GetRemoteSystemArchitecture () override;
 
+virtual size_t
+GetEnvironment (lldb_private::StringList environment);
+
 bool
 IsConnected () const override;
 
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] use std::atomic to protect variables being accessed by multiple threads

2014-09-10 Thread Shawn Best
There are several places where multiple threads are accessing the same 
variables simultaneously without any kind of protection.  I propose using 
std::atomic to make it safer.  I did a special build of lldb, using the 
google tool 'thread sanitizer' which identified many cases of multiple threads 
accessing the same memory.  std::atomic is low overhead and does not use any 
locks for simple types such as int/bool.

http://reviews.llvm.org/D5302

Files:
  include/lldb/Core/Communication.h
  include/lldb/Core/ConnectionFileDescriptor.h
  include/lldb/Target/Process.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/lldb-log.cpp
Index: include/lldb/Core/Communication.h
===
--- include/lldb/Core/Communication.h
+++ include/lldb/Core/Communication.h
@@ -352,7 +352,7 @@
 protected:
 lldb::ConnectionSP m_connection_sp; /// The connection that is current in use by this communications class.
 HostThread m_read_thread;   /// The read thread handle in case we need to cancel the thread.
-bool m_read_thread_enabled;
+std::atomicbool m_read_thread_enabled;
 std::string m_bytes;/// A buffer to cache bytes read in the ReadThread function.
 Mutex m_bytes_mutex;/// A mutex to protect multi-threaded access to the cached bytes.
 Mutex m_write_mutex;/// Don't let multiple threads write at the same time...
Index: include/lldb/Core/ConnectionFileDescriptor.h
===
--- include/lldb/Core/ConnectionFileDescriptor.h
+++ include/lldb/Core/ConnectionFileDescriptor.h
@@ -106,8 +106,8 @@
 
 Pipe m_pipe;
 Mutex m_mutex;
-bool m_shutting_down;   // This marks that we are shutting down so if we get woken up from
-// BytesAvailable to disconnect, we won't try to read again.
+std::atomicbool m_shutting_down;// This marks that we are shutting down so if we get woken up from
+  // BytesAvailable to disconnect, we won't try to read again.
 bool m_waiting_for_accept;
 private:
 DISALLOW_COPY_AND_ASSIGN (ConnectionFileDescriptor);
Index: include/lldb/Target/Process.h
===
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -3048,7 +3048,7 @@
 uint32_tm_process_unique_id;/// Each lldb_private::Process class that is created gets a unique integer ID that increments with each new instance
 uint32_tm_thread_index_id;  /// Each thread is created with a 1 based index that won't get re-used.
 std::mapuint64_t, uint32_t m_thread_id_to_index_id_map;
-int m_exit_status;  /// The exit status of the process, or -1 if not set.
+std::atomicintm_exit_status;  /// The exit status of the process, or -1 if not set.
 std::string m_exit_string;  /// A textual description of why a process exited.
 Mutex   m_thread_mutex;
 ThreadList  m_thread_list_real; /// The threads for this process as are known to the protocol we are debugging with
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -328,7 +328,7 @@
 
 lldb_private::Flags m_flags;// Process specific flags (see eFlags enums)
 GDBRemoteCommunicationClient m_gdb_comm;
-lldb::pid_t m_debugserver_pid;
+std::atomiclldb::pid_t m_debugserver_pid;
 StringExtractorGDBRemote m_last_stop_packet;
 lldb_private::Mutex m_last_stop_packet_mutex;
 GDBRemoteDynamicRegisterInfo m_register_info;
Index: source/lldb-log.cpp
===
--- source/lldb-log.cpp
+++ source/lldb-log.cpp
@@ -27,7 +27,7 @@
 // that will construct the static g_lob_sp the first time this function is 
 // called.
 
-static bool g_log_enabled = false;
+static std::atomicbool g_log_enabled {false};
 static Log * g_log = NULL;
 static Log *
 GetLog ()
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH]race condition calling PushProcessIOHandler

2014-08-08 Thread Shawn Best
Hi Matt,

Yeah that would probably be a good idea, particularly with a longer
timeout.  I have attached a revised patch:

- changed units of timeout passed to  SyncIOHandler() from us to ms.  I
think ms are a more appropriate unit for this kind of timeout.  This will
have the effect of increasing the timeout from 2ms to 2sec.

- moved the sync point to be inside if (error.Success()) to prevent case
of an error causing the main thread to block for 2s.

Shawn.


On Fri, Aug 8, 2014 at 1:35 AM, Matthew Gardiner m...@csr.com wrote:

 Hi Shawn,

 In the patch should not the call to SyncIOHandler in Target.cpp and
 CommandObjectProcess.cpp be inside the

 if (error.Success())
 {

 ?

 My thinking that is, if the resume operation reports a failure then,
 presumably the running event won't be delivered and we won't PushIOHandler,
 and flag the condition to unblock the waiting thread. So in such a
 situation the main thread would be unnecessarily blocked.

 What are your thoughts?

 Matt



 Shawn Best wrote:

 Thanks for the feedback Greg.  I have attached a revised patch based on
 your suggestions.

 - renamed m_pushed_IOHandler to m_iohandler_sync

 - got rid of method ClearPushedIOHandlerSync() and make calls directly to
 m_iohandler_sync.SetValue(false..)

 - renamed WaitForPushedIOHandlerSync() to SyncIOHandler()

 - only wait in case where m_process_input_reader != NULL

 I put the calls to reset the sync flag in both PrivateEventThread (after
 it has seen a public stop), and after the call to SyncIOHandler() is
 completed.  As far as I can tell it should work fine, but my preference is
 normally to reset the flag immediately before using it instead of relying
 on it set to false.  Having it internal does clean up the code though.

 I think the last suggestion of moving the sync point to
 Debugger::HandleProcessEvent() would defeat the purpose of the patch since
 it is called from the EventHandler thread.  The race condition is the main
 thread returning up the call stack to start another round of commandIO
 handling before PushProcessIOHandler() gets called.


 On Fri, Aug 1, 2014 at 10:39 AM, Greg Clayton gclay...@apple.com
 mailto:gclay...@apple.com wrote:

 Comments:

 Why should anyone outside of lldb_private::Process have to call
 ClearPushedIOHandlerSync() manually? Can we get rid of this
 function and just have Process.cpp do it at the right times by
 directly calling m_pushed_IOHandler.SetValue(false,
 eBroadcastNever);?

 If so then the following fixes apply:
 1 - remove Process::ClearPushedIOHandlerSync() since it will be
 done internally within process.
 2 - rename m_pushed_IOHandler to m_iohandler_sync
 3 - rename WaitForPushedIOHandlerSync() to SyncIOHandler

 Other general fixes:
 1 - the WaitForPushedIOHandlerSync should do nothing if there is
 no process IOHandler (no stdio or we attached to a process. This
 can be done by testing m_process_input_reader with if
 (m_process_input_reader) { ... }

 I would also like the fix this sync issue by not having to have
 every command add a call to
 process-WaitForPushedIOHandlerSync(...). Can't we sync this in
 the Debugger::HandleProcessEvent()?

  On Jul 31, 2014, at 2:57 PM, Shawn Best sb...@blueshiftinc.com
 mailto:sb...@blueshiftinc.com wrote:
 
  oops, with the attachment this time.
 
 
  On Thu, Jul 31, 2014 at 2:56 PM, Shawn Best
 sb...@blueshiftinc.com mailto:sb...@blueshiftinc.com wrote:
  Thanks everyone for the feedback.  I have reworked the patch to
 use Predicate bool, it reads much cleaner now.
 
  Shawn.
 
  On Wed, Jul 30, 2014 at 6:34 PM, Greg Clayton
 gclay...@apple.com mailto:gclay...@apple.com wrote:
  You will want to use a Predicatebool here in stead of what you
 have since it is exactly what we use a predicate for. The following:
 
  +bool  m_process_running_sync; // used with
 WaitForProcessRunning() synchronization
  +std::condition_variable m_condition_process_running;//
 used with WaitForProcessRunning() synchronization
  +std::mutex  m_mutex_process_running;// used with
 WaitForProcessRunning() synchronization
 
  Is exactly what the Predicate class does: protect a value with a
 mutex and condition.
 
  The above code should be replaced with:
 
   Predicatebool m_process_running_sync;
 
  The API on Predicate should do what you want. See the header
 file at lldb/Host/Predicate.h and also look for other places
 that use this class to wait for a value to be equal to another
 value, or wait for a value to not be equal to something.
 
  Let me know when you have a patch that uses Predicate and we
 will look at that.
 
  Greg
 
   On Jul 30, 2014, at 4:03 PM, Shawn Best
 sb...@blueshiftinc.com mailto:sb...@blueshiftinc.com wrote

Re: [Lldb-commits] [PATCH]race condition calling PushProcessIOHandler

2014-08-05 Thread Shawn Best
 the m_active flag in the previous topmost handler.


Regarding Greg's comment:

not having to have every command add a call to 
process-WaitForPushedIOHandlerSync(...).


The problem is that it is only the individual Command object 
implementations that know whether asynchronous processing will 
occur, and hence whether this block main thread until IOHandler 
pushed action is necessary. And therefore we may need to add this 
kind of logic piece-meal. It's not great, but with my limited view 
of lldb's architecture, I can't currently think of a better way.


Matt



Shawn Best wrote:
Thanks for the feedback Greg.  I have attached a revised patch 
based on your suggestions.


- renamed m_pushed_IOHandler to m_iohandler_sync

- got rid of method ClearPushedIOHandlerSync() and make calls 
directly to m_iohandler_sync.SetValue(false..)


- renamed WaitForPushedIOHandlerSync() to SyncIOHandler()

- only wait in case where m_process_input_reader != NULL

I put the calls to reset the sync flag in both PrivateEventThread 
(after it has seen a public stop), and after the call to 
SyncIOHandler() is completed.  As far as I can tell it should work 
fine, but my preference is normally to reset the flag immediately 
before using it instead of relying on it set to false.  Having it 
internal does clean up the code though.


I think the last suggestion of moving the sync point to 
Debugger::HandleProcessEvent() would defeat the purpose of the 
patch since it is called from the EventHandler thread.  The race 
condition is the main thread returning up the call stack to start 
another round of commandIO handling before PushProcessIOHandler() 
gets called.



On Fri, Aug 1, 2014 at 10:39 AM, Greg Clayton gclay...@apple.com 
mailto:gclay...@apple.com wrote:


Comments:

Why should anyone outside of lldb_private::Process have to call
ClearPushedIOHandlerSync() manually? Can we get rid of this
function and just have Process.cpp do it at the right times by
directly calling m_pushed_IOHandler.SetValue(false, 
eBroadcastNever);?


If so then the following fixes apply:
1 - remove Process::ClearPushedIOHandlerSync() since it will be
done internally within process.
2 - rename m_pushed_IOHandler to m_iohandler_sync
3 - rename WaitForPushedIOHandlerSync() to SyncIOHandler

Other general fixes:
1 - the WaitForPushedIOHandlerSync should do nothing if there is
no process IOHandler (no stdio or we attached to a process. This
can be done by testing m_process_input_reader with if
(m_process_input_reader) { ... }

I would also like the fix this sync issue by not having to have
every command add a call to
process-WaitForPushedIOHandlerSync(...). Can't we sync this in
the Debugger::HandleProcessEvent()?

 On Jul 31, 2014, at 2:57 PM, Shawn Best sb...@blueshiftinc.com
mailto:sb...@blueshiftinc.com wrote:

 oops, with the attachment this time.


 On Thu, Jul 31, 2014 at 2:56 PM, Shawn Best
sb...@blueshiftinc.com mailto:sb...@blueshiftinc.com wrote:
 Thanks everyone for the feedback.  I have reworked the patch to
use Predicate bool, it reads much cleaner now.

 Shawn.

 On Wed, Jul 30, 2014 at 6:34 PM, Greg Clayton
gclay...@apple.com mailto:gclay...@apple.com wrote:
 You will want to use a Predicatebool here in stead of what 
you
have since it is exactly what we use a predicate for. The 
following:


 +bool  m_process_running_sync; // used with
WaitForProcessRunning() synchronization
 +std::condition_variable m_condition_process_running;//
used with WaitForProcessRunning() synchronization
 +std::mutex  m_mutex_process_running; // used with
WaitForProcessRunning() synchronization

 Is exactly what the Predicate class does: protect a value 
with a

mutex and condition.

 The above code should be replaced with:

  Predicatebool m_process_running_sync;

 The API on Predicate should do what you want. See the header
file at lldb/Host/Predicate.h and also look for other places
that use this class to wait for a value to be equal to another
value, or wait for a value to not be equal to something.

 Let me know when you have a patch that uses Predicate and we
will look at that.

 Greg

  On Jul 30, 2014, at 4:03 PM, Shawn Best
sb...@blueshiftinc.com mailto:sb...@blueshiftinc.com wrote:
 
  I have reworked the patch to use std::condition_variable.
 This particular sync mechanism was new to me, I hope I used it
correctly.  Is it portable across all target platforms/compilers?
 I tested on linux and OSX.
 
  The timeout is pretty small (1ms) but seems ample based on 
the

measurements I made.
 
 
  On Tue, Jul 29, 2014 at 9:58 PM, Matthew Gardiner
m...@csr.com mailto:m...@csr.com wrote:
  Cool, let us know how you get on!
  Matt

Re: [Lldb-commits] [PATCH]race condition calling PushProcessIOHandler

2014-07-31 Thread Shawn Best
Thanks everyone for the feedback.  I have reworked the patch to use
Predicate bool, it reads much cleaner now.

Shawn.

On Wed, Jul 30, 2014 at 6:34 PM, Greg Clayton gclay...@apple.com wrote:

 You will want to use a Predicatebool here in stead of what you have
 since it is exactly what we use a predicate for. The following:

 +boolm_process_running_sync; // used
 with WaitForProcessRunning() synchronization
 +std::condition_variable m_condition_process_running;// used
 with WaitForProcessRunning() synchronization
 +std::mutex  m_mutex_process_running;// used
 with WaitForProcessRunning() synchronization

 Is exactly what the Predicate class does: protect a value with a mutex and
 condition.

 The above code should be replaced with:

  Predicatebool m_process_running_sync;

 The API on Predicate should do what you want. See the header file at
 lldb/Host/Predicate.h and also look for other places that use this class
 to wait for a value to be equal to another value, or wait for a value to
 not be equal to something.

 Let me know when you have a patch that uses Predicate and we will look at
 that.

 Greg

  On Jul 30, 2014, at 4:03 PM, Shawn Best sb...@blueshiftinc.com wrote:
 
  I have reworked the patch to use std::condition_variable.  This
 particular sync mechanism was new to me, I hope I used it correctly.  Is it
 portable across all target platforms/compilers?  I tested on linux and OSX.
 
  The timeout is pretty small (1ms) but seems ample based on the
 measurements I made.
 
 
  On Tue, Jul 29, 2014 at 9:58 PM, Matthew Gardiner m...@csr.com wrote:
  Cool, let us know how you get on!
  Matt
 
  Shawn Best wrote:
  Thanks for the feedback guys.
 
  Studying the code, I had figured going with a straight int would in
 practice be most efficient and not run into multi-threaded problems, even
 if initially appearing a bit risky.  I will rework it to use a
 std::condition_variable.  That will be more robust and readable.
 
  Shawn.
 
  On 7/29/2014 10:53 AM, Zachary Turner wrote:
  Even better would be an std::condition_variable
 
 
  On Mon, Jul 28, 2014 at 10:30 PM, Matthew Gardiner m...@csr.com
 mailto:m...@csr.com wrote:
 
  Hi Shawn,
 
  I use 64-bit linux and I see this issue a lot. It usually
  manifests itself as the prompt just not being printed (or perhaps
  it just gets overwritten) - regardless - I invoke a command, and
  I don't see an (lldb) prompt when I should. So I'm well pleased
  that you are looking at this!
 
  Would it not be more robust to use a semaphore than usleep to
  synchronise the problematic threads?
 
  Although I've not looked too deeply into this particular issue,
  whenever I've seen similar races, I found that it's almost
  impossible to pick the right value when using a sleep command. A
  semaphore, though, should always ensure the waiting thread will
  wake precisely.
 
  I'd be happy to help to test such a fix.
 
  Matt
 
 
  Shawn Best wrote:
 
  Hi,
 
  I have attached a patch which addresses 3 related race
  conditions that cause the command line (lldb) prompt to get
  displayed inappropriately and make it appear it is not
  working correctly.  This issue can be seen on linux and
  FreeBSD.  I can also artificailly induce the problem on OSX.
 
  The issue happens when the command handler (in the main
  thread) issues a command such as run, step or continue.
   After the command finishes initiating its action, it returns
  up the call stack and goes back into the main command loop
  waiting for user input.  Simultaneously, as the inferior
  process starts up, the MonitorChildProcess thread picks up
  the change and posts to the PrivateEvent thread.
   HandePrivateEvent() then calls PushProcessIOHandler() which
  will disable the command IO handler and give the inferior
  control of the TTY.  To observe this on OSX, put a
 
  usleep(100);
 
  immediately prior the PushProcessIOHandler() in
  HandlePrivateEvent.
 
 
  My proposed solution is that after a 'run', 'step', or
  'continue' command, insert a synchronization point and wait
  until HandlePrivateEvent knows the inferior process is
  running and has pushed the IO handler.  One context switch
  (100us) is usually all the time it takes on my machine.  As
  an additional safety, I have a timeout (currently 1ms) so it
  will never hang the main thread.
 
  Any thoughts, or suggestions would be appreciated.
 
  Regards,
  Shawn.
 
 
  To report this email as spam click here
  https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==.
 
 
 
  ___
  lldb-commits mailing list

Re: [Lldb-commits] [PATCH]race condition calling PushProcessIOHandler

2014-07-31 Thread Shawn Best
oops, with the attachment this time.


On Thu, Jul 31, 2014 at 2:56 PM, Shawn Best sb...@blueshiftinc.com wrote:

 Thanks everyone for the feedback.  I have reworked the patch to use
 Predicate bool, it reads much cleaner now.

 Shawn.

 On Wed, Jul 30, 2014 at 6:34 PM, Greg Clayton gclay...@apple.com wrote:

 You will want to use a Predicatebool here in stead of what you have
 since it is exactly what we use a predicate for. The following:

 +boolm_process_running_sync; // used
 with WaitForProcessRunning() synchronization
 +std::condition_variable m_condition_process_running;// used
 with WaitForProcessRunning() synchronization
 +std::mutex  m_mutex_process_running;// used
 with WaitForProcessRunning() synchronization

 Is exactly what the Predicate class does: protect a value with a mutex
 and condition.

 The above code should be replaced with:

  Predicatebool m_process_running_sync;

 The API on Predicate should do what you want. See the header file at
 lldb/Host/Predicate.h and also look for other places that use this class
 to wait for a value to be equal to another value, or wait for a value to
 not be equal to something.

 Let me know when you have a patch that uses Predicate and we will look at
 that.

 Greg

  On Jul 30, 2014, at 4:03 PM, Shawn Best sb...@blueshiftinc.com wrote:
 
  I have reworked the patch to use std::condition_variable.  This
 particular sync mechanism was new to me, I hope I used it correctly.  Is it
 portable across all target platforms/compilers?  I tested on linux and OSX.
 
  The timeout is pretty small (1ms) but seems ample based on the
 measurements I made.
 
 
  On Tue, Jul 29, 2014 at 9:58 PM, Matthew Gardiner m...@csr.com wrote:
  Cool, let us know how you get on!
  Matt
 
  Shawn Best wrote:
  Thanks for the feedback guys.
 
  Studying the code, I had figured going with a straight int would in
 practice be most efficient and not run into multi-threaded problems, even
 if initially appearing a bit risky.  I will rework it to use a
 std::condition_variable.  That will be more robust and readable.
 
  Shawn.
 
  On 7/29/2014 10:53 AM, Zachary Turner wrote:
  Even better would be an std::condition_variable
 
 
  On Mon, Jul 28, 2014 at 10:30 PM, Matthew Gardiner m...@csr.com
 mailto:m...@csr.com wrote:
 
  Hi Shawn,
 
  I use 64-bit linux and I see this issue a lot. It usually
  manifests itself as the prompt just not being printed (or perhaps
  it just gets overwritten) - regardless - I invoke a command, and
  I don't see an (lldb) prompt when I should. So I'm well pleased
  that you are looking at this!
 
  Would it not be more robust to use a semaphore than usleep to
  synchronise the problematic threads?
 
  Although I've not looked too deeply into this particular issue,
  whenever I've seen similar races, I found that it's almost
  impossible to pick the right value when using a sleep command. A
  semaphore, though, should always ensure the waiting thread will
  wake precisely.
 
  I'd be happy to help to test such a fix.
 
  Matt
 
 
  Shawn Best wrote:
 
  Hi,
 
  I have attached a patch which addresses 3 related race
  conditions that cause the command line (lldb) prompt to get
  displayed inappropriately and make it appear it is not
  working correctly.  This issue can be seen on linux and
  FreeBSD.  I can also artificailly induce the problem on OSX.
 
  The issue happens when the command handler (in the main
  thread) issues a command such as run, step or continue.
   After the command finishes initiating its action, it returns
  up the call stack and goes back into the main command loop
  waiting for user input.  Simultaneously, as the inferior
  process starts up, the MonitorChildProcess thread picks up
  the change and posts to the PrivateEvent thread.
   HandePrivateEvent() then calls PushProcessIOHandler() which
  will disable the command IO handler and give the inferior
  control of the TTY.  To observe this on OSX, put a
 
  usleep(100);
 
  immediately prior the PushProcessIOHandler() in
  HandlePrivateEvent.
 
 
  My proposed solution is that after a 'run', 'step', or
  'continue' command, insert a synchronization point and wait
  until HandlePrivateEvent knows the inferior process is
  running and has pushed the IO handler.  One context switch
  (100us) is usually all the time it takes on my machine.  As
  an additional safety, I have a timeout (currently 1ms) so it
  will never hang the main thread.
 
  Any thoughts, or suggestions would be appreciated.
 
  Regards,
  Shawn.
 
 
  To report this email as spam click here
  https://www.mailcontrol.com/sr

Re: [Lldb-commits] [PATCH]race condition calling PushProcessIOHandler

2014-07-30 Thread Shawn Best
I have reworked the patch to use std::condition_variable.  This particular
sync mechanism was new to me, I hope I used it correctly.  Is it portable
across all target platforms/compilers?  I tested on linux and OSX.

The timeout is pretty small (1ms) but seems ample based on the measurements
I made.


On Tue, Jul 29, 2014 at 9:58 PM, Matthew Gardiner m...@csr.com wrote:

 Cool, let us know how you get on!
 Matt

 Shawn Best wrote:

 Thanks for the feedback guys.

 Studying the code, I had figured going with a straight int would in
 practice be most efficient and not run into multi-threaded problems, even
 if initially appearing a bit risky.  I will rework it to use a
 std::condition_variable.  That will be more robust and readable.

 Shawn.

 On 7/29/2014 10:53 AM, Zachary Turner wrote:

 Even better would be an std::condition_variable


 On Mon, Jul 28, 2014 at 10:30 PM, Matthew Gardiner m...@csr.com
 mailto:m...@csr.com wrote:

 Hi Shawn,

 I use 64-bit linux and I see this issue a lot. It usually
 manifests itself as the prompt just not being printed (or perhaps
 it just gets overwritten) - regardless - I invoke a command, and
 I don't see an (lldb) prompt when I should. So I'm well pleased
 that you are looking at this!

 Would it not be more robust to use a semaphore than usleep to
 synchronise the problematic threads?

 Although I've not looked too deeply into this particular issue,
 whenever I've seen similar races, I found that it's almost
 impossible to pick the right value when using a sleep command. A
 semaphore, though, should always ensure the waiting thread will
 wake precisely.

 I'd be happy to help to test such a fix.

 Matt


 Shawn Best wrote:

 Hi,

 I have attached a patch which addresses 3 related race
 conditions that cause the command line (lldb) prompt to get
 displayed inappropriately and make it appear it is not
 working correctly.  This issue can be seen on linux and
 FreeBSD.  I can also artificailly induce the problem on OSX.

 The issue happens when the command handler (in the main
 thread) issues a command such as run, step or continue.
  After the command finishes initiating its action, it returns
 up the call stack and goes back into the main command loop
 waiting for user input.  Simultaneously, as the inferior
 process starts up, the MonitorChildProcess thread picks up
 the change and posts to the PrivateEvent thread.
  HandePrivateEvent() then calls PushProcessIOHandler() which
 will disable the command IO handler and give the inferior
 control of the TTY.  To observe this on OSX, put a

 usleep(100);

 immediately prior the PushProcessIOHandler() in
 HandlePrivateEvent.


 My proposed solution is that after a 'run', 'step', or
 'continue' command, insert a synchronization point and wait
 until HandlePrivateEvent knows the inferior process is
 running and has pushed the IO handler.  One context switch
 (100us) is usually all the time it takes on my machine.  As
 an additional safety, I have a timeout (currently 1ms) so it
 will never hang the main thread.

 Any thoughts, or suggestions would be appreciated.

 Regards,
 Shawn.


 To report this email as spam click here
 https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==.



 ___
 lldb-commits mailing list
 lldb-commits@cs.uiuc.edu mailto:lldb-commits@cs.uiuc.edu

 http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




 Member of the CSR plc group of companies. CSR plc registered in
 England and Wales, registered number 4187346, registered office
 Churchill House, Cambridge Business Park, Cowley Road, Cambridge,
 CB4 0WZ, United Kingdom
 More information can be found at www.csr.com
 http://www.csr.com. Keep up to date with CSR on our technical
 blog, www.csr.com/blog http://www.csr.com/blog, CSR people
 blog, www.csr.com/people http://www.csr.com/people, YouTube,
 www.youtube.com/user/CSRplc http://www.youtube.com/user/CSRplc,
 Facebook, www.facebook.com/pages/CSR/191038434253534
 http://www.facebook.com/pages/CSR/191038434253534, or follow us
 on Twitter at www.twitter.com/CSR_plc
 http://www.twitter.com/CSR_plc.

 New for 2014, you can now access the wide range of products
 powered by aptX at www.aptx.com http://www.aptx.com.
 ___
 lldb-commits mailing list
 lldb-commits@cs.uiuc.edu mailto:lldb-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 658bc75..d877270 100644
--- a/include/lldb/Target/Process.h