[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for AArch64 targets

2017-02-09 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

In https://reviews.llvm.org/D29669#670896, @clayborg wrote:

> I would prefer to see NativeBreakpoint struct expanded to have more member 
> variables instead of adding a new hardware breakpoint list. Then you just ask 
> any breakpoint to enable/disable/remove itself and the structure contains all 
> of the info we need. Keeping two lists means we have to check two lists. Let 
> me know if any of my inline comments weren't clear?


So I thought about it but gave up on the idea for two reasons:

1. Hardware breakpoints implementation has more similarities with hardware 
watchpoints than software breakpoints and I plan to consolidate both 
functionalities onces hardware brekapoints start working.

2. Software breakpoint are implemented with process wide scope and hardware 
breakpoints are thread specific which means that we add existing hw breakpoint 
on all new threads. On resume we ll be traversing through a breakpoint list 
which predominantly has only software breakpoints in most cases a overhead will 
be added in case we  have 20 software breakpoint and just 1 hardware breakpoint 
installed by user.

Let me know what do you think about above two ppoints and I ll clear up all 
other comments in following revision.


https://reviews.llvm.org/D29669



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


[Lldb-commits] [lldb] r294580 - Fix shared library build

2017-02-09 Thread Ismail Donmez via lldb-commits
Author: ismail
Date: Thu Feb  9 04:59:33 2017
New Revision: 294580

URL: http://llvm.org/viewvc/llvm-project?rev=294580&view=rev
Log:
Fix shared library build

Modified:
lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt?rev=294580&r1=294579&r2=294580&view=diff
==
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt Thu Feb  9 
04:59:33 2017
@@ -8,5 +8,6 @@ add_lldb_library(lldbPluginUnwindAssembl
 lldbTarget
 lldbUtility
   LINK_COMPONENTS
+MC
 Support
   )


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


[Lldb-commits] [lldb] r294583 - Revert r294580 , it didn't fix the shared build

2017-02-09 Thread Ismail Donmez via lldb-commits
Author: ismail
Date: Thu Feb  9 06:30:09 2017
New Revision: 294583

URL: http://llvm.org/viewvc/llvm-project?rev=294583&view=rev
Log:
Revert r294580 , it didn't fix the shared build

Modified:
lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt?rev=294583&r1=294582&r2=294583&view=diff
==
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/CMakeLists.txt Thu Feb  9 
06:30:09 2017
@@ -8,6 +8,5 @@ add_lldb_library(lldbPluginUnwindAssembl
 lldbTarget
 lldbUtility
   LINK_COMPONENTS
-MC
 Support
   )


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


[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for AArch64 targets

2017-02-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

If it isn't making too much extra code I am fine with it being separate if you 
believe this is the right way forward. Give it some thought and if you still 
believe they should be separate, I won't object. It might be nice to send the 
HardwareBreakpoint structure down to the functions that are going to 
enable/disable the HW breakpoints instead of individual arguments as you may 
end up adding members to the HardwareBreakpoint in the future and this will 
keep you from having to update all of the signatures.


https://reviews.llvm.org/D29669



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


[Lldb-commits] [lldb] r294597 - Fixed documentation bug found by Ramana who sent a patch to the lldb-dev list.

2017-02-09 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Feb  9 11:16:19 2017
New Revision: 294597

URL: http://llvm.org/viewvc/llvm-project?rev=294597&view=rev
Log:
Fixed documentation bug found by Ramana who sent a patch to the lldb-dev list.


Modified:
lldb/trunk/www/test.html

Modified: lldb/trunk/www/test.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/test.html?rev=294597&r1=294596&r2=294597&view=diff
==
--- lldb/trunk/www/test.html (original)
+++ lldb/trunk/www/test.html Thu Feb  9 11:16:19 2017
@@ -46,7 +46,7 @@
   built with a custom version of clang, do:
 
 
-  > cmake -DLLDB_TEST_ARGS="-A i386 -C 
/path/to/custom/clang" -G Ninja
+  > cmake -DLLDB_TEST_USER_ARGS="-A i386 -C 
/path/to/custom/clang" -G Ninja
   > ninja check-lldb
 
 Note that multiple -A and -C flags can be specified to 
LLDB_TEST_USER_ARGS.


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


[Lldb-commits] [lldb] r294600 - Fixed an issue where AllocatedBlock::ReserveRange does a linear search through reserved ranges.

2017-02-09 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Feb  9 11:56:55 2017
New Revision: 294600

URL: http://llvm.org/viewvc/llvm-project?rev=294600&view=rev
Log:
Fixed an issue where AllocatedBlock::ReserveRange does a linear search through 
reserved ranges.

After many expressions are evaluated we were spending time looking for open 
blocks on memory in the one or more AllocatedBlock objects and it would slow 
down expression evaluation.

I implemented a fixed size blocks implementation that maintains a sorted free 
list to fix the issue.

 

Modified:
lldb/trunk/include/lldb/Core/RangeMap.h
lldb/trunk/include/lldb/Target/Memory.h
lldb/trunk/source/Target/Memory.cpp

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=294600&r1=294599&r2=294600&view=diff
==
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Thu Feb  9 11:56:55 2017
@@ -59,6 +59,18 @@ template  struct
 
   void Slide(BaseType slide) { base += slide; }
 
+  bool Union(const Range &rhs)
+  {
+if (DoesAdjoinOrIntersect(rhs))
+{
+  auto new_end = std::max(GetRangeEnd(), rhs.GetRangeEnd());
+  base = std::min(base, rhs.base);
+  size = new_end - base;
+  return true;
+}
+return false;
+  }
+
   BaseType GetRangeEnd() const { return base + size; }
 
   void SetRangeEnd(BaseType end) {
@@ -348,7 +360,33 @@ public:
 
   void Append(B base, S size) { m_entries.emplace_back(base, size); }
 
-  bool RemoveEntrtAtIndex(uint32_t idx) {
+  // Insert an item into a sorted list and optionally combine it with any
+  // adjacent blocks if requested.
+  void Insert(const Entry &entry, bool combine) {
+if (m_entries.empty()) {
+  m_entries.push_back(entry);
+  return;
+}
+auto begin = m_entries.begin();
+auto end = m_entries.end();
+auto pos = std::lower_bound(begin, end, entry);
+if (combine) {
+  if (pos != end && pos->Union(entry)) {
+CombinePrevAndNext(pos);
+return;
+  }
+  if (pos != begin) {
+auto prev = pos - 1;
+if (prev->Union(entry)) {
+  CombinePrevAndNext(prev);
+  return;
+}
+  }
+}
+m_entries.insert(pos, entry);
+  }
+
+  bool RemoveEntryAtIndex(uint32_t idx) {
 if (idx < m_entries.size()) {
   m_entries.erase(m_entries.begin() + idx);
   return true;
@@ -458,6 +496,7 @@ public:
 
   // Clients must ensure that "i" is a valid index prior to calling this
   // function
+  Entry &GetEntryRef(size_t i) { return m_entries[i]; }
   const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
 
   Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
@@ -538,6 +577,28 @@ public:
   }
 
 protected:
+  
+  void CombinePrevAndNext(typename Collection::iterator pos) {
+// Check if the prev or next entries in case they need to be unioned with
+// the entry pointed to by "pos".
+if (pos != m_entries.begin()) {
+  auto prev = pos - 1;
+  if (prev->Union(*pos))
+m_entries.erase(pos);
+  pos = prev;
+}
+
+auto end = m_entries.end();
+if (pos != end) {
+  auto next = pos + 1;
+  if (next != end) {
+if (pos->Union(*next))
+  m_entries.erase(next);
+  }
+}
+return;
+  }
+
   Collection m_entries;
 };
 

Modified: lldb/trunk/include/lldb/Target/Memory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=294600&r1=294599&r2=294600&view=diff
==
--- lldb/trunk/include/lldb/Target/Memory.h (original)
+++ lldb/trunk/include/lldb/Target/Memory.h Thu Feb  9 11:56:55 2017
@@ -75,6 +75,8 @@ private:
   DISALLOW_COPY_AND_ASSIGN(MemoryCache);
 };
 
+
+
 class AllocatedBlock {
 public:
   AllocatedBlock(lldb::addr_t addr, uint32_t byte_size, uint32_t permissions,
@@ -86,32 +88,35 @@ public:
 
   bool FreeBlock(lldb::addr_t addr);
 
-  lldb::addr_t GetBaseAddress() const { return m_addr; }
+  lldb::addr_t GetBaseAddress() const { return m_range.GetRangeBase(); }
 
-  uint32_t GetByteSize() const { return m_byte_size; }
+  uint32_t GetByteSize() const { return m_range.GetByteSize(); }
 
   uint32_t GetPermissions() const { return m_permissions; }
 
   uint32_t GetChunkSize() const { return m_chunk_size; }
 
   bool Contains(lldb::addr_t addr) const {
-return ((addr >= m_addr) && addr < (m_addr + m_byte_size));
+return m_range.Contains(addr);
   }
 
 protected:
-  uint32_t TotalChunks() const { return m_byte_size / m_chunk_size; }
+  uint32_t TotalChunks() const { return GetByteSize() / GetChunkSize(); }
 
   uint32_t CalculateChunksNeededForSize(uint32_t size) const {
 return (size + m_chunk_size - 1) / m_chunk_size;
   }
-  const lldb::addr_t m_addr;// Base address of this block of memory
-  con

[Lldb-commits] [lldb] r294603 - Fix build bots.

2017-02-09 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Feb  9 12:21:04 2017
New Revision: 294603

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


Modified:
lldb/trunk/include/lldb/Target/Memory.h
lldb/trunk/source/Target/Memory.cpp

Modified: lldb/trunk/include/lldb/Target/Memory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=294603&r1=294602&r2=294603&view=diff
==
--- lldb/trunk/include/lldb/Target/Memory.h (original)
+++ lldb/trunk/include/lldb/Target/Memory.h Thu Feb  9 12:21:04 2017
@@ -106,9 +106,8 @@ protected:
   uint32_t CalculateChunksNeededForSize(uint32_t size) const {
 return (size + m_chunk_size - 1) / m_chunk_size;
   }
-  typedef Range Range;
   // Base address of this block of memory 4GB of chunk should be enough.
-  Range m_range;
+  Range m_range;
   // Permissions for this memory (logical OR of lldb::Permissions bits)
   const uint32_t m_permissions;
   // The size of chunks that the memory at m_addr is divied up into.

Modified: lldb/trunk/source/Target/Memory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=294603&r1=294602&r2=294603&view=diff
==
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Thu Feb  9 12:21:04 2017
@@ -269,7 +269,7 @@ lldb::addr_t AllocatedBlock::ReserveBloc
   const size_t free_count = m_free_blocks.GetSize();
   for (size_t i=0; i= size)
 {
@@ -291,7 +291,7 @@ lldb::addr_t AllocatedBlock::ReserveBloc
   else
   {
 // Make the new allocated range and add it to the allocated ranges.
-Range reserved_block(free_block);
+Range reserved_block(free_block);
 reserved_block.SetByteSize(block_size);
 // Insert the reserved range and don't combine it with other blocks
 // in the reserved blocks list.


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


[Lldb-commits] [lldb] r294611 - Make sure we only load the OS plug-in once.

2017-02-09 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Feb  9 12:55:41 2017
New Revision: 294611

URL: http://llvm.org/viewvc/llvm-project?rev=294611&view=rev
Log:
Make sure we only load the OS plug-in once.

 


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

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=294611&r1=294610&r2=294611&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Feb  9 12:55:41 2017
@@ -2798,7 +2798,8 @@ Error Process::Launch(ProcessLaunchInfo
 if (system_runtime)
   system_runtime->DidLaunch();
 
-LoadOperatingSystemPlugin(false);
+if (!m_os_ap)
+LoadOperatingSystemPlugin(false);
 
 // Note, the stop event was consumed above, but not handled. This
 // was done
@@ -2862,7 +2863,9 @@ Error Process::LoadCore() {
 if (system_runtime)
   system_runtime->DidAttach();
 
-m_os_ap.reset(OperatingSystem::FindPlugin(this, nullptr));
+if (!m_os_ap)
+  LoadOperatingSystemPlugin(false);
+
 // We successfully loaded a core file, now pretend we stopped so we can
 // show all of the threads in the core file and explore the crashed
 // state.
@@ -3205,7 +3208,8 @@ void Process::CompleteAttach() {
 }
   }
 
-  m_os_ap.reset(OperatingSystem::FindPlugin(this, nullptr));
+  if (!m_os_ap)
+LoadOperatingSystemPlugin(false);
   // Figure out which one is the executable, and set that in our target:
   const ModuleList &target_modules = GetTarget().GetImages();
   std::lock_guard guard(target_modules.GetMutex());


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