[Lldb-commits] [lldb] 1c90ce0 - [lldb/Test] Disable hardware check on arm/aarch64

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T20:54:18-08:00
New Revision: 1c90ce0c761719ab58361402fb85c0b58680832b

URL: 
https://github.com/llvm/llvm-project/commit/1c90ce0c761719ab58361402fb85c0b58680832b
DIFF: 
https://github.com/llvm/llvm-project/commit/1c90ce0c761719ab58361402fb85c0b58680832b.diff

LOG: [lldb/Test] Disable hardware check on arm/aarch64

BreakpointSites know they're backed by hardware based on whether the
"hardware index" is set. This does not appear the to be done for
arm/aarch64.

https://llvm.org/PR44659

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index f9a916f87b86..90d182bfcc89 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -21,7 +21,7 @@ class HardwareBreakpointMultiThreadTestCase(TestBase):
 def test_hw_break_set_delete_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('delete')
+self.break_multi_thread('delete', False) # llvm.org/PR44659
 
 # LLDB on linux supports hardware breakpoints for arm and aarch64
 # architectures.
@@ -30,7 +30,7 @@ def test_hw_break_set_delete_multi_thread_linux(self):
 def test_hw_break_set_disable_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('disable')
+self.break_multi_thread('disable', False) # llvm.org/PR44659
 
 # LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
 # i386 architectures.
@@ -60,7 +60,7 @@ def setUp(self):
 self.first_stop = line_number(
 self.source, 'Starting thread creation with hardware breakpoint 
set')
 
-def break_multi_thread(self, removal_type):
+def break_multi_thread(self, removal_type, check_hw_bp=True):
 """Test that lldb hardware breakpoints work for multiple threads."""
 self.runCmd("file " + self.getBuildArtifact("a.out"),
 CURRENT_EXECUTABLE_SET)
@@ -101,9 +101,10 @@ def break_multi_thread(self, removal_type):
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
-# Check the breakpoint list.
-self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
-self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
+if check_hw_bp:
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
+self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
 
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")



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


[Lldb-commits] [lldb] 1ed561a - [lldb/Test] Update minidebuginfo-set-and-hit-breakpoint.test

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T20:47:31-08:00
New Revision: 1ed561aa4bdc2e9f5e743ffcbdbe10a3443947dd

URL: 
https://github.com/llvm/llvm-project/commit/1ed561aa4bdc2e9f5e743ffcbdbe10a3443947dd
DIFF: 
https://github.com/llvm/llvm-project/commit/1ed561aa4bdc2e9f5e743ffcbdbe10a3443947dd.diff

LOG: [lldb/Test] Update minidebuginfo-set-and-hit-breakpoint.test

Update test to account for the new 'hardware' field between 'resolved'
and 'hit count'.

Added: 


Modified: 
lldb/test/Shell/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test

Removed: 




diff  --git 
a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test 
b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test
index cf073fc16cb7..84c69bea87f7 100644
--- a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test
+++ b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test
@@ -73,17 +73,19 @@
 # CHECK: (lldb) breakpoint list -v
 # CHECK-NEXT: Current breakpoints:
 # CHECK-NEXT: 1: name = 'multiplyByThree'
-# CHECK-NEXT:  1.1: 
+# CHECK-NEXT:  1.1:
 # CHECK-NEXT:  module = 
{{.*}}/minidebuginfo-set-and-hit-breakpoint.test.tmp.binary
 # CHECK-NEXT:  symbol = multiplyByThree
 # CHECK-NEXT:  address = 0x{{.*}}
 # CHECK-NEXT:  resolved = true
-# CHECK-NEXT:  hit count = 1 
+# CHECK-NEXT:  hardware = false
+# CHECK-NEXT:  hit count = 1
 
 # CHECK: 2: name = 'multiplyByFour'
-# CHECK-NEXT:  2.1: 
+# CHECK-NEXT:  2.1:
 # CHECK-NEXT:  module = 
{{.*}}/minidebuginfo-set-and-hit-breakpoint.test.tmp.binary
 # CHECK-NEXT:  symbol = multiplyByFour
 # CHECK-NEXT:  address = 0x{{.*}}
 # CHECK-NEXT:  resolved = true
-# CHECK-NEXT:  hit count = 1 
+# CHECK-NEXT:  hardware = false
+# CHECK-NEXT:  hit count = 1



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


[Lldb-commits] [PATCH] D73389: [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd8e0f4fae7a2: [lldb/Breakpoint] Include whether or not a 
breakpoint is a HW BP (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73389/new/

https://reviews.llvm.org/D73389

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/source/Breakpoint/BreakpointLocation.cpp


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -101,6 +101,10 @@
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
+self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
+
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
 


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -101,6 +101,10 @@
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 'hardware'])
+self.expect("breakpoint list -v", substrs=['function = hw_break_function', 'hardware = true'])
+
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73401: [ldb/Breakpoint] Recognize HW breakpoints as breakpoints instead of just mach exceptions.

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2bc38ab3d038: [lldb/Breakpoint] Recogize hardware 
breakpoints as such (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73401/new/

https://reviews.llvm.org/D73401

Files:
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp

Index: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
===
--- lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -8,6 +8,7 @@
 
 #include "StopInfoMachException.h"
 
+#include "lldb/lldb-forward.h"
 
 #if defined(__APPLE__)
 // Needed for the EXC_RESOURCE interpretation macros
@@ -293,6 +294,44 @@
   return m_description.c_str();
 }
 
+static StopInfoSP GetStopInfoForHardwareBP(Thread , Target *target,
+   uint32_t exc_data_count,
+   uint64_t exc_sub_code,
+   uint64_t exc_sub_sub_code) {
+  // Try hardware watchpoint.
+  if (target) {
+// The exc_sub_code indicates the data break address.
+lldb::WatchpointSP wp_sp =
+target->GetWatchpointList().FindByAddress((lldb::addr_t)exc_sub_code);
+if (wp_sp && wp_sp->IsEnabled()) {
+  // Debugserver may piggyback the hardware index of the fired watchpoint
+  // in the exception data. Set the hardware index if that's the case.
+  if (exc_data_count >= 3)
+wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+  return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID());
+}
+  }
+
+  // Try hardware breakpoint.
+  ProcessSP process_sp(thread.GetProcess());
+  if (process_sp) {
+// The exc_sub_code indicates the data break address.
+lldb::BreakpointSiteSP bp_sp =
+process_sp->GetBreakpointSiteList().FindByAddress(
+(lldb::addr_t)exc_sub_code);
+if (bp_sp && bp_sp->IsEnabled()) {
+  // Debugserver may piggyback the hardware index of the fired breakpoint
+  // in the exception data. Set the hardware index if that's the case.
+  if (exc_data_count >= 3)
+bp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+  return StopInfo::CreateStopReasonWithBreakpointSiteID(thread,
+bp_sp->GetID());
+}
+  }
+
+  return nullptr;
+}
+
 StopInfoSP StopInfoMachException::CreateStopReasonWithMachException(
 Thread , uint32_t exc_type, uint32_t exc_data_count,
 uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
@@ -350,22 +389,10 @@
   is_actual_breakpoint = true;
   is_trace_if_actual_breakpoint_missing = true;
 } else {
-
-  // It's a watchpoint, then.
-  // The exc_sub_code indicates the data break address.
-  lldb::WatchpointSP wp_sp;
-  if (target)
-wp_sp = target->GetWatchpointList().FindByAddress(
-(lldb::addr_t)exc_sub_code);
-  if (wp_sp && wp_sp->IsEnabled()) {
-// Debugserver may piggyback the hardware index of the fired
-// watchpoint in the exception data. Set the hardware index if
-// that's the case.
-if (exc_data_count >= 3)
-  wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
-return StopInfo::CreateStopReasonWithWatchpointID(thread,
-  wp_sp->GetID());
-  }
+  if (StopInfoSP stop_info =
+  GetStopInfoForHardwareBP(thread, target, exc_data_count,
+   exc_sub_code, exc_sub_sub_code))
+return stop_info;
 }
   } else if (exc_code == 2 || // EXC_I386_BPT
  exc_code == 3)   // EXC_I386_BPTFLT
Index: lldb/source/Breakpoint/BreakpointSite.cpp
===
--- lldb/source/Breakpoint/BreakpointSite.cpp
+++ lldb/source/Breakpoint/BreakpointSite.cpp
@@ -156,6 +156,13 @@
   }
 }
 
+void BreakpointSite::SetHardwareIndex(uint32_t index) {
+  std::lock_guard guard(m_owners_mutex);
+  for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) {
+loc_sp->SetHardwareIndex(index);
+  }
+}
+
 bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size,
  lldb::addr_t *intersect_addr,
  size_t *intersect_size,
Index: 

[Lldb-commits] [lldb] d8e0f4f - [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T19:24:25-08:00
New Revision: d8e0f4fae7a2d6a2510d9eea21a12ed9b8948d65

URL: 
https://github.com/llvm/llvm-project/commit/d8e0f4fae7a2d6a2510d9eea21a12ed9b8948d65
DIFF: 
https://github.com/llvm/llvm-project/commit/d8e0f4fae7a2d6a2510d9eea21a12ed9b8948d65.diff

LOG: [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

Include whether or not a breakpoint is a hardware breakpoint in the
breakpoint location. This will show up in things like the breakpoint
list.

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
lldb/source/Breakpoint/BreakpointLocation.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index 0ea8e042c5d9..f9a916f87b86 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -101,6 +101,10 @@ def break_multi_thread(self, removal_type):
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
+self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
+
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
 

diff  --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index ecfc8b53d92e..646c2e3c628b 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@ void BreakpointLocation::GetDescription(Stream *s,
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@ void BreakpointLocation::GetDescription(Stream *s,
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }



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


[Lldb-commits] [lldb] 2bc38ab - [lldb/Breakpoint] Recogize hardware breakpoints as such

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T19:24:25-08:00
New Revision: 2bc38ab3d038344317b7299e4a562f5724180f5a

URL: 
https://github.com/llvm/llvm-project/commit/2bc38ab3d038344317b7299e4a562f5724180f5a
DIFF: 
https://github.com/llvm/llvm-project/commit/2bc38ab3d038344317b7299e4a562f5724180f5a.diff

LOG: [lldb/Breakpoint] Recogize hardware breakpoints as such

Recognize hardware breakpoints as breakpoints instead of just mach
exceptions. The mach exception is the same for watch and breakpoints, so
we have to try each to figure out which is which.

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

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointSite.h
lldb/include/lldb/Breakpoint/StoppointLocation.h

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
lldb/source/Breakpoint/BreakpointSite.cpp
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h 
b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 5c9f79a9ab1c..eef2e295c1ff 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -61,6 +61,8 @@ class BreakpointSite : public 
std::enable_shared_from_this,
   /// Sets the trap opcode
   bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size);
 
+  void SetHardwareIndex(uint32_t index) override;
+
   /// Gets the original instruction bytes that were overwritten by the trap
   uint8_t *GetSavedOpcodeBytes();
 

diff  --git a/lldb/include/lldb/Breakpoint/StoppointLocation.h 
b/lldb/include/lldb/Breakpoint/StoppointLocation.h
index 3926f452e564..3c22813f7e19 100644
--- a/lldb/include/lldb/Breakpoint/StoppointLocation.h
+++ b/lldb/include/lldb/Breakpoint/StoppointLocation.h
@@ -48,7 +48,7 @@ class StoppointLocation {
 
   virtual void Dump(Stream *stream) const {}
 
-  void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
+  virtual void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
 
   lldb::break_id_t GetID() const { return m_loc_id; }
 

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index 16c63b9ced1c..0ea8e042c5d9 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -21,7 +21,7 @@ class HardwareBreakpointMultiThreadTestCase(TestBase):
 def test_hw_break_set_delete_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('delete', 'breakpoint')
+self.break_multi_thread('delete')
 
 # LLDB on linux supports hardware breakpoints for arm and aarch64
 # architectures.
@@ -30,7 +30,7 @@ def test_hw_break_set_delete_multi_thread_linux(self):
 def test_hw_break_set_disable_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('disable', 'breakpoint')
+self.break_multi_thread('disable')
 
 # LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
 # i386 architectures.
@@ -39,7 +39,7 @@ def test_hw_break_set_disable_multi_thread_linux(self):
 def test_hw_break_set_delete_multi_thread_macos(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('delete', 'EXC_BREAKPOINT')
+self.break_multi_thread('delete')
 
 # LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
 # i386 architectures.
@@ -48,7 +48,7 @@ def test_hw_break_set_delete_multi_thread_macos(self):
 def test_hw_break_set_disable_multi_thread_macos(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('disable', 'EXC_BREAKPOINT')
+self.break_multi_thread('disable')
 
 
 def setUp(self):
@@ -60,7 +60,7 @@ def setUp(self):
 self.first_stop = line_number(
 self.source, 'Starting thread creation with hardware breakpoint 
set')
 
-def break_multi_thread(self, removal_type, stop_reason):
+def break_multi_thread(self, removal_type):
 """Test that lldb hardware breakpoints work for multiple threads."""
 self.runCmd("file " + self.getBuildArtifact("a.out"),
 CURRENT_EXECUTABLE_SET)
@@ -95,7 +95,7 @@ def break_multi_thread(self, removal_type, 

[Lldb-commits] [PATCH] D73401: [ldb/Breakpoint] Recognize HW breakpoints as breakpoints instead of just mach exceptions.

2020-01-24 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Looks like a good change.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73401/new/

https://reviews.llvm.org/D73401



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


[Lldb-commits] [PATCH] D73389: [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 240350.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73389/new/

https://reviews.llvm.org/D73389

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/source/Breakpoint/BreakpointLocation.cpp


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -101,6 +101,10 @@
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
+self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
+
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
 


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -101,6 +101,10 @@
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 'hardware'])
+self.expect("breakpoint list -v", substrs=['function = hw_break_function', 'hardware = true'])
+
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73401: [ldb/Breakpoint] Recognize HW breakpoints as breakpoints instead of just mach exceptions.

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jasonmolenda.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D73401

Files:
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp

Index: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
===
--- lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -8,6 +8,7 @@
 
 #include "StopInfoMachException.h"
 
+#include "lldb/lldb-forward.h"
 
 #if defined(__APPLE__)
 // Needed for the EXC_RESOURCE interpretation macros
@@ -293,6 +294,44 @@
   return m_description.c_str();
 }
 
+static StopInfoSP GetStopInfoForHardwareBP(Thread , Target *target,
+   uint32_t exc_data_count,
+   uint64_t exc_sub_code,
+   uint64_t exc_sub_sub_code) {
+  // Try hardware watchpoint.
+  if (target) {
+// The exc_sub_code indicates the data break address.
+lldb::WatchpointSP wp_sp =
+target->GetWatchpointList().FindByAddress((lldb::addr_t)exc_sub_code);
+if (wp_sp && wp_sp->IsEnabled()) {
+  // Debugserver may piggyback the hardware index of the fired watchpoint
+  // in the exception data. Set the hardware index if that's the case.
+  if (exc_data_count >= 3)
+wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+  return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID());
+}
+  }
+
+  // Try hardware breakpoint.
+  ProcessSP process_sp(thread.GetProcess());
+  if (process_sp) {
+// The exc_sub_code indicates the data break address.
+lldb::BreakpointSiteSP bp_sp =
+process_sp->GetBreakpointSiteList().FindByAddress(
+(lldb::addr_t)exc_sub_code);
+if (bp_sp && bp_sp->IsEnabled()) {
+  // Debugserver may piggyback the hardware index of the fired breakpoint
+  // in the exception data. Set the hardware index if that's the case.
+  if (exc_data_count >= 3)
+bp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+  return StopInfo::CreateStopReasonWithBreakpointSiteID(thread,
+bp_sp->GetID());
+}
+  }
+
+  return nullptr;
+}
+
 StopInfoSP StopInfoMachException::CreateStopReasonWithMachException(
 Thread , uint32_t exc_type, uint32_t exc_data_count,
 uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
@@ -350,22 +389,10 @@
   is_actual_breakpoint = true;
   is_trace_if_actual_breakpoint_missing = true;
 } else {
-
-  // It's a watchpoint, then.
-  // The exc_sub_code indicates the data break address.
-  lldb::WatchpointSP wp_sp;
-  if (target)
-wp_sp = target->GetWatchpointList().FindByAddress(
-(lldb::addr_t)exc_sub_code);
-  if (wp_sp && wp_sp->IsEnabled()) {
-// Debugserver may piggyback the hardware index of the fired
-// watchpoint in the exception data. Set the hardware index if
-// that's the case.
-if (exc_data_count >= 3)
-  wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
-return StopInfo::CreateStopReasonWithWatchpointID(thread,
-  wp_sp->GetID());
-  }
+  if (StopInfoSP stop_info =
+  GetStopInfoForHardwareBP(thread, target, exc_data_count,
+   exc_sub_code, exc_sub_sub_code))
+return stop_info;
 }
   } else if (exc_code == 2 || // EXC_I386_BPT
  exc_code == 3)   // EXC_I386_BPTFLT
Index: lldb/source/Breakpoint/BreakpointSite.cpp
===
--- lldb/source/Breakpoint/BreakpointSite.cpp
+++ lldb/source/Breakpoint/BreakpointSite.cpp
@@ -156,6 +156,13 @@
   }
 }
 
+void BreakpointSite::SetHardwareIndex(uint32_t index) {
+  std::lock_guard guard(m_owners_mutex);
+  for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) {
+loc_sp->SetHardwareIndex(index);
+  }
+}
+
 bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size,
  lldb::addr_t *intersect_addr,
  size_t *intersect_size,
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

jingham wrote:
> mib wrote:
> > friss wrote:
> > > mib wrote:
> > > > JDevlieghere wrote:
> > > > > Magic value? Why 10?
> > > > Pretty much. In the beginning I was unwinding the entire stack. But if 
> > > > there is too much frames (i.e. recursion) this would take too much 
> > > > time. We agreed with @friss and @jingham to unwind up to 10 frames at 
> > > > most.
> > > > 
> > > > Can you think of a better way to do it ?
> > > I don't think that's exactly what I said. My opinion was that asserts 
> > > will have a pretty deterministic layout, and that we should know exactly 
> > > what to unwind to determine whether we have an assert or not.
> > > 
> > > In your test, you actually check that the frame with the assert is frame 
> > > 4. If it is anything other then 4 in any configuration, then the test 
> > > will fail. You might as well just put 4 in the code here rather than a 
> > > magical 10.
> > The number of frames to unwind is different depending on the platform. I 
> > chose 10 to give us some extra margin but I'll change it to 4 or 5,
> We want this as small as will do the job - since we don't want to unwind more 
> than necessary.  But we aren't going to do this unwinding on every stop - 
> only when we actually see a thread with frame 0 in __pthread_kill (or 
> whatever the system kill is).  So we don't need to over optimize.  It would 
> be silly to go have to fix this because some platform added another layer 
> between assert and kill.
> 
> I'd go see what it is on all the Unixes we know about and add a couple to 
> future proof it.
> 
> The test should definitely not depend on how many frames there are between 
> the assert and the _pthread_kill.  It should just check that the currently 
> selected frame has the right file & line number.  If you want to keep this a 
> shell test, you could backtrace the thread and make sure the * is on the line 
> with "assert.c", or maybe try:
> 
> ```
> (lldb) source info
> Lines found in module `killme
> [0x00010f2e-0x00010f6f): /tmp/assert.c:7:3
> 
> ```
> 
> If the frame wasn't selected properly this will show:
> 
> 
> ```
> (lldb) source info
> error: No debug info for the selected frame.
> 
> ```
Actually, the test you have is fine if you just leave out the "4".  You really 
only care about the "assert.c".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D69273: ValueObject: Fix a crash related to children address type computation

2020-01-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D69273#1765235 , @davide wrote:

> We've been off all the past week. I'll circle back with Jim about this once I 
> get to the office.


Sorry, I've been busy with other things.

In answer to Pavel's direct question "What did we do about the swift crashes" 
the current answer is "we backed out the patch from the swift-lldb sources".  
But that's clearly not the good answer...

The thing that's surprising about the crash in the swift testsuite is that it 
happens because, in the process of building the dynamic ValueObject of the 
synthetic child for the expression result ValueObject for a simple swift 
expression, with this code in place one of the Values we are using that is in 
fact a load address type gets mislabeled as a host address, and then we crash 
accessing it in our address space.  IIUC, that's of the opposite of what this 
patch was trying to do...

BTW, I also think this patch is formally wrong for const result objects, 
because once the stop ID has moved on, const result object values should never 
be converted back to load address types.  They are supposed to represent the 
state at the time of the capture, so checking the state of the process after 
that time can't be right.  But that wasn't the failure we were seeing in the 
Swift testsuite.

ConstResult objects are still implicated in this crash, because "expr var" 
crashes but "frame var" for this swift variable works.  The difference between 
the two cases is that in the succeeding case the root ValueObject is a 
ValueObjectVariable, and in the crashing case a ValueObjectConstResult.   But 
it doesn't have to do with the const result getting into an inconsistent state 
because it updates itself when it shouldn't.  It seems like there's just 
something in the logic of UpdateChildrenAddressType that is wrong for 
ValueObjectConstResult.  But it seems to take a fairly complex chain of values 
- ConstResult->ConstResultChild->SyntheticValue->DynamicValue to trigger the 
crash, and the crash is actually in getting the backing data for a 
ValueObjectDynamicValue...

It will take me some more head scratching to figure out why this is going wrong 
but I'm currently in the process of hastening my eventual balding.  Hopefully, 
once I've figured that out I can get a fix and if I'm lucky a C/C++ based test 
case that shows the same error.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69273/new/

https://reviews.llvm.org/D69273



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


[Lldb-commits] [PATCH] D73389: [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

2020-01-24 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73389/new/

https://reviews.llvm.org/D73389



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


[Lldb-commits] [PATCH] D73384: [lldb/Lit] Change the lldbtest format to behave more like shell test.

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe3a7c7713cd8: [lldb/Lit] Change the lldbtest format to 
behave more like shell test. (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73384/new/

https://reviews.llvm.org/D73384

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@
 shutil.copy(python, copied_python)
 cmd[0] = copied_python
 
+timeoutInfo = None
 try:
 out, err, exitCode = lit.util.executeCommand(
 cmd,
 env=test.config.environment,
 timeout=litConfig.maxIndividualTestTime)
 except lit.util.ExecuteCommandTimeoutException:
-return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-litConfig.maxIndividualTestTime))
+timeoutInfo = 'Reached timeout of {} seconds'.format(
+litConfig.maxIndividualTestTime)
+
+output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+' '.join(cmd), exitCode)
+if timeoutInfo is not None:
+output += """Timeout: %s\n""" % (timeoutInfo,)
+output += "\n"
+
+if out:
+output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+if err:
+output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+if timeoutInfo:
+return lit.Test.TIMEOUT, output
 
 if exitCode:
 # Match FAIL but not XFAIL.
 for line in out.splitlines() + err.splitlines():
 if line.startswith('FAIL:'):
-return lit.Test.FAIL, out + err
+return lit.Test.FAIL, output
 
 if 'XPASS:' in out or 'XPASS:' in err:
-return lit.Test.XPASS, out + err
+return lit.Test.XPASS, output
 
 has_unsupported_tests = 'UNSUPPORTED:' in out or 'UNSUPPORTED:' in err
 has_passing_tests = 'PASS:' in out or 'PASS:' in err
 if has_unsupported_tests and not has_passing_tests:
-return lit.Test.UNSUPPORTED, out + err
+return lit.Test.UNSUPPORTED, output
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
-msg = ('Unable to find %r in dotest output (exit code %d):\n\n%s%s'
-   % (passing_test_line, exitCode, out, err))
-return lit.Test.UNRESOLVED, msg
+return lit.Test.UNRESOLVED, output
 
-return lit.Test.PASS, ''
+return lit.Test.PASS, output


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@
 shutil.copy(python, copied_python)
 cmd[0] = copied_python
 
+timeoutInfo = None
 try:
 out, err, exitCode = lit.util.executeCommand(
 cmd,
 env=test.config.environment,
 timeout=litConfig.maxIndividualTestTime)
 except lit.util.ExecuteCommandTimeoutException:
-return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-litConfig.maxIndividualTestTime))
+timeoutInfo = 'Reached timeout of {} seconds'.format(
+litConfig.maxIndividualTestTime)
+
+output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+' '.join(cmd), exitCode)
+if timeoutInfo is not None:
+output += """Timeout: %s\n""" % (timeoutInfo,)
+output += "\n"
+
+if out:
+output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+if err:
+output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+if timeoutInfo:
+return lit.Test.TIMEOUT, output
 
 if exitCode:
 # Match FAIL but not XFAIL.
 for line in out.splitlines() + err.splitlines():
 if line.startswith('FAIL:'):
-return lit.Test.FAIL, out + err
+return lit.Test.FAIL, output
 
 if 'XPASS:' in out or 'XPASS:' in err:
-return lit.Test.XPASS, out + err
+return lit.Test.XPASS, output
 
 has_unsupported_tests = 'UNSUPPORTED:' in out or 'UNSUPPORTED:' in err
 has_passing_tests = 'PASS:' in out or 'PASS:' in err
 if has_unsupported_tests and not has_passing_tests:
-return lit.Test.UNSUPPORTED, out + err
+return lit.Test.UNSUPPORTED, output
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
-   

[Lldb-commits] [lldb] e3a7c77 - [lldb/Lit] Change the lldbtest format to behave more like shell test.

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T16:17:55-08:00
New Revision: e3a7c7713cd87e37a95a544373cd21f6f06ab94e

URL: 
https://github.com/llvm/llvm-project/commit/e3a7c7713cd87e37a95a544373cd21f6f06ab94e
DIFF: 
https://github.com/llvm/llvm-project/commit/e3a7c7713cd87e37a95a544373cd21f6f06ab94e.diff

LOG: [lldb/Lit] Change the lldbtest format to behave more like shell test.

The current lldbtest format has a number of shortcomings, all related to
how we omit information based on why the test fails. For example, a
successful test would print nothing, even when `-a` is passed to lit.
It's not up to the test format to decide whether to print something or
not, that's handled by lit itself. For other test results we would
sometimes print stdout & stderr, but not always, such as when a timeout
was reached or we couldn't parse the dotest output.

This patch changes the lldbtest format and makes it behave more like
lit. We now always print the dotest invocation, the exit code, the
output to stdout & stderr. If you're used to dealing with ShTests in
lit, this will feel all very familiar.

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

Added: 


Modified: 
lldb/test/API/lldbtest.py

Removed: 




diff  --git a/lldb/test/API/lldbtest.py b/lldb/test/API/lldbtest.py
index 349a67f22fb3..864d5ea1df03 100644
--- a/lldb/test/API/lldbtest.py
+++ b/lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@ def execute(self, test, litConfig):
 shutil.copy(python, copied_python)
 cmd[0] = copied_python
 
+timeoutInfo = None
 try:
 out, err, exitCode = lit.util.executeCommand(
 cmd,
 env=test.config.environment,
 timeout=litConfig.maxIndividualTestTime)
 except lit.util.ExecuteCommandTimeoutException:
-return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-litConfig.maxIndividualTestTime))
+timeoutInfo = 'Reached timeout of {} seconds'.format(
+litConfig.maxIndividualTestTime)
+
+output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+' '.join(cmd), exitCode)
+if timeoutInfo is not None:
+output += """Timeout: %s\n""" % (timeoutInfo,)
+output += "\n"
+
+if out:
+output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+if err:
+output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+if timeoutInfo:
+return lit.Test.TIMEOUT, output
 
 if exitCode:
 # Match FAIL but not XFAIL.
 for line in out.splitlines() + err.splitlines():
 if line.startswith('FAIL:'):
-return lit.Test.FAIL, out + err
+return lit.Test.FAIL, output
 
 if 'XPASS:' in out or 'XPASS:' in err:
-return lit.Test.XPASS, out + err
+return lit.Test.XPASS, output
 
 has_unsupported_tests = 'UNSUPPORTED:' in out or 'UNSUPPORTED:' in err
 has_passing_tests = 'PASS:' in out or 'PASS:' in err
 if has_unsupported_tests and not has_passing_tests:
-return lit.Test.UNSUPPORTED, out + err
+return lit.Test.UNSUPPORTED, output
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
-msg = ('Unable to find %r in dotest output (exit code %d):\n\n%s%s'
-   % (passing_test_line, exitCode, out, err))
-return lit.Test.UNRESOLVED, msg
+return lit.Test.UNRESOLVED, output
 
-return lit.Test.PASS, ''
+return lit.Test.PASS, output



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


[Lldb-commits] [PATCH] D73389: [lldb/Breakpoint] Include whether or not a breakpoint is a HW BP

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, jingham.
Herald added a project: LLDB.

Include whether or not a breakpoint is a hardware breakpoint in the breakpoint 
list.

  (lldb) breakpoint list
  Current breakpoints:
  1: name = 'main', locations = 1, resolved = 1, hit count = 0
1.1: where = a.out`main + 15 at :18:10, address = 
0x00010f9f, resolved, hardware, hit count = 0
  
  (lldb) breakpoint list -v
  Current breakpoints:
  1: name = 'main'
  1.1:
module = /Volumes/Jonas/llvm/build-ra/a.out
compile unit = -
function = main
location = /Volumes/Jonas/llvm/build-ra/:18:10
address = 0x00010f9f
resolved = true
hardware = true
hit count = 0


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D73389

Files:
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/source/Breakpoint/BreakpointLocation.cpp


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -84,6 +84,10 @@
 'hw_break_function',
 'address = 0x'])
 
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 
'hardware'])
+self.expect("breakpoint list -v", substrs=['function = 
hw_break_function', 'hardware = true'])
+
 # We should stop in hw_break_function function for 4 threads.
 count = 0
 
Index: lldb/include/lldb/Breakpoint/StoppointLocation.h
===
--- lldb/include/lldb/Breakpoint/StoppointLocation.h
+++ lldb/include/lldb/Breakpoint/StoppointLocation.h
@@ -41,7 +41,7 @@
   bool HardwareRequired() const { return m_hardware; }
 
   virtual bool IsHardware() const {
-return m_hardware_index != LLDB_INVALID_INDEX32;
+return m_hardware;
   }
 
   virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }


Index: lldb/source/Breakpoint/BreakpointLocation.cpp
===
--- lldb/source/Breakpoint/BreakpointLocation.cpp
+++ lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -597,7 +597,8 @@
 s->EOL();
 s->Indent();
 s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
-
+s->Indent();
+s->Printf("hardware = %s\n", IsHardware() ? "true" : "false");
 s->Indent();
 s->Printf("hit count = %-4u\n", GetHitCount());
 
@@ -608,8 +609,8 @@
 }
 s->IndentLess();
   } else if (level != eDescriptionLevelInitial) {
-s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
-  GetHitCount());
+s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"),
+  (IsHardware() ? "hardware, " : ""), GetHitCount());
 if (m_options_up) {
   m_options_up->GetDescription(s, level);
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -84,6 +84,10 @@
 

[Lldb-commits] [PATCH] D71313: [AST] Split parent map traversal logic into ParentMapContext.h

2020-01-24 Thread Stephen Kelly via Phabricator via lldb-commits
steveire added a comment.

Should this new class have some tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71313/new/

https://reviews.llvm.org/D71313



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


[Lldb-commits] [PATCH] D73384: [lldb/Lit] Change the lldbtest format to behave more like shell test.

2020-01-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision as: vsk.
vsk added a comment.
This revision is now accepted and ready to land.

Nice!


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73384/new/

https://reviews.llvm.org/D73384



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


[Lldb-commits] [PATCH] D72981: [debugserver] Unify the breakpoint/watchpoint interface (NFCI)

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9902c8e3c661: [lldb/debugserver] Unify the 
breakpoint/watchpoint interface (NFCI) (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72981/new/

https://reviews.llvm.org/D72981

Files:
  lldb/tools/debugserver/source/DNBArch.h
  lldb/tools/debugserver/source/MacOSX/MachThread.cpp
  lldb/tools/debugserver/source/MacOSX/MachThread.h
  lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
  lldb/tools/debugserver/source/MacOSX/MachThreadList.h

Index: lldb/tools/debugserver/source/MacOSX/MachThreadList.h
===
--- lldb/tools/debugserver/source/MacOSX/MachThreadList.h
+++ lldb/tools/debugserver/source/MacOSX/MachThreadList.h
@@ -86,9 +86,11 @@
   enum class HardwareBreakpointAction {
 EnableWatchpoint,
 DisableWatchpoint,
+EnableBreakpoint,
+DisableBreakpoint,
   };
 
-  uint32_t DoHardwareBreakpointAction(const DNBBreakpoint *wp,
+  uint32_t DoHardwareBreakpointAction(const DNBBreakpoint *bp,
   HardwareBreakpointAction action) const;
 
   uint32_t UpdateThreadList(MachProcess *process, bool update,
Index: lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
===
--- lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
+++ lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
@@ -483,28 +483,9 @@
   }
 }
 
-uint32_t
-MachThreadList::EnableHardwareBreakpoint(const DNBBreakpoint *bp) const {
-  if (bp != NULL) {
-const size_t num_threads = m_threads.size();
-for (uint32_t idx = 0; idx < num_threads; ++idx)
-  m_threads[idx]->EnableHardwareBreakpoint(bp);
-  }
-  return INVALID_NUB_HW_INDEX;
-}
-
-bool MachThreadList::DisableHardwareBreakpoint(const DNBBreakpoint *bp) const {
-  if (bp != NULL) {
-const size_t num_threads = m_threads.size();
-for (uint32_t idx = 0; idx < num_threads; ++idx)
-  m_threads[idx]->DisableHardwareBreakpoint(bp);
-  }
-  return false;
-}
-
 uint32_t MachThreadList::DoHardwareBreakpointAction(
-const DNBBreakpoint *wp, HardwareBreakpointAction action) const {
-  if (wp == NULL)
+const DNBBreakpoint *bp, HardwareBreakpointAction action) const {
+  if (bp == NULL)
 return INVALID_NUB_HW_INDEX;
 
   uint32_t hw_index = INVALID_NUB_HW_INDEX;
@@ -517,11 +498,18 @@
   for (uint32_t idx = 0; idx < num_threads; ++idx) {
 switch (action) {
 case HardwareBreakpointAction::EnableWatchpoint:
-  hw_index = m_threads[idx]->EnableHardwareWatchpoint(wp, also_set_on_task);
+  hw_index = m_threads[idx]->EnableHardwareWatchpoint(bp, also_set_on_task);
   break;
 case HardwareBreakpointAction::DisableWatchpoint:
   hw_index =
-  m_threads[idx]->DisableHardwareWatchpoint(wp, also_set_on_task);
+  m_threads[idx]->DisableHardwareWatchpoint(bp, also_set_on_task);
+  break;
+case HardwareBreakpointAction::EnableBreakpoint:
+  hw_index = m_threads[idx]->EnableHardwareBreakpoint(bp, also_set_on_task);
+  break;
+case HardwareBreakpointAction::DisableBreakpoint:
+  hw_index =
+  m_threads[idx]->DisableHardwareBreakpoint(bp, also_set_on_task);
   break;
 }
 if (hw_index == INVALID_NUB_HW_INDEX) {
@@ -554,6 +542,18 @@
  INVALID_NUB_HW_INDEX;
 }
 
+uint32_t
+MachThreadList::EnableHardwareBreakpoint(const DNBBreakpoint *bp) const {
+  return DoHardwareBreakpointAction(bp,
+HardwareBreakpointAction::EnableBreakpoint);
+}
+
+bool MachThreadList::DisableHardwareBreakpoint(const DNBBreakpoint *bp) const {
+  return DoHardwareBreakpointAction(
+ bp, HardwareBreakpointAction::DisableBreakpoint) !=
+ INVALID_NUB_HW_INDEX;
+}
+
 uint32_t MachThreadList::NumSupportedHardwareWatchpoints() const {
   PTHREAD_MUTEX_LOCKER(locker, m_threads_mutex);
   const size_t num_threads = m_threads.size();
Index: lldb/tools/debugserver/source/MacOSX/MachThread.h
===
--- lldb/tools/debugserver/source/MacOSX/MachThread.h
+++ lldb/tools/debugserver/source/MacOSX/MachThread.h
@@ -66,10 +66,12 @@
   uint64_t GetSP(uint64_t failValue = INVALID_NUB_ADDRESS); // Get stack pointer
 
   DNBBreakpoint *CurrentBreakpoint();
-  uint32_t EnableHardwareBreakpoint(const DNBBreakpoint *breakpoint);
+  uint32_t EnableHardwareBreakpoint(const DNBBreakpoint *breakpoint,
+bool also_set_on_task);
   uint32_t EnableHardwareWatchpoint(const DNBBreakpoint *watchpoint,
 bool also_set_on_task);
-  bool DisableHardwareBreakpoint(const DNBBreakpoint *breakpoint);
+  bool DisableHardwareBreakpoint(const DNBBreakpoint *breakpoint,
+ bool also_set_on_task);
   bool 

[Lldb-commits] [PATCH] D72985: [lldb/debugserver] Implement hardware breakpoints for x86_64 and i386

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG96f3ea0d21b4: [lldb/debugserver] Implement hardware 
breakpoints for x86_64 and i386 (authored by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D72985?vs=238964=240307#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72985/new/

https://reviews.llvm.org/D72985

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
  lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
  lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
  lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
  lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
  lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
  lldb/tools/debugserver/source/RNBRemote.cpp

Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -279,12 +279,10 @@
  "x", "Read data from memory"));
   t.push_back(Packet(write_data_to_memory, ::HandlePacket_X, NULL,
  "X", "Write data to memory"));
-  //  t.push_back (Packet (insert_hardware_bp,
-  //  ::HandlePacket_UNIMPLEMENTED, NULL, "Z1", "Insert hardware
-  //  breakpoint"));
-  //  t.push_back (Packet (remove_hardware_bp,
-  //  ::HandlePacket_UNIMPLEMENTED, NULL, "z1", "Remove hardware
-  //  breakpoint"));
+  t.push_back(Packet(insert_hardware_bp, ::HandlePacket_z, NULL, "Z1",
+ "Insert hardware breakpoint"));
+  t.push_back(Packet(remove_hardware_bp, ::HandlePacket_z, NULL, "z1",
+ "Remove hardware breakpoint"));
   t.push_back(Packet(insert_write_watch_bp, ::HandlePacket_z, NULL,
  "Z2", "Insert write watchpoint"));
   t.push_back(Packet(remove_write_watch_bp, ::HandlePacket_z, NULL,
Index: lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
===
--- lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
+++ lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
@@ -50,7 +50,13 @@
   virtual bool ThreadDidStop();
   virtual bool NotifyException(MachException::Data );
 
+  virtual uint32_t NumSupportedHardwareBreakpoints();
   virtual uint32_t NumSupportedHardwareWatchpoints();
+
+  virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
+bool also_set_on_task);
+  virtual bool DisableHardwareBreakpoint(uint32_t hw_break_index,
+ bool also_set_on_task);
   virtual uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size,
 bool read, bool write,
 bool also_set_on_task);
@@ -213,6 +219,9 @@
 
   static uint32_t GetRegisterContextSize();
 
+  static void SetHardwareBreakpoint(DBG _state, uint32_t hw_index,
+nub_addr_t addr, nub_size_t size);
+
   // Helper functions for watchpoint manipulations.
   static void SetWatchpoint(DBG _state, uint32_t hw_index,
 nub_addr_t addr, nub_size_t size, bool read,
Index: lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -679,6 +679,12 @@
   return 4;
 }
 
+uint32_t DNBArchImplX86_64::NumSupportedHardwareBreakpoints() {
+  DNBLogThreadedIf(LOG_BREAKPOINTS,
+   "DNBArchImplX86_64::NumSupportedHardwareBreakpoints");
+  return 4;
+}
+
 static uint32_t size_and_rw_bits(nub_size_t size, bool read, bool write) {
   uint32_t rw;
   if (read) {
@@ -853,6 +859,153 @@
   return m_2pc_dbg_checkpoint;
 }
 
+void DNBArchImplX86_64::SetHardwareBreakpoint(DBG _state,
+  uint32_t hw_index,
+  nub_addr_t addr,
+  nub_size_t size) {
+  // Set both dr7 (debug control register) and dri (debug address register).
+
+  // dr7{7-0} encodes the local/gloabl enable bits:
+  //  global enable --. .-- local enable
+  //  | |
+  //  v v
+  //  dr0 -> bits{1-0}
+  //  dr1 -> bits{3-2}
+  //  dr2 -> bits{5-4}
+  //  dr3 -> bits{7-6}
+  //
+  // dr7{31-16} encodes the rw/len bits:
+  //  b_x+3, b_x+2, b_x+1, b_x
+  //  where bits{x+1, x} => rw
+  //0b00: execute, 0b01: write, 0b11: read-or-write, 0b10: io

[Lldb-commits] [lldb] 96f3ea0 - [lldb/debugserver] Implement hardware breakpoints for x86_64 and i386

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T15:07:31-08:00
New Revision: 96f3ea0d21b48ca088355db10d4d1a2e9bc9f884

URL: 
https://github.com/llvm/llvm-project/commit/96f3ea0d21b48ca088355db10d4d1a2e9bc9f884
DIFF: 
https://github.com/llvm/llvm-project/commit/96f3ea0d21b48ca088355db10d4d1a2e9bc9f884.diff

LOG: [lldb/debugserver] Implement hardware breakpoints for x86_64 and i386

This implements hardware breakpoints for x86_64 and i386 in debugserver.
It's based on Pedro's patch sent to lldb-commits [1] although most of it
is the same as the existing hardware watchpoint implementation.

[1] 
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20200113/060327.html

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index 56112b24eb52..16c63b9ced1c 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -9,26 +9,47 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-# Hardware breakpoints are supported only by platforms mentioned in oslist.
-@skipUnlessPlatform(oslist=['linux'])
 class HardwareBreakpointMultiThreadTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 mydir = TestBase.compute_mydir(__file__)
 
-# LLDB supports hardware breakpoints for arm and aarch64 architectures.
+# LLDB on linux supports hardware breakpoints for arm and aarch64
+# architectures.
+@skipUnlessPlatform(oslist=['linux'])
 @skipIf(archs=no_match(['arm', 'aarch64']))
-def test_hw_break_set_delete_multi_thread(self):
+def test_hw_break_set_delete_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('delete')
+self.break_multi_thread('delete', 'breakpoint')
 
-# LLDB supports hardware breakpoints for arm and aarch64 architectures.
+# LLDB on linux supports hardware breakpoints for arm and aarch64
+# architectures.
+@skipUnlessPlatform(oslist=['linux'])
 @skipIf(archs=no_match(['arm', 'aarch64']))
-def test_hw_break_set_disable_multi_thread(self):
+def test_hw_break_set_disable_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
-self.break_multi_thread('disable')
+self.break_multi_thread('disable', 'breakpoint')
+
+# LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
+# i386 architectures.
+@skipUnlessDarwin
+@skipIfOutOfTreeDebugserver
+def test_hw_break_set_delete_multi_thread_macos(self):
+self.build()
+self.setTearDownCleanup()
+self.break_multi_thread('delete', 'EXC_BREAKPOINT')
+
+# LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
+# i386 architectures.
+@skipUnlessDarwin
+@skipIfOutOfTreeDebugserver
+def test_hw_break_set_disable_multi_thread_macos(self):
+self.build()
+self.setTearDownCleanup()
+self.break_multi_thread('disable', 'EXC_BREAKPOINT')
+
 
 def setUp(self):
 # Call super's setUp().
@@ -39,7 +60,7 @@ def setUp(self):
 self.first_stop = line_number(
 self.source, 'Starting thread creation with hardware breakpoint 
set')
 
-def break_multi_thread(self, removal_type):
+def break_multi_thread(self, removal_type, stop_reason):
 """Test that lldb hardware breakpoints work for multiple threads."""
 self.runCmd("file " + self.getBuildArtifact("a.out"),
 CURRENT_EXECUTABLE_SET)
@@ -54,8 +75,7 @@ def break_multi_thread(self, removal_type):
 # We should be stopped again due to the breakpoint.
 # The stop reason of the thread should be breakpoint.
 self.expect("thread list", 

[Lldb-commits] [lldb] 9902c8e - [lldb/debugserver] Unify the breakpoint/watchpoint interface (NFCI)

2020-01-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-24T15:07:31-08:00
New Revision: 9902c8e3c6615185a8a00325fa4671c63b61d535

URL: 
https://github.com/llvm/llvm-project/commit/9902c8e3c6615185a8a00325fa4671c63b61d535
DIFF: 
https://github.com/llvm/llvm-project/commit/9902c8e3c6615185a8a00325fa4671c63b61d535.diff

LOG: [lldb/debugserver] Unify the breakpoint/watchpoint interface (NFCI)

Unify the interface for enabling and disabling breakpoints with their
watchpoint counterpart. This allows both to go through
DoHardwareBreakpointAction.

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

Added: 


Modified: 
lldb/tools/debugserver/source/DNBArch.h
lldb/tools/debugserver/source/MacOSX/MachThread.cpp
lldb/tools/debugserver/source/MacOSX/MachThread.h
lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/tools/debugserver/source/MacOSX/MachThreadList.h

Removed: 




diff  --git a/lldb/tools/debugserver/source/DNBArch.h 
b/lldb/tools/debugserver/source/DNBArch.h
index 03b6b60ed86d..d46aa673a362 100644
--- a/lldb/tools/debugserver/source/DNBArch.h
+++ b/lldb/tools/debugserver/source/DNBArch.h
@@ -78,7 +78,8 @@ class DNBArchProtocol {
   virtual bool NotifyException(MachException::Data ) { return false; }
   virtual uint32_t NumSupportedHardwareBreakpoints() { return 0; }
   virtual uint32_t NumSupportedHardwareWatchpoints() { return 0; }
-  virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size) {
+  virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
+bool also_set_on_task) {
 return INVALID_NUB_HW_INDEX;
   }
   virtual uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size,
@@ -86,7 +87,10 @@ class DNBArchProtocol {
 bool also_set_on_task) {
 return INVALID_NUB_HW_INDEX;
   }
-  virtual bool DisableHardwareBreakpoint(uint32_t hw_index) { return false; }
+  virtual bool DisableHardwareBreakpoint(uint32_t hw_index,
+ bool also_set_on_task) {
+return false;
+  }
   virtual bool DisableHardwareWatchpoint(uint32_t hw_index,
  bool also_set_on_task) {
 return false;

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp 
b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
index 80d6042caa59..d2423a5decaa 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
@@ -534,9 +534,12 @@ bool MachThread::RestoreRegisterState(uint32_t save_id) {
   return m_arch_up->RestoreRegisterState(save_id);
 }
 
-uint32_t MachThread::EnableHardwareBreakpoint(const DNBBreakpoint *bp) {
-  if (bp != NULL && bp->IsBreakpoint())
-return m_arch_up->EnableHardwareBreakpoint(bp->Address(), bp->ByteSize());
+uint32_t MachThread::EnableHardwareBreakpoint(const DNBBreakpoint *bp,
+  bool also_set_on_task) {
+  if (bp != NULL && bp->IsBreakpoint()) {
+return m_arch_up->EnableHardwareBreakpoint(bp->Address(), bp->ByteSize(),
+   also_set_on_task);
+  }
   return INVALID_NUB_HW_INDEX;
 }
 
@@ -555,9 +558,12 @@ bool MachThread::RollbackTransForHWP() {
 
 bool MachThread::FinishTransForHWP() { return m_arch_up->FinishTransForHWP(); }
 
-bool MachThread::DisableHardwareBreakpoint(const DNBBreakpoint *bp) {
-  if (bp != NULL && bp->IsHardware())
-return m_arch_up->DisableHardwareBreakpoint(bp->GetHardwareIndex());
+bool MachThread::DisableHardwareBreakpoint(const DNBBreakpoint *bp,
+   bool also_set_on_task) {
+  if (bp != NULL && bp->IsHardware()) {
+return m_arch_up->DisableHardwareBreakpoint(bp->GetHardwareIndex(),
+also_set_on_task);
+  }
   return false;
 }
 

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachThread.h 
b/lldb/tools/debugserver/source/MacOSX/MachThread.h
index 1634522fde49..cbcd94ea5765 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.h
@@ -66,10 +66,12 @@ class MachThread {
   uint64_t GetSP(uint64_t failValue = INVALID_NUB_ADDRESS); // Get stack 
pointer
 
   DNBBreakpoint *CurrentBreakpoint();
-  uint32_t EnableHardwareBreakpoint(const DNBBreakpoint *breakpoint);
+  uint32_t EnableHardwareBreakpoint(const DNBBreakpoint *breakpoint,
+bool also_set_on_task);
   uint32_t EnableHardwareWatchpoint(const DNBBreakpoint *watchpoint,
 bool also_set_on_task);
-  bool DisableHardwareBreakpoint(const DNBBreakpoint *breakpoint);
+  bool DisableHardwareBreakpoint(const DNBBreakpoint *breakpoint,
+ bool also_set_on_task);
   bool 

[Lldb-commits] [PATCH] D73384: [lldb/Lit] Change the lldbtest format to behave more like shell test.

2020-01-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, labath.
Herald added a subscriber: abidh.
Herald added a project: LLDB.

The current lldbtest format has a number of shortcomings, all related to how we 
omit information based on why the test fails. For example, a successful test 
would print nothing, even when `-a` is passed to lit. It's not up to the test 
format to decide whether to print something or not, that's handled by lit 
itself. For other test results we would sometimes print stdout and stderr, but 
sometimes we would forget, such as when a timeout was reached or we couldn't 
parse the dotest output.

This patch changes the lldbtest format and makes it behave more like lit. We 
now always print the dotest invocation, the exit code, the output to stdout & 
stderr. If you're used to dealing with ShTests in lit, this will feel all very 
familiar.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D73384

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@
 shutil.copy(python, copied_python)
 cmd[0] = copied_python
 
+timeoutInfo = None
 try:
 out, err, exitCode = lit.util.executeCommand(
 cmd,
 env=test.config.environment,
 timeout=litConfig.maxIndividualTestTime)
 except lit.util.ExecuteCommandTimeoutException:
-return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-litConfig.maxIndividualTestTime))
+timeoutInfo = 'Reached timeout of {} seconds'.format(
+litConfig.maxIndividualTestTime)
+
+output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+' '.join(cmd), exitCode)
+if timeoutInfo is not None:
+output += """Timeout: %s\n""" % (timeoutInfo,)
+output += "\n"
+
+if out:
+output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+if err:
+output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+if timeoutInfo:
+return lit.Test.TIMEOUT, output
 
 if exitCode:
 # Match FAIL but not XFAIL.
 for line in out.splitlines() + err.splitlines():
 if line.startswith('FAIL:'):
-return lit.Test.FAIL, out + err
+return lit.Test.FAIL, output
 
 if 'XPASS:' in out or 'XPASS:' in err:
-return lit.Test.XPASS, out + err
+return lit.Test.XPASS, output
 
 has_unsupported_tests = 'UNSUPPORTED:' in out or 'UNSUPPORTED:' in err
 has_passing_tests = 'PASS:' in out or 'PASS:' in err
 if has_unsupported_tests and not has_passing_tests:
-return lit.Test.UNSUPPORTED, out + err
+return lit.Test.UNSUPPORTED, output
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
-msg = ('Unable to find %r in dotest output (exit code %d):\n\n%s%s'
-   % (passing_test_line, exitCode, out, err))
-return lit.Test.UNRESOLVED, msg
+return lit.Test.UNRESOLVED, output
 
-return lit.Test.PASS, ''
+return lit.Test.PASS, output


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@
 shutil.copy(python, copied_python)
 cmd[0] = copied_python
 
+timeoutInfo = None
 try:
 out, err, exitCode = lit.util.executeCommand(
 cmd,
 env=test.config.environment,
 timeout=litConfig.maxIndividualTestTime)
 except lit.util.ExecuteCommandTimeoutException:
-return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-litConfig.maxIndividualTestTime))
+timeoutInfo = 'Reached timeout of {} seconds'.format(
+litConfig.maxIndividualTestTime)
+
+output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+' '.join(cmd), exitCode)
+if timeoutInfo is not None:
+output += """Timeout: %s\n""" % (timeoutInfo,)
+output += "\n"
+
+if out:
+output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+if err:
+output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+if timeoutInfo:
+return lit.Test.TIMEOUT, output
 
 if exitCode:
 # Match FAIL but not XFAIL.
 for line in out.splitlines() + err.splitlines():
 if line.startswith('FAIL:'):
-return lit.Test.FAIL, out + err
+return 

[Lldb-commits] [PATCH] D72981: [debugserver] Unify the breakpoint/watchpoint interface (NFCI)

2020-01-24 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72981/new/

https://reviews.llvm.org/D72981



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


[Lldb-commits] [PATCH] D72985: [lldb/debugserver] Implement hardware breakpoints for x86_64 and i386

2020-01-24 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Sorry for the delay, looks good to me.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72985/new/

https://reviews.llvm.org/D72985



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 240292.
mstorsjo added a comment.

I tried doing the other alternative; now we primarily touch up the values in 
DWARFDebugInfoEntry::GetAttributeAddressRange(s) and 
DWARFDebugInfoEntry::GetDIENamesAndRanges. This variant feels fairly concise 
and consistent.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/include/lldb/Symbol/LineTable.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/include/lldb/Utility/RangeMap.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/source/Symbol/LineTable.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s

Index: lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s
@@ -0,0 +1,183 @@
+# Test that a linked windows executable, with a thumb bit in many address
+# fields, gets the thumb bit stripped out from addresses.
+
+# If the thumb bit isn't stripped out from subprogram ranges, 0x401006 is
+# associated with the function "entry", while it actually is the start of
+# the function "other".
+# If the thumb bit isn't stripped out from line tables, the LineEntry
+# points to the wrong line.
+
+# REQUIRES: lld, arm
+
+# RUN: llvm-mc -triple armv7-windows-gnu %s -filetype=obj > %t.o
+# RUN: lld-link %t.o -out:%t.exe -debug:dwarf -entry:entry -subsystem:console -lldmingw
+# RUN: %lldb %t.exe -o "image lookup -v -a 0x401006" -b | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -a 0x401006
+# CHECK: Function: {{.*}}, name = "other", range = [0x00401006-0x0040100c)
+# CHECK: LineEntry: [0x00401006-0x0040100a): /path/to/src/dwarf-thumb.c:7:12
+
+.text
+.syntax unified
+.file   "dwarf-thumb.c"
+.file   1 "" "dwarf-thumb.c"
+.def entry;
+.scl2;
+.type   32;
+.endef
+.globl  entry   @ -- Begin function entry
+.p2align1
+.code   16  @ @entry
+.thumb_func
+entry:
+.Lfunc_begin0:
+.loc1 2 0   @ dwarf-thumb.c:2:0
+.cfi_sections .debug_frame
+.cfi_startproc
+.loc1 4 9 prologue_end  @ dwarf-thumb.c:4:9
+mov r1, r0
+.Ltmp0:
+b   other
+.Ltmp1:
+.Lfunc_end0:
+.cfi_endproc
+@ -- End function
+.def other;
+.scl2;
+.type   32;
+.endef
+.globl  other   @ -- Begin function other
+.p2align1
+.code   16  @ @other
+.thumb_func
+other:
+.Lfunc_begin1:
+.loc1 6 0   @ dwarf-thumb.c:6:0
+.cfi_startproc
+.loc1 7 12 prologue_end @ dwarf-thumb.c:7:12
+add.w   r0, r1, r1, lsl #1
+.loc1 7 2 is_stmt 0 @ dwarf-thumb.c:7:2
+bx  lr
+.Ltmp2:
+.Lfunc_end1:
+.cfi_endproc
+@ -- End function
+.section.debug_str,"dr"
+.Linfo_string:
+.Linfo_string1:
+.asciz  "dwarf-thumb.c"
+.Linfo_string2:
+.asciz  "/path/to/src"
+.Linfo_string3:
+.asciz  "other"
+.Linfo_string6:
+.asciz  "entry"
+.section.debug_loc,"dr"
+.Lsection_debug_loc:
+.Ldebug_loc0:
+.long   .Lfunc_begin0-.Lfunc_begin0
+.long   .Ltmp0-.Lfunc_begin0
+.short  1   @ Loc expr size
+.byte   80  @ DW_OP_reg0
+.long   .Ltmp0-.Lfunc_begin0
+.long   .Lfunc_end0-.Lfunc_begin0
+.short  1   @ Loc expr size
+.byte   81  @ DW_OP_reg1
+.long   0
+.long   0
+.section.debug_abbrev,"dr"
+.Lsection_abbrev:
+.byte   1   @ Abbreviation Code
+.byte   17  @ DW_TAG_compile_unit
+.byte   1   @ DW_CHILDREN_yes
+.byte   37  @ DW_AT_producer
+.byte   37  @ DW_FORM_strx1
+.byte   19  @ DW_AT_language
+.byte   5   @ DW_FORM_data2
+.byte   3   @ DW_AT_name
+.byte   14  @ DW_FORM_strp
+.byte   16  @ DW_AT_stmt_list
+.byte   23  @ DW_FORM_sec_offset
+.byte   27  @ DW_AT_comp_dir
+.byte   14  @ DW_FORM_strp
+.byte   17   

[Lldb-commits] [PATCH] D73148: [lldb/Value] Report size of Value as size of underlying data buffer

2020-01-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/dw_op_piece/main.cpp:34
+  //% self.filecheck("image lookup -va $pc", "main.cpp", 
"-check-prefix=INFO-V1")
+  // INFO-V1: name = "v1", type = "S1", location = DW_OP_reg0 RAX, DW_OP_piece 
0x4, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x8, decl
+  sink++;

It seems unlikely that this lowering survives very long. Could you move this to 
unit tests instead?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73148/new/

https://reviews.llvm.org/D73148



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


[Lldb-commits] [PATCH] D73148: [lldb/Value] Report size of Value as size of underlying data buffer

2020-01-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Yes you have. Sorry for the noise.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73148/new/

https://reviews.llvm.org/D73148



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


[Lldb-commits] [PATCH] D73148: [lldb/Value] Report size of Value as size of underlying data buffer

2020-01-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In D73148#1835488 , @labath wrote:

> In D73148#1834955 , @vsk wrote:
>
> > In D73148#1832897 , @clayborg 
> > wrote:
> >
> > > Actually it would be nice to have a test that will trigger on at least 
> > > one build bot that runs ASAN?
> >
> >
> > I'll add an end-to-end test for DW_OP_piece, though I worry it might be 
> > brittle.
>
>
> I don't think that's a good way to write a test like this. I suggest checking 
> out `test/Shell/SymbolFile/DWARF/DW_OP_piece-struct.s` for an  dwarf 
> expression test that does not rely on guessing the DW_OP opcodes used by the 
> compiler. Maybe you can just take that test and tweak it to do what you need?


Sorry, I haven't read the rest yet, but for testing: Have you seen 
`lldb/unittests/Expression/DWARFExpressionTest.cpp` ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73148/new/

https://reviews.llvm.org/D73148



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


[Lldb-commits] [lldb] 118efa5 - [LLDB][NFC] Adding clarifying comment in SymbolFileDWARFDebugMap::DumpClangAST(...)

2020-01-24 Thread via lldb-commits

Author: shafik
Date: 2020-01-24T14:01:15-08:00
New Revision: 118efa5cda868604f3507760ca061f69b0050b19

URL: 
https://github.com/llvm/llvm-project/commit/118efa5cda868604f3507760ca061f69b0050b19
DIFF: 
https://github.com/llvm/llvm-project/commit/118efa5cda868604f3507760ca061f69b0050b19.diff

LOG: [LLDB][NFC] Adding clarifying comment in 
SymbolFileDWARFDebugMap::DumpClangAST(...)

It is not obvious that the code was correct since it would seem as if we want 
to perform the dump for
each symbol file.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 5b0f46aefbf1..add05d1a3a9d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1225,6 +1225,9 @@ CompilerDeclContext 
SymbolFileDWARFDebugMap::FindNamespace(
 void SymbolFileDWARFDebugMap::DumpClangAST(Stream ) {
   ForEachSymbolFile([](SymbolFileDWARF *oso_dwarf) -> bool {
 oso_dwarf->DumpClangAST(s);
+// The underlying assumption is that DumpClangAST(...) will obtain the
+// AST from the underlying TypeSystem and therefore we only need to do
+// this once and can stop after the first iteration hence we return true.
 return true;
   });
 }



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


[Lldb-commits] [PATCH] D71313: [AST] Split parent map traversal logic into ParentMapContext.h

2020-01-24 Thread Reid Kleckner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a81daaa8b58: [AST] Split parent map traversal logic into 
ParentMapContext.h (authored by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D71313?vs=240050=240283#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71313/new/

https://reviews.llvm.org/D71313

Files:
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
  clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
  clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/ParentMapContext.h
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/CMakeLists.txt
  clang/lib/AST/Linkage.h
  clang/lib/AST/ParentMapContext.cpp
  clang/lib/ASTMatchers/ASTMatchFinder.cpp
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp
  clang/lib/CodeGen/CGCall.h
  clang/lib/Tooling/ASTDiff/ASTDiff.cpp
  clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
  lldb/include/lldb/Symbol/TypeSystemClang.h

Index: lldb/include/lldb/Symbol/TypeSystemClang.h
===
--- lldb/include/lldb/Symbol/TypeSystemClang.h
+++ lldb/include/lldb/Symbol/TypeSystemClang.h
@@ -21,6 +21,7 @@
 #include 
 
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTFwd.h"
 #include "clang/AST/TemplateBase.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/SmallVector.h"
Index: clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
===
--- clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
+++ clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
@@ -15,6 +15,7 @@
 
 #include "clang/Tooling/Refactoring/Rename/USRLocFinder.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
Index: clang/lib/Tooling/ASTDiff/ASTDiff.cpp
===
--- clang/lib/Tooling/ASTDiff/ASTDiff.cpp
+++ clang/lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/Tooling/ASTDiff/ASTDiff.h"
 
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Lex/Lexer.h"
 #include "llvm/ADT/PriorityQueue.h"
Index: clang/lib/CodeGen/CGCall.h
===
--- clang/lib/CodeGen/CGCall.h
+++ clang/lib/CodeGen/CGCall.h
@@ -16,6 +16,7 @@
 
 #include "CGValue.h"
 #include "EHScopeStack.h"
+#include "clang/AST/ASTFwd.h"
 #include "clang/AST/CanonicalType.h"
 #include "clang/AST/GlobalDecl.h"
 #include "clang/AST/Type.h"
Index: clang/lib/ASTMatchers/ASTMatchersInternal.cpp
===
--- clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -15,6 +15,7 @@
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Basic/LLVM.h"
@@ -237,7 +238,8 @@
   TraversalKindScope RAII(Finder->getASTContext(),
   Implementation->TraversalKind());
 
-  auto N = Finder->getASTContext().traverseIgnored(DynNode);
+  auto N =
+  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
 
   if (RestrictKind.isBaseOf(N.getNodeKind()) &&
   Implementation->dynMatches(N, Finder, Builder)) {
@@ -256,7 +258,8 @@
   TraversalKindScope raii(Finder->getASTContext(),
   Implementation->TraversalKind());
 
-  auto N = Finder->getASTContext().traverseIgnored(DynNode);
+  auto N =
+  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
 
   assert(RestrictKind.isBaseOf(N.getNodeKind()));
   if (Implementation->dynMatches(N, Finder, Builder)) {
Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -143,11 +143,14 @@
 Stmt *StmtToTraverse = StmtNode;
 if (auto *ExprNode = dyn_cast_or_null(StmtNode)) {
   auto *LambdaNode = dyn_cast_or_null(StmtNode);
-  if (LambdaNode && Finder->getASTContext().getTraversalKind() ==
-  ast_type_traits::TK_IgnoreUnlessSpelledInSource)
+  if (LambdaNode &&
+  Finder->getASTContext().getParentMapContext().getTraversalKind() ==
+  ast_type_traits::TK_IgnoreUnlessSpelledInSource)
 StmtToTraverse = LambdaNode;
   else
-StmtToTraverse 

[Lldb-commits] [lldb] 8a81daa - [AST] Split parent map traversal logic into ParentMapContext.h

2020-01-24 Thread Reid Kleckner via lldb-commits

Author: Reid Kleckner
Date: 2020-01-24T13:42:28-08:00
New Revision: 8a81daaa8b58aeaa192a47c4ce7f94b4d59ce082

URL: 
https://github.com/llvm/llvm-project/commit/8a81daaa8b58aeaa192a47c4ce7f94b4d59ce082
DIFF: 
https://github.com/llvm/llvm-project/commit/8a81daaa8b58aeaa192a47c4ce7f94b4d59ce082.diff

LOG: [AST] Split parent map traversal logic into ParentMapContext.h

The only part of ASTContext.h that requires most AST types to be
complete is the parent map. Nothing in Clang proper uses the ParentMap,
so split it out into its own class. Make ASTContext own the
ParentMapContext so there is still a one-to-one relationship.

After this change, 562 fewer files depend on ASTTypeTraits.h, and 66
fewer depend on TypeLoc.h:
  $ diff -u deps-before.txt deps-after.txt | \
grep '^[-+] ' | sort | uniq -c | sort -nr | less
  562 -../clang/include/clang/AST/ASTTypeTraits.h
  340 +../clang/include/clang/AST/ParentMapContext.h
   66 -../clang/include/clang/AST/TypeLocNodes.def
   66 -../clang/include/clang/AST/TypeLoc.h
   15 -../clang/include/clang/AST/TemplateBase.h
  ...
I computed deps-before.txt and deps-after.txt with `ninja -t deps`.

This removes a common and key dependency on TemplateBase.h and
TypeLoc.h.

This also has the effect of breaking the ParentMap RecursiveASTVisitor
instantiation into its own file, which roughly halves the compilation
time of ASTContext.cpp (29.75s -> 17.66s). The new file takes 13.8s to
compile.

I left behind forwarding methods for getParents(), but clients will need
to include a new header to make them work:
  #include "clang/AST/ParentMapContext.h"

I noticed that this parent map functionality is unfortunately duplicated
in ParentMap.h, which only works for Stmt nodes.

Reviewed By: rsmith

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

Added: 
clang/include/clang/AST/ParentMapContext.h
clang/lib/AST/ParentMapContext.cpp

Modified: 

clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/ASTNodeTraverser.h
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/CMakeLists.txt
clang/lib/AST/Linkage.h
clang/lib/ASTMatchers/ASTMatchFinder.cpp
clang/lib/ASTMatchers/ASTMatchersInternal.cpp
clang/lib/CodeGen/CGCall.h
clang/lib/Tooling/ASTDiff/ASTDiff.cpp
clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
lldb/include/lldb/Symbol/TypeSystemClang.h

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
index 6939ec9b2e07..760073fcaac2 100644
--- 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
@@ -8,6 +8,7 @@
 
 #include "ProBoundsArrayToPointerDecayCheck.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
@@ -35,8 +36,7 @@ AST_MATCHER_P(Expr, hasParentIgnoringImpCasts,
   ast_matchers::internal::Matcher, InnerMatcher) {
   const Expr *E = 
   do {
-ASTContext::DynTypedNodeList Parents =
-Finder->getASTContext().getParents(*E);
+DynTypedNodeList Parents = Finder->getASTContext().getParents(*E);
 if (Parents.size() != 1)
   return false;
 E = Parents[0].get();

diff  --git 
a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
index aca8d0fe89d8..3f1dcfe803e2 100644
--- a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -8,6 +8,7 @@
 
 #include "MakeMemberFunctionConstCheck.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
@@ -57,7 +58,7 @@ class FindUsageOfThis : public 
RecursiveASTVisitor {
   UsageKind Usage = Unused;
 
   template  const T *getParent(const Expr *E) {
-ASTContext::DynTypedNodeList Parents = Ctxt.getParents(*E);
+DynTypedNodeList Parents = Ctxt.getParents(*E);
 if (Parents.size() != 1)
   return nullptr;
 

diff  --git a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp 
b/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
index 6ed595e4a0d6..3505f31c92a2 100644
--- a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp

[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-24 Thread Paolo Severini via Phabricator via lldb-commits
paolosev updated this revision to Diff 240262.
paolosev added a comment.

Modified to set `m_file_offset` to be the correct offset of the Code section. 
This also simplifies the code in ObjectFileWasm to avoid a special case for the 
code section in `ObjectFileWasm::SetLoadAddress`.
The DWARF code seems to only use GetFileAddress(), which still needs to return 
zero for the Code section.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72751/new/

https://reviews.llvm.org/D72751

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/test_wasm.yaml
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/DynamicLoader/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -37,6 +37,7 @@
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h"
 #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
 #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
 #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
@@ -246,6 +247,7 @@
   DynamicLoaderMacOSXDYLD::Initialize();
   DynamicLoaderMacOS::Initialize();
   DynamicLoaderPOSIXDYLD::Initialize();
+  wasm::DynamicLoaderWasmDYLD::Initialize();
   DynamicLoaderStatic::Initialize();
   DynamicLoaderWindowsDYLD::Initialize();
 
@@ -329,6 +331,7 @@
   DynamicLoaderMacOSXDYLD::Terminate();
   DynamicLoaderMacOS::Terminate();
   DynamicLoaderPOSIXDYLD::Terminate();
+  wasm::DynamicLoaderWasmDYLD::Terminate();
   DynamicLoaderStatic::Terminate();
   DynamicLoaderWindowsDYLD::Terminate();
 
Index: lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
===
--- lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -1,153 +1,151 @@
-//===-- ObjectFileWasm.h *- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-#define LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Utility/ArchSpec.h"
-
-namespace lldb_private {
-namespace wasm {
-
-/// Generic Wasm object file reader.
-///
-/// This class provides a generic wasm32 reader plugin implementing the
-/// ObjectFile protocol.
-class ObjectFileWasm : public ObjectFile {
-public:
-  static void Initialize();
-  static void Terminate();
-
-  static ConstString GetPluginNameStatic();
-  static const char *GetPluginDescriptionStatic() {
-return "WebAssembly object file reader.";
-  }
-
-  static ObjectFile *
-  CreateInstance(const lldb::ModuleSP _sp, lldb::DataBufferSP _sp,
- lldb::offset_t data_offset, const FileSpec *file,
- lldb::offset_t file_offset, lldb::offset_t length);
-
-  static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP _sp,
-  lldb::DataBufferSP _sp,
-  const lldb::ProcessSP _sp,
-  lldb::addr_t header_addr);
-
-  static size_t GetModuleSpecifications(const FileSpec ,
-lldb::DataBufferSP _sp,
-lldb::offset_t data_offset,
-lldb::offset_t file_offset,
-lldb::offset_t length,
-ModuleSpecList );
-
-  /// PluginInterface protocol.
-  /// \{
-  ConstString GetPluginName() override { return GetPluginNameStatic(); }
-  uint32_t GetPluginVersion() override { return 1; }
-  /// \}
-
-  /// LLVM RTTI support
-  /// \{
-  static char ID;
-  bool isA(const void *ClassID) const override {
-return ClassID ==  || ObjectFile::isA(ClassID);
-  }
-  static bool classof(const ObjectFile *obj) { return obj->isA(); }

[Lldb-commits] [PATCH] D72953: Fix the handling of unnamed bit-fields when parsing DWARF

2020-01-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik marked 2 inline comments as done.
shafik added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp:76
+  lbd.arr[1] = 'b';
+  lbd.arr[2] = 'c';
+  lbd.a = 5;

labath wrote:
> BTW, I've changed this to '\0' because the memory following this array is 
> uninitialized, and that would confuse the the "const char *" pretty printer, 
> which would continue to print the garbage after the array. The actual value 
> of `arr` does not seem to be relevant for this test (I hope), but the pretty 
> printer behavior is suboptimal, so I've filed pr44649 to track that.
Thank you for catching that and patching!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72953/new/

https://reviews.llvm.org/D72953



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

jingham wrote:
> mib wrote:
> > friss wrote:
> > > mib wrote:
> > > > JDevlieghere wrote:
> > > > > Magic value? Why 10?
> > > > Pretty much. In the beginning I was unwinding the entire stack. But if 
> > > > there is too much frames (i.e. recursion) this would take too much 
> > > > time. We agreed with @friss and @jingham to unwind up to 10 frames at 
> > > > most.
> > > > 
> > > > Can you think of a better way to do it ?
> > > I don't think that's exactly what I said. My opinion was that asserts 
> > > will have a pretty deterministic layout, and that we should know exactly 
> > > what to unwind to determine whether we have an assert or not.
> > > 
> > > In your test, you actually check that the frame with the assert is frame 
> > > 4. If it is anything other then 4 in any configuration, then the test 
> > > will fail. You might as well just put 4 in the code here rather than a 
> > > magical 10.
> > The number of frames to unwind is different depending on the platform. I 
> > chose 10 to give us some extra margin but I'll change it to 4 or 5,
> We want this as small as will do the job - since we don't want to unwind more 
> than necessary.  But we aren't going to do this unwinding on every stop - 
> only when we actually see a thread with frame 0 in __pthread_kill (or 
> whatever the system kill is).  So we don't need to over optimize.  It would 
> be silly to go have to fix this because some platform added another layer 
> between assert and kill.
> 
> I'd go see what it is on all the Unixes we know about and add a couple to 
> future proof it.
> 
> The test should definitely not depend on how many frames there are between 
> the assert and the _pthread_kill.  It should just check that the currently 
> selected frame has the right file & line number.  If you want to keep this a 
> shell test, you could backtrace the thread and make sure the * is on the line 
> with "assert.c", or maybe try:
> 
> ```
> (lldb) source info
> Lines found in module `killme
> [0x00010f2e-0x00010f6f): /tmp/assert.c:7:3
> 
> ```
> 
> If the frame wasn't selected properly this will show:
> 
> 
> ```
> (lldb) source info
> error: No debug info for the selected frame.
> 
> ```
You say it is 4 or 5, so your test will fail in one of those configurations as 
you have hardcoded the frame number there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 240238.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303

Files:
  lldb/include/lldb/Target/AbortRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/StopInfo.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/Target/AbortRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/StopInfo.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/abort.c
  lldb/test/Shell/Recognizer/abort.test

Index: lldb/test/Shell/Recognizer/abort.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/abort.test
@@ -0,0 +1,10 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/abort.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = signal SIGABRT
+frame info
+# CHECK: frame #4: {{.*}}`main at abort.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Abort StackFrame Recognizer
+q
Index: lldb/test/Shell/Recognizer/Inputs/abort.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/abort.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,41 @@
   m_state = state;
 }
 
+void Thread::SelectMostRelevantFrame() {
+  if (!m_curr_frames_sp)
+return;
+
+  auto cur_frame = m_curr_frames_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = cur_frame->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return;
+
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET);
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+
+  if (StopInfoSP stop_info_sp = recognized_frame_sp->GetStopInfo()) {
+LLDB_LOG(log, "Found stop reason {0}", stop_info_sp->GetStopReason());
+SetStopInfo(stop_info_sp);
+  } else {
+LLDB_LOG(log, "No stop reason for recognized frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StopInfo.cpp
===
--- lldb/source/Target/StopInfo.cpp
+++ lldb/source/Target/StopInfo.cpp
@@ -1016,6 +1016,23 @@
   }
 };
 
+// StopInfoRecognizedFrame
+
+class StopInfoRecognizedFrame : public StopInfoException {
+public:
+  StopInfoRecognizedFrame(Thread , const char *description)
+  : StopInfoException(thread, description) {}
+
+  ~StopInfoRecognizedFrame() override = default;
+
+  const char *GetDescription() override {
+if (m_description.empty())
+  return "recognized frame:";
+else
+  return m_description.c_str();
+  }
+};
+
 // StopInfoThreadPlan
 
 class StopInfoThreadPlan : public StopInfo {
@@ -1133,6 +1150,12 @@
   return StopInfoSP(new StopInfoException(thread, description));
 }
 
+StopInfoSP
+StopInfo::CreateStopReasonForRecognizedFrame(Thread ,
+ const char *description) {
+  return StopInfoSP(new StopInfoRecognizedFrame(thread, description));
+}
+
 StopInfoSP StopInfo::CreateStopReasonWithExec(Thread ) {
   return StopInfoSP(new StopInfoExec(thread));
 }
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,7 +92,7 @@
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFrameSP frame) {
 const SymbolContext  =
-frame->GetSymbolContext(eSymbolContextModule | eSymbolContextFunction);
+frame->GetSymbolContext(eSymbolContextEverything);
 ConstString function_name = symctx.GetFunctionName();
 ModuleSP module_sp = symctx.module_sp;
 if (!module_sp) return StackFrameRecognizerSP();
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/ABI.h"
+#include "lldb/Target/AbortRecognizer.h"
 #include "lldb/Target/DynamicLoader.h"
 #include 

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

mib wrote:
> friss wrote:
> > mib wrote:
> > > JDevlieghere wrote:
> > > > Magic value? Why 10?
> > > Pretty much. In the beginning I was unwinding the entire stack. But if 
> > > there is too much frames (i.e. recursion) this would take too much time. 
> > > We agreed with @friss and @jingham to unwind up to 10 frames at most.
> > > 
> > > Can you think of a better way to do it ?
> > I don't think that's exactly what I said. My opinion was that asserts will 
> > have a pretty deterministic layout, and that we should know exactly what to 
> > unwind to determine whether we have an assert or not.
> > 
> > In your test, you actually check that the frame with the assert is frame 4. 
> > If it is anything other then 4 in any configuration, then the test will 
> > fail. You might as well just put 4 in the code here rather than a magical 
> > 10.
> The number of frames to unwind is different depending on the platform. I 
> chose 10 to give us some extra margin but I'll change it to 4 or 5,
We want this as small as will do the job - since we don't want to unwind more 
than necessary.  But we aren't going to do this unwinding on every stop - only 
when we actually see a thread with frame 0 in __pthread_kill (or whatever the 
system kill is).  So we don't need to over optimize.  It would be silly to go 
have to fix this because some platform added another layer between assert and 
kill.

I'd go see what it is on all the Unixes we know about and add a couple to 
future proof it.

The test should definitely not depend on how many frames there are between the 
assert and the _pthread_kill.  It should just check that the currently selected 
frame has the right file & line number.  If you want to keep this a shell test, 
you could backtrace the thread and make sure the * is on the line with 
"assert.c", or maybe try:

```
(lldb) source info
Lines found in module `killme
[0x00010f2e-0x00010f6f): /tmp/assert.c:7:3

```

If the frame wasn't selected properly this will show:


```
(lldb) source info
error: No debug info for the selected frame.

```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

friss wrote:
> mib wrote:
> > JDevlieghere wrote:
> > > Magic value? Why 10?
> > Pretty much. In the beginning I was unwinding the entire stack. But if 
> > there is too much frames (i.e. recursion) this would take too much time. We 
> > agreed with @friss and @jingham to unwind up to 10 frames at most.
> > 
> > Can you think of a better way to do it ?
> I don't think that's exactly what I said. My opinion was that asserts will 
> have a pretty deterministic layout, and that we should know exactly what to 
> unwind to determine whether we have an assert or not.
> 
> In your test, you actually check that the frame with the assert is frame 4. 
> If it is anything other then 4 in any configuration, then the test will fail. 
> You might as well just put 4 in the code here rather than a magical 10.
The number of frames to unwind is different depending on the platform. I chose 
10 to give us some extra margin but I'll change it to 4 or 5,


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

mib wrote:
> JDevlieghere wrote:
> > Magic value? Why 10?
> Pretty much. In the beginning I was unwinding the entire stack. But if there 
> is too much frames (i.e. recursion) this would take too much time. We agreed 
> with @friss and @jingham to unwind up to 10 frames at most.
> 
> Can you think of a better way to do it ?
I don't think that's exactly what I said. My opinion was that asserts will have 
a pretty deterministic layout, and that we should know exactly what to unwind 
to determine whether we have an assert or not.

In your test, you actually check that the frame with the assert is frame 4. If 
it is anything other then 4 in any configuration, then the test will fail. You 
might as well just put 4 in the code here rather than a magical 10.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 240213.
mib marked 2 inline comments as done.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303

Files:
  lldb/include/lldb/Target/AbortRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/StopInfo.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/Target/AbortRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/StopInfo.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/abort.c
  lldb/test/Shell/Recognizer/abort.test

Index: lldb/test/Shell/Recognizer/abort.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/abort.test
@@ -0,0 +1,10 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/abort.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = signal SIGABRT
+frame info
+# CHECK: frame #4: {{.*}}`main at abort.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Abort StackFrame Recognizer
+q
Index: lldb/test/Shell/Recognizer/Inputs/abort.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/abort.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,41 @@
   m_state = state;
 }
 
+void Thread::SelectMostRelevantFrame() {
+  if (!m_curr_frames_sp)
+return;
+
+  auto cur_frame = m_curr_frames_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = cur_frame->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return;
+
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET);
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+
+  if (StopInfoSP stop_info_sp = recognized_frame_sp->GetStopInfo()) {
+LLDB_LOG(log, "Found stop reason {0}", stop_info_sp->GetStopReason());
+SetStopInfo(stop_info_sp);
+  } else {
+LLDB_LOG(log, "No stop reason for recognized frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StopInfo.cpp
===
--- lldb/source/Target/StopInfo.cpp
+++ lldb/source/Target/StopInfo.cpp
@@ -1016,6 +1016,23 @@
   }
 };
 
+// StopInfoRecognizedFrame
+
+class StopInfoRecognizedFrame : public StopInfoException {
+public:
+  StopInfoRecognizedFrame(Thread , const char *description)
+  : StopInfoException(thread, description) {}
+
+  ~StopInfoRecognizedFrame() override = default;
+
+  const char *GetDescription() override {
+if (m_description.empty())
+  return "recognized frame:";
+else
+  return m_description.c_str();
+  }
+};
+
 // StopInfoThreadPlan
 
 class StopInfoThreadPlan : public StopInfo {
@@ -1133,6 +1150,12 @@
   return StopInfoSP(new StopInfoException(thread, description));
 }
 
+StopInfoSP
+StopInfo::CreateStopReasonForRecognizedFrame(Thread ,
+ const char *description) {
+  return StopInfoSP(new StopInfoRecognizedFrame(thread, description));
+}
+
 StopInfoSP StopInfo::CreateStopReasonWithExec(Thread ) {
   return StopInfoSP(new StopInfoExec(thread));
 }
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,7 +92,7 @@
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFrameSP frame) {
 const SymbolContext  =
-frame->GetSymbolContext(eSymbolContextModule | eSymbolContextFunction);
+frame->GetSymbolContext(eSymbolContextEverything);
 ConstString function_name = symctx.GetFunctionName();
 ModuleSP module_sp = symctx.module_sp;
 if (!module_sp) return StackFrameRecognizerSP();
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/ABI.h"
+#include "lldb/Target/AbortRecognizer.h"
 #include 

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-24 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 14 inline comments as done.
mib added inline comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:1
+//===-- AbortRecognizer.cpp -*- C++ 
-*-===//
+//

teemperor wrote:
> Please remove the `-*- C++ -*-` as that's only for header files.
I saw this on a bunch of source files (StopInfo.cpp / Breakpoint.cpp / 
SymbolContext.cpp ...). I'm not sure what you mean by that.



Comment at: lldb/source/Target/AbortRecognizer.cpp:25
+
+llvm::Optional>
+AbortRecognizerHandler::GetAbortLocation(Process *process) {

JDevlieghere wrote:
> Why does this need to return a `ConstString`? 
I use ConstString because StackFrameRecognizerManager::AddRecognizer takes a 
ConstString.

And also SymbolContext::GetFunctionName returns a ConstString.



Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;

JDevlieghere wrote:
> Magic value? Why 10?
Pretty much. In the beginning I was unwinding the entire stack. But if there is 
too much frames (i.e. recursion) this would take too much time. We agreed with 
@friss and @jingham to unwind up to 10 frames at most.

Can you think of a better way to do it ?



Comment at: lldb/source/Target/Process.cpp:543
+
+  RegisterAbortRecognizer(this);
 }

friss wrote:
> We need to find a better place to register this.
May be this could go in Target/LanguageRuntime.cpp or Target/SystemRuntime.cpp ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73191: Ignore methods in full-name function lookup (with accelerators)

2020-01-24 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin marked an inline comment as done.
jarin added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp:45
   if (name_type_mask & eFunctionNameTypeFull) {
-dies.push_back(die);
-return;
+if (!die.IsMethod() || die.GetMangledName(false) == name) {
+  dies.push_back(die);

labath wrote:
> I don't believe the `IsMethod` check is really needed here -- the mangled 
> name check should handle everything.
> 
> In fact, looking at the implementation of 
> `DWARFDebugInfoEntry::GetMangledName`, I don't think you even need the extra 
> `substitute_name_allowed=false` part. The default value should do exactly 
> what we need. If the DIE has a linkage (mangled) name it will return it and 
> we will use that for comparison. For an `extern "C"` function it will return 
> the regular name, and we will compare that instead (this check is somewhat 
> redundant because if the name doesn't match, the function should not be in 
> the index in the first place, but I don't think it hurts to check either).
> 
> Am I missing something?
I want to avoid returning methods to [[ 
https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1258
 | ClangExpressionDeclMap::LookupFunction ]], so that 
ClangExpressionDeclMap::LookupFunction does not do the expensive [[ 
https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1298
 | DeclContext parsing ]] just to find out the function [[ 
https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1304
 | is a method ]] and must be thrown away.

The motivation is pretty much the same as for  https://reviews.llvm.org/D70846.

Does it make sense?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73345: [lldb] Don't create duplicate declarations when completing a forward declaration with a definition from another source

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath resigned from this revision.
labath added a comment.

The description makes sense to me but I don't know much about this stuff. I'll 
leave it to @shafik to ack this...


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73345/new/

https://reviews.llvm.org/D73345



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


[Lldb-commits] [PATCH] D73345: [lldb] Don't create duplicate declarations when completing a forward declaration with a definition from another source

2020-01-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: shafik, labath.
Herald added subscribers: lldb-commits, JDevlieghere, abidh, aprantl.
Herald added a project: LLDB.

I noticed this strange line in `ASTImporterDelegate::ImportDefinitionTo` which 
doesn't make a lot of sense:

  to_tag->setCompleteDefinition(from_tag->isCompleteDefinition());

It forcibly sets the imported TagDecl to be defined if the source TagDecl was 
defined. This doesn't make any
sense as in this code we already forced the ASTImporter to import the 
definition so this should always be
a no-op.

Turns out this is hiding two bugs:

1. The way we handle forward declarations in the debug info that might be 
completed later is that we import them and then mark them as having external 
lexical storage. This makes Clang ask for the definition later when it needs it 
(at which point we hopefully have the definition around and can complete it). 
However, this is currently not completing the forward decls with external 
storage but instead creates a duplicated decl in the target AST which is then 
defined. The forward decl is kept incomplete after the import and we just 
forcibly make it a definition of the record without any content with our 
workaround. The TestSharedLib* tests is only passing because of this.
2. Minimal import of lambdas is broken and never imports the definition it 
seems. That appears to be a bug in the ASTImporter which gives the definition 
of lambda's some special treatment. TestLambdas.py is actually broken but is 
passing because of this workaround.

This patch fixes the first bug by forcing the ASTImporter to import to the 
target forward declaration. We can't
delete the workaround as the second bug is still around but that will be a 
follow up review for the ASTImporter.
However it will get rid of all the duplicated RecordDecls that are in our 
expression AST that are strangely defined
but don't have any of the fields they are supposed to have.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D73345

Files:
  lldb/source/Symbol/ClangASTImporter.cpp
  lldb/unittests/Symbol/TestClangASTImporter.cpp


Index: lldb/unittests/Symbol/TestClangASTImporter.cpp
===
--- lldb/unittests/Symbol/TestClangASTImporter.cpp
+++ lldb/unittests/Symbol/TestClangASTImporter.cpp
@@ -88,6 +88,33 @@
   EXPECT_EQ(origin.decl, source.record_decl);
 }
 
+TEST_F(TestClangASTImporter, CompleteFwdDeclWithOtherOrigin) {
+  // Create an AST with a full type that is defined.
+  clang_utils::SourceASTWithRecord source_with_definition;
+
+  // Create an AST with a type thst is only a forward declaration with the
+  // same name as the one in the the other source.
+  std::unique_ptr fwd_decl_source = clang_utils::createAST();
+  CompilerType fwd_decl_type = clang_utils::createRecord(
+  *fwd_decl_source, source_with_definition.record_decl->getName());
+
+  // Create a target and import the forward decl.
+  std::unique_ptr target = clang_utils::createAST();
+  ClangASTImporter importer;
+  CompilerType imported = importer.CopyType(*target, fwd_decl_type);
+  ASSERT_TRUE(imported.IsValid());
+  EXPECT_FALSE(imported.IsDefined());
+
+  // Now complete the forward decl with the definition from the other source.
+  // This should define the decl and give it the fields of the other origin.
+  clang::TagDecl *imported_tag_decl = ClangUtil::GetAsTagDecl(imported);
+  importer.CompleteTagDeclWithOrigin(imported_tag_decl,
+ source_with_definition.record_decl);
+  ASSERT_TRUE(imported.IsValid());
+  EXPECT_TRUE(imported.IsDefined());
+  EXPECT_EQ(1U, imported.GetNumFields());
+}
+
 TEST_F(TestClangASTImporter, DeportDeclTagDecl) {
   // Tests that the ClangASTImporter::DeportDecl completely copies TagDecls.
   clang_utils::SourceASTWithRecord source;
Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -908,6 +908,14 @@
 
 void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(
 clang::Decl *to, clang::Decl *from) {
+  // We might have a forward declaration from a shared library that we
+  // gave external lexical storage so that Clang asks us about the full
+  // definition when it needs it. In this case the ASTImporter isn't aware
+  // that the forward decl from the shared library is the actual import
+  // target but would create a second declaration that would then be defined.
+  // We want that 'to' is actually complete after this function so let's
+  // tell the ASTImporter that 'to' was imported from 'from'.
+  MapImported(from, to);
   ASTImporter::Imported(from, to);
 
   /*


Index: lldb/unittests/Symbol/TestClangASTImporter.cpp
===
--- lldb/unittests/Symbol/TestClangASTImporter.cpp
+++ 

[Lldb-commits] [lldb] 06ae374 - [lldb][NFC] Cleanup some if conditions in ASTImporterDelegate::Imported

2020-01-24 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-24T13:49:25+01:00
New Revision: 06ae3748db8a23568f2f238a9534ea9052725ea3

URL: 
https://github.com/llvm/llvm-project/commit/06ae3748db8a23568f2f238a9534ea9052725ea3
DIFF: 
https://github.com/llvm/llvm-project/commit/06ae3748db8a23568f2f238a9534ea9052725ea3.diff

LOG: [lldb][NFC] Cleanup some if conditions in ASTImporterDelegate::Imported

Added: 


Modified: 
lldb/source/Symbol/ClangASTImporter.cpp

Removed: 




diff  --git a/lldb/source/Symbol/ClangASTImporter.cpp 
b/lldb/source/Symbol/ClangASTImporter.cpp
index a8a6f02fdb1f..518157dc1c15 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -1057,10 +1057,8 @@ void 
ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
 static_cast(>getASTContext()));
 }
 
-if (clang::NamespaceDecl *to_namespace =
-dyn_cast(to)) {
-  clang::NamespaceDecl *from_namespace =
-  dyn_cast(from);
+if (auto *to_namespace = dyn_cast(to)) {
+  auto *from_namespace = cast(from);
 
   NamespaceMetaMap _maps = from_context_md->m_namespace_maps;
 
@@ -1081,11 +1079,10 @@ void 
ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
   static_cast(>getASTContext()));
   }
 
-  if (TagDecl *from_tag_decl = dyn_cast(from)) {
-TagDecl *to_tag_decl = dyn_cast(to);
-
+  if (auto *to_tag_decl = dyn_cast(to)) {
 to_tag_decl->setHasExternalLexicalStorage();
 to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
+auto from_tag_decl = cast(from);
 
 LLDB_LOGF(
 log,
@@ -1096,22 +1093,15 @@ void 
ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
 (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
   }
 
-  if (isa(from)) {
-NamespaceDecl *to_namespace_decl = dyn_cast(to);
-
+  if (auto *to_namespace_decl = dyn_cast(to)) {
 m_master.BuildNamespaceMap(to_namespace_decl);
-
 to_namespace_decl->setHasExternalVisibleStorage();
   }
 
-  if (isa(from)) {
-ObjCContainerDecl *to_container_decl = dyn_cast(to);
-
+  if (auto *to_container_decl = dyn_cast(to)) {
 to_container_decl->setHasExternalLexicalStorage();
 to_container_decl->setHasExternalVisibleStorage();
 
-/*to_interface_decl->setExternallyCompleted();*/
-
 if (log) {
   if (ObjCInterfaceDecl *to_interface_decl =
   llvm::dyn_cast(to_container_decl)) {



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


[Lldb-commits] [PATCH] D73191: Ignore methods in full-name function lookup (with accelerators)

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp:45
   if (name_type_mask & eFunctionNameTypeFull) {
-dies.push_back(die);
-return;
+if (!die.IsMethod() || die.GetMangledName(false) == name) {
+  dies.push_back(die);

I don't believe the `IsMethod` check is really needed here -- the mangled name 
check should handle everything.

In fact, looking at the implementation of 
`DWARFDebugInfoEntry::GetMangledName`, I don't think you even need the extra 
`substitute_name_allowed=false` part. The default value should do exactly what 
we need. If the DIE has a linkage (mangled) name it will return it and we will 
use that for comparison. For an `extern "C"` function it will return the 
regular name, and we will compare that instead (this check is somewhat 
redundant because if the name doesn't match, the function should not be in the 
index in the first place, but I don't think it hurts to check either).

Am I missing something?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73024: [lldb] Complete return types of CXXMethodDecls to prevent crashing due to covariant return types

2020-01-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 240156.
teemperor added a comment.

- Made test stricter.
- Moved code to ASTImporterDelegate.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73024/new/

https://reviews.llvm.org/D73024

Files:
  lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/Makefile
  
lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/TestCovariantReturnTypes.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/main.cpp
  lldb/source/Symbol/ClangASTImporter.cpp

Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -1002,6 +1002,25 @@
   }
 }
 
+/// Takes a CXXMethodDecl and completes the return type if necessary. This
+/// is currently only necessary for virtual functions with covariant return
+/// types where Clang's CodeGen expects that the underlying records are already
+/// completed.
+static void MaybeCompleteReturnType(ClangASTImporter ,
+CXXMethodDecl *to_method) {
+  if (!to_method->isVirtual())
+return;
+  QualType return_type = to_method->getReturnType();
+  if (!return_type->isPointerType() && !return_type->isReferenceType())
+return;
+
+  clang::RecordDecl *rd = return_type->getPointeeType()->getAsRecordDecl();
+  if (!rd)
+return;
+
+  importer.CompleteTagDecl(rd);
+}
+
 void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
  clang::Decl *to) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -1157,6 +1176,9 @@
   }
 }
   }
+
+  if (clang::CXXMethodDecl *to_method = dyn_cast(to))
+MaybeCompleteReturnType(m_master, to_method);
 }
 
 clang::Decl *
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/main.cpp
@@ -0,0 +1,40 @@
+struct OtherBase {
+  // Allow checking actual type from the test by giving
+  // this class and the subclass unique values here.
+  virtual const char *value() { return "base"; }
+};
+struct OtherDerived : public OtherBase {
+  const char *value() override { return "derived"; }
+};
+
+// Those have to be globals as they would be completed if they
+// are members (which would make this test always pass).
+OtherBase other_base;
+OtherDerived other_derived;
+
+struct Base {
+  // Function with covariant return type that is same class.
+  virtual Base* getPtr() { return this; }
+  virtual Base& getRef() { return *this; }
+  // Function with covariant return type that is a different class.
+  virtual OtherBase* getOtherPtr() { return _base; }
+  virtual OtherBase& getOtherRef() { return other_base; }
+};
+
+struct Derived : public Base {
+  Derived* getPtr() override { return this; }
+  Derived& getRef() override { return *this; }
+  OtherDerived* getOtherPtr() override { return _derived; }
+  OtherDerived& getOtherRef() override { return other_derived; }
+};
+
+int main() {
+  Derived derived;
+  Base base;
+  Base *base_ptr_to_derived = 
+  (void)base_ptr_to_derived->getPtr();
+  (void)base_ptr_to_derived->getRef();
+  (void)base_ptr_to_derived->getOtherPtr();
+  (void)base_ptr_to_derived->getOtherRef();
+  return 0; // break here
+}
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/TestCovariantReturnTypes.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/TestCovariantReturnTypes.py
@@ -0,0 +1,40 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
+
+def test(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp"))
+
+# Test covariant return types for pointers to class that contains the called function.
+self.expect_expr("derived.getPtr()", result_type="Derived *")
+self.expect_expr("base_ptr_to_derived->getPtr()", result_type="Base *")
+self.expect_expr("base.getPtr()", result_type="Base *")
+# The same tests with reference types. LLDB drops the reference when it turns the
+# result into a SBValue so check for the the underlying type of the result.
+self.expect_expr("derived.getRef()", result_type="Derived")
+self.expect_expr("base_ptr_to_derived->getRef()", result_type="Base")
+self.expect_expr("base.getRef()", result_type="Base")
+
+# Test covariant return types for pointers to class that does *not* contain the called function.
+

[Lldb-commits] [PATCH] D73191: Ignore methods in full-name function lookup (with accelerators)

2020-01-24 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added a comment.

Pavel, does the latest patch address (and test) what you were worried about?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73191: Ignore methods in full-name function lookup (with accelerators)

2020-01-24 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin updated this revision to Diff 240144.
jarin edited the summary of this revision.
jarin added a comment.

Updated to include all methods/non-methods with matching mangled name.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp

Index: lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
===
--- lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
@@ -10,6 +10,10 @@
 // RUN:   FileCheck --check-prefix=FULL %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -24,6 +28,10 @@
 // RUN:   FileCheck --check-prefix=FULL-INDEXED %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -40,6 +48,10 @@
 // RUN:   FileCheck --check-prefix=FULL-INDEXED %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -58,20 +70,23 @@
 // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
 // METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
 
-// FULL-INDEXED: Found 7 functions:
+// FULL-INDEXED: Found 4 functions:
 // FULL-INDEXED-DAG: name = "foo()", mangled = "_Z3foov"
 // FULL-INDEXED-DAG: name = "foo(int)", mangled = "_Z3fooi"
 // FULL-INDEXED-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
 // FULL-INDEXED-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
-// FULL-INDEXED-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
-// FULL-INDEXED-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
-// FULL-INDEXED-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
 
 // FULL: Found 0 functions:
 
 // FULL-MANGLED: Found 1 functions:
 // FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi"
 
+// FULL-MANGLED-NAMESPACE: Found 1 functions:
+// FULL-MANGLED-NAMESPACE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
+
+// FULL-MANGLED-METHOD: Found 1 functions:
+// FULL-MANGLED-METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
+
 // CONTEXT: Found 1 functions:
 // CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
@@ -39,10 +39,13 @@
   if (!SymbolFileDWARF::DIEInDeclContext(_decl_ctx, die))
 return;
 
-  // In case of a full match, we just insert everything we find.
+  // In case of a full match, we insert all non-methods functions and all
+  // methods with matching mangled name.
   if (name_type_mask & eFunctionNameTypeFull) {
-dies.push_back(die);
-return;
+if (!die.IsMethod() || die.GetMangledName(false) == name) {
+  dies.push_back(die);
+  return;
+}
   }
 
   // If looking for ObjC selectors, we need to also check if the 

[Lldb-commits] [PATCH] D72953: Fix the handling of unnamed bit-fields when parsing DWARF

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp:76
+  lbd.arr[1] = 'b';
+  lbd.arr[2] = 'c';
+  lbd.a = 5;

BTW, I've changed this to '\0' because the memory following this array is 
uninitialized, and that would confuse the the "const char *" pretty printer, 
which would continue to print the garbage after the array. The actual value of 
`arr` does not seem to be relevant for this test (I hope), but the pretty 
printer behavior is suboptimal, so I've filed pr44649 to track that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72953/new/

https://reviews.llvm.org/D72953



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


[Lldb-commits] [lldb] d4b092b - [lldb/DWARF] Remove a workaround from DebugNamesDWARFIndex

2020-01-24 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-01-24T12:09:20+01:00
New Revision: d4b092b34125d6c571d43a185a1c774244b76957

URL: 
https://github.com/llvm/llvm-project/commit/d4b092b34125d6c571d43a185a1c774244b76957
DIFF: 
https://github.com/llvm/llvm-project/commit/d4b092b34125d6c571d43a185a1c774244b76957.diff

LOG: [lldb/DWARF] Remove a workaround from DebugNamesDWARFIndex

This was needed when asking a compile unit for its dwo component
triggered a infinite recursion if the dwo unit has not been already
parsed.

This has since been fixed.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 3cd082bc213b..705578c2e4eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -53,12 +53,7 @@ DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry 
) {
   if (!cu)
 return llvm::None;
 
-  // This initializes the DWO symbol file. It's not possible for
-  // GetDwoSymbolFile to call this automatically because of mutual recursion
-  // between this and DWARFDebugInfoEntry::GetAttributeValue.
-  cu->ExtractUnitDIEIfNeeded();
   cu = >GetNonSkeletonUnit();
-
   if (llvm::Optional die_offset = entry.getDIEUnitOffset())
 return DIERef(cu->GetSymbolFileDWARF().GetDwoNum(),
   DIERef::Section::DebugInfo, cu->GetOffset() + *die_offset);



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


[Lldb-commits] [lldb] 77cedb0 - [lldb] Fix nondeterminism in TestCppBitfields

2020-01-24 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-01-24T12:09:20+01:00
New Revision: 77cedb0cdb8623ff9eb22dbf3b9302ee4d9f8a20

URL: 
https://github.com/llvm/llvm-project/commit/77cedb0cdb8623ff9eb22dbf3b9302ee4d9f8a20
DIFF: 
https://github.com/llvm/llvm-project/commit/77cedb0cdb8623ff9eb22dbf3b9302ee4d9f8a20.diff

LOG: [lldb] Fix nondeterminism in TestCppBitfields

The test was printing a char[3] variable without a terminating nul. The
memory after that variable (an unnamed bitfield) was not initialized. If
the memory happened to be nonzero, the summary provider for the variable
would run off into the next field.

This is probably not the right behavior (it should stop at the end of
the array), but this is not the purpose of this test. I have filed
pr44649 for this bug, and fixed the test to not depend on this behavior.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
index 696e5647f13f..1b362e6b04f9 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
@@ -80,7 +80,7 @@ def test_and_run_command(self):
 "frame variable --show-types lbd",
 VARIABLES_DISPLAYED_CORRECTLY,
 substrs=[
-'(char [3]) arr = "abc"',
+'(char [3]) arr = "ab"',
 '(int:32)  =',
 '(unsigned int:20) a = 5',
 ])

diff  --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp
index 975c0f05683c..e43bf8c138e9 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp
@@ -73,7 +73,7 @@ int main(int argc, char const *argv[]) {
 
   lbd.arr[0] = 'a';
   lbd.arr[1] = 'b';
-  lbd.arr[2] = 'c';
+  lbd.arr[2] = '\0';
   lbd.a = 5;
 
 



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


[Lldb-commits] [lldb] c0738d2 - [lldb][NFC] Fix formatting in ASTImporterDelegate::ImportImpl

2020-01-24 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-24T11:57:06+01:00
New Revision: c0738d2480b93b1c3b354a2be16ea5f6e545c5ef

URL: 
https://github.com/llvm/llvm-project/commit/c0738d2480b93b1c3b354a2be16ea5f6e545c5ef
DIFF: 
https://github.com/llvm/llvm-project/commit/c0738d2480b93b1c3b354a2be16ea5f6e545c5ef.diff

LOG: [lldb][NFC] Fix formatting in ASTImporterDelegate::ImportImpl

Added: 


Modified: 
lldb/source/Symbol/ClangASTImporter.cpp

Removed: 




diff  --git a/lldb/source/Symbol/ClangASTImporter.cpp 
b/lldb/source/Symbol/ClangASTImporter.cpp
index 576a7d6f64b0..a8a6f02fdb1f 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -856,8 +856,8 @@ ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl 
*From) {
   // into the same ASTContext where it came from (which doesn't make a lot of
   // sense).
   if (origin.Valid() && origin.ctx == ()) {
-  RegisterImportedDecl(From, origin.decl);
-  return origin.decl;
+RegisterImportedDecl(From, origin.decl);
+return origin.decl;
   }
 
   // This declaration came originally from another ASTContext. Instead of



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


[Lldb-commits] [lldb] 36f12d2 - [lldb][NFC] Delete unused ClangASTImporter::CompleteDecl

2020-01-24 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-24T11:54:12+01:00
New Revision: 36f12d2638f887c417bd1167a54e0e6f1bf3daca

URL: 
https://github.com/llvm/llvm-project/commit/36f12d2638f887c417bd1167a54e0e6f1bf3daca
DIFF: 
https://github.com/llvm/llvm-project/commit/36f12d2638f887c417bd1167a54e0e6f1bf3daca.diff

LOG: [lldb][NFC] Delete unused ClangASTImporter::CompleteDecl

Added: 


Modified: 
lldb/include/lldb/Symbol/ClangASTImporter.h
lldb/source/Symbol/ClangASTImporter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/ClangASTImporter.h 
b/lldb/include/lldb/Symbol/ClangASTImporter.h
index a4e042425dc6..bfdb929119cb 100644
--- a/lldb/include/lldb/Symbol/ClangASTImporter.h
+++ b/lldb/include/lldb/Symbol/ClangASTImporter.h
@@ -80,8 +80,6 @@ class ClangASTImporter {
 
   bool CompleteType(const CompilerType _type);
 
-  void CompleteDecl(clang::Decl *decl);
-
   bool CompleteTagDecl(clang::TagDecl *decl);
 
   bool CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin);

diff  --git a/lldb/source/Symbol/ClangASTImporter.cpp 
b/lldb/source/Symbol/ClangASTImporter.cpp
index 0e1ab1cad0c5..576a7d6f64b0 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -546,32 +546,6 @@ void ClangASTImporter::SetRecordLayout(clang::RecordDecl 
*decl,
   m_record_decl_to_layout_map.insert(std::make_pair(decl, layout));
 }
 
-void ClangASTImporter::CompleteDecl(clang::Decl *decl) {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
-
-  LLDB_LOGF(log, "[ClangASTImporter] CompleteDecl called on (%sDecl*)%p",
-decl->getDeclKindName(), static_cast(decl));
-
-  if (ObjCInterfaceDecl *interface_decl = dyn_cast(decl)) {
-if (!interface_decl->getDefinition()) {
-  interface_decl->startDefinition();
-  CompleteObjCInterfaceDecl(interface_decl);
-}
-  } else if (ObjCProtocolDecl *protocol_decl =
- dyn_cast(decl)) {
-if (!protocol_decl->getDefinition())
-  protocol_decl->startDefinition();
-  } else if (TagDecl *tag_decl = dyn_cast(decl)) {
-if (!tag_decl->getDefinition() && !tag_decl->isBeingDefined()) {
-  tag_decl->startDefinition();
-  CompleteTagDecl(tag_decl);
-  tag_decl->setCompleteDefinition(true);
-}
-  } else {
-assert(0 && "CompleteDecl called on a Decl that can't be completed");
-  }
-}
-
 bool ClangASTImporter::CompleteTagDecl(clang::TagDecl *decl) {
   DeclOrigin decl_origin = GetDeclOrigin(decl);
 



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70840#1838186 , @labath wrote:

> Yes, I was keeping this problem in mind when I was working on that patch. :) 
> I believe more work could be done to reduce the number of places that parse 
> DW_AT_low/high_pc, but I haven't gotten around to that yet..


Thanks :-)

Ok - this patch at least shows which codepaths I think are touching it at the 
moment. In addition to DW_AT_low/high_pc, there's also the case of 
DW_AT_ranges; I think all relevant paths that access that are taken care of 
here.

One downside to moving the fixups further out from the parsing, is that it 
easily becomes more brittle. If a new codepath accesses some getter without 
doing the fixup afterwards, we'd end up with the same hard-to-diagnose 
brokenness again.

> The thing that I am not sure we have fully explored is whether there is any 
> need for this `&~1` business in the llvm dwarf code. For instance, what 
> should `llvm::DWARFUnit::getSubroutineForAddress` return if you pass it an 
> address that is equal to the actual memory address of the start of the thumb 
> function, but the relevant DW_AT_low_pc contains `address|1`? Answering that 
> might give us an indication on what is the layer at which this fixup should 
> be applied.

From a quick check at the code there, for that particular case, either it'd be 
done in `llvm::DWARFUnit::updateAddressDieMap` or in 
`llvm::DWARFDie::getAddressRanges`. Since all levels of the API is public, the 
fix does become safer the closer to parsing it is, but one also generally has 
less context to work with in those cases.

I think the most narrow interface to apply the fix in would be 
`DWARFDebugInfoEntry::GetAttributeAddressRanges` (plus 
`DWARFDebugInfoEntry::GetAttributeAddressRange` which is used a few places 
internally in `DWARFDebugInfoEntry`) and 
`DWARFDebugInfoEntry::GetDIENamesAndRanges` (plus line tables); if only applied 
there, I think it would cover all the cases I'm fixing up at the moment...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Yes, I was keeping this problem in mind when I was working on that patch. :) I 
believe more work could be done to reduce the number of places that parse 
DW_AT_low/high_pc, but I haven't gotten around to that yet..

The thing that I am not sure we have fully explored is whether there is any 
need for this `&~1` business in the llvm dwarf code. For instance, what should 
`llvm::DWARFUnit::getSubroutineForAddress` return if you pass it an address 
that is equal to the actual memory address of the start of the thumb function, 
but the relevant DW_AT_low_pc contains `address|1`? Answering that might give 
us an indication on what is the layer at which this fixup should be applied.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D73206: `DWARFASTParserClang::m_decl_ctx_to_die` `DWARFDIE`->`DIERef` for DWZ

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

BTW, I am currently trying to clean up the dwo/dwp code, and here (I think) I 
ran into a very similar problem to what you are encountering.

Dwo units currently contain a backlink to the skeleton unit that uses them, and 
we have a fairly convoluted system (that's the part I'm trying to clean up) to 
ensure that each time we are parsing a dwo unit, we are able to go back to the 
skeleton unit which uses it (and then to a lldb_private::CompileUnit). Now, in 
principle, there is nothing wrong with that because the skeleton and split 
units are in a 1:1 relationship. However, the llvm parser does not have such a 
backlink. And although I don't think it would be unreasonable to have the llvm 
parser include this backlink, given that the dwz unit cannot make use of that 
(not 1:1), I think it would be a good idea to come up with a different solution 
for this, and then have both dwo and dwz use that.

Overall I think the intention of passing another DWARFUnit pointer to identify 
the "compile unit that we're actually parsing stuff into" is reasonable (as 
with DWZ, the idea that a DWARFUnit somehow corresponds to an lldb CompileUnit 
is completely breaking down). But I don't think we should be making that a part 
of the DWARFDIE (and thereby inflitrating it into everything). Instead I think 
it should be something on top of that. Whether that needs to be a separate 
class/struct (std::pair?) or just and additional argument 
to the functions that need it is still not fully clear to me...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73206/new/

https://reviews.llvm.org/D73206



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 240118.
mstorsjo added a comment.
Herald added a reviewer: shafik.

Hopefully this is a bit less schizophrenic now. It's still quite RFC'y and many 
of the fixup loops could probably still be refactored, if someone suggests 
where to place the shared code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/include/lldb/Symbol/LineTable.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/include/lldb/Utility/RangeMap.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/source/Symbol/LineTable.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s

Index: lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/thumb-windows.s
@@ -0,0 +1,183 @@
+# Test that a linked windows executable, with a thumb bit in many address
+# fields, gets the thumb bit stripped out from addresses.
+
+# If the thumb bit isn't stripped out from subprogram ranges, 0x401006 is
+# associated with the function "entry", while it actually is the start of
+# the function "other".
+# If the thumb bit isn't stripped out from line tables, the LineEntry
+# points to the wrong line.
+
+# REQUIRES: lld, arm
+
+# RUN: llvm-mc -triple armv7-windows-gnu %s -filetype=obj > %t.o
+# RUN: lld-link %t.o -out:%t.exe -debug:dwarf -entry:entry -subsystem:console -lldmingw
+# RUN: %lldb %t.exe -o "image lookup -v -a 0x401006" -b | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -a 0x401006
+# CHECK: Function: {{.*}}, name = "other", range = [0x00401006-0x0040100c)
+# CHECK: LineEntry: [0x00401006-0x0040100a): /path/to/src/dwarf-thumb.c:7:12
+
+.text
+.syntax unified
+.file   "dwarf-thumb.c"
+.file   1 "" "dwarf-thumb.c"
+.def entry;
+.scl2;
+.type   32;
+.endef
+.globl  entry   @ -- Begin function entry
+.p2align1
+.code   16  @ @entry
+.thumb_func
+entry:
+.Lfunc_begin0:
+.loc1 2 0   @ dwarf-thumb.c:2:0
+.cfi_sections .debug_frame
+.cfi_startproc
+.loc1 4 9 prologue_end  @ dwarf-thumb.c:4:9
+mov r1, r0
+.Ltmp0:
+b   other
+.Ltmp1:
+.Lfunc_end0:
+.cfi_endproc
+@ -- End function
+.def other;
+.scl2;
+.type   32;
+.endef
+.globl  other   @ -- Begin function other
+.p2align1
+.code   16  @ @other
+.thumb_func
+other:
+.Lfunc_begin1:
+.loc1 6 0   @ dwarf-thumb.c:6:0
+.cfi_startproc
+.loc1 7 12 prologue_end @ dwarf-thumb.c:7:12
+add.w   r0, r1, r1, lsl #1
+.loc1 7 2 is_stmt 0 @ dwarf-thumb.c:7:2
+bx  lr
+.Ltmp2:
+.Lfunc_end1:
+.cfi_endproc
+@ -- End function
+.section.debug_str,"dr"
+.Linfo_string:
+.Linfo_string1:
+.asciz  "dwarf-thumb.c"
+.Linfo_string2:
+.asciz  "/path/to/src"
+.Linfo_string3:
+.asciz  "other"
+.Linfo_string6:
+.asciz  "entry"
+.section.debug_loc,"dr"
+.Lsection_debug_loc:
+.Ldebug_loc0:
+.long   .Lfunc_begin0-.Lfunc_begin0
+.long   .Ltmp0-.Lfunc_begin0
+.short  1   @ Loc expr size
+.byte   80  @ DW_OP_reg0
+.long   .Ltmp0-.Lfunc_begin0
+.long   .Lfunc_end0-.Lfunc_begin0
+.short  1   @ Loc expr size
+.byte   81  @ DW_OP_reg1
+.long   0
+.long   0
+.section.debug_abbrev,"dr"
+.Lsection_abbrev:
+.byte   1   @ Abbreviation Code
+.byte   17  @ DW_TAG_compile_unit
+.byte   1   @ DW_CHILDREN_yes
+.byte   37  @ DW_AT_producer
+.byte   37  @ DW_FORM_strx1
+.byte   19  @ DW_AT_language
+.byte   5   @ DW_FORM_data2
+.byte   3   @ DW_AT_name
+.byte   14  @ 

[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70840#1792498 , @labath wrote:

> In D70840#1791292 , @mstorsjo wrote:
>
> > And irrespectively if the ArchSpec vs Architecture design, can you (either 
> > of you) comment on the updated form of the patch?
>
>
> The code still seems somewhat schizophrenic to me. :/ The line tables are 
> fixed up super late, but DW_AT_low_pc is adjusted very early. The line table 
> adjustment happens even after sorting, which means the fixup could alter the 
> sort order. It probably wouldn't matter in practice, as everything would just 
> get decremented by one, but it still seems like a bad design. And adjusting 
> the low_pc so early will complicate the move to the llvm dwarf parser.
>
> I think I'd most prefer some middle ground where the fixup happens after the 
> lowest extraction layers are finished, but before the data hits the "generic" 
> code. It's possible that no such place exists right now, but it might be 
> possible to create something with a bit of refactoring...


I tried to revisit this a bit now. Thanks to D72920 
, some of the more problematic cases went 
away, and I tried to trace all callers of the relevant methods and moving the 
fixups into them. Now the DWARFDebugInfoEntry class is no longer touched at 
all. I also tried to move fixups to before sorting.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D72946: [lldb] Remove ClangASTImporter reference from Target

2020-01-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added inline comments.



Comment at: lldb/include/lldb/Symbol/TypeSystemClang.h:38
 
+#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
+

I would also just let this be part of the normal include list without the empty 
line (or wherever clang format decides to place this).



Comment at: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp:21
 
+#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
+

I would just keep this in the include list above and let clang-format do its 
thing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72946/new/

https://reviews.llvm.org/D72946



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D72751#1837883 , @aadsm wrote:

> Yeah, I'm not sure why the LoadModules function is calling 
> target.SetExecutableModule. It is true that the libraries-svr4 will not 
> include the main executable in its list.
>  This code was added in the context of providing qXfer:libraries support 
> here: https://reviews.llvm.org/D9471. I don't see any mention of including 
> the executable on that packet though: 
> https://sourceware.org/gdb/current/onlinedocs/gdb/Library-List-Format.html. 
> @clayborg was the main reviewer there (although this was 5 years ago or so) 
> and he does mention multiple times in the comments this exact issue with 
> calling target.SetExecutableModule. Maybe he can still remember and provide 
> some light here :).


Thanks for digging this up, Antonio. My impression of that thread is that the 
author did not fully understand what Greg was asking him to do, and then that 
discussion got buried in other stuff. Given that qXfer is not supposed to send 
shared libraries, wasm is not going to be using it, and it doesn't look like 
this code could ever work, I'm tempted to just remove this `SetExecutable` 
block. :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72751/new/

https://reviews.llvm.org/D72751



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


[Lldb-commits] [PATCH] D72946: [lldb] Remove ClangASTImporter reference from Target

2020-01-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

In D72946#1827372 , @clayborg wrote:

> Is an AST importer specific to a target? Can we just put it into the Clang 
> AST type system subclass and create it lazily?


If ClangASTImporter was stateless I would agree. But as the ClangASTImporter 
stores and hands out ASTImporters, it has a *lot* of state. So in theory we 
should only have one in LLDB to not have different state that goes out of sync. 
That doesn't fully work as the modules and the target are independent, so 
having 1(target) + N(modules) is the best we can do I think.

Anyway, the current approach moves it into the ClangPersistentVariables (which 
are part of the TypeSystemClangForExpressions which is the one for the 
target-unique scratch ASTContext) so this LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72946/new/

https://reviews.llvm.org/D72946



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D72751#1837764 , @paolosev wrote:

> Thanks for the explanation! I wasn't quite clear on "executable module" here, 
> but after your comments I realized that `Target::SetExecutableModule()` 
> should not probably be called also for Wasm modules.
>  The point is that `ObjectFileWasm::CalculateType()` should return 
> `eTypeSharedLibrary`, not `eTypeExecutable`.
>  With this change the first issue is easily solved: we just need to call 
> `Target::SetSectionLoadAddress()` once, in `ObjectFileWasm::SetLoadAddress()` 
> because `Target::SetExecutableModule() -> Target::ClearModules() -> 
> SectionLoadList::Clear()` is not called, and 
> `DynamicLoaderWasmDYLD::DidAttach()` can be simplified to just call 
> `ProcessGDBRemote::LoadModules()`.
>  Does this solution work for you?


I am fine that. I don't really know enough about wasm to say if you should have 
something like the "main" module, but I don't think it should make a big 
difference to lldb anyway. And another benefit to that is that we can say we 
stick to the qXfer "spec" and only send the shared libraries over.

> If so, we should look at the second point, the need to initialize 
> `m_file_addr = m_file_offset = 0` for the "code" Section in order to make the 
> DWARF symbols work...

Yes, let's do that. Can you check what happens if you just move the 
`file_offset = sect_info.offset & 0x;` line in ObjectFileWasm outside 
of the `if(!code)` block? My guess is that you'll just need to replace some 
section->GetFileOffset() calls with ->GetFileAddress(). I'm pretty sure those 
calls will be only in wasm code because other object formats don't have 
sections at file offset zero, and everything is fine with that.




Comment at: 
lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp:56-69
+/// In WebAssembly, linear memory is disjointed from code space. The VM can 
load
+/// multiple instances of a module, which logically share the same code.
+/// Currently we only support wasm32, which uses a 32-bit address space for the
+/// code.
+/// We represent a code address in LLDB as a 64-bit address with the format:
+/// 6332 31 0
+/// +---+---+

This comment is probably not that useful anymore...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72751/new/

https://reviews.llvm.org/D72751



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


[Lldb-commits] [lldb] 041fa5a - [lldb] Fix file header of Host/posix/FileSystemPosix.cpp

2020-01-24 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2020-01-24T00:29:53-08:00
New Revision: 041fa5ad7c3c61b2253efaa049326ea7e98752ab

URL: 
https://github.com/llvm/llvm-project/commit/041fa5ad7c3c61b2253efaa049326ea7e98752ab
DIFF: 
https://github.com/llvm/llvm-project/commit/041fa5ad7c3c61b2253efaa049326ea7e98752ab.diff

LOG: [lldb] Fix file header of Host/posix/FileSystemPosix.cpp

Added: 


Modified: 
lldb/source/Host/posix/FileSystemPosix.cpp

Removed: 




diff  --git a/lldb/source/Host/posix/FileSystemPosix.cpp 
b/lldb/source/Host/posix/FileSystemPosix.cpp
index 4c7158b42feb..3660f67895a4 100644
--- a/lldb/source/Host/posix/FileSystemPosix.cpp
+++ b/lldb/source/Host/posix/FileSystemPosix.cpp
@@ -1,4 +1,4 @@
-//===-- FileSystem.cpp 
===//
+//===-- FileSystemPosix.cpp 
---===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.



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