Re: [Lldb-commits] [PATCH] D23290: Added enforce-interactivity setting

2016-08-11 Thread Pavel Labath via lldb-commits
labath added a subscriber: zturner.
labath added a comment.

I think I have understood the situation a bit more now, so let me try to 
explain what is going on.

In https://reviews.llvm.org/D23290#511683, @clayborg wrote:

> Is this something the user is typing in your IDE that you are forwarding to 
> LLDB via pipes? Again, why are you using the command and not the API. There 
> are API for everything you can do and no IDE should be doing code like:
>
> void MyDebugger::ClearAllBreakpoints()
>  {
>
>   m_debugger.HandleCommand("breakpoint delete");
>
> }
>
> Can you explain your use case here? If this is something the user is typing, 
> then user PTY instead of pipes and all will be well. I know many functions in 
> the lldb-mi are incorrectly implemented and they actually create and send 
> LLDB commands using text and we need to fix this, so hopefully you aren't 
> copying that code as a basis???


Yes, this is for commands that the user is typing by hand into the IDE, which 
has a tiny lldb console. All commands that are issued by IDE directly use the 
proper SB APIs. (The IDE is android studio BTW.)

I had also considered using PTYs, but as far as I can tell there is no 
equivalent of that on windows. (@zturner, do you have any more insight into 
that? Is it possible to fake a terminal on windows à la POSIX pseudo 
terminals?).

Greg, how does xcode achieve this? (I presume it has some form of an lldb 
console)


https://reviews.llvm.org/D23290



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


Re: [Lldb-commits] [lldb] r278304 - Fix a problem where if a uint64_t value is placed into a python dictionary and sent up to LLDB and converted to StructuredData, it would not be able to parse the fu

2016-08-11 Thread Pavel Labath via lldb-commits
On 11 August 2016 at 00:41, Zachary Turner via lldb-commits
 wrote:
> Couple of random style comments below.  You don't have to fix these, just
> something to think about in the future.
>
>
>
> On Wed, Aug 10, 2016 at 4:33 PM Greg Clayton via lldb-commits
>  wrote:
>>
>> +
>> +TEST_F(PythonDataObjectsTest, TestExtractingUInt64ThroughStructuredData)
>> +{
>> +// Make up a custom dictionary with "sys" pointing to the `sys`
>> module.
>> +const char *key_name = "addr";
>> +const uint64_t value = 0xf000ull;
>> +PythonDictionary python_dict(PyInitialValue::Empty);
>> +PythonInteger python_ull_value(PyRefType::Owned,
>> PyLong_FromUnsignedLongLong(value));
>> +python_dict.SetItemForKey(PythonString(key_name), python_ull_value);
>> +StructuredData::ObjectSP structured_data_sp =
>> python_dict.CreateStructuredObject();
>> +EXPECT_TRUE((bool)structured_data_sp);
>
> EXPECT_NE(nullptr, structured_data_sp);
>
> would be preferable here.  If EXPECT_TRUE fails, you will just an error
> message saying it was false when it should have been true.  If EXPECT_NE
> fails, you will get an error message telling you the expected value and the
> actual value.  This is most useful when the actual and expected values are
> integers or strings, but the same concept applies anywhere.  Using the
> proper EXPECT macro gives you a better error message.  Same goes in a few
> other places below.
>
>>
>> +if (structured_data_sp)
>> +{
>> +StructuredData::Dictionary *structured_dict_ptr =
>> structured_data_sp->GetAsDictionary();
>> +EXPECT_TRUE(structured_dict_ptr != nullptr);
>> +if (structured_dict_ptr)
>> +{
>> +StructuredData::ObjectSP structured_addr_value_sp =
>> structured_dict_ptr->GetValueForKey(key_name);
>> +EXPECT_TRUE((bool)structured_addr_value_sp);
>> +const uint64_t extracted_value =
>> structured_addr_value_sp->GetIntegerValue(123);
>> +EXPECT_TRUE(extracted_value == value);
>
> Here's an example of where EXPECT_EQ(value, extracted_value) would be really
> helpful.  Without it, you'd need to debug the test to to see what the actual
> value is.  With it, it will print both values so you can often easily
> determine the cause of the failure without any additional effort.
>
>>
>> +}
>> +}
>> +}
>
> As a general rule of thumb, we should probably avoid conditionals in unit
> tests unless they're really necessary.  It's easy to end up in cases where
> your test ends up not testing something because it's behind a conditional.
> EXPECT_NE(nullptr, foo_sp) is probably fine, then just assume it's non null.

+1
Also note the presence of the ASSERT_XXX macros. The work the same as
the EXPECT_ versions, but also abort the current test (more precisely,
they just issue a "return", as gtest does not rely on exceptions).
That way you can do ASSERT_NE(nullptr, foo_sp), and in the rest of the
function you can assume that the check was successful.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r278325 - Remove a double send of eRunPacketSent event

2016-08-11 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 11 04:22:22 2016
New Revision: 278325

URL: http://llvm.org/viewvc/llvm-project?rev=278325&view=rev
Log:
Remove a double send of eRunPacketSent event

I accidentaly added the send both to the base class and the derived class in my 
refactor. Fix
that.

Modified:

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=278325&r1=278324&r2=278325&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Thu Aug 11 04:22:22 2016
@@ -3947,7 +3947,5 @@ void
 GDBRemoteCommunicationClient::OnRunPacketSent(bool first)
 {
 GDBRemoteClientBase::OnRunPacketSent(first);
-if (first)
-BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
 m_curr_tid = LLDB_INVALID_THREAD_ID;
 }


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


[Lldb-commits] [PATCH] D23395: Make sure LldbGdbServerTestCase is built in arm mode to avoid failures due thumb instructions

2016-08-11 Thread Muhammad Omair Javaid via lldb-commits
omjavaid created this revision.
omjavaid added a reviewer: labath.
omjavaid added a subscriber: lldb-commits.
Herald added subscribers: samparker, rengolin, aemerson.

LldbGdbServerTestCase.test_software_breakpoint_set* are failing when breakpoint 
target address is an thumb16 instruction.

Test right now doesnt handle thumb mode which means that it should only be 
built in arm mode using -marm flag in gcc.

This patch makes sure that we are building this test in arm mode.



https://reviews.llvm.org/D23395

Files:
  packages/Python/lldbsuite/test/tools/lldb-server/Makefile
  packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py

Index: packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -1233,15 +1233,23 @@
 @debugserver_test
 def test_software_breakpoint_set_and_remove_work_debugserver(self):
 self.init_debugserver_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
 @llgs_test
 @expectedFlakeyLinux("llvm.org/pr25652")
 def test_software_breakpoint_set_and_remove_work_llgs(self):
 self.init_llgs_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
Index: packages/Python/lldbsuite/test/tools/lldb-server/Makefile
===
--- packages/Python/lldbsuite/test/tools/lldb-server/Makefile
+++ packages/Python/lldbsuite/test/tools/lldb-server/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
+override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO


Index: packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -1233,15 +1233,23 @@
 @debugserver_test
 def test_software_breakpoint_set_and_remove_work_debugserver(self):
 self.init_debugserver_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
 @llgs_test
 @expectedFlakeyLinux("llvm.org/pr25652")
 def test_software_breakpoint_set_and_remove_work_llgs(self):
 self.init_llgs_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
Index: packages/Python/lldbsuite/test/tools/lldb-server/Makefile
===
--- packages/Python/lldbsuite/test/tools/lldb-server/Makefile
+++ packages/Python/lldbsuite/test/tools/lldb-server/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
+override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D20386: Correct makefile.rules to use arm/aarch64 target specific AR and OBJCOPY

2016-08-11 Thread Muhammad Omair Javaid via lldb-commits
omjavaid updated this revision to Diff 67669.
omjavaid added a comment.
Herald added a subscriber: srhines.

Updated with suggestion incorporated.

Here's what I am getting on different inputs:

Testing make clean CC=gcc
ar
objcopy

Testing make clean CC=clang
ar
objcopy

Testing make clean CC=gcc-5
ar
objcopy

Testing make clean CC=clang-3.8
ar
objcopy

Testing make clean CC=arm-linux-gnueabihf-gcc ARCH=arm
arm-linux-gnueabihf-ar
arm-linux-gnueabihf-objcopy

Testing make clean CC=arm-linux-gnueabihf-gcc-5 ARCH=arm
arm-linux-gnueabihf-ar
arm-linux-gnueabihf-objcopy

Testing make clean 
CC=/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-gcc
 ARCH=arm
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-ar
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-objcopy

Testing make clean 
CC=/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-gcc-4.9
 ARCH=arm
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-ar
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-objcopy


https://reviews.llvm.org/D20386

Files:
  packages/Python/lldbsuite/test/make/Makefile.rules

Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -265,7 +265,32 @@
 $(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
-OBJCOPY := $(CROSS_COMPILE)objcopy
+ifneq "$(OS)" "Darwin"
+CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
+ $(findstring clang,$(CC)), \
+ $(if $(findstring gcc,$(CC)), \
+  $(findstring gcc,$(CC)), \
+  cc)))
+
+CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC
+
+replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
+   $(subst $(3),$(1),$(2)), \
+   $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)
+
+ifeq "$(notdir $(CC))" "$(CC)"
+replace_cc_with = $(call replace_with,$(1),$(CC),$(CLANG_OR_GCC))
+else
+replace_cc_with = $(join $(dir $(CC)),$(call 
replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC)))
+endif
+
+OBJCOPY = $(call replace_cc_with,objcopy)
+AR = $(call replace_cc_with,ar)
+endif
+
+ifdef PIE
+LDFLAGS += -pie
+endif
 
 #--
 # Windows specific options
@@ -285,27 +310,6 @@
 endif
 
 #--
-# Android specific options
-#--
-ifeq "$(OS)" "Android"
-ifdef PIE
-LDFLAGS += -pie
-endif
-replace_with = $(if $(findstring clang,$(1)), \
-$(subst clang,$(2),$(1)), \
-$(if $(findstring gcc,$(1)), \
- $(subst gcc,$(2),$(1)), \
- $(subst cc,$(2),$(1
-ifeq "$(notdir $(CC))" "$(CC)"
-replace_cc_with = $(call replace_with,$(CC),$(1))
-else
-replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir 
$(CC)),$(1)))
-endif
-OBJCOPY = $(call replace_cc_with,objcopy)
-AR = $(call replace_cc_with,ar)
-endif
-
-#--
 # C++ standard library options
 #--
 ifeq (1,$(USE_LIBSTDCPP))


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -265,7 +265,32 @@
 $(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
-OBJCOPY := $(CROSS_COMPILE)objcopy
+ifneq "$(OS)" "Darwin"
+CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
+ $(findstring clang,$(CC)), \
+ $(if $(findstring gcc,$(CC)), \
+  $(findstring gcc,$(CC)), \
+  cc)))
+
+CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC
+
+replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
+   $(subst $(3),$(1),$(2)), \
+   $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)
+
+ifeq "$(notdir $(CC))" "$(CC)"
+   

[Lldb-commits] [lldb] r278326 - Make sure LldbGdbServerTestCase is built in arm mode to avoid failures due thumb instructions

2016-08-11 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Thu Aug 11 05:35:05 2016
New Revision: 278326

URL: http://llvm.org/viewvc/llvm-project?rev=278326&view=rev
Log:
Make sure LldbGdbServerTestCase is built in arm mode to avoid failures due 
thumb instructions

Differential revision: https://reviews.llvm.org/D23395



Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile?rev=278326&r1=278325&r2=278326&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile Thu 
Aug 11 05:35:05 2016
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
+override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py?rev=278326&r1=278325&r2=278326&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
 Thu Aug 11 05:35:05 2016
@@ -1233,7 +1233,11 @@ class LldbGdbServerTestCase(gdbremote_te
 @debugserver_test
 def test_software_breakpoint_set_and_remove_work_debugserver(self):
 self.init_debugserver_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
@@ -1241,7 +1245,11 @@ class LldbGdbServerTestCase(gdbremote_te
 @expectedFlakeyLinux("llvm.org/pr25652")
 def test_software_breakpoint_set_and_remove_work_llgs(self):
 self.init_llgs_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 


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


Re: [Lldb-commits] [PATCH] D23395: Make sure LldbGdbServerTestCase is built in arm mode to avoid failures due thumb instructions

2016-08-11 Thread Muhammad Omair Javaid via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL278326: Make sure LldbGdbServerTestCase is built in arm mode 
to avoid failures due… (authored by omjavaid).

Changed prior to commit:
  https://reviews.llvm.org/D23395?vs=67663&id=67670#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23395

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
+override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -1233,15 +1233,23 @@
 @debugserver_test
 def test_software_breakpoint_set_and_remove_work_debugserver(self):
 self.init_debugserver_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
 @llgs_test
 @expectedFlakeyLinux("llvm.org/pr25652")
 def test_software_breakpoint_set_and_remove_work_llgs(self):
 self.init_llgs_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 


Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
+override CFLAGS_EXTRAS += -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -1233,15 +1233,23 @@
 @debugserver_test
 def test_software_breakpoint_set_and_remove_work_debugserver(self):
 self.init_debugserver_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
 @llgs_test
 @expectedFlakeyLinux("llvm.org/pr25652")
 def test_software_breakpoint_set_and_remove_work_llgs(self):
 self.init_llgs_test()
-self.build()
+if self.getArchitecture() == "arm":
+# TODO: Handle case when setting breakpoint in thumb code
+self.build(dictionary={'CFLAGS_EXTRAS': '-marm'})
+else:
+self.build()
 self.set_inferior_startup_launch()
 self.software_breakpoint_set_and_remove_work()
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-11 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, jingham.
labath added subscribers: lldb-commits, tberghammer.

The following problem was occuring:
- broadcaster B had two listeners: L1 and L2 (thread T1)
- (T1) B has started to broadcast an event, it has locked a shared_ptr to L1 (in
  ListenerIterator())
- on another thread T2 the penultimate reference to L1 was destroyed (the 
transient object in B is
  now the last reference)
- (T2) the last reference to L2 was destroyed as well
- (T1) B has finished broadcasting the event to L1 and destroyed the last 
shared_ptr
- (T1) this triggered the destructor, which called into B->RemoveListener()
- (T1) all pointers in the m_listeners list were now stale, so RemoveListener 
emptied the list
- (T1) Eventually control returned to the ListenerIterator() for doing 
broadcasting, which was
  still in the middle of iterating through the list
- (T1) Only now, it was holding onto a dangling iterator. BOOM.

I fix this issue by making sure nothing can interfere with the
iterate-and-remove-expired-pointers loop, by moving this logic into a single 
function, which
first locks (or clears) the whole list and then returns the list of valid and 
locked Listeners
for further processing. Instead of std::list I use an llvm::SmallVector which 
should hopefully
offset the fact that we create a copy of the list for the common case where we 
have only a few
listeners (no heap allocations).

A slight difference in behaviour is that now RemoveListener does not remove an 
element from the
list -- it only sets it's mask to 0, which means it will be removed during the 
next iteration of
GetListeners(). This is purely an implementation detail and it should not be 
externally
noticable.

I was not able to reproduce this bug reliably without inserting sleep 
statements into the code,
so I do not add a test for it. Instead, I add some unit tests for the functions 
that I do modify.

https://reviews.llvm.org/D23406

Files:
  include/lldb/Core/Broadcaster.h
  source/Core/Broadcaster.cpp
  unittests/Core/BroadcasterTest.cpp
  unittests/Core/CMakeLists.txt

Index: unittests/Core/CMakeLists.txt
===
--- unittests/Core/CMakeLists.txt
+++ unittests/Core/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(LLDBCoreTests
+  BroadcasterTest.cpp
   DataExtractorTest.cpp
   ScalarTest.cpp
   )
Index: unittests/Core/BroadcasterTest.cpp
===
--- /dev/null
+++ unittests/Core/BroadcasterTest.cpp
@@ -0,0 +1,72 @@
+//===-- BroadcasterTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/Broadcaster.h"
+#include "lldb/Core/Listener.h"
+#include "lldb/Host/Predicate.h"
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+TEST(BroadcasterTest, BroadcastEvent)
+{
+EventSP event_sp;
+Broadcaster broadcaster(nullptr, "test-broadcaster");
+
+// Create a listener, sign it up, make sure it recieves an event.
+ListenerSP listener1_sp = Listener::MakeListener("test-listener1");
+const uint32_t event_mask1 = 1;
+EXPECT_EQ(event_mask1, listener1_sp->StartListeningForEvents(&broadcaster, event_mask1));
+broadcaster.BroadcastEvent(event_mask1, nullptr);
+EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+EXPECT_EQ(event_mask1, event_sp->GetType());
+
+{
+// Add one more listener, make sure it works as well.
+ListenerSP listener2_sp = Listener::MakeListener("test-listener2");
+const uint32_t event_mask2 = 1;
+EXPECT_EQ(event_mask2, listener2_sp->StartListeningForEvents(&broadcaster, event_mask1 | event_mask2));
+broadcaster.BroadcastEvent(event_mask2, nullptr);
+EXPECT_TRUE(listener2_sp->GetNextEvent(event_sp));
+EXPECT_EQ(event_mask2, event_sp->GetType());
+
+// Both listeners should get this event.
+broadcaster.BroadcastEvent(event_mask1, nullptr);
+EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+EXPECT_EQ(event_mask1, event_sp->GetType());
+EXPECT_TRUE(listener2_sp->GetNextEvent(event_sp));
+EXPECT_EQ(event_mask2, event_sp->GetType());
+}
+
+// Now again only one listener should be active.
+broadcaster.BroadcastEvent(event_mask1, nullptr);
+EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+EXPECT_EQ(event_mask1, event_sp->GetType());
+}
+
+TEST(BroadcasterTest, EventTypeHasListeners)
+{
+EventSP event_sp;
+Broadcaster broadcaster(nullptr, "test-broadcaster");
+
+const uint32_t event_mask = 1;
+EXPECT_FALSE(broadcaster.EventTypeHasListeners(event_mask));
+
+{
+ 

[Lldb-commits] [lldb] r278335 - Make sure files include what they use (part 2/2)

2016-08-11 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 11 09:12:10 2016
New Revision: 278335

URL: http://llvm.org/viewvc/llvm-project?rev=278335&view=rev
Log:
Make sure files include what they use (part 2/2)

This makes lldb still compile on linux after a project-wide clang-format

Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h

lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp

lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h

lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h?rev=278335&r1=278334&r2=278335&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h Thu Aug 11 
09:12:10 2016
@@ -10,6 +10,9 @@
 #ifndef liblldb_RegisterContext_x86_H_
 #define liblldb_RegisterContext_x86_H_
 
+#include 
+#include 
+
 //---
 // i386 ehframe, dwarf regnums
 //---

Modified: 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp?rev=278335&r1=278334&r2=278335&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp 
Thu Aug 11 09:12:10 2016
@@ -7,10 +7,11 @@
 //
 
//===--===//
 
-#include "lldb/Core/DataExtractor.h"
+#include "RegisterContextPOSIXCore_powerpc.h"
+
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/RegisterValue.h"
 #include "lldb/Target/Thread.h"
-#include "RegisterContextPOSIXCore_powerpc.h"
 
 using namespace lldb_private;
 

Modified: 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h?rev=278335&r1=278334&r2=278335&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h 
(original)
+++ 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h 
Thu Aug 11 09:12:10 2016
@@ -14,8 +14,8 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/DataBufferHeap.h"
 #include "Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h"
+#include "lldb/Core/DataExtractor.h"
 
 class RegisterContextCorePOSIX_powerpc :
 public RegisterContextPOSIX_powerpc

Modified: 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp?rev=278335&r1=278334&r2=278335&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp 
Thu Aug 11 09:12:10 2016
@@ -7,10 +7,11 @@
 //
 
//===--===//
 
-#include "lldb/Core/DataExtractor.h"
+#include "RegisterContextPOSIXCore_s390x.h"
+
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/RegisterValue.h"
 #include "lldb/Target/Thread.h"
-#include "RegisterContextPOSIXCore_s390x.h"
 
 using namespace lldb_private;
 

Modified: 
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h?rev=278335&r1=278334&r2=278335&view=diff
==
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h 
(original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h 
Thu Aug 11 09:12:10 2016
@@ -14,8 +14,8 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/DataBufferHeap.h"
 #include "Plugins/Proce

Re: [Lldb-commits] [PATCH] D23290: Added enforce-interactivity setting

2016-08-11 Thread Zachary Turner via lldb-commits
Tbh I've no experience with ptys so I don't know if there is an equivalent

I do know that more than one process can share a single console. So for
example if you run a copy of lldb, you can have the ide and lldb share the
same console.

Not sure if this is similar to what you're doing though
On Thu, Aug 11, 2016 at 2:01 AM Pavel Labath  wrote:

> labath added a subscriber: zturner.
> labath added a comment.
>
> I think I have understood the situation a bit more now, so let me try to
> explain what is going on.
>
> In https://reviews.llvm.org/D23290#511683, @clayborg wrote:
>
> > Is this something the user is typing in your IDE that you are forwarding
> to LLDB via pipes? Again, why are you using the command and not the API.
> There are API for everything you can do and no IDE should be doing code
> like:
> >
> > void MyDebugger::ClearAllBreakpoints()
> >  {
> >
> >   m_debugger.HandleCommand("breakpoint delete");
> >
> > }
> >
> > Can you explain your use case here? If this is something the user is
> typing, then user PTY instead of pipes and all will be well. I know many
> functions in the lldb-mi are incorrectly implemented and they actually
> create and send LLDB commands using text and we need to fix this, so
> hopefully you aren't copying that code as a basis???
>
>
> Yes, this is for commands that the user is typing by hand into the IDE,
> which has a tiny lldb console. All commands that are issued by IDE directly
> use the proper SB APIs. (The IDE is android studio BTW.)
>
> I had also considered using PTYs, but as far as I can tell there is no
> equivalent of that on windows. (@zturner, do you have any more insight into
> that? Is it possible to fake a terminal on windows à la POSIX pseudo
> terminals?).
>
> Greg, how does xcode achieve this? (I presume it has some form of an lldb
> console)
>
>
> https://reviews.llvm.org/D23290
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D23150: [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)

2016-08-11 Thread Kuba Brecka via lldb-commits
kubabrecka accepted this revision.
kubabrecka added a comment.
This revision is now accepted and ready to land.

LGTM.  While you’re at it, could you also reformat with clang-format?  I 
noticed that the files inconsistently use curly braces on same line or new line.


https://reviews.llvm.org/D23150



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


Re: [Lldb-commits] [PATCH] D23043: [InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI)

2016-08-11 Thread Kuba Brecka via lldb-commits
kubabrecka accepted this revision.
kubabrecka added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D23043



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


Re: [Lldb-commits] [PATCH] D20386: Correct makefile.rules to use arm/aarch64 target specific AR and OBJCOPY

2016-08-11 Thread Pavel Labath via lldb-commits
labath added a comment.

Looks great, just give me a while to prepare the new paths on the buildbots. 
Should be done by tomorrow.


https://reviews.llvm.org/D20386



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


[Lldb-commits] [lldb] r278345 - Fix unit tests on windows

2016-08-11 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Aug 11 10:31:30 2016
New Revision: 278345

URL: http://llvm.org/viewvc/llvm-project?rev=278345&view=rev
Log:
Fix unit tests on windows

Python headers need to be included before PosixApi.h

Modified:
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Modified: 
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp?rev=278345&r1=278344&r2=278345&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp 
(original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp 
Thu Aug 11 10:31:30 2016
@@ -8,11 +8,11 @@
 
//===--===//
 
 #include "gtest/gtest.h"
+#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 
 #include "lldb/Host/File.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
-#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 #include "Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
 

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=278345&r1=278344&r2=278345&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Thu Aug 
11 10:31:30 2016
@@ -8,9 +8,9 @@
 
//===--===//
 
 #include "gtest/gtest.h"
+#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 
 #include "lldb/Host/HostInfo.h"
-#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
 
 #include "PythonTestSuite.h"


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


Re: [Lldb-commits] [PATCH] D20386: Correct makefile.rules to use arm/aarch64 target specific AR and OBJCOPY

2016-08-11 Thread Pavel Labath via lldb-commits
labath added a comment.

Hm... there is one more problem here.. when we run the tests against a 
top-of-tree clang that we have just built, we will compute AR and OBJCOPY to be 
in the build directory. They will obviously not be there, and we cannot just 
create the symlinks there by hand because the directory gets wiped after every 
build. I'll need to think about this a bit...


https://reviews.llvm.org/D20386



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


Re: [Lldb-commits] [PATCH] D23150: [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)

2016-08-11 Thread Vedant Kumar via lldb-commits
vsk added a comment.

Thanks for the review!

Normally I'd be happy to commit some clang-format changes as a follow-up, but 
the lldb team is planning on doing a project-wide clang-format commit in early 
September. Maybe it would be best to wait for that?


https://reviews.llvm.org/D23150



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


[Lldb-commits] [lldb] r278368 - [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)

2016-08-11 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Thu Aug 11 12:28:37 2016
New Revision: 278368

URL: http://llvm.org/viewvc/llvm-project?rev=278368&view=rev
Log:
[InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)

Factor out some common logic used to find the runtime library in a list
of modules.

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

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

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h

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

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

Modified: lldb/trunk/include/lldb/Target/InstrumentationRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/InstrumentationRuntime.h?rev=278368&r1=278367&r2=278368&view=diff
==
--- lldb/trunk/include/lldb/Target/InstrumentationRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/InstrumentationRuntime.h Thu Aug 11 12:28:37 
2016
@@ -87,6 +87,19 @@ protected:
 m_is_active = IsActive;
 }
 
+/// Return a regular expression which can be used to identify a valid 
version of the runtime library.
+virtual const RegularExpression &
+GetPatternForRuntimeLibrary() = 0;
+
+/// Check whether \p module_sp corresponds to a valid runtime library.
+virtual bool
+CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) = 0;
+
+/// Register a breakpoint in the runtime library and perform any other 
necessary initialization. The runtime library
+/// is guaranteed to be loaded.
+virtual void
+Activate() = 0;
+
 public:
 
 static void
@@ -94,8 +107,8 @@ public:
 
 /// Look for the instrumentation runtime in \p module_list. Register and 
activate the runtime if this hasn't already
 /// been done.
-virtual void
-ModulesDidLoad(lldb_private::ModuleList &module_list) = 0;
+void
+ModulesDidLoad(lldb_private::ModuleList &module_list);
 
 bool
 IsActive() const

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=278368&r1=278367&r2=278368&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 Thu Aug 11 12:28:37 2016
@@ -12,7 +12,6 @@
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleList.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/PluginManager.h"
@@ -68,46 +67,21 @@ AddressSanitizerRuntime::~AddressSanitiz
 Deactivate();
 }
 
-bool ModuleContainsASanRuntime(Module * module)
+const RegularExpression &
+AddressSanitizerRuntime::GetPatternForRuntimeLibrary()
 {
-const Symbol* symbol = module->FindFirstSymbolWithNameAndType(
-ConstString("__asan_get_alloc_stack"),
-lldb::eSymbolTypeAny);
-
-return symbol != nullptr;
+// FIXME: This shouldn't include the "dylib" suffix.
+static RegularExpression regex("libclang_rt.asan_(.*)_dynamic\\.dylib");
+return regex;
 }
 
-void
-AddressSanitizerRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list)
+bool
+AddressSanitizerRuntime::CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp)
 {
-if (IsActive())
-return;
-
-if (GetRuntimeModuleSP()) {
-Activate();
-return;
-}
-
-std::lock_guard guard(module_list.GetMutex());
-const size_t num_modules = module_list.GetSize();
-for (size_t i = 0; i < num_modules; ++i)
-{
-Module *module_pointer = 
module_list.GetModulePointerAtIndexUnlocked(i);
-const FileSpec & file_spec = module_pointer->GetFileSpec();
-if (! file_spec)
-continue;
-
-static RegularExpression 
g_asan_runtime_regex("libclang_rt.asan_(.*)_dynamic\\.dylib");
-if (g_asan_runtime_regex.Execute 
(file_spec.GetFilename().GetCString()) || module_pointer->IsExecutable())
-{
-if (ModuleContainsASanRuntime(module_pointer))
-{
-SetRuntimeModuleSP(module_pointer->shared_from_this());
-Activate();
-return;
-}
-}
-}
+const Symbol *symbol =
+
module_sp->FindFirstSymbolWithNameAndType(ConstString("__asan_get_

Re: [Lldb-commits] [PATCH] D23150: [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)

2016-08-11 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL278368: [InstrumentationRuntime] Refactor the API (Part 2/N) 
(NFCI) (authored by vedantk).

Changed prior to commit:
  https://reviews.llvm.org/D23150?vs=66755&id=67706#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23150

Files:
  lldb/trunk/include/lldb/Target/InstrumentationRuntime.h
  
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h
  
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
  
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
  lldb/trunk/source/Target/InstrumentationRuntime.cpp

Index: lldb/trunk/source/Target/InstrumentationRuntime.cpp
===
--- lldb/trunk/source/Target/InstrumentationRuntime.cpp
+++ lldb/trunk/source/Target/InstrumentationRuntime.cpp
@@ -13,7 +13,10 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/RegularExpression.h"
 #include "lldb/Target/InstrumentationRuntime.h"
 
 using namespace lldb;
@@ -40,6 +43,38 @@
 }
 }
 
+void
+InstrumentationRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list)
+{
+if (IsActive())
+return;
+
+if (GetRuntimeModuleSP())
+{
+Activate();
+return;
+}
+
+module_list.ForEach([this](const lldb::ModuleSP module_sp) -> bool {
+const FileSpec &file_spec = module_sp->GetFileSpec();
+if (!file_spec)
+return true; // Keep iterating.
+
+const RegularExpression &runtime_regex = GetPatternForRuntimeLibrary();
+if (runtime_regex.Execute(file_spec.GetFilename().GetCString()) || module_sp->IsExecutable())
+{
+if (CheckIfRuntimeIsValid(module_sp))
+{
+SetRuntimeModuleSP(module_sp);
+Activate();
+return false; // Stop iterating, we're done.
+}
+}
+
+return true;
+});
+}
+
 lldb::ThreadCollectionSP
 InstrumentationRuntime::GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info)
 {
Index: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
===
--- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -12,7 +12,6 @@
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleList.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/PluginManager.h"
@@ -73,46 +72,6 @@
 Deactivate();
 }
 
-static bool
-ModuleContainsTSanRuntime(ModuleSP module_sp)
-{
-static ConstString g_tsan_get_current_report("__tsan_get_current_report");
-const Symbol* symbol = module_sp->FindFirstSymbolWithNameAndType(g_tsan_get_current_report, lldb::eSymbolTypeAny);
-return symbol != nullptr;
-}
-
-void
-ThreadSanitizerRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list)
-{
-if (IsActive())
-return;
-
-if (GetRuntimeModuleSP()) {
-Activate();
-return;
-}
-
-module_list.ForEach ([this](const lldb::ModuleSP module_sp) -> bool
-{
-const FileSpec & file_spec = module_sp->GetFileSpec();
-if (! file_spec)
-return true; // Keep iterating through modules
-
-llvm::StringRef module_basename(file_spec.GetFilename().GetStringRef());
-if (module_sp->IsExecutable() || module_basename.startswith("libclang_rt.tsan_"))
-{
-if (ModuleContainsTSanRuntime(module_sp))
-{
-SetRuntimeModuleSP(module_sp);
-Activate();
-return false; // Stop iterating
-}
-}
-
-return true; // Keep iterating through modules
-});
-}
-
 #define RETRIEVE_REPORT_DATA_FUNCTION_TIMEOUT_USEC 2*1000*1000
 
 const char *
@@ -713,6 +672,20 @@
 return false;   // Let target run
 }
 
+const RegularExpression &
+ThreadSanitizerRuntime::GetPatternForRuntimeLibrary() {
+  static RegularExpression regex("libclang_rt.tsan_");
+  return regex;
+}
+
+bool
+ThreadSanitizerRuntime::CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp)
+{
+static ConstString g_tsan_get_current_report("__tsan_get_current_report");
+const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(g_tsan_get_current_report, lldb::eSymbolTypeAny);
+return symbol != nullptr;
+}
+
 void
 Threa

[Lldb-commits] [lldb] r278367 - [InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI)

2016-08-11 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Thu Aug 11 12:28:33 2016
New Revision: 278367

URL: http://llvm.org/viewvc/llvm-project?rev=278367&view=rev
Log:
[InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI)

Adapters for instrumentation runtimes have to do two basic things:

  1) Load a runtime library.
  2) Install breakpoints in that library.

This logic is duplicated in the adapters for asan and tsan. Factor it
out and document bits of it to make it easier to add new adapters.

I tested this with check-lldb, and double-checked
testcases/functionalities/{a,t}san.

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

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

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h

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

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

Modified: lldb/trunk/include/lldb/Target/InstrumentationRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/InstrumentationRuntime.h?rev=278367&r1=278366&r2=278367&view=diff
==
--- lldb/trunk/include/lldb/Target/InstrumentationRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/InstrumentationRuntime.h Thu Aug 11 12:28:33 
2016
@@ -17,6 +17,7 @@
 
 // Other libraries and framework includes
 // Project includes
+#include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-types.h"
 #include "lldb/Core/PluginInterface.h"
@@ -30,16 +31,77 @@ class InstrumentationRuntime :
 public std::enable_shared_from_this,
 public PluginInterface
 {
+/// The instrumented process.
+lldb::ProcessWP m_process_wp;
+
+/// The module containing the instrumentation runtime.
+lldb::ModuleSP m_runtime_module;
+
+/// The breakpoint in the instrumentation runtime.
+lldb::user_id_t m_breakpoint_id;
+
+/// Indicates whether or not breakpoints have been registered in the 
instrumentation runtime.
+bool m_is_active;
+
+protected:
+InstrumentationRuntime(const lldb::ProcessSP &process_sp)
+: m_process_wp(), m_runtime_module(), m_breakpoint_id(0), 
m_is_active(false)
+{
+if (process_sp)
+m_process_wp = process_sp;
+}
+
+lldb::ProcessSP
+GetProcessSP()
+{
+return m_process_wp.lock();
+}
+
+lldb::ModuleSP
+GetRuntimeModuleSP()
+{
+return m_runtime_module;
+}
+
+void
+SetRuntimeModuleSP(lldb::ModuleSP module_sp)
+{
+m_runtime_module = module_sp;
+}
+
+lldb::user_id_t
+GetBreakpointID() const
+{
+return m_breakpoint_id;
+}
+
+void
+SetBreakpointID(lldb::user_id_t ID)
+{
+m_breakpoint_id = ID;
+}
+
+void
+SetActive(bool IsActive)
+{
+m_is_active = IsActive;
+}
+
 public:
 
 static void
 ModulesDidLoad(lldb_private::ModuleList &module_list, Process *process, 
InstrumentationRuntimeCollection &runtimes);
-
+
+/// Look for the instrumentation runtime in \p module_list. Register and 
activate the runtime if this hasn't already
+/// been done.
 virtual void
-ModulesDidLoad(lldb_private::ModuleList &module_list);
-
-virtual bool
-IsActive();
+ModulesDidLoad(lldb_private::ModuleList &module_list) = 0;
+
+bool
+IsActive() const
+{
+return m_is_active;
+}
 
 virtual lldb::ThreadCollectionSP
 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info);

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=278367&r1=278366&r2=278367&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 Thu Aug 11 12:28:33 2016
@@ -63,16 +63,6 @@ AddressSanitizerRuntime::GetTypeStatic()
 return eInstrumentationRuntimeTypeAddressSanitizer;
 }
 
-AddressSanitizerRuntime::AddressSanitizerRuntime(const ProcessSP &process_sp) :
-m_is_active(false),
-m_runtime_module(),
-m_process_wp(),
-m_breakpoint_id(0)
-{
-if (process_sp)
-m_process_wp = process_sp;
-}
-
 AddressSanitizerRuntime::~AddressSanitizerRuntime()
 {
 Deactivate();
@@ -93,7 +83,7 @@ AddressSanitizerRuntime::ModulesDidLoad(
 if (IsActive())
 return;
 
-if (m_runtime_module) {
+if (Get

Re: [Lldb-commits] [PATCH] D23043: [InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI)

2016-08-11 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL278367: [InstrumentationRuntime] Refactor the API (Part 1/N) 
(NFCI) (authored by vedantk).

Changed prior to commit:
  https://reviews.llvm.org/D23043?vs=66411&id=67705#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23043

Files:
  lldb/trunk/include/lldb/Target/InstrumentationRuntime.h
  
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h
  
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
  
lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
  lldb/trunk/source/Target/InstrumentationRuntime.cpp

Index: lldb/trunk/source/Target/InstrumentationRuntime.cpp
===
--- lldb/trunk/source/Target/InstrumentationRuntime.cpp
+++ lldb/trunk/source/Target/InstrumentationRuntime.cpp
@@ -40,17 +40,6 @@
 }
 }
 
-void
-InstrumentationRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list)
-{
-}
-
-bool
-InstrumentationRuntime::IsActive()
-{
-return false;
-}
-
 lldb::ThreadCollectionSP
 InstrumentationRuntime::GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info)
 {
Index: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
===
--- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
@@ -17,7 +17,6 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/InstrumentationRuntime.h"
-#include "lldb/Target/Process.h"
 #include "lldb/Core/StructuredData.h"
 
 namespace lldb_private {
@@ -60,26 +59,11 @@
 void
 ModulesDidLoad(lldb_private::ModuleList &module_list) override;
 
-bool
-IsActive() override;
-
 lldb::ThreadCollectionSP
 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
 
 private:
-ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp);
-
-lldb::ProcessSP
-GetProcessSP ()
-{
-return m_process_wp.lock();
-}
-
-lldb::ModuleSP
-GetRuntimeModuleSP ()
-{
-return m_runtime_module_wp.lock();
-}
+ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp) : lldb_private::InstrumentationRuntime(process_sp) {}
 
 void
 Activate();
@@ -107,11 +91,6 @@
 
 lldb::addr_t
 GetFirstNonInternalFramePc(StructuredData::ObjectSP trace);
-
-bool m_is_active;
-lldb::ModuleWP m_runtime_module_wp;
-lldb::ProcessWP m_process_wp;
-lldb::user_id_t m_breakpoint_id;
 };
 
 } // namespace lldb_private
Index: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
===
--- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -68,16 +68,6 @@
 return eInstrumentationRuntimeTypeThreadSanitizer;
 }
 
-ThreadSanitizerRuntime::ThreadSanitizerRuntime(const ProcessSP &process_sp) :
-m_is_active(false),
-m_runtime_module_wp(),
-m_process_wp(),
-m_breakpoint_id(0)
-{
-if (process_sp)
-m_process_wp = process_sp;
-}
-
 ThreadSanitizerRuntime::~ThreadSanitizerRuntime()
 {
 Deactivate();
@@ -113,7 +103,7 @@
 {
 if (ModuleContainsTSanRuntime(module_sp))
 {
-m_runtime_module_wp = module_sp;
+SetRuntimeModuleSP(module_sp);
 Activate();
 return false; // Stop iterating
 }
@@ -123,12 +113,6 @@
 });
 }
 
-bool
-ThreadSanitizerRuntime::IsActive()
-{
-return m_is_active;
-}
-
 #define RETRIEVE_REPORT_DATA_FUNCTION_TIMEOUT_USEC 2*1000*1000
 
 const char *
@@ -732,7 +716,7 @@
 void
 ThreadSanitizerRuntime::Activate()
 {
-if (m_is_active)
+if (IsActive())
 return;
 
 ProcessSP process_sp = GetProcessSP();
@@ -759,30 +743,30 @@
 Breakpoint *breakpoint = process_sp->GetTarget().CreateBreakpoint(symbol_address, internal, hardware).get();
 breakpoint->SetCallback (ThreadSanitizerRuntime::NotifyBreakpointHit, this, true);
 breakpoint->SetBreakpointKind ("thread-sanitizer-report");
-m_breakpoint_id = breakpoint->GetID();
+SetBreakpointID(breakpoint->GetID());
 
 StreamFileSP stream_sp (process_sp->GetTarget().GetDebugger().GetOutputFile());
 if (stream_sp)
 {
 stream_sp->Printf ("ThreadSanitizer debugger support is active.\n");
 }
 
-m_is_active = true;
+SetActive(true);
 }
 
 void
 ThreadSanitizerRuntime:

[Lldb-commits] [lldb] r278373 - Modify coding conventions to mention include ordering.

2016-08-11 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Aug 11 13:10:40 2016
New Revision: 278373

URL: http://llvm.org/viewvc/llvm-project?rev=278373&view=rev
Log:
Modify coding conventions to mention include ordering.

Modified:
lldb/trunk/www/lldb-coding-conventions.html

Modified: lldb/trunk/www/lldb-coding-conventions.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/lldb-coding-conventions.html?rev=278373&r1=278372&r2=278373&view=diff
==
--- lldb/trunk/www/lldb-coding-conventions.html (original)
+++ lldb/trunk/www/lldb-coding-conventions.html Thu Aug 11 13:10:40 2016
@@ -34,7 +34,20 @@
 Important: Where not explicitly 
outlined below, assume that the
 http://llvm.org/docs/CodingStandards.html";>LLVM Coding Conventions 
are to be followed.
   
-
+  Include Order:
+  LLDB follows http://llvm.org/docs/CodingStandards.html#include-style";>LLVM's include 
order,
+with an addition for LLDB specific 
headers.
+
+
+Main Module Header
+Local/Private Headers
+lldb/...
+llvm/...
+System #includes
+
+  If you encounter existing code that 
does not follow this ordering, it should not be
+taken as an indication that it is ok 
to not use it.  Instead, the surrounding ordering
+should be fixed gradually and 
incrementally.
   Source code width:
   lldb does not follow the 80 character 
line restriction llvm imposes.  In our 
 experience, trying to fit C++ code 
into an 80 character line results in code that


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


Re: [Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-11 Thread Greg Clayton via lldb-commits
clayborg added a comment.

My only issue with this patch is that is uses llvm::SmallVector. Although the 
class is nice, we don't have visibility into this class when debugging like we 
do when we use STL collections. I would rather not move to SmallVector if we 
don't need to. Jim, thoughts?


https://reviews.llvm.org/D23406



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


Re: [Lldb-commits] [PATCH] D23290: Added enforce-interactivity setting

2016-08-11 Thread Greg Clayton via lldb-commits
clayborg added a comment.

In https://reviews.llvm.org/D23290#512346, @labath wrote:

> I think I have understood the situation a bit more now, so let me try to 
> explain what is going on.
>
> In https://reviews.llvm.org/D23290#511683, @clayborg wrote:
>
> > Is this something the user is typing in your IDE that you are forwarding to 
> > LLDB via pipes? Again, why are you using the command and not the API. There 
> > are API for everything you can do and no IDE should be doing code like:
> >
> > void MyDebugger::ClearAllBreakpoints()
> >  {
> >
> >   m_debugger.HandleCommand("breakpoint delete");
> >
> > }
> >
> > Can you explain your use case here? If this is something the user is 
> > typing, then user PTY instead of pipes and all will be well. I know many 
> > functions in the lldb-mi are incorrectly implemented and they actually 
> > create and send LLDB commands using text and we need to fix this, so 
> > hopefully you aren't copying that code as a basis???
>
>
> Yes, this is for commands that the user is typing by hand into the IDE, which 
> has a tiny lldb console. All commands that are issued by IDE directly use the 
> proper SB APIs. (The IDE is android studio BTW.)
>
> I had also considered using PTYs, but as far as I can tell there is no 
> equivalent of that on windows. (@zturner, do you have any more insight into 
> that? Is it possible to fake a terminal on windows à la POSIX pseudo 
> terminals?).
>
> Greg, how does xcode achieve this? (I presume it has some form of an lldb 
> console)


We use PTY (pseudo terminals). Look at source/Utilitiy/PseudoTerminal.cpp as a 
wrapper around what you need to do. Basically it goes like this: with pseudo 
terminals you have master and slave sides. You open the master, and if LLDB is 
a framework that is in process, you open the slave as well. You take the file 
descriptor for the slave and you fdopen() it to get a "FILE *" and you give 
that to your SBDebugger via:

  void SBDebugger::SetInputFileHandle (FILE *f, bool transfer_ownership);
  void SBDebugger::SetOutputFileHandle (FILE *f, bool transfer_ownership);
  void SBDebugger::SetErrorFileHandle (FILE *f, bool transfer_ownership);

One thing to note: if Android Studio can have multiple debugging session 
windows open, you should have a different SBDebugger each window since each 
SBDebugger has it's own command interpreter and can set its input/output/error 
file handles correctly. See the EditlineAdapter::EditlineAdapter() class for 
details on how to open the master and slave.


https://reviews.llvm.org/D23290



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


Re: [Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-11 Thread Jim Ingham via lldb-commits
jingham added a comment.

The patch seems correct to me.

I don't have a strong opinion about std::vector vrs. SmallVector.  These are 
temporary objects, so the size of the container doesn't matter, and I doubt 
this code is hot enough in normal lldb sessions that the difference between in 
performance between the two will matter.  Maybe the SmallVector data formatter 
(llvm/utils/lldbDataFormatters.py) works, or if it doesn't we should fix it?


https://reviews.llvm.org/D23406



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


Re: [Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-11 Thread Enrico Granata via lldb-commits

> On Aug 11, 2016, at 3:55 PM, Jim Ingham via lldb-commits 
>  wrote:
> 
> jingham added a comment.
> 
> The patch seems correct to me.
> 
> I don't have a strong opinion about std::vector vrs. SmallVector.  These are 
> temporary objects, so the size of the container doesn't matter, and I doubt 
> this code is hot enough in normal lldb sessions that the difference between 
> in performance between the two will matter.  Maybe the SmallVector data 
> formatter (llvm/utils/lldbDataFormatters.py) works, or if it doesn't we 
> should fix it?

IIRC, Argyrios wrote those formatters a few years ago, so +Argyrios to comment 
on whether it's expected to work

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


Thanks,
- Enrico
📩 egranata@.com ☎️ 27683

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


Re: [Lldb-commits] [PATCH] D23406: Fix a race in Broadcaster/Listener interaction

2016-08-11 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Ok. Jim says the patch is OK, so I will OK it also.


https://reviews.llvm.org/D23406



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


Re: [Lldb-commits] [lldb] r278440 - Decoupled Options from CommandInterpreter.

2016-08-11 Thread Jim Ingham via lldb-commits
I have no opposition to unit tests in general, but if somebody finds some free 
time on their hands, it would be really great to make the option definition & 
argument parsing available to the SB API's so that people could define real 
lldb Python commands that did completion, help etc as an equal of the built-in 
commands.  That would allow you to kill two birds with one stone, since then 
you could use the SB API's to test them.

Just a thought while we're allocating other people's time...

Jim

> On Aug 11, 2016, at 5:33 PM, Todd Fiala via lldb-commits 
>  wrote:
> 
> :-)
> 
> That would be great.  I think it would be useful to invest in that area.  
> I'll add that to my list.
> 
> On Thu, Aug 11, 2016 at 5:11 PM, Zachary Turner  wrote:
> Have you considered writing some unit test for all the option stuff now?
> 
> On Thu, Aug 11, 2016 at 5:10 PM Zachary Turner  wrote:
> This sounds very helpful.  It also means it should become easier to start 
> unit testing the options framework
> 
> On Thu, Aug 11, 2016 at 4:59 PM Todd Fiala via lldb-commits 
>  wrote:
> Author: tfiala
> Date: Thu Aug 11 18:51:28 2016
> New Revision: 278440
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=278440&view=rev
> Log:
> Decoupled Options from CommandInterpreter.
> 
> Options used to store a reference to the CommandInterpreter instance
> in the base Options class.  This made it impossible to parse options
> independent of a CommandInterpreter.
> 
> This change removes the reference from the base class.  Instead, it
> modifies the options-parsing-related methods to take an
> ExecutionContext pointer, which the options may inspect if they need
> to do so.
> 
> Closes https://reviews.llvm.org/D23416
> Reviewers: clayborg, jingham
> 
> Modified:
> lldb/trunk/include/lldb/Interpreter/Args.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
> lldb/trunk/include/lldb/Interpreter/Options.h
> lldb/trunk/include/lldb/Target/Platform.h
> lldb/trunk/include/lldb/Target/Process.h
> lldb/trunk/source/Commands/CommandObjectArgs.cpp
> lldb/trunk/source/Commands/CommandObjectArgs.h
> lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
> lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
> lldb/trunk/source/Commands/CommandObjectBugreport.cpp
> lldb/trunk/source/Commands/CommandObjectCommands.cpp
> lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
> lldb/trunk/source/Commands/CommandObjectDisassemble.h
> lldb/trunk/source/Commands/CommandObjectExpression.cpp
> lldb/trunk/source/Commands/CommandObjectExpression.h
> lldb/trunk/source/Commands/CommandObjectFrame.cpp
> lldb/trunk/source/Commands/CommandObjectHelp.cpp
> lldb/trunk/source/Commands/CommandObjectHelp.h
> lldb/trunk/source/Commands/CommandObjectLog.cpp
> lldb/trunk/source/Commands/CommandObjectMemory.cpp
> lldb/trunk/source/Commands/CommandObjectPlatform.cpp
> lldb/trunk/source/Commands/CommandObjectPlugin.cpp
> lldb/trunk/source/Commands/CommandObjectProcess.cpp
> lldb/trunk/source/Commands/CommandObjectRegister.cpp
> lldb/trunk/source/Commands/CommandObjectSettings.cpp
> lldb/trunk/source/Commands/CommandObjectSource.cpp
> lldb/trunk/source/Commands/CommandObjectTarget.cpp
> lldb/trunk/source/Commands/CommandObjectThread.cpp
> lldb/trunk/source/Commands/CommandObjectType.cpp
> lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
> lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
> lldb/trunk/source/Expression/REPL.cpp
> lldb/trunk/source/Interpreter/Args.cpp
> lldb/trunk/source/Interpreter/CommandAlias.cpp
> lldb/trunk/source/Interpreter/CommandObject.cpp
> lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
> lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
> lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp
> lldb/trunk/source/Interpreter/OptionGroupFile.cpp
> lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
> lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
> lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
> lldb/trunk/source/Interpreter/OptionGroupString.cpp
> lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp
> lldb/trunk/sou