[Lldb-commits] [PATCH] D32522: Test case for the issue raised in D32271

2017-04-27 Thread vignesh balu via Phabricator via lldb-commits
vbalu updated this revision to Diff 96878.
vbalu added a comment.

Removed the changes from test frame work.


https://reviews.llvm.org/D32522

Files:
  
packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py


Index: 
packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
===
--- 
packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
+++ 
packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
@@ -8,6 +8,7 @@
 import os
 import time
 import lldb
+import shutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
@@ -38,6 +39,24 @@
 process = target.GetProcess()
 self.assertTrue(process, PROCESS_IS_VALID)
 
+   def test_attach_to_process_frm_different_dir_by_id(self):
+   """Test attach by process id"""
+os.mkdir(os.path.join(os.getcwd(),'newdir'))
+self.buildProgram('main.cpp','newdir/proc_attach')
+exe = os.path.join(os.getcwd(), 'newdir/proc_attach')
+self.addTearDownHook(lambda: shutil.rmtree(os.path.dirname(exe)))
+
+# Spawn a new process
+popen = self.spawnSubprocess(exe)
+self.addTearDownHook(self.cleanupSubprocesses)
+
+self.runCmd("process attach -p " + str(popen.pid))
+
+target = self.dbg.GetSelectedTarget()
+
+process = target.GetProcess()
+self.assertTrue(process, PROCESS_IS_VALID)
+
 def test_attach_to_process_by_name(self):
 """Test attach by process name"""
 self.build()


Index: packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
===
--- packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
+++ packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
@@ -8,6 +8,7 @@
 import os
 import time
 import lldb
+import shutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
@@ -38,6 +39,24 @@
 process = target.GetProcess()
 self.assertTrue(process, PROCESS_IS_VALID)
 
+	def test_attach_to_process_frm_different_dir_by_id(self):
+		"""Test attach by process id"""
+os.mkdir(os.path.join(os.getcwd(),'newdir'))
+self.buildProgram('main.cpp','newdir/proc_attach')
+exe = os.path.join(os.getcwd(), 'newdir/proc_attach')
+self.addTearDownHook(lambda: shutil.rmtree(os.path.dirname(exe)))
+
+# Spawn a new process
+popen = self.spawnSubprocess(exe)
+self.addTearDownHook(self.cleanupSubprocesses)
+
+self.runCmd("process attach -p " + str(popen.pid))
+
+target = self.dbg.GetSelectedTarget()
+
+process = target.GetProcess()
+self.assertTrue(process, PROCESS_IS_VALID)
+
 def test_attach_to_process_by_name(self):
 """Test attach by process name"""
 self.build()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32568: Protect Proces::GetMemoryRegionInfo and ::GetFileLoadAddress with a lock

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

This is not necessary. NativeProcess classes are only used in lldb-server, 
which is completely single threaded. If you want to change that, then we should 
start with a discussion of what you intend to achieve.


Repository:
  rL LLVM

https://reviews.llvm.org/D32568



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


[Lldb-commits] [PATCH] D32306: Remove lock from ConstString::GetLength

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.



Comment at: source/Utility/ConstString.cpp:49
+  // pointer, we don't need the lock.
   const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr);
   return entry.getKey().size();

labath wrote:
> scott.smith wrote:
> > zturner wrote:
> > > Why do we even have this function which digs into the `StringMap` 
> > > internals rather than just calling existing `StringMap` member functions? 
> > >  Can Can we just delete `GetStringMapEntryFromKeyData` entirely and use 
> > > `StringMap::find`?
> > Probably performance.  If we have to call Find, then we have to call hash, 
> > fault in the appropriate bucket, and then finally return the entry that we 
> > already have in hand.  Plus we'd need the lock.
> > 
> > Can we just delete GetStringMapEntryFromKeyData entirely and use 
> > StringMap::find?
> Unfortunately, I don't think that's possible. `StringMap::find` expects a 
> StringRef. In order to construct that, we need to know the length of the 
> string, and we're back where we started :(
> 
> In reality, this is doing a very different operation than find (which takes a 
> random string and checks whether it's in the map) -- this takes a string 
> which we know to be in the map and get its size.
> 
> It will take some rearchitecting of the ConstString class to get rid of this 
> hack. Probably it could be fixed by ConstString storing a StringMap::iterator 
> instead of the raw pointer. In any case, that seems out of scope of this 
> change.
Cool, I didn't notice that one when looking for it. I guess at this point we 
can just delete our copy of `GetStringMapEntryFromKeyData` completely and call 
the StringPool's version instead.


Repository:
  rL LLVM

https://reviews.llvm.org/D32306



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


[Lldb-commits] [lldb] r301524 - Fix build for clang r301507

2017-04-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Apr 27 03:49:19 2017
New Revision: 301524

URL: http://llvm.org/viewvc/llvm-project?rev=301524&view=rev
Log:
Fix build for clang r301507

LangStandard::lang_opencl -> LangStandard::lang_opencl10

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

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=301524&r1=301523&r2=301524&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Apr 27 03:49:19 2017
@@ -394,7 +394,7 @@ static void ParseLangArgs(LangOptions &O
 case InputKind::RenderScript:
   llvm_unreachable("Invalid input kind!");
 case InputKind::OpenCL:
-  LangStd = LangStandard::lang_opencl;
+  LangStd = LangStandard::lang_opencl10;
   break;
 case InputKind::CUDA:
   LangStd = LangStandard::lang_cuda;
@@ -425,7 +425,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.WChar = true;
 
   // OpenCL has some additional defaults.
-  if (LangStd == LangStandard::lang_opencl) {
+  if (LangStd == LangStandard::lang_opencl10) {
 Opts.OpenCL = 1;
 Opts.AltiVec = 1;
 Opts.CXXOperatorNames = 1;


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


[Lldb-commits] [PATCH] D32584: Fixing the build break introduced by the change in LangStandard in clang

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath closed this revision.
labath added a comment.

I already submitted a fix of my own before seeing this. Thanks for the patch 
though. :)


https://reviews.llvm.org/D32584



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


[Lldb-commits] [PATCH] D32522: Test case for the issue raised in D32271

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Cool. Thank you.


https://reviews.llvm.org/D32522



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


[Lldb-commits] [lldb] r301530 - [LLDB][MIPS] Fix TestMiExec.py failure.

2017-04-27 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Thu Apr 27 05:21:46 2017
New Revision: 301530

URL: http://llvm.org/viewvc/llvm-project?rev=301530&view=rev
Log:
[LLDB][MIPS] Fix TestMiExec.py failure.

Reviewers: ki.stfu, labath

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py?rev=301530&r1=301529&r2=301530&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
Thu Apr 27 05:21:46 2017
@@ -319,8 +319,14 @@ class MiExecTestCase(lldbmi_testcase.MiT
 # -exec-step can keep us in the g_MyFunction for gcc
 self.runCmd("-exec-finish --frame 0")
 self.expect("\^running")
-self.expect(
-
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+it = 
self.expect(["\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"",
+ 
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\""])
+
+if it == 1:
+# Call to s_MyFunction may not follow immediately after 
g_MyFunction.
+# There might be some instructions in between to restore 
caller-saved registers.
+# We need to get past these instructions with a step to reach call 
to s_MyFunction.
+self.runCmd("-exec-step --thread 1")
 
 # Test that -exec-step steps into s_MyFunction
 # (and that --frame is optional)


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


[Lldb-commits] [PATCH] D32340: [LLDB][MIPS] Fix TestMiExec.py failure

2017-04-27 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL301530: [LLDB][MIPS] Fix TestMiExec.py failure. (authored by 
nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D32340?vs=96368&id=96890#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32340

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
@@ -319,8 +319,14 @@
 # -exec-step can keep us in the g_MyFunction for gcc
 self.runCmd("-exec-finish --frame 0")
 self.expect("\^running")
-self.expect(
-
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+it = 
self.expect(["\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"",
+ 
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\""])
+
+if it == 1:
+# Call to s_MyFunction may not follow immediately after 
g_MyFunction.
+# There might be some instructions in between to restore 
caller-saved registers.
+# We need to get past these instructions with a step to reach call 
to s_MyFunction.
+self.runCmd("-exec-step --thread 1")
 
 # Test that -exec-step steps into s_MyFunction
 # (and that --frame is optional)


Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
@@ -319,8 +319,14 @@
 # -exec-step can keep us in the g_MyFunction for gcc
 self.runCmd("-exec-finish --frame 0")
 self.expect("\^running")
-self.expect(
-"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+it = self.expect(["\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"",
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\""])
+
+if it == 1:
+# Call to s_MyFunction may not follow immediately after g_MyFunction.
+# There might be some instructions in between to restore caller-saved registers.
+# We need to get past these instructions with a step to reach call to s_MyFunction.
+self.runCmd("-exec-step --thread 1")
 
 # Test that -exec-step steps into s_MyFunction
 # (and that --frame is optional)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32168: [LLDB][MIPS] Fix TestStepOverBreakpoint.py failure

2017-04-27 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain updated this revision to Diff 96891.
nitesh.jain added a comment.

Update Diff as per suggestion


https://reviews.llvm.org/D32168

Files:
  include/lldb/API/SBAddress.h
  include/lldb/API/SBInstruction.h
  include/lldb/API/SBInstructionList.h
  include/lldb/Core/Disassembler.h
  
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
  scripts/interface/SBInstruction.i
  scripts/interface/SBInstructionList.i
  source/API/SBAddress.cpp
  source/API/SBInstruction.cpp
  source/API/SBInstructionList.cpp
  source/Core/Disassembler.cpp

Index: source/Core/Disassembler.cpp
===
--- source/Core/Disassembler.cpp
+++ source/Core/Disassembler.cpp
@@ -759,6 +759,10 @@
   return false;
 }
 
+bool Instruction::CanSetBreakpoint () {
+  return !HasDelaySlot();
+}
+
 bool Instruction::HasDelaySlot() {
   // Default is false.
   return false;
Index: source/API/SBInstructionList.cpp
===
--- source/API/SBInstructionList.cpp
+++ source/API/SBInstructionList.cpp
@@ -9,6 +9,7 @@
 
 #include "lldb/API/SBInstructionList.h"
 #include "lldb/API/SBInstruction.h"
+#include "lldb/API/SBAddress.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/Module.h"
@@ -49,6 +50,31 @@
   return inst;
 }
 
+size_t SBInstructionList::GetInstructionsCount(const SBAddress &start,
+  const SBAddress &end, 
+  bool canSetBreakpoint) {
+  size_t num_instructions = GetSize();
+  size_t i = 0;
+  SBAddress addr;
+  size_t lower_index = 0;
+  size_t upper_index = 0;
+  size_t instructions_to_skip = 0;
+  for (i = 0; i < num_instructions; ++i) {
+addr = GetInstructionAtIndex(i).GetAddress();
+if (start == addr)
+  lower_index = i;
+if (end == addr)
+  upper_index = i;
+  }
+  if (canSetBreakpoint)
+for (i = lower_index; i <= upper_index; ++i) {
+  SBInstruction insn = GetInstructionAtIndex(i);
+  if (!insn.CanSetBreakpoint())
+++instructions_to_skip;
+}
+  return upper_index - lower_index - instructions_to_skip;
+}
+
 void SBInstructionList::Clear() { m_opaque_sp.reset(); }
 
 void SBInstructionList::AppendInstruction(SBInstruction insn) {}
Index: source/API/SBInstruction.cpp
===
--- source/API/SBInstruction.cpp
+++ source/API/SBInstruction.cpp
@@ -176,6 +176,13 @@
   return false;
 }
 
+bool SBInstruction::CanSetBreakpoint () {
+  lldb::InstructionSP inst_sp(GetOpaque());
+  if (inst_sp)
+return inst_sp->CanSetBreakpoint();
+  return false;
+}
+
 lldb::InstructionSP SBInstruction::GetOpaque() {
   if (m_opaque_sp)
 return m_opaque_sp->GetSP();
Index: source/API/SBAddress.cpp
===
--- source/API/SBAddress.cpp
+++ source/API/SBAddress.cpp
@@ -55,6 +55,12 @@
   return *this;
 }
 
+bool lldb::operator==(const SBAddress &lhs, const SBAddress &rhs) {
+  if (lhs.IsValid() && rhs.IsValid())
+return lhs.ref() == rhs.ref();
+  return false;
+}
+
 bool SBAddress::IsValid() const {
   return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
 }
Index: scripts/interface/SBInstructionList.i
===
--- scripts/interface/SBInstructionList.i
+++ scripts/interface/SBInstructionList.i
@@ -44,6 +44,9 @@
 lldb::SBInstruction
 GetInstructionAtIndex (uint32_t idx);
 
+size_t GetInstructionsCount(const SBAddress &start, const SBAddress &end,
+bool canSetBreakpoint);
+
 void
 Clear ();
 
Index: scripts/interface/SBInstruction.i
===
--- scripts/interface/SBInstruction.i
+++ scripts/interface/SBInstruction.i
@@ -54,6 +54,9 @@
 bool
 HasDelaySlot ();
 
+bool
+CanSetBreakpoint ();
+
 void
 Print (FILE *out);
 
Index: packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
===
--- packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
+++ packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
@@ -62,19 +62,11 @@
 instructions = function.GetInstructions(self.target)
 addr_1 = self.breakpoint1.GetLocationAtIndex(0).GetAddress()
 addr_4 = self.breakpoint4.GetLocationAtIndex(0).GetAddress()
-delay_slot = 0
-addr_1_load_address = addr_1.GetLoadAddress(self.target)
-addr_4_load_address = addr_4.GetLoadAddress(self.target)
-for i in range(instructions.GetSize()) :
-addr = instructions.GetInstructionAtIndex(i).GetAddress()
-   

[Lldb-commits] [PATCH] D32340: [LLDB][MIPS] Fix TestMiExec.py failure

2017-04-27 Thread Ilia K via Phabricator via lldb-commits
ki.stfu added inline comments.



Comment at: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py:329
+# We need to get past these instructions with a step to reach call 
to s_MyFunction.
+self.runCmd("-exec-step --thread 1")
 

I mistyped there should be -exec-next,, and why you are not checking that it 
has stopped at the right line (as I suggested)?


Repository:
  rL LLVM

https://reviews.llvm.org/D32340



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


[Lldb-commits] [lldb] r301534 - TCPSocket: add back support for "*" address

2017-04-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Apr 27 06:32:25 2017
New Revision: 301534

URL: http://llvm.org/viewvc/llvm-project?rev=301534&view=rev
Log:
TCPSocket: add back support for "*" address

before r301492, we could specify "*:1234" as an address to lldb-server
and it would interpret that as "any". I am not sure that's a good idea,
but we have usages of that in the test suite, and without this the
remote test suite fails.

I'm adding that back, as it does not seem it was an intended side-effect
of that change, but I am open to removing it in the future, after
discussion and test suite fixup.

Modified:
lldb/trunk/source/Host/common/TCPSocket.cpp

Modified: lldb/trunk/source/Host/common/TCPSocket.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TCPSocket.cpp?rev=301534&r1=301533&r2=301534&view=diff
==
--- lldb/trunk/source/Host/common/TCPSocket.cpp (original)
+++ lldb/trunk/source/Host/common/TCPSocket.cpp Thu Apr 27 06:32:25 2017
@@ -178,6 +178,8 @@ Error TCPSocket::Listen(llvm::StringRef
   if (!DecodeHostAndPort(name, host_str, port_str, port, &error))
 return error;
 
+  if (host_str == "*")
+host_str = "0.0.0.0";
   auto addresses = lldb_private::SocketAddress::GetAddressInfo(
   host_str.c_str(), NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
   for (auto address : addresses) {


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


[Lldb-commits] [PATCH] D32340: [LLDB][MIPS] Fix TestMiExec.py failure

2017-04-27 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain added inline comments.



Comment at: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py:329
+# We need to get past these instructions with a step to reach call 
to s_MyFunction.
+self.runCmd("-exec-step --thread 1")
 

ki.stfu wrote:
> I mistyped there should be -exec-next,, and why you are not checking that it 
> has stopped at the right line (as I suggested)?
ohh. i just forgot to do that . I will update it


Repository:
  rL LLVM

https://reviews.llvm.org/D32340



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


[Lldb-commits] [lldb] r301537 - [LLDB][MIPS] Forgot to add check in commit rl301530

2017-04-27 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Thu Apr 27 07:27:42 2017
New Revision: 301537

URL: http://llvm.org/viewvc/llvm-project?rev=301537&view=rev
Log:
[LLDB][MIPS] Forgot to add check in commit rl301530
Reviewers: ki.stfu, labath
Subscribers: jaydeep, bhushan, lldb-commits, slthakur

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py?rev=301537&r1=301536&r2=301537&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py 
Thu Apr 27 07:27:42 2017
@@ -325,8 +325,10 @@ class MiExecTestCase(lldbmi_testcase.MiT
 if it == 1:
 # Call to s_MyFunction may not follow immediately after 
g_MyFunction.
 # There might be some instructions in between to restore 
caller-saved registers.
-# We need to get past these instructions with a step to reach call 
to s_MyFunction.
-self.runCmd("-exec-step --thread 1")
+# We need to get past these instructions with a next to reach call 
to s_MyFunction.
+self.runCmd("-exec-next --thread 1")
+self.expect("\^running")
+
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
 
 # Test that -exec-step steps into s_MyFunction
 # (and that --frame is optional)


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


[Lldb-commits] [PATCH] D32340: [LLDB][MIPS] Fix TestMiExec.py failure

2017-04-27 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain added a comment.

Hi Ki,

The changes has been committed (https://reviews.llvm.org/rL301537).

Thanks


Repository:
  rL LLVM

https://reviews.llvm.org/D32340



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


[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Joerg Sonnenberger via Phabricator via lldb-commits
joerg added inline comments.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:55
 const char *const LLDB_NT_OWNER_NETBSD = "NetBSD";
+const char *const LLDB_NT_OWNER_NETBSDCORE = "NetBSD-CORE";
 const char *const LLDB_NT_OWNER_OPENBSD = "OpenBSD";

Not your fault, but is there a reason why this are all pointers to strings and 
not just const char[] ?



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:302
+  // default 32 or 64 bit arch (without any architecture revision) based on
+  // object file's class.
   if (header.e_type == ET_CORE) {

Unrelated cosmetic change.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:412
+data_sp = DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length,
+  file_offset);
 if (!data_sp)

Unrelated cosmetic change.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:775
+data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(),
+  -1, file_offset);
 if (data_sp) {

Dito.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1488
   llvm::StringRef path(cstr);
-  if (path.contains("/lib/x86_64-linux-gnu") || 
path.contains("/lib/i386-linux-gnu")) {
+  if (path.contains("/lib/x86_64-linux-gnu") ||
+  path.contains("/lib/i386-linux-gnu")) {

Unrelated.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:3042
+  [this, symbol_table, section_list,
+   &new_symbols](lldb::addr_t file_addr, uint32_t size, dw_offset_t) {
+Symbol *symbol = symbol_table->FindSymbolAtFileAddress(file_addr);

Unrelated.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:3066
+section_sp, // Section in which this symbol is defined or null.
+offset, // Offset in section or symbol value.
+0, // Size:  Don't specify the size as an FDE can

Unrelated.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:378
+  // Don't proceed if core file doesn't contain the actual data for this 
address
+  // range.
   if (file_start == file_end)

Unrelated.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:463
 
-enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35 };
+enum { NT_PROCINFO = 1, NT_PROCINFO_SIZE = 160, NT_AUXV = 2 };
+

Either sort them by value or by name, but not randomly



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:523
+
+  offset += 108;
+  cpi_nlwps = data.GetU32(&offset); /* number of LWPs */

Can you define a constant for the offset here below instead of a magic number?



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:685
   thread_data->fpregset = note_data;
-else if(arch.IsMIPS())
+else if (arch.IsMIPS())
   thread_data->fpregset = note_data;

Unrelated.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:844
+  if (m_thread_data.size() != nlwps)
+return Error("rror parsing NetBSD core(5) notes: Mismatch between the "
+ "number of LWPs in netbsd_elfcore_procinfo and the number of "

Typo



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:854
+  /* Signal destinated for a particular LWP */
+  else {
+bool passed = false;

Move the else to the } and the comment after the {


Repository:
  rL LLVM

https://reviews.llvm.org/D32149



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


[Lldb-commits] [PATCH] D32584: Fixing the build break introduced by the change in LangStandard in clang

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

looks fine


https://reviews.llvm.org/D32584



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


[Lldb-commits] [PATCH] D32585: Implementation of remote packets for Trace data.

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

This patch does nicely follow the way other GDB remote packets are implemented. 
I wonder if we should just have a "jTrace" packet that is JSON from the start? 
This is more of a question to anyone that cares about the direction of the GDB 
remote protocol we are using. We might not multiple flavors of the qTrace 
packet in that case. Just add a key/value pair that say what the packet command 
is (start, stop, get trace data, get metadata, etc). I am curious to see what 
others think. I don't have any objections to this patch as is, but just wanted 
to check.




Comment at: docs/lldb-gdb-remote.txt:212
 //--
+// QTrace:1:type:;
+//

Should we make all these new packets JSON based to start with? "jTrace"? If we 
have any need for JSON at all in this or the other new packets I would say lets 
just go with JSON packets. They are currently prefixed with "j". If we go this 
route we should specify the mandatory key/value pairs in the header doc. We 
should also allow a JSON dictionary from the trace config up at the SBTrace 
layer to make it into this packet? 


https://reviews.llvm.org/D32585



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


[Lldb-commits] [PATCH] D32168: [LLDB][MIPS] Fix TestStepOverBreakpoint.py failure

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: include/lldb/API/SBInstructionList.h:36-38
+  // Its return the number of instructions between start and end address
+  // if canSetBreakpoint is true then count will correspond to 
+  // number of instructions on which breakpoint can be set.

comment boundaries? Either extend the '-' or format within


https://reviews.llvm.org/D32168



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


[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:302
+  // default 32 or 64 bit arch (without any architecture revision) based on
+  // object file's class.
   if (header.e_type == ET_CORE) {

joerg wrote:
> Unrelated cosmetic change.
I let clang-format to go and alter minor things. I can run clang-format over 
original files - commit, and add my diff again.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:463
 
-enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35 };
+enum { NT_PROCINFO = 1, NT_PROCINFO_SIZE = 160, NT_AUXV = 2 };
+

joerg wrote:
> Either sort them by value or by name, but not randomly
I will split this enum{} into two enums.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:523
+
+  offset += 108;
+  cpi_nlwps = data.GetU32(&offset); /* number of LWPs */

joerg wrote:
> Can you define a constant for the offset here below instead of a magic number?
I will try to get something to define aliases for these magic numbers.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:844
+  if (m_thread_data.size() != nlwps)
+return Error("rror parsing NetBSD core(5) notes: Mismatch between the "
+ "number of LWPs in netbsd_elfcore_procinfo and the number of "

joerg wrote:
> Typo
OK



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:854
+  /* Signal destinated for a particular LWP */
+  else {
+bool passed = false;

joerg wrote:
> Move the else to the } and the comment after the {
OK


Repository:
  rL LLVM

https://reviews.llvm.org/D32149



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


Re: [Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Zachary Turner via lldb-commits
There is a file in the repo called git-clang-format.  Make sure that file
is on your PATH somewhere, then just run `git clang-format`.  It will only
touch lines that are part of your diff, and leave surrounding lines alone.
When making a diff, we only want to clang-format the lines we touched, not
the entire files.

On Thu, Apr 27, 2017 at 8:56 AM Kamil Rytarowski via Phabricator <
revi...@reviews.llvm.org> wrote:

> krytarowski added inline comments.
>
>
> 
> Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:302
> +  // default 32 or 64 bit arch (without any architecture revision) based
> on
> +  // object file's class.
>if (header.e_type == ET_CORE) {
> 
> joerg wrote:
> > Unrelated cosmetic change.
> I let clang-format to go and alter minor things. I can run clang-format
> over original files - commit, and add my diff again.
>
>
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:463
>
> -enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35
> };
> +enum { NT_PROCINFO = 1, NT_PROCINFO_SIZE = 160, NT_AUXV = 2 };
> +
> 
> joerg wrote:
> > Either sort them by value or by name, but not randomly
> I will split this enum{} into two enums.
>
>
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:523
> +
> +  offset += 108;
> +  cpi_nlwps = data.GetU32(&offset); /* number of LWPs */
> 
> joerg wrote:
> > Can you define a constant for the offset here below instead of a magic
> number?
> I will try to get something to define aliases for these magic numbers.
>
>
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:844
> +  if (m_thread_data.size() != nlwps)
> +return Error("rror parsing NetBSD core(5) notes: Mismatch between the
> "
> + "number of LWPs in netbsd_elfcore_procinfo and the
> number of "
> 
> joerg wrote:
> > Typo
> OK
>
>
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:854
> +  /* Signal destinated for a particular LWP */
> +  else {
> +bool passed = false;
> 
> joerg wrote:
> > Move the else to the } and the comment after the {
> OK
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D32149
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Zachary Turner via lldb-commits
In case it's not obvious, note the space in the command I said to run.
 `git-clang-format` has a dash, and when you run `git clang-format` (with a
space), it will run the file with the dash.

On Thu, Apr 27, 2017 at 8:58 AM Zachary Turner  wrote:

> There is a file in the repo called git-clang-format.  Make sure that file
> is on your PATH somewhere, then just run `git clang-format`.  It will only
> touch lines that are part of your diff, and leave surrounding lines alone.
> When making a diff, we only want to clang-format the lines we touched, not
> the entire files.
>
> On Thu, Apr 27, 2017 at 8:56 AM Kamil Rytarowski via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> krytarowski added inline comments.
>>
>>
>> 
>> Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:302
>> +  // default 32 or 64 bit arch (without any architecture revision) based
>> on
>> +  // object file's class.
>>if (header.e_type == ET_CORE) {
>> 
>> joerg wrote:
>> > Unrelated cosmetic change.
>> I let clang-format to go and alter minor things. I can run clang-format
>> over original files - commit, and add my diff again.
>>
>>
>> 
>> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:463
>>
>> -enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS =
>> 35 };
>> +enum { NT_PROCINFO = 1, NT_PROCINFO_SIZE = 160, NT_AUXV = 2 };
>> +
>> 
>> joerg wrote:
>> > Either sort them by value or by name, but not randomly
>> I will split this enum{} into two enums.
>>
>>
>> 
>> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:523
>> +
>> +  offset += 108;
>> +  cpi_nlwps = data.GetU32(&offset); /* number of LWPs */
>> 
>> joerg wrote:
>> > Can you define a constant for the offset here below instead of a magic
>> number?
>> I will try to get something to define aliases for these magic numbers.
>>
>>
>> 
>> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:844
>> +  if (m_thread_data.size() != nlwps)
>> +return Error("rror parsing NetBSD core(5) notes: Mismatch between
>> the "
>> + "number of LWPs in netbsd_elfcore_procinfo and the
>> number of "
>> 
>> joerg wrote:
>> > Typo
>> OK
>>
>>
>> 
>> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:854
>> +  /* Signal destinated for a particular LWP */
>> +  else {
>> +bool passed = false;
>> 
>> joerg wrote:
>> > Move the else to the } and the comment after the {
>> OK
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D32149
>>
>>
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Kamil Rytarowski via lldb-commits
Thanks, I will give it a try!

On 27.04.2017 17:59, Zachary Turner wrote:
> In case it's not obvious, note the space in the command I said to run.
>  `git-clang-format` has a dash, and when you run `git clang-format`
> (with a space), it will run the file with the dash.
> 
> On Thu, Apr 27, 2017 at 8:58 AM Zachary Turner  > wrote:
> 
> There is a file in the repo called git-clang-format.  Make sure that
> file is on your PATH somewhere, then just run `git clang-format`. 
> It will only touch lines that are part of your diff, and leave
> surrounding lines alone.  When making a diff, we only want to
> clang-format the lines we touched, not the entire files.
> 
> On Thu, Apr 27, 2017 at 8:56 AM Kamil Rytarowski via Phabricator
> mailto:revi...@reviews.llvm.org>> wrote:
> 
> krytarowski added inline comments.
> 
> 
> 
> Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:302
> +  // default 32 or 64 bit arch (without any architecture
> revision) based on
> +  // object file's class.
>if (header.e_type == ET_CORE) {
> 
> joerg wrote:
> > Unrelated cosmetic change.
> I let clang-format to go and alter minor things. I can run
> clang-format over original files - commit, and add my diff again.
> 
> 
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:463
> 
> -enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33,
> NT_AMD64_FPREGS = 35 };
> +enum { NT_PROCINFO = 1, NT_PROCINFO_SIZE = 160, NT_AUXV = 2 };
> +
> 
> joerg wrote:
> > Either sort them by value or by name, but not randomly
> I will split this enum{} into two enums.
> 
> 
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:523
> +
> +  offset += 108;
> +  cpi_nlwps = data.GetU32(&offset); /* number of LWPs */
> 
> joerg wrote:
> > Can you define a constant for the offset here below instead of
> a magic number?
> I will try to get something to define aliases for these magic
> numbers.
> 
> 
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:844
> +  if (m_thread_data.size() != nlwps)
> +return Error("rror parsing NetBSD core(5) notes: Mismatch
> between the "
> + "number of LWPs in netbsd_elfcore_procinfo and
> the number of "
> 
> joerg wrote:
> > Typo
> OK
> 
> 
> 
> Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:854
> +  /* Signal destinated for a particular LWP */
> +  else {
> +bool passed = false;
> 
> joerg wrote:
> > Move the else to the } and the comment after the {
> OK
> 
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D32149
> 
> 
> 




signature.asc
Description: OpenPGP digital signature
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r301553 - [CMake] Abstract Config.h generation for Xcode

2017-04-27 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Apr 27 11:04:26 2017
New Revision: 301553

URL: http://llvm.org/viewvc/llvm-project?rev=301553&view=rev
Log:
[CMake] Abstract Config.h generation for Xcode

This patch abstracts the generation of Config.h and creates a dummy project 
entry point to allow generation of LLDB's Config header without performing a 
full CMake configuration.

This will enable the Xcode project to generate LLDB's Config header.

Added:
lldb/trunk/cmake/XcodeHeaderGenerator/
lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=301553&r1=301552&r2=301553&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Apr 27 11:04:26 2017
@@ -1,8 +1,15 @@
 cmake_minimum_required(VERSION 3.4.3)
 
-include(cmake/modules/LLDBStandalone.cmake)
-include(cmake/modules/LLDBConfig.cmake)
-include(cmake/modules/AddLLDB.cmake)
+# Add path for custom modules
+set(CMAKE_MODULE_PATH
+  ${CMAKE_MODULE_PATH}
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+  )
+
+include(LLDBStandalone)
+include(LLDBConfig)
+include(AddLLDB)
 
 if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
   set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)

Added: lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt?rev=301553&view=auto
==
--- lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt (added)
+++ lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt Thu Apr 27 11:04:26 
2017
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.4.3)
+
+project(XcodeConfig C CXX)
+
+set(CMAKE_MODULE_PATH
+  ${CMAKE_MODULE_PATH}
+  "${CMAKE_CURRENT_SOURCE_DIR}/.."
+  "${CMAKE_CURRENT_SOURCE_DIR}/../modules"
+  )
+
+set(LLDB_CONFIG_HEADER_INPUT
+${CMAKE_CURRENT_SOURCE_DIR}/../../include/lldb/Host/Config.h.cmake)
+
+include(LLDBGenerateConfig)

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=301553&r1=301552&r2=301553&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Apr 27 11:04:26 2017
@@ -1,7 +1,4 @@
 include(CheckCXXSymbolExists)
-include(CheckSymbolExists)
-include(CheckIncludeFile)
-include(CheckIncludeFiles)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
@@ -429,24 +426,4 @@ if ((CMAKE_SYSTEM_NAME MATCHES "Android"
 endif()
 
 find_package(Backtrace)
-set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
-check_symbol_exists(ppoll poll.h HAVE_PPOLL)
-set(CMAKE_REQUIRED_DEFINITIONS)
-check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
-
-include(CheckIncludeFile)
-check_include_file(termios.h HAVE_TERMIOS_H)
-check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
-
-# These checks exist in LLVM's configuration, so I want to match the LLVM names
-# so that the check isn't duplicated, but we translate them into the LLDB names
-# so that I don't have to change all the uses at the moment.
-set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H})
-if(NOT UNIX)
-  set(LLDB_DISABLE_POSIX 1)
-endif()
-
-# This should be done at the end
-configure_file(
-  ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake
-  ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
+include(LLDBGenerateConfig)

Added: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake?rev=301553&view=auto
==
--- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake (added)
+++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake Thu Apr 27 11:04:26 2017
@@ -0,0 +1,35 @@
+# This file contains all the logic for running configure-time checks
+
+include(CheckSymbolExists)
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+
+set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+check_symbol_exists(ppoll poll.h HAVE_PPOLL)
+set(CMAKE_REQUIRED_DEFINITIONS)
+check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
+
+check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
+
+# These checks exist in LLVM's configuration, so I want to match the LLVM names
+# so that the check isn't duplicated, but we translate them into the LLDB names
+# so that I don't have to change all the uses at the moment.
+set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H})
+if(NOT UNIX)
+

[Lldb-commits] [lldb] r301559 - Update GDB remote command regex for IPv6

2017-04-27 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Apr 27 11:13:58 2017
New Revision: 301559

URL: http://llvm.org/viewvc/llvm-project?rev=301559&view=rev
Log:
Update GDB remote command regex for IPv6

This updates the regular expression used to match host/port pairs for the 
gdb-remote command to also match IPv6 addresses.

The IPv6 address matcher is very generic and does not really check for 
structural validity of the address. It turns out that IPv6 addresses are very 
complicated.

Modified:
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=301559&r1=301558&r2=301559&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Apr 27 11:13:58 
2017
@@ -645,8 +645,8 @@ void CommandInterpreter::LoadCommandDict
   "gdb-remote [:]", 2, 0, false));
   if (connect_gdb_remote_cmd_ap.get()) {
 if (connect_gdb_remote_cmd_ap->AddRegexCommand(
-"^([^:]+:[[:digit:]]+)$",
-"process connect --plugin gdb-remote connect://%1") &&
+"^([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)$",
+"process connect --plugin gdb-remote connect://%1:%2") &&
 connect_gdb_remote_cmd_ap->AddRegexCommand(
 "^([[:digit:]]+)$",
 "process connect --plugin gdb-remote connect://localhost:%1")) {


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


[Lldb-commits] [PATCH] D32306: Remove lock from ConstString::GetLength

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith marked 3 inline comments as done.
scott.smith added inline comments.



Comment at: source/Utility/ConstString.cpp:49
+  // pointer, we don't need the lock.
   const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr);
   return entry.getKey().size();

labath wrote:
> labath wrote:
> > scott.smith wrote:
> > > zturner wrote:
> > > > Why do we even have this function which digs into the `StringMap` 
> > > > internals rather than just calling existing `StringMap` member 
> > > > functions?  Can Can we just delete `GetStringMapEntryFromKeyData` 
> > > > entirely and use `StringMap::find`?
> > > Probably performance.  If we have to call Find, then we have to call 
> > > hash, fault in the appropriate bucket, and then finally return the entry 
> > > that we already have in hand.  Plus we'd need the lock.
> > > 
> > > Can we just delete GetStringMapEntryFromKeyData entirely and use 
> > > StringMap::find?
> > Unfortunately, I don't think that's possible. `StringMap::find` expects a 
> > StringRef. In order to construct that, we need to know the length of the 
> > string, and we're back where we started :(
> > 
> > In reality, this is doing a very different operation than find (which takes 
> > a random string and checks whether it's in the map) -- this takes a string 
> > which we know to be in the map and get its size.
> > 
> > It will take some rearchitecting of the ConstString class to get rid of 
> > this hack. Probably it could be fixed by ConstString storing a 
> > StringMap::iterator instead of the raw pointer. In any case, that seems out 
> > of scope of this change.
> Cool, I didn't notice that one when looking for it. I guess at this point we 
> can just delete our copy of `GetStringMapEntryFromKeyData` completely and 
> call the StringPool's version instead.
It will push a lot of lines past the 80 char limit.  Do you want me to make 
that change?  If not, can you submit this one since I do not have commit 
access?  Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D32306



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


[Lldb-commits] [PATCH] D32568: Protect Proces::GetMemoryRegionInfo and ::GetFileLoadAddress with a lock

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

In https://reviews.llvm.org/D32568#739190, @labath wrote:

> This is not necessary. NativeProcess classes are only used in lldb-server, 
> which is completely single threaded. If you want to change that, then we 
> should start with a discussion of what you intend to achieve.


Let me post the other two changes to start a broader discussion.  We can center 
the conversation around whether/how to prime the caches; the other two changes 
naturally follow from that.


Repository:
  rL LLVM

https://reviews.llvm.org/D32568



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


[Lldb-commits] [PATCH] D32597: Initiate loading of shared libraries in parallel

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith created this revision.

This change forks a thread for each shared library, so that as much work as 
possible can be done in parallel.


Repository:
  rL LLVM

https://reviews.llvm.org/D32597

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
@@ -66,6 +66,10 @@
   uint32_t GetPluginVersion() override;
 
 protected:
+  /// Mutex to protect various global variables during parallel shared library
+  /// loading.
+  std::recursive_mutex m_mutex;
+
   /// Runtime linker rendezvous structure.
   DYLDRendezvous m_rendezvous;
 
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -29,6 +29,8 @@
 #include "lldb/Utility/Log.h"
 
 // C++ Includes
+#include 
+
 // C Includes
 
 using namespace lldb;
@@ -195,6 +197,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::DidLaunch() {
+  std::lock_guard guard(m_mutex);
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   if (log)
 log->Printf("DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
@@ -228,17 +231,20 @@
   addr_t link_map_addr,
   addr_t base_addr,
   bool base_addr_is_offset) {
+  std::lock_guard guard(m_mutex);
   m_loaded_modules[module] = link_map_addr;
   UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset);
 }
 
 void DynamicLoaderPOSIXDYLD::UnloadSections(const ModuleSP module) {
+  std::lock_guard guard(m_mutex);
   m_loaded_modules.erase(module);
 
   UnloadSectionsCommon(module);
 }
 
 void DynamicLoaderPOSIXDYLD::ProbeEntry() {
+  std::lock_guard guard(m_mutex);
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
 
   const addr_t entry = GetEntryPoint();
@@ -329,6 +335,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() {
+  std::lock_guard guard(m_mutex);
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
 
   addr_t break_addr = m_rendezvous.GetBreakAddress();
@@ -372,6 +379,7 @@
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   DynamicLoaderPOSIXDYLD *const dyld_instance =
   static_cast(baton);
+  std::lock_guard guard(dyld_instance->m_mutex);
   if (log)
 log->Printf("DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
 __FUNCTION__,
@@ -393,6 +401,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::RefreshModules() {
+  std::lock_guard guard(m_mutex);
   if (!m_rendezvous.Resolve())
 return;
 
@@ -437,6 +446,7 @@
 ThreadPlanSP
 DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
  bool stop) {
+  std::lock_guard guard(m_mutex);
   ThreadPlanSP thread_plan_sp;
 
   StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
@@ -517,24 +527,40 @@
   m_process->PrefetchModuleSpecs(
   module_names, m_process->GetTarget().GetArchitecture().GetTriple());
 
+  struct loader {
+std::thread t;
+ModuleSP m;
+DYLDRendezvous::iterator I;
+  };
+  std::list loaders;
   for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) {
-ModuleSP module_sp =
-LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
-if (module_sp.get()) {
-  module_list.Append(module_sp);
+loaders.push_back(loader());
+auto * last = &loaders.back();
+last->I = I;
+last->t = std::thread([this, last]()
+{
+  last->m = LoadModuleAtAddress(
+last->I->file_spec, last->I->link_addr, last->I->base_addr, true);
+});
+  }
+  for (auto & l : loaders) {
+l.t.join();
+if (l.m.get()) {
+  module_list.Append(l.m);
 } else {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   if (log)
 log->Printf(
 "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
-__FUNCTION__, I->file_spec.GetCString(), I->base_addr);
+__FUNCTION__, l.I->file_spec.GetCString(), l.I->base_addr);
 }
   }
 
   m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 addr_t DynamicLoaderPOSIXDYLD::ComputeLoadOffset() {
+  std::lock_guard guard(m_mutex);
   addr_t virt_entry;
 
   if (m_load_offset != LLDB_INVALID_ADDRESS)
@@ -561,13 +587,15 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
+  std::lock_guard guard(m_mutex);
   AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
 
   if (I != m_

[Lldb-commits] [PATCH] D32597: Initiate loading of shared libraries in parallel

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

1. This change requires https://reviews.llvm.org/D32568 for correctness.
2. I think the use of std::thread should be replaced by a custom TaskPool, or 
else executables with thousands of shared libraries may have a problem.  A 
separate TaskPool is necessary to prevent recursive TaskPool use.


Repository:
  rL LLVM

https://reviews.llvm.org/D32597



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith created this revision.

Loading a shared library can require a large amount of work; rather than do 
that serially for each library, provide a mechanism to do some amount of 
priming before hand.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/Symtab.h
  source/Core/Module.cpp
  source/Core/ModuleList.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/Symtab.cpp

Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -425,6 +425,12 @@
   }
 }
 
+void Symtab::PrimeCaches()
+{
+  std::lock_guard guard(m_mutex);
+  InitNameIndexes();
+}
+
 void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
 bool add_demangled, bool add_mangled,
 NameToIndexMap &name_to_index_map) const {
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -21,6 +21,10 @@
 
 using namespace lldb_private;
 
+void SymbolFile::PrimeCaches() {
+  // No-op for most implementations.
+}
+
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr best_symfile_ap;
   if (obj_file != nullptr) {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -226,6 +226,8 @@
   const lldb_private::ConstString &name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
 
+  void PrimeCaches() override;
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1917,6 +1917,12 @@
   return sc_list.GetSize() - prev_size;
 }
 
+void SymbolFileDWARF::PrimeCaches() {
+  std::lock_guard guard(
+  GetObjectFile()->GetModule()->GetMutex());
+  Index();
+}
+
 void SymbolFileDWARF::Index() {
   if (m_indexed)
 return;
Index: source/Core/ModuleList.cpp
===
--- source/Core/ModuleList.cpp
+++ source/Core/ModuleList.cpp
@@ -103,6 +103,11 @@
 
 void ModuleList::AppendImpl(const ModuleSP &module_sp, bool use_notifier) {
   if (module_sp) {
+// Do this outside of the lock for parallelism, in case we're called from a
+// separate thread.
+if (use_notifier && m_notifier)
+  module_sp->PrimeCaches();
+
 std::lock_guard guard(m_modules_mutex);
 m_modules.push_back(module_sp);
 if (use_notifier && m_notifier)
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -140,7 +140,7 @@
 const bool mandatory = true;
 ModuleList::RemoveOrphanSharedModules(mandatory);
 }
-
+
 void
 DumpModuleInfo (void)
 {
@@ -150,15 +150,15 @@
 printf ("%s: %" PRIu64 " modules:\n", LLVM_PRETTY_FUNCTION, (uint64_t)count);
 for (size_t i = 0; i < count; ++i)
 {
-
+
 StreamString strm;
 Module *module = modules[i];
 const bool in_shared_module_list = ModuleList::ModuleIsInCache (module);
 module->GetDescription(&strm, eDescriptionLevelFull);
-printf ("%p: shared = %i, ref_count = %3u, module = %s\n", 
-module, 
+printf ("%p: shared = %i, ref_count = %3u, module = %s\n",
+module,
 in_shared_module_list,
-(uint32_t)module->use_count(), 
+(uint32_t)module->use_count(),
 strm.GetString().c_str());
 }
 }
@@ -1432,6 +1432,22 @@
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PrimeCaches() {
+  std::lock_guard guard(m_mutex);
+  SymbolVendor * sym_vendor = GetSymbolVendor();
+  if (!sym_vendor) {
+return;
+  }
+  // Prime the symbol file first, since it adds symbols to the symbol table.
+  if (SymbolFile *symbol_file = sym_vendor->GetSymbolFile()) {
+symbol_file->PrimeCaches();
+  }
+  // Now we can prime the symbol table.
+  if (Symtab * symtab = sym_vendor->GetSymtab()) {
+symtab->PrimeCaches();
+  }
+}
+
 void Module::SetSymbolFileFileSpec(const FileSpec &file) {
   if (!file.Exists())
 return;
Index: include/lldb/S

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

Here's the controversial patch.  It has been brought up that the intent is to 
not load symbols before they are needed, but at least in my experience this 
patch has no effect on performance when running:
lldb -b -o run /path/to/myprogram
where myprogram has main(){return 0;} and links in a whole lot of libraries.  
My platform is Ubuntu 14.04; are there other systems where symbol processing is 
actually delayed?  Maybe on those systems PrimeCaches() can be a no-op to not 
impact performance?

This patch requires https://reviews.llvm.org/D32597 in order to actually 
improve performance, but does not require it for correctness.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32168: [LLDB][MIPS] Fix TestStepOverBreakpoint.py failure

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Couple tiny tweaks to the comment, and this is good to go.




Comment at: include/lldb/API/SBInstructionList.h:36-38
+  // Its return the number of instructions between start and end address
+  // if canSetBreakpoint is true then count will correspond to 
+  // number of instructions on which breakpoint can be set.

clayborg wrote:
> comment boundaries? Either extend the '-' or format within
Also grammar.  Like:

Returns the number of instructions between the start and end address.  If 
canSetBreakpoint is true then the count will be the number of instructions on 
which a breakpoint can be set.


https://reviews.llvm.org/D32168



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


[Lldb-commits] [PATCH] D32316: Change UniqueCStringMap to use ConstString as the key

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

Can I get a re-review on this?  Thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D32316



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a reviewer: clayborg.
jingham added a comment.

Adding Greg as a Reviewer.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32600: Resurrect pselect MainLoop implementation

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added a subscriber: srhines.

It turns out that even though ppoll is available on all the android
devices we support, it does not seem to be working properly on all of
them -- MainLoop just does a busy loop with ppoll returning EINTR and
not making any progress.

This brings back the pselect implementation and makes it available on
android. I could not do any cmake checks for this as the ppoll symbol is
actually avaiable -- it just does not work.

I haven't tested (or even built) this yet on platforms other than linux,
but I wanted to share this early to get feedback on the way I abstract
the pselect/ppoll/kevent implementations.


https://reviews.llvm.org/D32600

Files:
  include/lldb/Host/MainLoop.h
  source/Host/common/MainLoop.cpp

Index: source/Host/common/MainLoop.cpp
===
--- source/Host/common/MainLoop.cpp
+++ source/Host/common/MainLoop.cpp
@@ -32,6 +32,10 @@
 #define POLL poll
 #endif
 
+#ifdef __ANDROID__
+#define FORCE_PSELECT
+#endif
+
 #if SIGNAL_POLLING_UNSUPPORTED
 #ifdef LLVM_ON_WIN32
 typedef int sigset_t;
@@ -59,6 +63,165 @@
   g_signal_flags[signo] = 1;
 }
 
+class MainLoop::RunImpl {
+public:
+  // TODO: Use llvm::Expected
+  static std::unique_ptr Create(MainLoop &loop, Error &error);
+  ~RunImpl();
+
+  Error Poll();
+
+  template  void ForEachReadFD(F &&f);
+  template  void ForEachSignal(F &&f);
+
+private:
+  MainLoop &loop;
+
+#if HAVE_SYS_EVENT_H
+  int queue_id;
+  std::vector events;
+  struct kevent event_list[4];
+  int num_events = -1;
+
+  RunImpl(MainLoop &loop, int queue_id) : loop(loop), queue_id(queue_id) {
+events.reserve(loop.m_read_fds.size() + loop.m_signals.size());
+  }
+#else
+  sigset_t sigmask;
+  std::vector signals;
+  std::vector read_fds;
+
+  RunImpl(MainLoop &loop) : loop(loop) {
+read_fds.reserve(loop.m_read_fds.size());
+signals.reserve(loop.m_signals.size());
+  }
+#endif
+};
+
+#if HAVE_SYS_EVENT_H
+MainLoop::RunImpl::~RunImpl() {
+  int r = close(queue_id);
+  assert(r == 0);
+  (void)r;
+}
+std::unique_ptr MainLoop::RunImpl::Create(MainLoop &loop, Error &error)
+{
+  error.Clear();
+  int queue_id = kqueue();
+  if(queue_id < 0) {
+error = Error(errno, eErrorTypePOSIX);
+return nullptr;
+  }
+  return std::unique_ptr(new RunImpl(loop, queue_id));
+}
+
+Error MainLoop::RunImpl::Poll() {
+  events.resize(loop.m_read_fds.size() + loop.m_signals.size());
+  unsigned i = 0;
+  for (auto &fd : loop.m_read_fds)
+EV_SET(&events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
+
+  for (const auto &sig : loop.m_signals)
+EV_SET(&events[i++], sig.first, EVFILT_SIGNAL, EV_ADD, 0, 0, 0);
+
+  num_events = kevent(queue_id, events.data(), events.size(), event_list,
+  llvm::array_lengthof(event_list), nullptr);
+
+  if (num_events < 0)
+return Error("kevent() failed with error %d\n", num_events);
+  return Error();
+}
+
+template  void MainLoop::RunImpl::ForEachReadFD(F &&f) {
+  assert(num_events >= 0);
+  for (int i = 0; i < num_events; ++i) {
+f(event_list[i].ident);
+if (loop.m_terminate_request)
+  return;
+  }
+}
+template  void MainLoop::RunImpl::ForEachSignal(F && f) {}
+#else
+MainLoop::RunImpl::~RunImpl() {}
+std::unique_ptr MainLoop::RunImpl::Create(MainLoop &loop, Error &error)
+{
+  error.Clear();
+  return std::unique_ptr(new RunImpl(loop));
+}
+
+Error MainLoop::RunImpl::Poll() {
+  // To avoid problems with callbacks changing the things we're supposed to
+  // listen to, we will store the *real* list of events separately.
+  signals.clear();
+  read_fds.clear();
+#if !SIGNAL_POLLING_UNSUPPORTED
+  if (int ret = pthread_sigmask(SIG_SETMASK, nullptr, &sigmask))
+return Error("pthread_sigmask failed with error %d\n", ret);
+
+  for (const auto &sig : loop.m_signals) {
+signals.push_back(sig.first);
+sigdelset(&sigmask, sig.first);
+  }
+#endif
+
+#ifdef FORCE_PSELECT
+  fd_set read_fd_set;
+  FD_ZERO(&read_fd_set);
+  int nfds = 0;
+#endif
+
+  for (const auto &fd : loop.m_read_fds) {
+struct pollfd pfd;
+pfd.fd = fd.first;
+pfd.events = POLLIN;
+pfd.revents = 0;
+read_fds.push_back(pfd);
+#ifdef FORCE_PSELECT
+FD_SET(fd.first, &read_fd_set);
+nfds = std::max(nfds, fd.first + 1);
+#endif
+  }
+
+#ifdef FORCE_PSELECT
+  if (pselect(nfds, &read_fd_set, nullptr, nullptr, nullptr, &sigmask) == -1 &&
+  errno != EINTR)
+return Error(errno, eErrorTypePOSIX);
+  for (auto &fd : read_fds) {
+if(FD_ISSET(fd.fd, &read_fd_set))
+  fd.revents = POLLIN;
+  }
+#else
+  if (ppoll(read_fds.data(), read_fds.size(), nullptr, &sigmask) == -1 &&
+  errno != EINTR)
+return Error(errno, eErrorTypePOSIX);
+#endif
+
+  return Error();
+}
+
+template  void MainLoop::RunImpl::ForEachReadFD(F &&f) {
+  for (const auto &fd : read_fds) {
+if ((fd.revents & POLLIN) == 0)
+  continue;
+
+f(fd.fd);
+if (loop.m_terminate_request)
+  return;

[Lldb-commits] [PATCH] D32568: Protect Proces::GetMemoryRegionInfo and ::GetFileLoadAddress with a lock

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D32568#739607, @scott.smith wrote:

> In https://reviews.llvm.org/D32568#739190, @labath wrote:
>
> > This is not necessary. NativeProcess classes are only used in lldb-server, 
> > which is completely single threaded. If you want to change that, then we 
> > should start with a discussion of what you intend to achieve.
>
>
> Let me post the other two changes to start a broader discussion.  We can 
> center the conversation around whether/how to prime the caches; the other two 
> changes naturally follow from that.


All your other changes are client-side, so still think this will not matter, 
but I'll take a look. :)

I meant to respond to the discussion today, but I got sidetracked by the ipv6 
thingy. I'll try to look at that tomorrow.


Repository:
  rL LLVM

https://reviews.llvm.org/D32568



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


[Lldb-commits] [PATCH] D32600: Resurrect pselect MainLoop implementation

2017-04-27 Thread Chris Bieneman via Phabricator via lldb-commits
beanz accepted this revision.
beanz added a comment.
This revision is now accepted and ready to land.

This looks like a nice improvement. There are some formatting inconsistencies, 
can you run clang-format?


https://reviews.llvm.org/D32600



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


[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D32149#738250, @krytarowski wrote:

> ping?


Sorry, I wasn't responding partially because I was waiting to see how the 
discussion on https://reviews.llvm.org/D32434 settles, as I think it may have 
effect on the test strategy. I'll write more tomorrow. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D32149



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


[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

2017-04-27 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D32149#739727, @labath wrote:

> In https://reviews.llvm.org/D32149#738250, @krytarowski wrote:
>
> > ping?
>
>
> Sorry, I wasn't responding partially because I was waiting to see how the 
> discussion on https://reviews.llvm.org/D32434 settles, as I think it may have 
> effect on the test strategy. I'll write more tomorrow. :)


Thanks for working on it. I will upload soon changes to address notes by Joerg.


Repository:
  rL LLVM

https://reviews.llvm.org/D32149



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Making an empty main program and saying I see no difference is not enough 
testing to enable this. I also don't see the benefit of this path. When LLDB is 
used for symbolication, it might never actually load any debug info or symbols 
from modules that are added to a target. Also if there is any DWARF that 
doesn't have the Apple accelerator tables then the DWARF manually indexes 
itself by spawning threads that will index a compile unit per thread using a 
thread pool.. So now if we load all symbols at once, using NUM_CORES threads, 
and then each DWARF file spins off NUM_CORES threads to index the DWARF we can 
probably bring the machine to the brink? If this feature does go it, we should 
add a setting that is disabled by default, but if enabled, uses this new 
functionality. That way we can get it in, ask people to opt into it and later 
possibly change the default if all goes well. That is my two cents. I still 
vote for do as little as possible and only do it when needed. But I can see the 
desire to do things as you coded them. So I think it should be an option that 
is off by default, but users can set it in their ~/.lldbinit file.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Instead of having the cache priming be determined by platform or something like 
that, it would be better to add a setting (on the target level seems right) 
that controls this.  I think you are right that in most common usage, there's 
going unrestricted query that will end up looking through all the symbols, and 
in that case, having ingested them in parallel would be a win.  So the correct 
default would be to do this eagerly.

The control is more for people who are writing special purpose tools than for 
ordinary users.  For instance, when Xcode runs its "Test" action, by default it 
uses lldb to run the test binaries.  That great because it means that if a test 
crashes, you'll be right in the debugger and can analyze the failure.  But most 
of the time the tests never actually stop in the debugger.  So reading in a 
whole raft of symbol information in that use case is pretty pointless.  They 
would be a good candidate to use this setting.

Note, this will make the lazy loading symbol path the less common one, so we'll 
have to be careful to add some tests to make sure that mode still works.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32568: Protect Proces::GetMemoryRegionInfo and ::GetFileLoadAddress with a lock

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

In https://reviews.llvm.org/D32568#739723, @labath wrote:

> All your other changes are client-side, so still think this will not matter, 
> but I'll take a look. :)


Interesting.  Maybe this only matters in the context of unit tests?  I was 
still getting crashes without this change, but now I'm not (I've since git 
pull'd and switched to another machine).  I'll keep investigating.


Repository:
  rL LLVM

https://reviews.llvm.org/D32568



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

In https://reviews.llvm.org/D32598#739779, @clayborg wrote:

> Making an empty main program and saying I see no difference is not enough 
> testing to enable this.


It's not quite an empty main program; it links in 40+ shared libraries with 2M+ 
symbols.  The point of having main() just return 0 is so I could compare the 
performance of "b main; run" vs "run" without taking program execution into 
account, but just the amount of work lldb does.

But as it turns out, I still managed to screw that up.  I'm now seeing a 
difference:

WITHOUT CHANGE:
lldb -b -o 'b main' -o 'run' xyz:
real 0m15.248s
user 0m24.632s
sys 0m3.839s
lldb -b -o 'run' xyz:
real0m11.540s
user0m9.692s
sys 0m0.892s

WITH CHANGE:
real 0m9.747s
user 0m29.507s
sys 0m10.531s

(timings are reasonably representative, but they do change a bit run to run)

> I also don't see the benefit of this path.

It improves lldb startup time significantly.  Our use cases seem centered 
around using symbols, so for us, delaying loading of symbols does not help, it 
just moves when we wait to another point.

> When LLDB is used for symbolication, it might never actually load any debug 
> info or symbols from modules that are added to a target. Also if there is any 
> DWARF that doesn't have the Apple accelerator tables then the DWARF manually 
> indexes itself by spawning threads that will index a compile unit per thread 
> using a thread pool.. So now if we load all symbols at once, using NUM_CORES 
> threads, and then each DWARF file spins off NUM_CORES threads to index the 
> DWARF we can probably bring the machine to the brink?

No, because it uses a global TaskPool, so regardless of how many users there 
are, there will only be NUM_CORES threads.  Note my comments in 
https://reviews.llvm.org/D32597 about changing TaskPool so it will be 
file-local instead of global, so TaskPool workers can spawn other TaskPool work.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

In https://reviews.llvm.org/D32598#739804, @jingham wrote:

> Instead of having the cache priming be determined by platform or something 
> like that, it would be better to add a setting (on the target level seems 
> right) that controls this.  I think you are right that in most common usage, 
> there's going to be an unrestricted query that will end up looking through 
> all the symbols, and in that case, having ingested them in parallel would be 
> a win.  So the correct default would be to do this eagerly.


Define "a setting."  A method on class Target?  A parameter when constructing 
class Target?  Or something via the command line, or lldbinit?


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


Re: [Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Zachary Turner via lldb-commits
"(lldb) settings set target.cache-priming foo"
On Thu, Apr 27, 2017 at 11:53 AM Scott Smith via Phabricator via
lldb-commits  wrote:

> scott.smith added a comment.
>
> In https://reviews.llvm.org/D32598#739804, @jingham wrote:
>
> > Instead of having the cache priming be determined by platform or
> something like that, it would be better to add a setting (on the target
> level seems right) that controls this.  I think you are right that in most
> common usage, there's going to be an unrestricted query that will end up
> looking through all the symbols, and in that case, having ingested them in
> parallel would be a win.  So the correct default would be to do this
> eagerly.
>
>
> Define "a setting."  A method on class Target?  A parameter when
> constructing class Target?  Or something via the command line, or lldbinit?
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D32598
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Ah, sorry.  I was talking about an lldb, which you access through the "setting 
set/get" command.  Those are actually implemented by adding a property on the 
class in question.  Look in Target.cpp for the TargetProperties class.  You'll 
just want to add another property there.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith updated this revision to Diff 96976.
scott.smith added a comment.

Added setting.  Verified that:
settings set target.cache-priming off
works as expected.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  source/Core/Module.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/Symtab.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1870,6 +1870,11 @@
   }
 }
 
+// Prime caches outside of any lock, so hopefully we can do this for
+// each library in parallel.
+if (GetCachePriming())
+  module_sp->PrimeCaches();
+
 if (old_module_sp &&
 m_images.GetIndexForModule(old_module_sp.get()) !=
 LLDB_INVALID_INDEX32) {
@@ -3277,6 +3282,8 @@
 {"detach-on-error", OptionValue::eTypeBoolean, false, true, nullptr,
  nullptr, "debugserver will detach (rather than killing) a process if it "
   "loses connection with lldb."},
+{"cache-priming", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
+ "Enable loading of symbol tables before they are needed."},
 {"disable-aslr", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
  "Disable Address Space Layout Randomization (ASLR)"},
 {"disable-stdio", OptionValue::eTypeBoolean, false, false, nullptr, nullptr,
@@ -3379,6 +3386,7 @@
   ePropertyOutputPath,
   ePropertyErrorPath,
   ePropertyDetachOnError,
+  ePropertyCachePriming,
   ePropertyDisableASLR,
   ePropertyDisableSTDIO,
   ePropertyInlineStrategy,
@@ -3641,6 +3649,17 @@
   return m_collection_sp->SetPropertyAtIndexAsEnumeration(nullptr, idx, d);
 }
 
+bool TargetProperties::GetCachePriming() const {
+  const uint32_t idx = ePropertyCachePriming;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void TargetProperties::SetCachePriming(bool b) {
+  const uint32_t idx = ePropertyCachePriming;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetDisableASLR() const {
   const uint32_t idx = ePropertyDisableASLR;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -425,6 +425,11 @@
   }
 }
 
+void Symtab::PrimeCaches() {
+  std::lock_guard guard(m_mutex);
+  InitNameIndexes();
+}
+
 void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
 bool add_demangled, bool add_mangled,
 NameToIndexMap &name_to_index_map) const {
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -21,6 +21,10 @@
 
 using namespace lldb_private;
 
+void SymbolFile::PrimeCaches() {
+  // No-op for most implementations.
+}
+
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr best_symfile_ap;
   if (obj_file != nullptr) {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -226,6 +226,8 @@
   const lldb_private::ConstString &name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
 
+  void PrimeCaches() override;
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1917,6 +1917,12 @@
   return sc_list.GetSize() - prev_size;
 }
 
+void SymbolFileDWARF::PrimeCaches() {
+  std::lock_guard guard(
+  GetObjectFile()->GetModule()->GetMutex());
+  Index();
+}
+
 void SymbolFileDWARF::Index() {
   if (m_indexed)
 return;
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1432,6 +1432,22 @@
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PrimeCaches() {
+  std::lock_guard guard(m_mutex);
+  SymbolVendor * sym_vendor = GetSymbolVendor();
+  if (!sym_vendor) {
+return;
+  }
+  // Prime the symbol file first, since it adds symbol

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

This is picky but can you call it "symbol-cache-priming".  The help text 
explains it, but this is a very specific cache so we should scope it in case we 
have some other one later on.

And we really need to test that both modes continue to work.  If we're always 
fetching symbols up-front by default, then it will be easy for triggering lazy 
loading to break.  One way to do that would to add another mode of the 
testsuite (like the dwarf vrs. dSYM vrs. dso vrs. gmodules.)  But at some point 
continually multiplying runs of the whole testsuite is going to make it so time 
consuming people will stop running all the options.

In this case, it's probably sufficient to add a test that runs to a 
shared-library scoped breakpoint, and performs some operations that require 
symbols from other shared-libraries and makes sure they succeed.  Then do that 
with the setting on and off.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [lldb] r301579 - Fix GreenDragon bots

2017-04-27 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Apr 27 14:45:13 2017
New Revision: 301579

URL: http://llvm.org/viewvc/llvm-project?rev=301579&view=rev
Log:
Fix GreenDragon bots

We don't actually need to include Compiler.h here because it is only used on 
Windows and Windows/PosixAPI.h includes it.

Modified:
lldb/trunk/include/lldb/Host/PosixApi.h

Modified: lldb/trunk/include/lldb/Host/PosixApi.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PosixApi.h?rev=301579&r1=301578&r2=301579&view=diff
==
--- lldb/trunk/include/lldb/Host/PosixApi.h (original)
+++ lldb/trunk/include/lldb/Host/PosixApi.h Thu Apr 27 14:45:13 2017
@@ -14,8 +14,6 @@
 // to provide a minimum level of compatibility across all platforms to rely
 // on various posix api functionality.
 
-#include "llvm/Support/Compiler.h"
-
 #if defined(LLVM_ON_WIN32)
 #include "lldb/Host/windows/PosixApi.h"
 #endif


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


[Lldb-commits] [lldb] r301580 - NFC. Add comment about debugserver usage

2017-04-27 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Apr 27 14:45:16 2017
New Revision: 301580

URL: http://llvm.org/viewvc/llvm-project?rev=301580&view=rev
Log:
NFC. Add comment about debugserver usage

This just adds a comment to SocketAddress about it being used by debugserver 
and the implications of that.

If we need to make changes to this class that make it unsuitable for 
debugserver we can re-implement the minimal abstractions we need from this file 
in debugserver. I would prefer not to do that because code duplication is bad. 
Nuff said.

Modified:
lldb/trunk/source/Host/common/SocketAddress.cpp

Modified: lldb/trunk/source/Host/common/SocketAddress.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/SocketAddress.cpp?rev=301580&r1=301579&r2=301580&view=diff
==
--- lldb/trunk/source/Host/common/SocketAddress.cpp (original)
+++ lldb/trunk/source/Host/common/SocketAddress.cpp Thu Apr 27 14:45:16 2017
@@ -6,6 +6,12 @@
 // License. See LICENSE.TXT for details.
 //
 
//===--===//
+//
+// Note: This file is used on Darwin by debugserver, so it needs to remain as
+//   self contained as possible, and devoid of references to LLVM unless 
+//   there is compelling reason.
+//
+//===--===//
 
 #if defined(_MSC_VER)
 #define _WINSOCK_DEPRECATED_NO_WARNINGS


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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Would "preload-symbols" be a bit more clear and concise?


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [lldb] r301581 - Fixing Windows bot

2017-04-27 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Apr 27 14:56:54 2017
New Revision: 301581

URL: http://llvm.org/viewvc/llvm-project?rev=301581&view=rev
Log:
Fixing Windows bot

URL:
http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/8700

Modified:
lldb/trunk/include/lldb/Host/PosixApi.h

Modified: lldb/trunk/include/lldb/Host/PosixApi.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PosixApi.h?rev=301581&r1=301580&r2=301581&view=diff
==
--- lldb/trunk/include/lldb/Host/PosixApi.h (original)
+++ lldb/trunk/include/lldb/Host/PosixApi.h Thu Apr 27 14:56:54 2017
@@ -14,7 +14,7 @@
 // to provide a minimum level of compatibility across all platforms to rely
 // on various posix api functionality.
 
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
 #include "lldb/Host/windows/PosixApi.h"
 #endif
 


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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Yes, I like that better too.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith updated this revision to Diff 96990.
scott.smith added a comment.

1. Rename to preload-symbols / PreloadSymbols()
2. Modify an existing test to run with and without symbol preloading.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  source/Core/Module.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/Symtab.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1870,6 +1870,11 @@
   }
 }
 
+// Preload symbols outside of any lock, so hopefully we can do this for
+// each library in parallel.
+if (GetPreloadSymbols())
+  module_sp->PreloadSymbols();
+
 if (old_module_sp &&
 m_images.GetIndexForModule(old_module_sp.get()) !=
 LLDB_INVALID_INDEX32) {
@@ -3277,6 +3282,8 @@
 {"detach-on-error", OptionValue::eTypeBoolean, false, true, nullptr,
  nullptr, "debugserver will detach (rather than killing) a process if it "
   "loses connection with lldb."},
+{"preload-symbols", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
+ "Enable loading of symbol tables before they are needed."},
 {"disable-aslr", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
  "Disable Address Space Layout Randomization (ASLR)"},
 {"disable-stdio", OptionValue::eTypeBoolean, false, false, nullptr, nullptr,
@@ -3379,6 +3386,7 @@
   ePropertyOutputPath,
   ePropertyErrorPath,
   ePropertyDetachOnError,
+  ePropertyPreloadSymbols,
   ePropertyDisableASLR,
   ePropertyDisableSTDIO,
   ePropertyInlineStrategy,
@@ -3641,6 +3649,17 @@
   return m_collection_sp->SetPropertyAtIndexAsEnumeration(nullptr, idx, d);
 }
 
+bool TargetProperties::GetPreloadSymbols() const {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void TargetProperties::SetPreloadSymbols(bool b) {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetDisableASLR() const {
   const uint32_t idx = ePropertyDisableASLR;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -425,6 +425,11 @@
   }
 }
 
+void Symtab::PreloadSymbols() {
+  std::lock_guard guard(m_mutex);
+  InitNameIndexes();
+}
+
 void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
 bool add_demangled, bool add_mangled,
 NameToIndexMap &name_to_index_map) const {
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -21,6 +21,10 @@
 
 using namespace lldb_private;
 
+void SymbolFile::PreloadSymbols() {
+  // No-op for most implementations.
+}
+
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr best_symfile_ap;
   if (obj_file != nullptr) {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -226,6 +226,8 @@
   const lldb_private::ConstString &name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
 
+  void PreloadSymbols() override;
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1917,6 +1917,12 @@
   return sc_list.GetSize() - prev_size;
 }
 
+void SymbolFileDWARF::PreloadSymbols() {
+  std::lock_guard guard(
+  GetObjectFile()->GetModule()->GetMutex());
+  Index();
+}
+
 void SymbolFileDWARF::Index() {
   if (m_indexed)
 return;
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1432,6 +1432,22 @@
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PreloadSymbols() {
+  std::lock_guard guard(m_mutex);
+  SymbolVen

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith updated this revision to Diff 96991.
scott.smith added a comment.

Fix default param to setup_common so that we actually test both paths.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  source/Core/Module.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/Symtab.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1870,6 +1870,11 @@
   }
 }
 
+// Preload symbols outside of any lock, so hopefully we can do this for
+// each library in parallel.
+if (GetPreloadSymbols())
+  module_sp->PreloadSymbols();
+
 if (old_module_sp &&
 m_images.GetIndexForModule(old_module_sp.get()) !=
 LLDB_INVALID_INDEX32) {
@@ -3277,6 +3282,8 @@
 {"detach-on-error", OptionValue::eTypeBoolean, false, true, nullptr,
  nullptr, "debugserver will detach (rather than killing) a process if it "
   "loses connection with lldb."},
+{"preload-symbols", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
+ "Enable loading of symbol tables before they are needed."},
 {"disable-aslr", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
  "Disable Address Space Layout Randomization (ASLR)"},
 {"disable-stdio", OptionValue::eTypeBoolean, false, false, nullptr, nullptr,
@@ -3379,6 +3386,7 @@
   ePropertyOutputPath,
   ePropertyErrorPath,
   ePropertyDetachOnError,
+  ePropertyPreloadSymbols,
   ePropertyDisableASLR,
   ePropertyDisableSTDIO,
   ePropertyInlineStrategy,
@@ -3641,6 +3649,17 @@
   return m_collection_sp->SetPropertyAtIndexAsEnumeration(nullptr, idx, d);
 }
 
+bool TargetProperties::GetPreloadSymbols() const {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void TargetProperties::SetPreloadSymbols(bool b) {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetDisableASLR() const {
   const uint32_t idx = ePropertyDisableASLR;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -425,6 +425,11 @@
   }
 }
 
+void Symtab::PreloadSymbols() {
+  std::lock_guard guard(m_mutex);
+  InitNameIndexes();
+}
+
 void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
 bool add_demangled, bool add_mangled,
 NameToIndexMap &name_to_index_map) const {
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -21,6 +21,10 @@
 
 using namespace lldb_private;
 
+void SymbolFile::PreloadSymbols() {
+  // No-op for most implementations.
+}
+
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr best_symfile_ap;
   if (obj_file != nullptr) {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -226,6 +226,8 @@
   const lldb_private::ConstString &name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
 
+  void PreloadSymbols() override;
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1917,6 +1917,12 @@
   return sc_list.GetSize() - prev_size;
 }
 
+void SymbolFileDWARF::PreloadSymbols() {
+  std::lock_guard guard(
+  GetObjectFile()->GetModule()->GetMutex());
+  Index();
+}
+
 void SymbolFileDWARF::Index() {
   if (m_indexed)
 return;
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1432,6 +1432,22 @@
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PreloadSymbols() {
+  std::lock_guard guard(m_mutex);
+  SymbolVendor * sym_vendor = GetSymbolVendor();
+  if (!s

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

That test is good.  That tests the lazy lookup of the dwarf type indices.  The 
other thing this changes is symbol reading.  Can you also add a similar test 
that relies on finding a symbol in a shared library we might not have read in?  
It probably fine to add it to this test case...  It's unlikely we'll break lazy 
symbol reading and not also break lazy Dwarf Index building, but you never 
know.  Other than that, this looks fine to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith updated this revision to Diff 97002.
scott.smith added a comment.

Add test to print expression (calls func, hence resolves symbols).  Also better 
parameterize the common test to reduce code duplication.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598

Files:
  include/lldb/Core/Module.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/Symtab.h
  include/lldb/Target/Target.h
  packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  source/Core/Module.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/Symtab.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1870,6 +1870,11 @@
   }
 }
 
+// Preload symbols outside of any lock, so hopefully we can do this for
+// each library in parallel.
+if (GetPreloadSymbols())
+  module_sp->PreloadSymbols();
+
 if (old_module_sp &&
 m_images.GetIndexForModule(old_module_sp.get()) !=
 LLDB_INVALID_INDEX32) {
@@ -3277,6 +3282,8 @@
 {"detach-on-error", OptionValue::eTypeBoolean, false, true, nullptr,
  nullptr, "debugserver will detach (rather than killing) a process if it "
   "loses connection with lldb."},
+{"preload-symbols", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
+ "Enable loading of symbol tables before they are needed."},
 {"disable-aslr", OptionValue::eTypeBoolean, false, true, nullptr, nullptr,
  "Disable Address Space Layout Randomization (ASLR)"},
 {"disable-stdio", OptionValue::eTypeBoolean, false, false, nullptr, nullptr,
@@ -3379,6 +3386,7 @@
   ePropertyOutputPath,
   ePropertyErrorPath,
   ePropertyDetachOnError,
+  ePropertyPreloadSymbols,
   ePropertyDisableASLR,
   ePropertyDisableSTDIO,
   ePropertyInlineStrategy,
@@ -3641,6 +3649,17 @@
   return m_collection_sp->SetPropertyAtIndexAsEnumeration(nullptr, idx, d);
 }
 
+bool TargetProperties::GetPreloadSymbols() const {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void TargetProperties::SetPreloadSymbols(bool b) {
+  const uint32_t idx = ePropertyPreloadSymbols;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetDisableASLR() const {
   const uint32_t idx = ePropertyDisableASLR;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(
Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -425,6 +425,11 @@
   }
 }
 
+void Symtab::PreloadSymbols() {
+  std::lock_guard guard(m_mutex);
+  InitNameIndexes();
+}
+
 void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
 bool add_demangled, bool add_mangled,
 NameToIndexMap &name_to_index_map) const {
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -21,6 +21,10 @@
 
 using namespace lldb_private;
 
+void SymbolFile::PreloadSymbols() {
+  // No-op for most implementations.
+}
+
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr best_symfile_ap;
   if (obj_file != nullptr) {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -226,6 +226,8 @@
   const lldb_private::ConstString &name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
 
+  void PreloadSymbols() override;
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1917,6 +1917,12 @@
   return sc_list.GetSize() - prev_size;
 }
 
+void SymbolFileDWARF::PreloadSymbols() {
+  std::lock_guard guard(
+  GetObjectFile()->GetModule()->GetMutex());
+  Index();
+}
+
 void SymbolFileDWARF::Index() {
   if (m_indexed)
 return;
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1432,6 +1432,22 @@
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PreloadSymbols() {
+  std::lock_guard guard(m_

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Looks good.  Thanks for working on this!


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] LLVM lab network glitch

2017-04-27 Thread Galina Kistanova via lldb-commits
Some of builders lost connection with master recently due to network glitch.
Thank you for understanding.

Thanks

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


[Lldb-commits] [PATCH] D32600: Resurrect pselect MainLoop implementation

2017-04-27 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene added inline comments.



Comment at: source/Host/common/MainLoop.cpp:82
+  int queue_id;
+  std::vector events;
+  struct kevent event_list[4];

here and below struct seems to be redundant


https://reviews.llvm.org/D32600



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


[Lldb-commits] [PATCH] D32600: Resurrect pselect MainLoop implementation

2017-04-27 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: source/Host/common/MainLoop.cpp:135
+
+template  void MainLoop::RunImpl::ForEachReadFD(F &&f) {
+  assert(num_events >= 0);

Why do we need this function?  Just have a function that returns an 
`ArrayRef` and let the caller iterate over it themselves.



Comment at: source/Host/common/MainLoop.cpp:143
+}
+template  void MainLoop::RunImpl::ForEachSignal(F && f) {}
+#else

Same here.



Comment at: source/Host/common/MainLoop.cpp:167
+
+#ifdef FORCE_PSELECT
+  fd_set read_fd_set;

How about just moving this `#ifdef` up outside of the Poll function?  Given 
that it occurs so many times, i think it makes the logic and the differences 
between the two implementations easier to follow.


https://reviews.llvm.org/D32600



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


[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks good.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [lldb] r301600 - integrate SBTrace changes into Xcode project

2017-04-27 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Thu Apr 27 18:09:08 2017
New Revision: 301600

URL: http://llvm.org/viewvc/llvm-project?rev=301600&view=rev
Log:
integrate SBTrace changes into Xcode project

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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=301600&r1=301599&r2=301600&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Apr 27 18:09:08 2017
@@ -867,6 +867,8 @@
9A0FDEA71E8EF5110086B2F5 /* RegisterContextLinux_mips.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A0FDE971E8EF5010086B2F5 /* 
RegisterContextLinux_mips.cpp */; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
+   9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
+   9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/; };
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* 
EmulateInstructionARM.cpp */; };
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* 
EmulationStateARM.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -2809,6 +2811,10 @@
9A0FDE9B1E8EF5010086B2F5 /* RegisterInfos_mips.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterInfos_mips.h; path = Utility/RegisterInfos_mips.h; sourceTree = 
""; };
9A19A6A51163BB7E00E0D453 /* SBValue.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBValue.h; path = include/lldb/API/SBValue.h; sourceTree = ""; };
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBValue.cpp; path = source/API/SBValue.cpp; sourceTree = ""; };
+   9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTrace.cpp; path = source/API/SBTrace.cpp; sourceTree = ""; };
+   9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTraceOptions.cpp; path = source/API/SBTraceOptions.cpp; sourceTree = 
""; };
+   9A1E59581EB2B10D002206A5 /* SBTrace.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBTrace.h; path = include/lldb/API/SBTrace.h; sourceTree = ""; };
+   9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBTraceOptions.h; path = include/lldb/API/SBTraceOptions.h; sourceTree = 
""; };
9A22A15D135E30370024DDC3 /* EmulateInstructionARM.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = EmulateInstructionARM.cpp; sourceTree = ""; };
9A22A15E135E30370024DDC3 /* EmulateInstructionARM.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
EmulateInstructionARM.h; sourceTree = ""; };
9A22A15F135E30370024DDC3 /* EmulationStateARM.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = EmulationStateARM.cpp; sourceTree = ""; };
@@ -4004,6 +4010,10 @@
8CCB017F19BA4DD9FD44 /* 
SBThreadCollection.cpp */,
4C56543419D2297A002E9C44 /* SBThreadPlan.h */,
4C56543619D22B32002E9C44 /* SBThreadPlan.cpp */,
+   9A1E59581EB2B10D002206A5 /* SBTrace.h */,
+   9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */,
+   9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */,
+   9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/,
2617447911685869005ADD65 /* SBType.h */,
261744771168585B005ADD65 /* SBType.cpp */,
   

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

Can someone commit this for me?  Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32626: Make the ELF symbol demangling loop order independent

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith created this revision.

Currently, the loop will insert entries into the class_contexts set, and then 
use the absence or presence to affect decisions made by later iterations of the 
same loop.

In order to support parallelizing the loop, this change moves those decisions 
to always occur after the main loop, instead of sometimes occurring after the 
loop.


Repository:
  rL LLVM

https://reviews.llvm.org/D32626

Files:
  source/Symbol/Symtab.cpp


Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -310,22 +310,16 @@
 m_method_to_index.Append(entry);
   } else {
 if (const_context && const_context[0]) {
-  if (class_contexts.find(const_context) !=
-  class_contexts.end()) {
-// The current decl context is in our "class_contexts" 
which
-// means
-// this is a method on a class
-m_method_to_index.Append(entry);
-  } else {
-// We don't know if this is a function basename or a 
method,
-// so put it into a temporary collection so once we are 
done
-// we can look in class_contexts to see if each entry is a
-// class
-// or just a function and will put any remaining items into
-// m_method_to_index or m_basename_to_index as needed
-mangled_name_to_index.Append(entry);
-symbol_contexts[entry.value] = const_context;
-  }
+  // We don't know if this is a function basename or a method,
+  // so put it into a temporary collection so once we are done
+  // we can look in class_contexts to see if each entry is a
+  // class
+  // or just a function and will put any remaining items into
+  // m_method_to_index or m_basename_to_index as needed
+  mangled_name_to_index.Append(entry);
+  symbol_contexts[entry.value] = const_context;
+  // Note this is common to both paths, though
+  m_method_to_index.Append(entry);
 } else {
   // No context for this function so this has to be a basename
   m_basename_to_index.Append(entry);
@@ -373,26 +367,19 @@
   }
 }
 
-size_t count;
-if (!mangled_name_to_index.IsEmpty()) {
-  count = mangled_name_to_index.GetSize();
-  for (size_t i = 0; i < count; ++i) {
-if (mangled_name_to_index.GetValueAtIndex(i, entry.value)) {
-  entry.cstring = mangled_name_to_index.GetCStringAtIndex(i);
-  if (symbol_contexts[entry.value] &&
-  class_contexts.find(symbol_contexts[entry.value]) !=
-  class_contexts.end()) {
-m_method_to_index.Append(entry);
-  } else {
-// If we got here, we have something that had a context (was inside
-// a namespace or class)
-// yet we don't know if the entry
-m_method_to_index.Append(entry);
-m_basename_to_index.Append(entry);
-  }
+size_t count = mangled_name_to_index.GetSize();
+for (size_t i = 0; i < count; ++i) {
+  if (mangled_name_to_index.GetValueAtIndex(i, entry.value)) {
+entry.cstring = mangled_name_to_index.GetCStringAtIndex(i);
+if (class_contexts.find(symbol_contexts[entry.value]) ==
+class_contexts.end()) {
+  // If we got here, we have something that had a context (was inside
+  // a namespace or class) yet we don't know if the entry
+  m_basename_to_index.Append(entry);
 }
   }
 }
+
 m_name_to_index.Sort();
 m_name_to_index.SizeToFit();
 m_selector_to_index.Sort();


Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -310,22 +310,16 @@
 m_method_to_index.Append(entry);
   } else {
 if (const_context && const_context[0]) {
-  if (class_contexts.find(const_context) !=
-  class_contexts.end()) {
-// The current decl context is in our "class_contexts" which
-// means
-// this is a method on a class
-m_method_to_index.Append(entry);
-  } else {
-// We don't know if this is a function basename or a method,
-// so put it into a temporary collection so once we are done
-// we can look in class_contexts to see if each entry is a
-// class
-// or just a function an

[Lldb-commits] [PATCH] D32626: Make the ELF symbol demangling loop order independent

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith added a comment.

I welcome any suggestions on how to update the comments near the code I 
touched.  I can make the code functionally the same, but it doesn't mean I know 
why it's doing what it's doing :-)




Comment at: source/Symbol/Symtab.cpp:382
-  entry.cstring = mangled_name_to_index.GetCStringAtIndex(i);
-  if (symbol_contexts[entry.value] &&
-  class_contexts.find(symbol_contexts[entry.value]) !=

Note the old code checked that symbol_contexts[] (aka const_context above) is 
"true."  However, because of the code above, we would never get here unless it 
is true.  So I removed the check.



Comment at: source/Symbol/Symtab.cpp:385
-  class_contexts.end()) {
-m_method_to_index.Append(entry);
-  } else {

Note that adding to m_method_to_index happened in both code paths in the old 
code, so I moved it up to the main loop.


Repository:
  rL LLVM

https://reviews.llvm.org/D32626



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


[Lldb-commits] [PATCH] D32626: Make the symbol demangling loop order independent

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a reviewer: clayborg.
jingham added a comment.

Adding Greg as a reviewer.  You can generally see  from the CODE_OWNERS.txt 
file who has overall responsibility for areas in lldb, and you should at least 
assign them as a reviewer.  For Symbol parsing stuff that's definitely Greg.


Repository:
  rL LLVM

https://reviews.llvm.org/D32626



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


[Lldb-commits] [PATCH] D32568: Protect Proces::GetMemoryRegionInfo and ::GetFileLoadAddress with a lock

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith abandoned this revision.
scott.smith added a comment.

Further testing shows this is not necessary.  I'll abandon it.


Repository:
  rL LLVM

https://reviews.llvm.org/D32568



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


[Lldb-commits] [lldb] r301603 - Resurrect the standalone build of LLDB

2017-04-27 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Thu Apr 27 19:29:54 2017
New Revision: 301603

URL: http://llvm.org/viewvc/llvm-project?rev=301603&view=rev
Log:
Resurrect the standalone build of LLDB

Switch includes "llvm/Config/config.h" to "llvm/Config/llvm-config.h".

Tested on NetBSD 7.99.70 amd64

Modified:
lldb/trunk/source/Host/common/MainLoop.cpp
lldb/trunk/source/Host/common/TCPSocket.cpp

Modified: lldb/trunk/source/Host/common/MainLoop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MainLoop.cpp?rev=301603&r1=301602&r2=301603&view=diff
==
--- lldb/trunk/source/Host/common/MainLoop.cpp (original)
+++ lldb/trunk/source/Host/common/MainLoop.cpp Thu Apr 27 19:29:54 2017
@@ -7,7 +7,7 @@
 //
 
//===--===//
 
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 
 #include "lldb/Host/MainLoop.h"
 #include "lldb/Utility/Error.h"

Modified: lldb/trunk/source/Host/common/TCPSocket.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TCPSocket.cpp?rev=301603&r1=301602&r2=301603&view=diff
==
--- lldb/trunk/source/Host/common/TCPSocket.cpp (original)
+++ lldb/trunk/source/Host/common/TCPSocket.cpp Thu Apr 27 19:29:54 2017
@@ -17,7 +17,7 @@
 #include "lldb/Host/MainLoop.h"
 #include "lldb/Utility/Log.h"
 
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/raw_ostream.h"
 
 #ifndef LLDB_DISABLE_POSIX


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


[Lldb-commits] [lldb] r301608 - Add a newline to suppress compiler warnings.

2017-04-27 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Apr 27 19:44:07 2017
New Revision: 301608

URL: http://llvm.org/viewvc/llvm-project?rev=301608&view=rev
Log:
Add a newline to suppress compiler warnings.

Modified:
lldb/trunk/include/lldb/Core/TraceOptions.h

Modified: lldb/trunk/include/lldb/Core/TraceOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/TraceOptions.h?rev=301608&r1=301607&r2=301608&view=diff
==
--- lldb/trunk/include/lldb/Core/TraceOptions.h (original)
+++ lldb/trunk/include/lldb/Core/TraceOptions.h Thu Apr 27 19:44:07 2017
@@ -59,4 +59,4 @@ private:
 };
 }
 
-#endif // liblldb_TraceOptions_h_
\ No newline at end of file
+#endif // liblldb_TraceOptions_h_


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


[Lldb-commits] [lldb] r301609 - Provide a mechanism to do some pre-loading of symbols up front.

2017-04-27 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Apr 27 19:51:06 2017
New Revision: 301609

URL: http://llvm.org/viewvc/llvm-project?rev=301609&view=rev
Log:
Provide a mechanism to do some pre-loading of symbols up front.

Loading a shared library can require a large amount of work; rather than do 
that serially for each library,
this patch will allow parallelization of the symbols and debug info name 
indexes.

From scott.sm...@purestorage.com

https://reviews.llvm.org/D32598

Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/Symtab.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/Symtab.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=301609&r1=301608&r2=301609&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Apr 27 19:51:06 2017
@@ -614,6 +614,8 @@ public:
 
   const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; }
 
+  void PreloadSymbols();
+
   void SetSymbolFileFileSpec(const FileSpec &file);
 
   const llvm::sys::TimePoint<> &GetModificationTime() const {

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=301609&r1=301608&r2=301609&view=diff
==
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Thu Apr 27 19:51:06 2017
@@ -180,6 +180,8 @@ public:
   uint32_t type_mask,
   lldb_private::TypeList &type_list) = 0;
 
+  virtual void PreloadSymbols();
+
   virtual lldb_private::TypeSystem *
   GetTypeSystemForLanguage(lldb::LanguageType language);
 

Modified: lldb/trunk/include/lldb/Symbol/Symtab.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=301609&r1=301608&r2=301609&view=diff
==
--- lldb/trunk/include/lldb/Symbol/Symtab.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symtab.h Thu Apr 27 19:51:06 2017
@@ -40,6 +40,7 @@ public:
   Symtab(ObjectFile *objfile);
   ~Symtab();
 
+  void PreloadSymbols();
   void Reserve(size_t count);
   Symbol *Resize(size_t count);
   uint32_t AddSymbol(const Symbol &symbol);

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=301609&r1=301608&r2=301609&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Apr 27 19:51:06 2017
@@ -82,6 +82,10 @@ public:
 
   bool SetPreferDynamicValue(lldb::DynamicValueType d);
 
+  bool GetPreloadSymbols() const;
+
+  void SetPreloadSymbols(bool b);
+
   bool GetDisableASLR() const;
 
   void SetDisableASLR(bool b);

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py?rev=301609&r1=301608&r2=301609&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py 
Thu Apr 27 19:51:06 2017
@@ -13,14 +13,13 @@ class SharedLibTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-def test_expr(self):
-"""Test that types work when defined in a shared library and 
forward-declared in the main executable"""
+def common_test_expr(self, preload_symbols):
 if "clang" in self.getCompiler() and "3.4" in 
self.getCompilerVersion():
 self.skipTest(
 "llvm.org/pr16214 -- clang emits partial DWARF for structures 
referenced via typedef")
 
 self.build()
-self.common_setup()
+self.common_setup(preload_symbols)
 
 # This should display correctly.
 self.expect(
@@ -31,6 +30,18 @@ class SharedLibTestCase(TestBase):
 "(sub_foo)",
 "other_element = 3"])
 
+self.expect(
+"expression GetMeASubFoo(my_foo_ptr)",
+startstr="(sub_foo *) $")
+
+def test_expr(self):
+"""Test that

[Lldb-commits] [PATCH] D32598: Prime module caches outside of the module list lock for better parallelism

2017-04-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham closed this revision.
jingham added a comment.

Sure.  Closed with r301609.


Repository:
  rL LLVM

https://reviews.llvm.org/D32598



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


[Lldb-commits] [PATCH] D32626: Make the symbol demangling loop order independent

2017-04-27 Thread Scott Smith via Phabricator via lldb-commits
scott.smith abandoned this revision.
scott.smith added a comment.

Turns out I'm planning on making more drastic changes to this loop, so there's 
no point in reviewing this step.


Repository:
  rL LLVM

https://reviews.llvm.org/D32626



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