[Lldb-commits] [lldb] 30e7df0 - [lldb] XFAIL TestTypeGetModule.py (temporarily)

2020-10-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-10-29T18:37:46-07:00
New Revision: 30e7df0d58542ad35d517eace70a4cea40e6fa7a

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

LOG: [lldb] XFAIL TestTypeGetModule.py (temporarily)

Temporarily XFAIL'ing TestTypeGetModule.py while the DWO failure is
being investigated.

Added: 


Modified: 
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py 
b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index 14edc0a14675..80ce005e7ed1 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -58,6 +58,7 @@ def find_type(self, type_list, name):
 
 return result
 
+@expectedFailureAll(debug_info=["dwo"])
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)



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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

It was still failing so I've temporarily XFAIL'ed it in 
30e7df0d58542ad35d517eace70a4cea40e6fa7a 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D88483#2363529 , @fallkrum wrote:

> make types extern.
> @jingham  please commit this patch to check if it will fix DWO issue, the 
> rest of your recommendations will add later.

Jim asked me to follow up on this so I've committed this for you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [lldb] 56282cf - [lldb] Update TestTypeGetModule.py

2020-10-29 Thread Jonas Devlieghere via lldb-commits

Author: Ilya Bukonkin
Date: 2020-10-29T18:28:57-07:00
New Revision: 56282cf7e271092a81aced9cb1e8998f2d395f70

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

LOG: [lldb] Update TestTypeGetModule.py

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

Added: 
lldb/test/API/functionalities/type_get_module/type_definitions.h

Modified: 
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
lldb/test/API/functionalities/type_get_module/compile_unit1.c
lldb/test/API/functionalities/type_get_module/compile_unit2.c
lldb/test/API/functionalities/type_get_module/main.c

Removed: 




diff  --git 
a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py 
b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index ccab396455ea..14edc0a14675 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -17,78 +17,78 @@ def find_module(self, target, name):
 num_modules = target.GetNumModules()
 index = 0
 result = lldb.SBModule()
-
+
 while index < num_modules:
 module = target.GetModuleAtIndex(index)
 if module.GetFileSpec().GetFilename() == name:
 result = module
 break
-
+
 index += 1
-
+
 return result
 
 def find_comp_unit(self, exe_module, name):
 num_comp_units = exe_module.GetNumCompileUnits()
 index = 0
 result = lldb.SBCompileUnit()
-
+
 while index < num_comp_units:
 comp_unit = exe_module.GetCompileUnitAtIndex(index)
 if comp_unit.GetFileSpec().GetFilename() == name:
 result = comp_unit
 break
-
+
 index += 1
-
+
 return result
-
+
 def find_type(self, type_list, name):
 num_types = type_list.GetSize()
 index = 0
 result = lldb.SBType()
-
+
 while index < num_types:
 type = type_list.GetTypeAtIndex(index)
 if type.GetName() == name:
 result = type
 break
-
+
 index += 1
-
+
 return result
-
+
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)
 exe_module = self.find_module(target, 'a.out')
 self.assertTrue(exe_module.IsValid())
-
+
 type1_name = 'compile_unit1_type'
 type2_name = 'compile_unit2_type'
-
+
 num_comp_units = exe_module.GetNumCompileUnits()
 self.assertEqual(num_comp_units, 3)
-
+
 comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
 self.assertTrue(comp_unit.IsValid())
-
+
 cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
 self.assertTrue(cu_type.IsValid())
 self.assertEqual(cu_type.GetName(), type1_name)
-
+
 comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
 self.assertTrue(comp_unit.IsValid())
-
+
 cu_type = self.find_type(comp_unit.GetTypes(), type2_name)
 self.assertTrue(cu_type.IsValid())
 self.assertEqual(cu_type.GetName(), type2_name)
-
+
 type1 = target.FindFirstType(type1_name)
 self.assertTrue(type1.IsValid())
-
+
 type2 = target.FindFirstType(type2_name)
 self.assertTrue(type2.IsValid())
-
+
 self.assertTrue(exe_module == type1.GetModule() and
 exe_module == type2.GetModule())

diff  --git a/lldb/test/API/functionalities/type_get_module/compile_unit1.c 
b/lldb/test/API/functionalities/type_get_module/compile_unit1.c
index 0f967ef66810..2d1a31ccbf0c 100644
--- a/lldb/test/API/functionalities/type_get_module/compile_unit1.c
+++ b/lldb/test/API/functionalities/type_get_module/compile_unit1.c
@@ -1,6 +1,3 @@
-struct compile_unit1_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit1_type compile_unit1_var = {1, 1};

diff  --git a/lldb/test/API/functionalities/type_get_module/compile_unit2.c 
b/lldb/test/API/functionalities/type_get_module/compile_unit2.c
index ca7735e27042..2d93d1fb8758 100644
--- a/lldb/test/API/functionalities/type_get_module/compile_unit2.c
+++ b/lldb/test/API/functionalities/type_get_module/compile_unit2.c
@@ -1,6 +1,3 @@
-struct compile_unit2_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit2_type compile_unit2_var = {2, 2};

diff  --git a/lldb/test/API/functionalities/type_get_module/main.c 

[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG56282cf7e271: [lldb] Update TestTypeGetModule.py (authored 
by fallkrum, committed by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D88483?vs=301796=301801#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

Files:
  lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
  lldb/test/API/functionalities/type_get_module/compile_unit1.c
  lldb/test/API/functionalities/type_get_module/compile_unit2.c
  lldb/test/API/functionalities/type_get_module/main.c
  lldb/test/API/functionalities/type_get_module/type_definitions.h

Index: lldb/test/API/functionalities/type_get_module/type_definitions.h
===
--- /dev/null
+++ lldb/test/API/functionalities/type_get_module/type_definitions.h
@@ -0,0 +1,9 @@
+struct compile_unit1_type {
+  int x;
+  int y;
+};
+
+struct compile_unit2_type {
+  int x;
+  int y;
+};
Index: lldb/test/API/functionalities/type_get_module/main.c
===
--- lldb/test/API/functionalities/type_get_module/main.c
+++ lldb/test/API/functionalities/type_get_module/main.c
@@ -1 +1,11 @@
-int main() { return 0; }
+#include "type_definitions.h"
+
+extern struct compile_unit1_type compile_unit1_var;
+extern struct compile_unit2_type compile_unit2_var;
+
+int main() {
+  compile_unit1_var.x = 5;
+  compile_unit2_var.y = 10;
+
+  return 0;
+}
Index: lldb/test/API/functionalities/type_get_module/compile_unit2.c
===
--- lldb/test/API/functionalities/type_get_module/compile_unit2.c
+++ lldb/test/API/functionalities/type_get_module/compile_unit2.c
@@ -1,6 +1,3 @@
-struct compile_unit2_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit2_type compile_unit2_var = {2, 2};
Index: lldb/test/API/functionalities/type_get_module/compile_unit1.c
===
--- lldb/test/API/functionalities/type_get_module/compile_unit1.c
+++ lldb/test/API/functionalities/type_get_module/compile_unit1.c
@@ -1,6 +1,3 @@
-struct compile_unit1_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit1_type compile_unit1_var = {1, 1};
Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -17,78 +17,78 @@
 num_modules = target.GetNumModules()
 index = 0
 result = lldb.SBModule()
-
+
 while index < num_modules:
 module = target.GetModuleAtIndex(index)
 if module.GetFileSpec().GetFilename() == name:
 result = module
 break
-
+
 index += 1
-
+
 return result
 
 def find_comp_unit(self, exe_module, name):
 num_comp_units = exe_module.GetNumCompileUnits()
 index = 0
 result = lldb.SBCompileUnit()
-
+
 while index < num_comp_units:
 comp_unit = exe_module.GetCompileUnitAtIndex(index)
 if comp_unit.GetFileSpec().GetFilename() == name:
 result = comp_unit
 break
-
+
 index += 1
-
+
 return result
-
+
 def find_type(self, type_list, name):
 num_types = type_list.GetSize()
 index = 0
 result = lldb.SBType()
-
+
 while index < num_types:
 type = type_list.GetTypeAtIndex(index)
 if type.GetName() == name:
 result = type
 break
-
+
 index += 1
-
+
 return result
-
+
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)
 exe_module = self.find_module(target, 'a.out')
 self.assertTrue(exe_module.IsValid())
-
+
 type1_name = 'compile_unit1_type'
 type2_name = 'compile_unit2_type'
-
+
 num_comp_units = exe_module.GetNumCompileUnits()
 self.assertEqual(num_comp_units, 3)
-
+
 comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
 self.assertTrue(comp_unit.IsValid())
-
+
 cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
 self.assertTrue(cu_type.IsValid())
 self.assertEqual(cu_type.GetName(), type1_name)
-
+
 comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
 self.assertTrue(comp_unit.IsValid())

[Lldb-commits] [PATCH] D89842: [lldb/DWARF] Add support for DW_OP_implicit_value

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89842

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


[Lldb-commits] [PATCH] D89842: [lldb/DWARF] Add support for DW_OP_implicit_value

2020-10-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGefe62b637d51: [lldb/DWARF] Add support for 
DW_OP_implicit_value (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89842

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -218,6 +218,14 @@
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_implicit_value) {
+  unsigned char bytes = 4;
+
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_implicit_value, bytes, 0x11, 0x22, 0x33, 0x44}),
+  llvm::HasValue(GetScalar(8 * bytes, 0x44332211, true)));
+}
+
 TEST(DWARFExpression, DW_OP_unknown) {
   EXPECT_THAT_EXPECTED(
   Evaluate({0xff}),
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2248,6 +2248,29 @@
   }
   break;
 
+// OPCODE: DW_OP_implicit_value
+// OPERANDS: 2
+//  ULEB128  size of the value block in bytes
+//  uint8_t* block bytes encoding value in target's memory
+//  representation
+// DESCRIPTION: Value is immediately stored in block in the debug info with
+// the memory representation of the target.
+case DW_OP_implicit_value: {
+  const uint32_t len = opcodes.GetULEB128();
+  const void *data = opcodes.GetData(, len);
+
+  if (!data) {
+LLDB_LOG(log, "Evaluate_DW_OP_implicit_value: could not be read data");
+LLDB_ERRORF(error_ptr, "Could not evaluate %s.",
+DW_OP_value_to_name(op));
+return false;
+  }
+
+  Value result(data, len);
+  stack.push_back(result);
+  break;
+}
+
 // OPCODE: DW_OP_push_object_address
 // OPERANDS: none
 // DESCRIPTION: Pushes the address of the object currently being


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -218,6 +218,14 @@
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_implicit_value) {
+  unsigned char bytes = 4;
+
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_implicit_value, bytes, 0x11, 0x22, 0x33, 0x44}),
+  llvm::HasValue(GetScalar(8 * bytes, 0x44332211, true)));
+}
+
 TEST(DWARFExpression, DW_OP_unknown) {
   EXPECT_THAT_EXPECTED(
   Evaluate({0xff}),
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2248,6 +2248,29 @@
   }
   break;
 
+// OPCODE: DW_OP_implicit_value
+// OPERANDS: 2
+//  ULEB128  size of the value block in bytes
+//  uint8_t* block bytes encoding value in target's memory
+//  representation
+// DESCRIPTION: Value is immediately stored in block in the debug info with
+// the memory representation of the target.
+case DW_OP_implicit_value: {
+  const uint32_t len = opcodes.GetULEB128();
+  const void *data = opcodes.GetData(, len);
+
+  if (!data) {
+LLDB_LOG(log, "Evaluate_DW_OP_implicit_value: could not be read data");
+LLDB_ERRORF(error_ptr, "Could not evaluate %s.",
+DW_OP_value_to_name(op));
+return false;
+  }
+
+  Value result(data, len);
+  stack.push_back(result);
+  break;
+}
+
 // OPCODE: DW_OP_push_object_address
 // OPERANDS: none
 // DESCRIPTION: Pushes the address of the object currently being
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum updated this revision to Diff 301796.
fallkrum added a comment.

make types extern.
@jingham  please commit this patch to check if it will fix DWO issue, the rest 
of your recommendations will add later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

Files:
  lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
  lldb/test/API/functionalities/type_get_module/compile_unit1.c
  lldb/test/API/functionalities/type_get_module/compile_unit2.c
  lldb/test/API/functionalities/type_get_module/main.c
  lldb/test/API/functionalities/type_get_module/type_definitions.h

Index: lldb/test/API/functionalities/type_get_module/type_definitions.h
===
--- /dev/null
+++ lldb/test/API/functionalities/type_get_module/type_definitions.h
@@ -0,0 +1,9 @@
+struct compile_unit1_type {
+  int x;
+  int y;
+};
+
+struct compile_unit2_type {
+  int x;
+  int y;
+};
Index: lldb/test/API/functionalities/type_get_module/main.c
===
--- lldb/test/API/functionalities/type_get_module/main.c
+++ lldb/test/API/functionalities/type_get_module/main.c
@@ -1 +1,11 @@
-int main() { return 0; }
+#include "type_definitions.h"
+
+extern struct compile_unit1_type compile_unit1_var;
+extern struct compile_unit2_type compile_unit2_var;
+
+int main() {
+  compile_unit1_var.x = 5;
+  compile_unit2_var.y = 10;
+
+  return 0;
+}
Index: lldb/test/API/functionalities/type_get_module/compile_unit2.c
===
--- lldb/test/API/functionalities/type_get_module/compile_unit2.c
+++ lldb/test/API/functionalities/type_get_module/compile_unit2.c
@@ -1,6 +1,3 @@
-struct compile_unit2_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit2_type compile_unit2_var = {2, 2};
Index: lldb/test/API/functionalities/type_get_module/compile_unit1.c
===
--- lldb/test/API/functionalities/type_get_module/compile_unit1.c
+++ lldb/test/API/functionalities/type_get_module/compile_unit1.c
@@ -1,6 +1,3 @@
-struct compile_unit1_type {
-  int x;
-  int y;
-};
+#include "type_definitions.h"
 
 struct compile_unit1_type compile_unit1_var = {1, 1};
Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -13,10 +13,56 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+def find_module(self, target, name):
+num_modules = target.GetNumModules()
+index = 0
+result = lldb.SBModule()
+
+while index < num_modules:
+module = target.GetModuleAtIndex(index)
+if module.GetFileSpec().GetFilename() == name:
+result = module
+break
+
+index += 1
+
+return result
+
+def find_comp_unit(self, exe_module, name):
+num_comp_units = exe_module.GetNumCompileUnits()
+index = 0
+result = lldb.SBCompileUnit()
+
+while index < num_comp_units:
+comp_unit = exe_module.GetCompileUnitAtIndex(index)
+if comp_unit.GetFileSpec().GetFilename() == name:
+result = comp_unit
+break
+
+index += 1
+
+return result
+
+def find_type(self, type_list, name):
+num_types = type_list.GetSize()
+index = 0
+result = lldb.SBType()
+
+while index < num_types:
+type = type_list.GetTypeAtIndex(index)
+if type.GetName() == name:
+result = type
+break
+
+index += 1
+
+return result
+
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)
-exe_module = target.GetModuleAtIndex(0)
+exe_module = self.find_module(target, 'a.out')
+self.assertTrue(exe_module.IsValid())
 
 type1_name = 'compile_unit1_type'
 type2_name = 'compile_unit2_type'
@@ -24,13 +70,19 @@
 num_comp_units = exe_module.GetNumCompileUnits()
 self.assertEqual(num_comp_units, 3)
 
-comp_unit = exe_module.GetCompileUnitAtIndex(1)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
-self.assertEqual(type_name, type1_name)
+comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
+self.assertTrue(comp_unit.IsValid())
+
+cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
+self.assertTrue(cu_type.IsValid())
+   

[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The test failed in the new form at line 77.  So we got the CU for 
compile_unit1.c and it was valid.  But it didn't contain an SBType for 
compile_unit1_type.  Probably the same thing is true in compile_unit2.c you 
just didn't get there.

Maybe your executable is too artificial?  You define a type in easy .c file, 
and you make a CU level variable with that type.  But neither of those 
variables are used by anything.  So some compiler that's being a little bit too 
smart for our good could discern that it can elide all those types.  Maybe make 
those struct elements extern and refer to them in main.c so that the compiler 
will have to keep them around?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Sorry to be picky, but you can compress this by putting the IsValid checks into 
your find_* routines.  And the:

  self.assertEqual(cu_type.GetName(), type2_name)

calls aren't necessary, since you already found the type by matching the name.  
So I think you can simplify this by moving all the checks into the helper 
routines.

Note, you are also assuming that SBTarget::FindFirstType goes through the 
modules starting with the executable module for the tests at the end of the 
file.  That is true but is not part of the contract for FindFirstType.  It 
doesn't seem a good idea to rely on that either.

I pushed this version so we can hopefully either clear up the bot failures or 
better see why they are happening.  But can you clean up the patch as suggested 
above for the final version?  Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [lldb] 32a85b2 - This is a preliminary version of the test for https://reviews.llvm.org/D88483.

2020-10-29 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2020-10-29T16:39:35-07:00
New Revision: 32a85b268a010035e81646541ac1c9675da6cb2e

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

LOG: This is a preliminary version of the test for 
https://reviews.llvm.org/D88483.

The test can be cleaned up a bit, but this should be good to see why the
Debian bot is failing...

Added: 


Modified: 
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py 
b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
index e6acecc76e17..ccab396455ea 100644
--- a/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ b/lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -13,10 +13,56 @@ class TestTypeGetModule(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+def find_module(self, target, name):
+num_modules = target.GetNumModules()
+index = 0
+result = lldb.SBModule()
+
+while index < num_modules:
+module = target.GetModuleAtIndex(index)
+if module.GetFileSpec().GetFilename() == name:
+result = module
+break
+
+index += 1
+
+return result
+
+def find_comp_unit(self, exe_module, name):
+num_comp_units = exe_module.GetNumCompileUnits()
+index = 0
+result = lldb.SBCompileUnit()
+
+while index < num_comp_units:
+comp_unit = exe_module.GetCompileUnitAtIndex(index)
+if comp_unit.GetFileSpec().GetFilename() == name:
+result = comp_unit
+break
+
+index += 1
+
+return result
+
+def find_type(self, type_list, name):
+num_types = type_list.GetSize()
+index = 0
+result = lldb.SBType()
+
+while index < num_types:
+type = type_list.GetTypeAtIndex(index)
+if type.GetName() == name:
+result = type
+break
+
+index += 1
+
+return result
+
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)
-exe_module = target.GetModuleAtIndex(0)
+exe_module = self.find_module(target, 'a.out')
+self.assertTrue(exe_module.IsValid())
 
 type1_name = 'compile_unit1_type'
 type2_name = 'compile_unit2_type'
@@ -24,13 +70,19 @@ def test(self):
 num_comp_units = exe_module.GetNumCompileUnits()
 self.assertEqual(num_comp_units, 3)
 
-comp_unit = exe_module.GetCompileUnitAtIndex(1)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
-self.assertEqual(type_name, type1_name)
+comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
+self.assertTrue(comp_unit.IsValid())
+
+cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
+self.assertTrue(cu_type.IsValid())
+self.assertEqual(cu_type.GetName(), type1_name)
+
+comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
+self.assertTrue(comp_unit.IsValid())
 
-comp_unit = exe_module.GetCompileUnitAtIndex(2)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
-self.assertEqual(type_name, type2_name)
+cu_type = self.find_type(comp_unit.GetTypes(), type2_name)
+self.assertTrue(cu_type.IsValid())
+self.assertEqual(cu_type.GetName(), type2_name)
 
 type1 = target.FindFirstType(type1_name)
 self.assertTrue(type1.IsValid())



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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum added a comment.

In D88483#2363277 , @jingham wrote:

> This test is still assuming (1) that main.c is CompUnit(0), etc.  You don't 
> know that's true.  And that there is only one type in each CU (and type 0 is 
> the one you want).  Neither of these is guaranteed.  Can you check all these 
> things, I'd rather not have to go a bunch of rounds on this.

Sorry, did not pay due attention on this. Think this issue is solved in my 
latest update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum updated this revision to Diff 301783.
fallkrum added a comment.

Api test fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

Files:
  lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py


Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -13,10 +13,56 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+def find_module(self, target, name):
+num_modules = target.GetNumModules()
+index = 0
+result = lldb.SBModule()
+
+while index < num_modules:
+module = target.GetModuleAtIndex(index)
+if module.GetFileSpec().GetFilename() == name:
+result = module
+break
+
+index += 1
+
+return result
+
+def find_comp_unit(self, exe_module, name):
+num_comp_units = exe_module.GetNumCompileUnits()
+index = 0
+result = lldb.SBCompileUnit()
+
+while index < num_comp_units:
+comp_unit = exe_module.GetCompileUnitAtIndex(index)
+if comp_unit.GetFileSpec().GetFilename() == name:
+result = comp_unit
+break
+
+index += 1
+
+return result
+
+def find_type(self, type_list, name):
+num_types = type_list.GetSize()
+index = 0
+result = lldb.SBType()
+
+while index < num_types:
+type = type_list.GetTypeAtIndex(index)
+if type.GetName() == name:
+result = type
+break
+
+index += 1
+
+return result
+
 def test(self):
 self.build()
 target  = lldbutil.run_to_breakpoint_make_target(self)
-exe_module = target.GetModuleAtIndex(0)
+exe_module = self.find_module(target, 'a.out')
+self.assertTrue(exe_module.IsValid())
 
 type1_name = 'compile_unit1_type'
 type2_name = 'compile_unit2_type'
@@ -24,13 +70,19 @@
 num_comp_units = exe_module.GetNumCompileUnits()
 self.assertEqual(num_comp_units, 3)
 
-comp_unit = exe_module.GetCompileUnitAtIndex(1)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
-self.assertEqual(type_name, type1_name)
+comp_unit = self.find_comp_unit(exe_module, 'compile_unit1.c')
+self.assertTrue(comp_unit.IsValid())
+
+cu_type = self.find_type(comp_unit.GetTypes(), type1_name)
+self.assertTrue(cu_type.IsValid())
+self.assertEqual(cu_type.GetName(), type1_name)
+
+comp_unit = self.find_comp_unit(exe_module, 'compile_unit2.c')
+self.assertTrue(comp_unit.IsValid())
 
-comp_unit = exe_module.GetCompileUnitAtIndex(2)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
-self.assertEqual(type_name, type2_name)
+cu_type = self.find_type(comp_unit.GetTypes(), type2_name)
+self.assertTrue(cu_type.IsValid())
+self.assertEqual(cu_type.GetName(), type2_name)
 
 type1 = target.FindFirstType(type1_name)
 self.assertTrue(type1.IsValid())


Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -13,10 +13,56 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+def find_module(self, target, name):
+num_modules = target.GetNumModules()
+index = 0
+result = lldb.SBModule()
+
+while index < num_modules:
+module = target.GetModuleAtIndex(index)
+if module.GetFileSpec().GetFilename() == name:
+result = module
+break
+
+index += 1
+
+return result
+
+def find_comp_unit(self, exe_module, name):
+num_comp_units = exe_module.GetNumCompileUnits()
+index = 0
+result = lldb.SBCompileUnit()
+
+while index < num_comp_units:
+comp_unit = exe_module.GetCompileUnitAtIndex(index)
+if comp_unit.GetFileSpec().GetFilename() == name:
+result = comp_unit
+break
+
+index += 1
+
+return result
+
+def find_type(self, type_list, name):
+num_types = type_list.GetSize()
+index = 0
+result = lldb.SBType()
+
+while index < 

[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This test is still assuming (1) that main.c is CompUnit(0), etc.  You don't 
know that's true.  And that there is only one type in each CU (and type 0 is 
the one you want).  Neither of these is guaranteed.  Can you check all these 
things, I'd rather not have to go a bunch of rounds on this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum added a comment.

In D88483#2363075 , @fallkrum wrote:

> @JDevlieghere @jingham api test failed after my commit:
> http://lab.llvm.org:8011/#/builders/68/builds/1040
> Had no such an error on my computer, please help to figure out what went 
> wrong.

Checked test on my machine again, it simply skips DWO:

  libstdcxx tests will not be run because: Don't know how to build with 
libstdcxx on macosx
  Skipping following debug info categories: ['dwo']
  
  Session logs for test failures/errors/unexpected successes will go into 
directory 
'/Users/ilya/Documents/Projects/llvm-project/build/Ninja/lldb-test-traces'
  PASS: LLDB 
(/Users/ilya/Documents/Projects/llvm-project/build/Ninja/bin/clang-x86_64) :: 
test_dsym (TestTypeGetModule.TestTypeGetModule)
  PASS: LLDB 
(/Users/ilya/Documents/Projects/llvm-project/build/Ninja/bin/clang-x86_64) :: 
test_dwarf (TestTypeGetModule.TestTypeGetModule)
  UNSUPPORTED: LLDB 
(/Users/ilya/Documents/Projects/llvm-project/build/Ninja/bin/clang-x86_64) :: 
test_dwo (TestTypeGetModule.TestTypeGetModule) (test case does not fall in any 
category of interest for this run) 
  PASS: LLDB 
(/Users/ilya/Documents/Projects/llvm-project/build/Ninja/bin/clang-x86_64) :: 
test_gmodules (TestTypeGetModule.TestTypeGetModule)
  }

@jingham Are there special tricks to enable DWO testing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum updated this revision to Diff 301768.
fallkrum added a comment.

Api test improvements.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

Files:
  lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py


Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -25,11 +25,25 @@
 self.assertEqual(num_comp_units, 3)
 
 comp_unit = exe_module.GetCompileUnitAtIndex(1)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
+self.assertTrue(comp_unit.IsValid())
+
+type = comp_unit.GetTypes().GetTypeAtIndex(0)
+self.assertTrue(type.IsValid())
+
+type_name = type.GetName()
+if self.TraceOn():
+print(type_name)
 self.assertEqual(type_name, type1_name)
 
 comp_unit = exe_module.GetCompileUnitAtIndex(2)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
+self.assertTrue(comp_unit.IsValid())
+
+type = comp_unit.GetTypes().GetTypeAtIndex(0)
+self.assertTrue(type.IsValid())
+
+type_name = type.GetName()
+if self.TraceOn():
+print(type_name)
 self.assertEqual(type_name, type2_name)
 
 type1 = target.FindFirstType(type1_name)


Index: lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
===
--- lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
+++ lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
@@ -25,11 +25,25 @@
 self.assertEqual(num_comp_units, 3)
 
 comp_unit = exe_module.GetCompileUnitAtIndex(1)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
+self.assertTrue(comp_unit.IsValid())
+
+type = comp_unit.GetTypes().GetTypeAtIndex(0)
+self.assertTrue(type.IsValid())
+
+type_name = type.GetName()
+if self.TraceOn():
+print(type_name)
 self.assertEqual(type_name, type1_name)
 
 comp_unit = exe_module.GetCompileUnitAtIndex(2)
-type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()
+self.assertTrue(comp_unit.IsValid())
+
+type = comp_unit.GetTypes().GetTypeAtIndex(0)
+self.assertTrue(type.IsValid())
+
+type_name = type.GetName()
+if self.TraceOn():
+print(type_name)
 self.assertEqual(type_name, type2_name)
 
 type1 = target.FindFirstType(type1_name)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] fa5a132 - Provide a reasonable value for PATH_MAX if the lldb headers don't provide it.

2020-10-29 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2020-10-29T15:02:51-07:00
New Revision: fa5a13276764a2657b3571fa3c57b07ee5d2d661

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

LOG: Provide a reasonable value for PATH_MAX if the lldb headers don't provide 
it.

Added: 


Modified: 
lldb/test/API/api/multithreaded/test_stop-hook.cpp.template

Removed: 




diff  --git a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template 
b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
index 8b60421ec301..393e717cceb5 100644
--- a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
@@ -12,6 +12,10 @@
 
 #include "common.h"
 
+#if !defined(PATH_MAX)
+#define PATH_MAX 4096
+#endif
+
 using namespace lldb;
 
 void test(SBDebugger , std::vector args) {



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


[Lldb-commits] [lldb] c8c07b7 - Use !hasLocalLinkage instead of listing the symbol types

2020-10-29 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2020-10-29T14:44:06-07:00
New Revision: c8c07b76b2cf2ada8e7ec132f7f57b97d76743cf

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

LOG: Use !hasLocalLinkage instead of listing the symbol types
we should be exporting one by one.

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

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index e3c9c1d7fdf5..538935da52ee 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -328,8 +328,7 @@ void IRExecutionUnit::GetRunnableInfo(Status , 
lldb::addr_t _addr,
 if (function.isDeclaration() || function.hasPrivateLinkage())
   continue;
 
-const bool external =
-function.hasExternalLinkage() || function.hasLinkOnceODRLinkage();
+const bool external = !function.hasLocalLinkage();
 
 void *fun_ptr = m_execution_engine_up->getPointerToFunction();
 



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


[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8c07b76b2cf: Use !hasLocalLinkage instead of listing the 
symbol types (authored by jingham).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78972

Files:
  lldb/source/Expression/IRExecutionUnit.cpp


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -328,8 +328,7 @@
 if (function.isDeclaration() || function.hasPrivateLinkage())
   continue;
 
-const bool external =
-function.hasExternalLinkage() || function.hasLinkOnceODRLinkage();
+const bool external = !function.hasLocalLinkage();
 
 void *fun_ptr = m_execution_engine_up->getPointerToFunction();
 


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -328,8 +328,7 @@
 if (function.isDeclaration() || function.hasPrivateLinkage())
   continue;
 
-const bool external =
-function.hasExternalLinkage() || function.hasLinkOnceODRLinkage();
+const bool external = !function.hasLocalLinkage();
 
 void *fun_ptr = m_execution_engine_up->getPointerToFunction();
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D90332: Mark the execution of commands in stop hooks as non-interactive

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa37672e2db73: Mark the execution of stop-hooks as 
non-interactive. (authored by jingham).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90332

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Target/Target.cpp
  lldb/test/API/api/multithreaded/TestMultithreaded.py
  lldb/test/API/api/multithreaded/some_cmd.py
  lldb/test/API/api/multithreaded/test_stop-hook.cpp.template

Index: lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
===
--- /dev/null
+++ lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
@@ -0,0 +1,130 @@
+// LLDB C++ API Test: Verify that when the Debugger stdin
+// is set to a FILE *, lldb can still successfully run a
+// python command in a stop hook.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+%include_SB_APIs%
+
+#include "common.h"
+
+using namespace lldb;
+
+void test(SBDebugger , std::vector args) {
+  // The problem we had was that when the thread that was
+  // waiting on input went into the call to 'read' it had
+  // the file handle lock.  Then when the python interpreter
+  // Initialized itself to run the python command, it tried
+  // to flush the file channel, and that deadlocked.
+  // This only happens when Async is true, since otherwise
+  // the process event is handled on the I/O read thread,
+  // which sidestepped the problem.
+  dbg.SetAsync(true);
+
+  SBTarget target = dbg.CreateTarget(args.at(0).c_str());
+  if (!target.IsValid())
+throw Exception("invalid target");
+
+  SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
+  if (!breakpoint.IsValid())
+throw Exception("invalid breakpoint");
+
+  SBCommandInterpreter interp = dbg.GetCommandInterpreter();
+  SBCommandReturnObject result;
+
+  // Bring in the python command. We actually add two commands,
+  // one that runs in the stop hook and sets a variable when it
+  // runs, and one that reports out the variable so we can ensure
+  // that we did indeed run the stop hook.
+  const char *source_dir = "%SOURCE_DIR%";
+  SBFileSpec script_spec(source_dir);
+  script_spec.AppendPathComponent("some_cmd.py");
+  char path[PATH_MAX];
+  script_spec.GetPath(path, PATH_MAX);
+
+  std::string import_command("command script import ");
+  import_command.append(path);
+  interp.HandleCommand(import_command.c_str(), result);
+  if (!result.Succeeded())
+throw Exception("Couldn't import %SOURCE_DIR%/some_cmd.py");
+
+  SBProcess process = target.LaunchSimple(nullptr, nullptr, nullptr);
+  if (!process.IsValid())
+throw Exception("Couldn't launch process.");
+  if (process.GetState() != lldb::eStateStopped)
+throw Exception("Process was not stopped");
+
+  process.SetSelectedThreadByIndexID(0);
+
+  // Now add the stop hook:
+  interp.HandleCommand("target stop-hook add -o some-cmd", result);
+  if (!result.Succeeded())
+throw Exception("Couldn't add a stop hook.");
+
+  // Now switch the I/O over to a pipe, which will be handled by the
+  // NativeFile class:
+  int to_lldb_des[2];
+  int pipe_result = pipe(to_lldb_des);
+  FILE *fh_lldb_in = fdopen(to_lldb_des[0], "r");
+  FILE *fh_to_lldb = fdopen(to_lldb_des[1], "w");
+
+  // We need to reset the handle before destroying the debugger
+  // or the same deadlock will stall exiting:
+  class Cleanup {
+  public:
+Cleanup(SBDebugger dbg, int filedes[2]) : m_dbg(dbg) {
+  m_file = m_dbg.GetInputFileHandle();
+  m_filedes[0] = filedes[0];
+  m_filedes[1] = filedes[1];
+}
+~Cleanup() {
+  m_dbg.SetInputFileHandle(m_file, false);
+  close(m_filedes[0]);
+  close(m_filedes[1]);
+}
+
+  private:
+FILE *m_file;
+SBDebugger m_dbg;
+int m_filedes[2];
+  };
+  Cleanup cleanup(dbg, to_lldb_des);
+
+  dbg.SetInputFileHandle(fh_lldb_in, false);
+
+  // Now run the command interpreter.  You have to pass true to
+  // start thread so we will run the I/O in a separate thread.
+  dbg.RunCommandInterpreter(false, true);
+
+  // Now issue a stepi, and fetch the running and stopped events:
+  fprintf(fh_to_lldb, "thread step-inst\n");
+
+  SBEvent proc_event;
+  StateType state;
+  bool got_event;
+
+  got_event = dbg.GetListener().WaitForEventForBroadcaster(
+  100, process.GetBroadcaster(), proc_event);
+  if (!got_event)
+throw Exception("Didn't get running event");
+  state = SBProcess::GetStateFromEvent(proc_event);
+  if (state != eStateRunning)
+throw Exception("Event wasn't a running event.");
+
+  got_event = dbg.GetListener().WaitForEventForBroadcaster(
+  100, process.GetBroadcaster(), proc_event);
+  if 

[Lldb-commits] [lldb] a37672e - Mark the execution of stop-hooks as non-interactive.

2020-10-29 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2020-10-29T14:41:53-07:00
New Revision: a37672e2db7377681d996834a0c3073c9838a549

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

LOG: Mark the execution of stop-hooks as non-interactive.

The intention is not to allow stop-hook commands to query the
user, so this is correct.  It also works around a deadlock in
switching to the Python Session to execute python based commands
in the stop hook when the Debugger stdin is backed by a FILE *.

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

Added: 
lldb/test/API/api/multithreaded/some_cmd.py
lldb/test/API/api/multithreaded/test_stop-hook.cpp.template

Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Target/Target.cpp
lldb/test/API/api/multithreaded/TestMultithreaded.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 69da3914f1f2..81110f9f80c4 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1927,6 +1927,7 @@ def generateSource(self, source):
 header.startswith("SB") and header.endswith(".h"))]
 includes = '\n'.join(list)
 new_content = content.replace('%include_SB_APIs%', includes)
+new_content = new_content.replace('%SOURCE_DIR%', self.getSourceDir())
 src = os.path.join(self.getBuildDir(), source)
 with open(src, 'w') as f:
 f.write(new_content)

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index c6031f571311..d6b4b89da1c9 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2307,6 +2307,8 @@ void CommandInterpreter::HandleCommands(const StringList 
,
 }
 
 CommandReturnObject tmp_result(m_debugger.GetUseColor());
+tmp_result.SetInteractive(result.GetInteractive());
+
 // If override_context is not NULL, pass no_context_switching = true for
 // HandleCommand() since we updated our context already.
 

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 6b8a053b972e..7c78b4a84c41 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3286,6 +3286,7 @@ Target::StopHookCommandLine::HandleStop(ExecutionContext 
_ctx,
 
   CommandReturnObject result(false);
   result.SetImmediateOutputStream(output_sp);
+  result.SetInteractive(false);
   Debugger  = exc_ctx.GetTargetPtr()->GetDebugger();
   CommandInterpreterRunOptions options;
   options.SetStopOnContinue(true);

diff  --git a/lldb/test/API/api/multithreaded/TestMultithreaded.py 
b/lldb/test/API/api/multithreaded/TestMultithreaded.py
index 436f645e6521..60c2c3b372cb 100644
--- a/lldb/test/API/api/multithreaded/TestMultithreaded.py
+++ b/lldb/test/API/api/multithreaded/TestMultithreaded.py
@@ -23,9 +23,19 @@ def setUp(self):
 self.generateSource('test_listener_event_description.cpp')
 self.generateSource('test_listener_event_process_state.cpp')
 self.generateSource('test_listener_resume.cpp')
+self.generateSource('test_stop-hook.cpp')
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIfRemote
+@skipIfNoSBHeaders
+# clang-cl does not support throw or catch (llvm.org/pr24538)
+@skipIfWindows
+def test_python_stop_hook(self):
+"""Test that you can run a python command in a stop-hook when stdin is 
File based. """
+self.build_and_test('driver.cpp test_stop-hook.cpp',
+'test_python_stop_hook')
+
 @skipIfRemote
 @skipIfNoSBHeaders
 # clang-cl does not support throw or catch (llvm.org/pr24538)

diff  --git a/lldb/test/API/api/multithreaded/some_cmd.py 
b/lldb/test/API/api/multithreaded/some_cmd.py
new file mode 100644
index ..8db4b5f7b432
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/some_cmd.py
@@ -0,0 +1,33 @@
+""" Test command for checking the Python commands can run in a stop-hook """
+import lldb
+
+did_run = False
+
+class SomeCommand:
+def __init__(self, debugger, unused):
+self.dbg = debugger
+def __call__(self, debugger, command, exe_ctx, result):
+global did_run
+did_run = True
+result.PutCString("some output\n")
+
+def get_short_help(self):
+return "Test command - sets a variable."
+
+class OtherCommand:
+def __init__(self, debugger, unused):
+self.dbg = debugger
+def __call__(self, debugger, command, exe_ctx, result):
+global did_run
+if did_run:
+result.SetStatus(lldb.eReturnStatusSuccessFinishNoResult)
+else:

[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum added a comment.

Could you explain how to commit that Differential revision is closed by commit? 
Commited like described in here 
https://llvm.org/docs/Phabricator.html#committing-someone-s-change-from-phabricator

  git pull --rebase https://github.com/llvm/llvm-project.git master
  git show # Ensure the patch looks correct.
  ninja check-$whatever # Rerun the appropriate tests if needed.
  git push https://github.com/llvm/llvm-project.git HEAD:master

And nothing happened, as far as I see will have to close revision manually.
Thanks in advance.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D88483#2363075 , @fallkrum wrote:

> @JDevlieghere @jingham api test failed after my commit:
> http://lab.llvm.org:8011/#/builders/68/builds/1040
> Had no such an error on my computer, please help to figure out what went 
> wrong.

The test is failing because

  type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()

is returning an empty string.  I can't tell from the error whether that's 
because comp_unit is not valid in this case, or because GetTypeAtIndex(0) is 
not valid, or because for some reason this compile unit has an anonymous type 
injected as the first type in the CU.

You are also assuming that the compile units will come in order with main as 
the 0-th.  That seems reasonable, but there's no law about what order the 
compiler has to insert compile units into the debug information, so the CU at 
index 2 could also be the wrong CU.

Particularly when writing tests, I try never to chain calls together like this 
and instead to check each entity I care about as I get it.  Otherwise you get 
these "happens on a remote machine I can't access" failures and you can't tell 
from the failure site what was actually failing.

Can you rewrite the test to check that the comp_unit you get is valid and has 
the name you expected?  Then get the type and check that it is valid.  Then 
check its name.  If you make up that patch we can resubmit this change and the 
next time it fails you should get more information about why.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D78972#2353643 , @labath wrote:

> Right -- I can understand that. I'm not sure whether this is a real issue -- 
> I'd expect that these compiler-internal symbols would normally have private 
> (not "internal") linkage (and hence be caught by line 330) -- but I'm not 
> insisting on exposing all of the internal linkage symbols either.
>
> However, I think the phrase "meant to be exported" brings us back to the 
> beginning, full circle. Objects with "weak" linkage are also "meant" to be 
> exported (== externally visible in a normal compilation), just like their 
> weak_odr counterparts. I think that the real bug here is that we've started 
> special-casing individual linkage types, and that it's only a matter of time 
> before we find ourselves needing to add another linkage type to this list. 
> Llvm has a bunch of functions to check for the properties of linkage types, 
> and it seems to me like we should be able to pick one of them. So, if we want 
> to just expose the functions that would be visible during a normal 
> compilation, the function to use is `hasLocalLinkage()` (negation of it, that 
> is)

The REPL is weird since it formally has to compile individual expressions as 
"compile units" but must also pretend they aren't individual compile units, but 
rather a weird kind of streaming single compile unit (weird because they also 
allow redefinitions that wouldn't be legal if the thing were one compile unit). 
 So the compiler's normal notion of "localLinkage" isn't necessarily related to 
what the REPL needs to export.  OTOH, localLinkage also works, so I'm happy to 
use it for now till we come up with a reason not to.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78972

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


[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham updated this revision to Diff 301752.
jingham added a comment.

Switched to !hasLocalLinkage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78972

Files:
  lldb/source/Expression/IRExecutionUnit.cpp


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -328,8 +328,7 @@
 if (function.isDeclaration() || function.hasPrivateLinkage())
   continue;
 
-const bool external =
-function.hasExternalLinkage() || function.hasLinkOnceODRLinkage();
+const bool external = !function.hasLocalLinkage();
 
 void *fun_ptr = m_execution_engine_up->getPointerToFunction();
 


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -328,8 +328,7 @@
 if (function.isDeclaration() || function.hasPrivateLinkage())
   continue;
 
-const bool external =
-function.hasExternalLinkage() || function.hasLinkOnceODRLinkage();
+const bool external = !function.hasLocalLinkage();
 
 void *fun_ptr = m_execution_engine_up->getPointerToFunction();
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

2020-10-29 Thread Ilya Bukonkin via Phabricator via lldb-commits
fallkrum added a comment.

@JDevlieghere @jingham api test failed after my commit:
http://lab.llvm.org:8011/#/builders/68/builds/1040
Had no such an error on my computer, please help to figure out what went wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483

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


[Lldb-commits] [lldb] 2c0cbc4 - GetModule, GetExeModule methods added

2020-10-29 Thread Ilya Bukonkin via lldb-commits

Author: Ilya Bukonkin
Date: 2020-10-29T23:44:51+03:00
New Revision: 2c0cbc47cae4e69195a883771664ef3d5a54c7d2

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

LOG: GetModule, GetExeModule methods added

Added: 
lldb/test/API/functionalities/type_get_module/Makefile
lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py
lldb/test/API/functionalities/type_get_module/compile_unit1.c
lldb/test/API/functionalities/type_get_module/compile_unit2.c
lldb/test/API/functionalities/type_get_module/main.c

Modified: 
lldb/bindings/interface/SBType.i
lldb/include/lldb/API/SBModule.h
lldb/include/lldb/API/SBType.h
lldb/include/lldb/Symbol/Type.h
lldb/source/API/SBType.cpp
lldb/source/Symbol/Type.cpp

Removed: 




diff  --git a/lldb/bindings/interface/SBType.i 
b/lldb/bindings/interface/SBType.i
index 3cd82452084b..fd2dda188454 100644
--- a/lldb/bindings/interface/SBType.i
+++ b/lldb/bindings/interface/SBType.i
@@ -277,6 +277,9 @@ public:
 lldb::SBTypeEnumMemberList
 GetEnumMembers();
 
+lldb::SBModule
+GetModule();
+
 const char*
 GetName();
 
@@ -330,6 +333,7 @@ public:
 return template_args
 return None
 
+module = property(GetModule, None, doc='''A read only property that 
returns the module in which type is defined.''') 
 name = property(GetName, None, doc='''A read only property that 
returns the name for this type as a string.''')
 size = property(GetByteSize, None, doc='''A read only property that 
returns size in bytes for this type as an integer.''')
 is_pointer = property(IsPointerType, None, doc='''A read only property 
that returns a boolean value that indicates if this type is a pointer type.''')

diff  --git a/lldb/include/lldb/API/SBModule.h 
b/lldb/include/lldb/API/SBModule.h
index ec6e7c21b058..dd783fe4107d 100644
--- a/lldb/include/lldb/API/SBModule.h
+++ b/lldb/include/lldb/API/SBModule.h
@@ -300,6 +300,7 @@ class LLDB_API SBModule {
   friend class SBSection;
   friend class SBSymbolContext;
   friend class SBTarget;
+  friend class SBType;
 
   explicit SBModule(const lldb::ModuleSP _sp);
 

diff  --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index b0af43351192..5f487aa5d258 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -185,6 +185,8 @@ class SBType {
 
   lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
 
+  lldb::SBModule GetModule();
+
   const char *GetName();
 
   const char *GetDisplayTypeName();

diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 06fc1d5da0aa..dd917cfb7ca8 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -109,12 +109,18 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 
   void DumpTypeName(Stream *s);
 
-  // Since Type instances only keep a "SymbolFile *" internally, other classes
-  // like TypeImpl need make sure the module is still around before playing
-  // with
-  // Type instances. They can store a weak pointer to the Module;
+  /// Since Type instances only keep a "SymbolFile *" internally, other classes
+  /// like TypeImpl need make sure the module is still around before playing
+  /// with
+  /// Type instances. They can store a weak pointer to the Module;
   lldb::ModuleSP GetModule();
 
+  /// GetModule may return module for compile unit's object file.
+  /// GetExeModule returns module for executable object file that contains
+  /// compile unit where type was actualy defined.
+  /// GetModule and GetExeModule may return the same value.
+  lldb::ModuleSP GetExeModule();
+
   void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name,
   ExecutionContextScope *exe_scope);
 
@@ -261,6 +267,8 @@ class TypeImpl {
 
   void Clear();
 
+  lldb::ModuleSP GetModule() const;
+
   ConstString GetName() const;
 
   ConstString GetDisplayTypeName() const;
@@ -288,8 +296,12 @@ class TypeImpl {
 
 private:
   bool CheckModule(lldb::ModuleSP _sp) const;
+  bool CheckExeModule(lldb::ModuleSP _sp) const;
+  bool CheckModuleCommon(const lldb::ModuleWP _module_wp,
+ lldb::ModuleSP _sp) const;
 
   lldb::ModuleWP m_module_wp;
+  lldb::ModuleWP m_exe_module_wp;
   CompilerType m_static_type;
   CompilerType m_dynamic_type;
 };

diff  --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 1c1d4e3a3ed9..772ac87145bb 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -9,6 +9,7 @@
 #include "lldb/API/SBType.h"
 #include "SBReproducerPrivate.h"
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBModule.h"
 #include "lldb/API/SBStream.h"
 #include 

[Lldb-commits] [lldb] 9bb9b73 - Remove HAVE_VCS_VERSION_INC, not needed

2020-10-29 Thread Fangrui Song via lldb-commits

Author: Marcel Hlopko
Date: 2020-10-29T13:09:05-07:00
New Revision: 9bb9b737c5573cf3850230bc4db8dac7be0e1e85

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

LOG: Remove HAVE_VCS_VERSION_INC, not needed

This preprocessor define was meant to be used to conditionally include 
VCSVersion.inc. However, the define was always set, and it was the content of 
the header that was conditionally generated. Therefore HAVE_VCS_VERSION_INC 
should be cleaned up.

Reviewed By: gribozavr2, MaskRay

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

Added: 


Modified: 
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Version.cpp
lld/Common/CMakeLists.txt
lld/Common/Version.cpp
lldb/source/CMakeLists.txt
lldb/source/lldb.cpp
llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
llvm/utils/gn/secondary/lld/Common/BUILD.gn

Removed: 




diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index dfbe74a3f9f1..d259b951f2c2 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -33,9 +33,6 @@ set_source_files_properties("${version_inc}"
   PROPERTIES GENERATED TRUE
  HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE Version.cpp APPEND PROPERTY
- COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 add_clang_library(clangBasic
   Attributes.cpp
   Builtins.cpp

diff  --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp
index 286107cab9d7..af3118b0f6da 100644
--- a/clang/lib/Basic/Version.cpp
+++ b/clang/lib/Basic/Version.cpp
@@ -17,9 +17,7 @@
 #include 
 #include 
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 namespace clang {
 

diff  --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index bfa4f7b8ee58..0437d5afb8eb 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -26,9 +26,6 @@ set_source_files_properties("${version_inc}"
   PROPERTIES GENERATED TRUE
   HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE Version.cpp APPEND PROPERTY
-  COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 add_lld_library(lldCommon
   Args.cpp
   DWARF.cpp

diff  --git a/lld/Common/Version.cpp b/lld/Common/Version.cpp
index cd9fcd4f4059..f3768091cd0e 100644
--- a/lld/Common/Version.cpp
+++ b/lld/Common/Version.cpp
@@ -12,9 +12,7 @@
 
 #include "lld/Common/Version.h"
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 // Returns a version string, e.g.:
 // lld 9.0.0 (https://github.com/llvm/llvm-project.git 9efdd7ac5e914d3c9fa1ef)

diff  --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index 6dbdec5ec008..56ea8342be4e 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -26,9 +26,6 @@ set_source_files_properties("${version_inc}"
   PROPERTIES GENERATED TRUE
  HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE lldb.cpp APPEND PROPERTY
- COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 list(APPEND lldbBase_SOURCES ${version_inc})
 
 if(LLDB_VERSION_STRING)

diff  --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp
index 4d4c636a4f9c..10fc2d7cf556 100644
--- a/lldb/source/lldb.cpp
+++ b/lldb/source/lldb.cpp
@@ -13,9 +13,7 @@ using namespace lldb_private;
 
 #include "clang/Basic/Version.h"
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 static const char *GetLLDBRevision() {
 #ifdef LLDB_REVISION

diff  --git a/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn 
b/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
index 43767f15e1a1..2fe572ada231 100644
--- a/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
@@ -103,5 +103,4 @@ static_library("Basic") {
 "XRayInstr.cpp",
 "XRayLists.cpp",
   ]
-  defines = [ "HAVE_VCS_VERSION_INC" ]  # For Version.cpp
 }

diff  --git a/llvm/utils/gn/secondary/lld/Common/BUILD.gn 
b/llvm/utils/gn/secondary/lld/Common/BUILD.gn
index 125cad30a32e..d02d950e88d2 100644
--- a/llvm/utils/gn/secondary/lld/Common/BUILD.gn
+++ b/llvm/utils/gn/secondary/lld/Common/BUILD.gn
@@ -42,5 +42,4 @@ static_library("Common") {
 "Timer.cpp",
 "Version.cpp",
   ]
-  defines = [ "HAVE_VCS_VERSION_INC" ]  # For Version.cpp
 }



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


[Lldb-commits] [PATCH] D84623: Remove HAVE_VCS_VERSION_INC, not needed

2020-10-29 Thread Fangrui Song via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9bb9b737c557: Remove HAVE_VCS_VERSION_INC, not needed 
(authored by hlopko, committed by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84623

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Version.cpp
  lld/Common/CMakeLists.txt
  lld/Common/Version.cpp
  lldb/source/CMakeLists.txt
  lldb/source/lldb.cpp
  llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
  llvm/utils/gn/secondary/lld/Common/BUILD.gn

Index: llvm/utils/gn/secondary/lld/Common/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/Common/BUILD.gn
+++ llvm/utils/gn/secondary/lld/Common/BUILD.gn
@@ -42,5 +42,4 @@
 "Timer.cpp",
 "Version.cpp",
   ]
-  defines = [ "HAVE_VCS_VERSION_INC" ]  # For Version.cpp
 }
Index: llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
@@ -103,5 +103,4 @@
 "XRayInstr.cpp",
 "XRayLists.cpp",
   ]
-  defines = [ "HAVE_VCS_VERSION_INC" ]  # For Version.cpp
 }
Index: lldb/source/lldb.cpp
===
--- lldb/source/lldb.cpp
+++ lldb/source/lldb.cpp
@@ -13,9 +13,7 @@
 
 #include "clang/Basic/Version.h"
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 static const char *GetLLDBRevision() {
 #ifdef LLDB_REVISION
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -26,9 +26,6 @@
   PROPERTIES GENERATED TRUE
  HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE lldb.cpp APPEND PROPERTY
- COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 list(APPEND lldbBase_SOURCES ${version_inc})
 
 if(LLDB_VERSION_STRING)
Index: lld/Common/Version.cpp
===
--- lld/Common/Version.cpp
+++ lld/Common/Version.cpp
@@ -12,9 +12,7 @@
 
 #include "lld/Common/Version.h"
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 // Returns a version string, e.g.:
 // lld 9.0.0 (https://github.com/llvm/llvm-project.git 9efdd7ac5e914d3c9fa1ef)
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -26,9 +26,6 @@
   PROPERTIES GENERATED TRUE
   HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE Version.cpp APPEND PROPERTY
-  COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 add_lld_library(lldCommon
   Args.cpp
   DWARF.cpp
Index: clang/lib/Basic/Version.cpp
===
--- clang/lib/Basic/Version.cpp
+++ clang/lib/Basic/Version.cpp
@@ -17,9 +17,7 @@
 #include 
 #include 
 
-#ifdef HAVE_VCS_VERSION_INC
 #include "VCSVersion.inc"
-#endif
 
 namespace clang {
 
Index: clang/lib/Basic/CMakeLists.txt
===
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -33,9 +33,6 @@
   PROPERTIES GENERATED TRUE
  HEADER_FILE_ONLY TRUE)
 
-set_property(SOURCE Version.cpp APPEND PROPERTY
- COMPILE_DEFINITIONS "HAVE_VCS_VERSION_INC")
-
 add_clang_library(clangBasic
   Attributes.cpp
   Builtins.cpp
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84623: Remove HAVE_VCS_VERSION_INC, not needed

2020-10-29 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added a comment.
Herald added a subscriber: dexonsmith.

Thanks! Assuming you don't have a commit bit, I'll commit on your behalf.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84623

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


[Lldb-commits] [PATCH] D90414: [lldb] Ignore binary data in crashlog

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 301716.

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

https://reviews.llvm.org/D90414

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
-thread_match = self.thread_regex.search(line)
-if thread_match:
-app_specific_backtrace = False
-parse_mode = PARSE_MODE_THREAD
-thread_idx = int(thread_match.group(1))
-thread = CrashLog.Thread(thread_idx, False)
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
+thread_match = self.thread_regex.search(line)
+if thread_match:
+app_specific_backtrace = False
+parse_mode = PARSE_MODE_THREAD
+thread_idx = int(thread_match.group(1))
+thread = CrashLog.Thread(thread_idx, False)
+continue
 continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 self.system_profile.append(line)
+elif parse_mode == PARSE_MODE_INSTRS:
+pass
 f.close()
 
 def dump(self):


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
-thread_match = self.thread_regex.search(line)
-if thread_match:
-app_specific_backtrace = False
-parse_mode = PARSE_MODE_THREAD
-thread_idx = int(thread_match.group(1))
-thread = CrashLog.Thread(thread_idx, False)
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
+thread_match = self.thread_regex.search(line)
+if thread_match:
+app_specific_backtrace = False
+parse_mode = PARSE_MODE_THREAD
+thread_idx = int(thread_match.group(1))
+thread = CrashLog.Thread(thread_idx, False)
+continue
 continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 

[Lldb-commits] [PATCH] D90414: [lldb] Ignore binary data in crashlog

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 301714.
JDevlieghere added a comment.

Fix indentation that got screwed up when staging only non-whitespace changes.


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

https://reviews.llvm.org/D90414

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
 thread_match = self.thread_regex.search(line)
-if thread_match:
-app_specific_backtrace = False
-parse_mode = PARSE_MODE_THREAD
-thread_idx = int(thread_match.group(1))
-thread = CrashLog.Thread(thread_idx, False)
+if thread_match:
+app_specific_backtrace = False
+parse_mode = PARSE_MODE_THREAD
+thread_idx = int(thread_match.group(1))
+thread = CrashLog.Thread(thread_idx, False)
+continue
 continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 self.system_profile.append(line)
+elif parse_mode == PARSE_MODE_INSTRS:
+pass
 f.close()
 
 def dump(self):


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,13 +471,18 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
 thread_match = self.thread_regex.search(line)
-if thread_match:
-app_specific_backtrace = False
-parse_mode = PARSE_MODE_THREAD
-thread_idx = int(thread_match.group(1))
-thread = CrashLog.Thread(thread_idx, False)
+if thread_match:
+app_specific_backtrace = False
+parse_mode = PARSE_MODE_THREAD
+thread_idx = int(thread_match.group(1))
+thread = CrashLog.Thread(thread_idx, False)
+continue
 continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 self.system_profile.append(line)

[Lldb-commits] [PATCH] D89157: [lldb] Report old modules from ModuleList::ReplaceEquivalent

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D89157#2362697 , @JosephTremoulet 
wrote:

>> But then you get to a point where you shouldn't really have multiple modules 
>> replacing a single one so you aren't really sure what to do about it. That 
>> part makes me a little uneasy.
>
> Yeah, I wouldn't claim that the handling of the multiple-old-module case 
> there is ideal. My thinking is that it makes an incremental step in the right 
> direction, though -- the same potential for having multiple old modules is 
> there with or without the change; the change makes the issue more apparent to 
> readers of the code, makes note of it in the relevant log if we hit the issue 
> at runtime, and refactors the code so there is one place to handle the issue. 
> If you think it's best to hold off on that until we have a better way to 
> actually handle the case, I can see the logic in that, just let me know and 
> I'll rebase this to fix the bug in the meantime.
>
> Thanks!

Since we'd just be dropping all the other modules that we don't know how they 
are coming about on the floor before your patch, that seems strictly better.  
Can you emit more info when this happens, like the module that's replacing this 
set of old modules, and the UUID of the duplicate entries.  That way when this 
happens for some reason we didn't expect - which will invariably be on some 
proprietary code that we can't debug locally - we have a better chance of 
figuring out what went wrong.  Then this should be fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89157

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


[Lldb-commits] [PATCH] D90414: [lldb] Ignore binary data in crashlog

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jasonmolenda.
Herald added a project: LLDB.
JDevlieghere requested review of this revision.

Skip the instruction stream section in the crashlog section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90414

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,7 +471,11 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
 thread_match = self.thread_regex.search(line)
 if thread_match:
 app_specific_backtrace = False
@@ -477,6 +483,7 @@
 thread_idx = int(thread_match.group(1))
 thread = CrashLog.Thread(thread_idx, False)
 continue
+continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
 continue
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 self.system_profile.append(line)
+elif parse_mode == PARSE_MODE_INSTRS:
+pass
 f.close()
 
 def dump(self):


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -92,12 +92,14 @@
 PARSE_MODE_IMAGES = 2
 PARSE_MODE_THREGS = 3
 PARSE_MODE_SYSTEM = 4
+PARSE_MODE_INSTRS = 5
 
 
 class CrashLog(symbolication.Symbolicator):
 """Class that does parses darwin crash logs"""
 parent_process_regex = re.compile('^Parent Process:\s*(.*)\[(\d+)\]')
 thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
+thread_instrs_regex = re.compile('^Thread ([0-9]+) instruction stream')
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
@@ -469,7 +471,11 @@
 thread_idx = int(thread_state_match.group(1))
 parse_mode = PARSE_MODE_THREGS
 thread = self.threads[thread_idx]
-else:
+continue
+thread_insts_match  = self.thread_instrs_regex.search(line)
+if thread_insts_match:
+parse_mode = PARSE_MODE_INSTRS
+continue
 thread_match = self.thread_regex.search(line)
 if thread_match:
 app_specific_backtrace = False
@@ -477,6 +483,7 @@
 thread_idx = int(thread_match.group(1))
 thread = CrashLog.Thread(thread_idx, False)
 continue
+continue
 elif line.startswith('Binary Images:'):
 parse_mode = PARSE_MODE_IMAGES
 continue
@@ -539,6 +546,8 @@
 thread.registers[reg.strip()] = int(value, 0)
 elif parse_mode == PARSE_MODE_SYSTEM:
 self.system_profile.append(line)
+elif parse_mode == PARSE_MODE_INSTRS:
+pass
 f.close()
 
 def dump(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D89157: [lldb] Report old modules from ModuleList::ReplaceEquivalent

2020-10-29 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet added a comment.

> But then you get to a point where you shouldn't really have multiple modules 
> replacing a single one so you aren't really sure what to do about it. That 
> part makes me a little uneasy.

Yeah, I wouldn't claim that the handling of the multiple-old-module case there 
is ideal. My thinking is that it makes an incremental step in the right 
direction, though -- the same potential for having multiple old modules is 
there with or without the change; the change makes the issue more apparent to 
readers of the code, makes note of it in the relevant log if we hit the issue 
at runtime, and refactors the code so there is one place to handle the issue. 
If you think it's best to hold off on that until we have a better way to 
actually handle the case, I can see the logic in that, just let me know and 
I'll rebase this to fix the bug in the meantime.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89157

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


[Lldb-commits] [PATCH] D90413: [nfc] [lldb] Align `user_id_t` format to the current `DIERef` format

2020-10-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added a reviewer: labath.
jankratochvil added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jankratochvil requested review of this revision.

Current `user_id_t` format is:
`63{isDebugTypes} 62..32{dwo || 7fff} 31..0 {die_offset}`
while current `DIERef` format is (I have made up the bit positions but the 
field widths do match):
`63{m_section==isDebugTypes} 62{m_dwo_num_valid} 61..32{m_dwo_num} 31..0 
{m_die_offset}`

Proposing to change `user_id_t` to:
`63{isDebugTypes} 62{dwo_is_valid} 61..32{dwo; 0 if !valid} 31..0 {die_offset}`

There is no benefit of having 31-bits wide `dwo_num` in `user_id_t` when it 
gets converted to 30-bits width in `DIERef`.

This patch is for future DWZ patchset which extends the `dwo_is_valid` bit into 
a 2-bit field (normal, DWO, DWZ, DWZcommon) so that both `user_id_t` and 
`DIERef` can be changed then the same way.

It would be best to somehow unify `user_id_t` and `DIERef` but I do not plan to 
do that. `user_id_t` should probably remain a number for the Python API 
compatibility while there still needs to be some class with all the methods to 
access it.

`SymbolFileDWARF::GetDwpSymbolFile()` and `SymbolFileDWARF::GetDIE` use 
0x3fff for DWP but that does not clash:
formerly:

- 31bits32..62:0x7fff = normal unit / not any DWO
- 31bits32..62:0x3fff = DWP
- 31bits32..62:others = DWO unit number

after this patch:

- bit62=0 30bits32..61:any = normal unit / not any DWO
- bit62=1 30bits32..61:0x3fff = DWP
- bit62=1 30bits32..61:others = DWO unit number


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90413

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_low_pc-addrx.s
  lldb/test/Shell/SymbolFile/DWARF/array-sizes.s
  lldb/test/Shell/SymbolFile/DWARF/debug-types-address-ranges.s
  lldb/test/Shell/SymbolFile/DWARF/debug-types-dwarf5.s
  lldb/test/Shell/SymbolFile/DWARF/debug_ranges-missing-section.s
  lldb/test/Shell/SymbolFile/DWARF/debug_ranges.s
  lldb/test/Shell/SymbolFile/DWARF/debug_rnglists-dwo.s
  lldb/test/Shell/SymbolFile/DWARF/debug_rnglists.s
  lldb/test/Shell/SymbolFile/DWARF/dwarf5_locations.s
  lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s

Index: lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s
===
--- lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s
+++ lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s
@@ -16,15 +16,15 @@
 
 # Make sure each entity is present in the index only once.
 # SYMBOLS:  Globals and statics:
-# SYMBOLS-DAG: 3fff/INFO/0023 "A"
-# SYMBOLS-DAG: 3fff/INFO/005a "A"
+# SYMBOLS-DAG: INFO/0023 "A"
+# SYMBOLS-DAG: INFO/005a "A"
 # SYMBOLS-EMPTY:
 
 # SYMBOLS: Types:
-# SYMBOLS-DAG: 3fff/TYPE/0018 "ENUM0"
-# SYMBOLS-DAG: 3fff/TYPE/004d "ENUM1"
-# SYMBOLS-DAG: 3fff/TYPE/002d "int"
-# SYMBOLS-DAG: 3fff/TYPE/0062 "int"
+# SYMBOLS-DAG: TYPE/0018 "ENUM0"
+# SYMBOLS-DAG: TYPE/004d "ENUM1"
+# SYMBOLS-DAG: TYPE/002d "int"
+# SYMBOLS-DAG: TYPE/0062 "int"
 # SYMBOLS-EMPTY:
 
 .ifdef MAIN
Index: lldb/test/Shell/SymbolFile/DWARF/dwarf5_locations.s
===
--- lldb/test/Shell/SymbolFile/DWARF/dwarf5_locations.s
+++ lldb/test/Shell/SymbolFile/DWARF/dwarf5_locations.s
@@ -6,7 +6,7 @@
 # RUN: ld.lld -m elf_x86_64 %t.o -o %t 
 # RUN: lldb-test symbols %t | FileCheck %s
 
-# CHECK: Variable{0x7fff0011}, name = "color"
+# CHECK: Variable{0x0011}, name = "color"
 # CHECK-SAME: location = DW_OP_addrx 0x0
 
 .text
Index: lldb/test/Shell/SymbolFile/DWARF/debug_rnglists.s
===
--- lldb/test/Shell/SymbolFile/DWARF/debug_rnglists.s
+++ lldb/test/Shell/SymbolFile/DWARF/debug_rnglists.s
@@ -5,14 +5,14 @@
 # RUN:   -o "image lookup -v -s lookup_rnglists2" -o exit | FileCheck %s
 
 # CHECK-LABEL: image lookup -v -s lookup_rnglists
-# CHECK:  Function: id = {0x7fff0030}, name = "rnglists", range = [0x-0x0004)
-# CHECK:Blocks: id = {0x7fff0030}, range = [0x-0x0004)
-# CHECK-NEXT:   id = {0x7fff0046}, ranges = [0x0001-0x0002)[0x0003-0x0004)
+# CHECK:  Function: id = {0x0030}, name = "rnglists", range = [0x-0x0004)
+# CHECK:Blocks: id = {0x0030}, range = [0x-0x0004)
+# CHECK-NEXT:   id = {0x0046}, ranges = [0x0001-0x0002)[0x0003-0x0004)
 
 # CHECK-LABEL: image lookup -v -s lookup_rnglists2
-# CHECK:  Function: id = {0x7fff007a}, name = "rnglists2", range = [0x0004-0x0007)
-# CHECK:Blocks: id = {0x7fff007a}, range = [0x0004-0x0007)
-# CHECK-NEXT:   id = {0x7fff0091}, range = [0x0005-0x0007)
+# CHECK:  

[Lldb-commits] [PATCH] D90325: [lldb][NFC] Refactor getUUID functionality

2020-10-29 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 301694.
zequanwu marked 3 inline comments as done.
zequanwu added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90325

Files:
  lldb/include/lldb/Utility/UUID.h
  lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
  lldb/source/Plugins/Process/minidump/MinidumpTypes.h
  lldb/source/Utility/UUID.cpp

Index: lldb/source/Utility/UUID.cpp
===
--- lldb/source/Utility/UUID.cpp
+++ lldb/source/Utility/UUID.cpp
@@ -35,6 +35,16 @@
   }
 }
 
+UUID UUID::fromCvRecord(UUID::CvRecordPdb70 _info) {
+  llvm::sys::swapByteOrder(debug_info.Uuid.Data1);
+  llvm::sys::swapByteOrder(debug_info.Uuid.Data2);
+  llvm::sys::swapByteOrder(debug_info.Uuid.Data3);
+  llvm::sys::swapByteOrder(debug_info.Age);
+  if (debug_info.Age)
+return UUID::fromOptionalData(_info, sizeof(debug_info));
+  return UUID::fromOptionalData(_info.Uuid, sizeof(debug_info.Uuid));
+}
+
 std::string UUID::GetAsString(llvm::StringRef separator) const {
   std::string result;
   llvm::raw_string_ostream os(result);
Index: lldb/source/Plugins/Process/minidump/MinidumpTypes.h
===
--- lldb/source/Plugins/Process/minidump/MinidumpTypes.h
+++ lldb/source/Plugins/Process/minidump/MinidumpTypes.h
@@ -40,21 +40,6 @@
   ElfBuildId = 0x4270454c, // BpEL (Breakpad/Crashpad minidumps)
 };
 
-// Reference:
-// https://crashpad.chromium.org/doxygen/structcrashpad_1_1CodeViewRecordPDB70.html
-struct CvRecordPdb70 {
-  struct {
-llvm::support::ulittle32_t Data1;
-llvm::support::ulittle16_t Data2;
-llvm::support::ulittle16_t Data3;
-uint8_t Data4[8];
-  } Uuid;
-  llvm::support::ulittle32_t Age;
-  // char PDBFileName[];
-};
-static_assert(sizeof(CvRecordPdb70) == 20,
-  "sizeof CvRecordPdb70 is not correct!");
-
 enum class MinidumpMiscInfoFlags : uint32_t {
   ProcessID = (1 << 0),
   ProcessTimes = (1 << 1),
Index: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -62,27 +62,18 @@
   static_cast(static_cast(*signature));
 
   if (cv_signature == CvSignature::Pdb70) {
-const CvRecordPdb70 *pdb70_uuid = nullptr;
+const UUID::CvRecordPdb70 *pdb70_uuid = nullptr;
 Status error = consumeObject(cv_record, pdb70_uuid);
 if (error.Fail())
   return UUID();
-
-CvRecordPdb70 swapped;
-if (!GetArchitecture().GetTriple().isOSBinFormatELF()) {
-  // LLDB's UUID class treats the data as a sequence of bytes, but breakpad
-  // interprets it as a sequence of little-endian fields, which it converts
-  // to big-endian when converting to text. Swap the bytes to big endian so
-  // that the string representation comes out right.
-  swapped = *pdb70_uuid;
-  llvm::sys::swapByteOrder(swapped.Uuid.Data1);
-  llvm::sys::swapByteOrder(swapped.Uuid.Data2);
-  llvm::sys::swapByteOrder(swapped.Uuid.Data3);
-  llvm::sys::swapByteOrder(swapped.Age);
-  pdb70_uuid = 
+if (GetArchitecture().GetTriple().isOSBinFormatELF()) {
+  if (pdb70_uuid->Age != 0)
+return UUID::fromOptionalData(pdb70_uuid, sizeof(*pdb70_uuid));
+  return UUID::fromOptionalData(_uuid->Uuid,
+sizeof(pdb70_uuid->Uuid));
 }
-if (pdb70_uuid->Age != 0)
-  return UUID::fromOptionalData(pdb70_uuid, sizeof(*pdb70_uuid));
-return UUID::fromOptionalData(_uuid->Uuid, sizeof(pdb70_uuid->Uuid));
+UUID::CvRecordPdb70 debug_info = *pdb70_uuid;
+return UUID::fromCvRecord(debug_info);
   } else if (cv_signature == CvSignature::ElfBuildId)
 return UUID::fromOptionalData(cv_record);
 
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -43,45 +43,16 @@
 
 LLDB_PLUGIN_DEFINE(ObjectFilePECOFF)
 
-struct CVInfoPdb70 {
-  // 16-byte GUID
-  struct _Guid {
-llvm::support::ulittle32_t Data1;
-llvm::support::ulittle16_t Data2;
-llvm::support::ulittle16_t Data3;
-uint8_t Data4[8];
-  } Guid;
-
-  llvm::support::ulittle32_t Age;
-};
-
 static UUID GetCoffUUID(llvm::object::COFFObjectFile _obj) {
   const llvm::codeview::DebugInfo *pdb_info = nullptr;
   llvm::StringRef pdb_file;
 
-  // This part is similar with what has done in minidump parser.
   if (!coff_obj.getDebugPDBInfo(pdb_info, pdb_file) && pdb_info) {
 if (pdb_info->PDB70.CVSignature == 

[Lldb-commits] [PATCH] D89157: [lldb] Report old modules from ModuleList::ReplaceEquivalent

2020-10-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

All the parts of D89156  that are just being 
consistent about always passing old_modules as a vector seem okay.  But then 
you get to a point where you shouldn't really have multiple modules replacing a 
single one so you aren't really sure what to do about it.  That part makes me a 
little uneasy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89157

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


[Lldb-commits] [lldb] 41f2bb2 - [nfc] [lldb] Remove excessive parentheses in SymbolFileDWARF::GetUID

2020-10-29 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-10-29T18:01:37+01:00
New Revision: 41f2bb232cc064c0289de877552cbd6a077a7ba5

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

LOG: [nfc] [lldb] Remove excessive parentheses in SymbolFileDWARF::GetUID

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index be9832a14dfa..4036b01105ea 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1270,7 +1270,7 @@ user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
 
   return user_id_t(GetDwoNum().getValueOr(0x7fff)) << 32 |
  ref.die_offset() |
- (lldb::user_id_t(ref.section() == DIERef::Section::DebugTypes) << 63);
+ lldb::user_id_t(ref.section() == DIERef::Section::DebugTypes) << 63;
 }
 
 llvm::Optional



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


[Lldb-commits] [PATCH] D90318: Return actual type from SBType::GetArrayElementType

2020-10-29 Thread Andy Yankovsky via Phabricator via lldb-commits
werat added a comment.

Btw, I don't have commit access, so would be great if someone could land this 
for me :) (if everything is OK with this patch).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90318

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


[Lldb-commits] [PATCH] D90393: [lldb/test] Simplify/generalize YAMLModuleTester

2020-10-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90393

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


[Lldb-commits] [PATCH] D89157: [lldb] Report old modules from ModuleList::ReplaceEquivalent

2020-10-29 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet added a comment.

Thanks for the review!

I'm still unsure how to proceed w.r.t. D89156  
-- did you intend to include that when you approved this change, or do you have 
a sense when you'll have time to look at it, or should I change this to not 
depend on it, or find another reviewer, or ... ?  I'd appreciate any advice.

> I'm still not quite certain why I've never seen an instance where the absence 
> of your fix has caused problems, and it isn't clear from the patch why that 
> is. If there something special about handling breakpad files that moves you 
> out of the normal code path for replacing overridden modules? So I still have 
> a lurking feeling I'm missing something?

I'm confused by that too.  When reducing the repro / creating the testcase, I 
was surprised how tough it was to hit exactly this codepath.  I don't know what 
the scenario was that these calls to ReplaceEquivalent were originally put in 
for (I couldn't figure it out from source history) to be able to say why it 
didn't matter there about not reporting the old module.  There is some fallback 
code in Target::GetOrCreateModule to deal with the case that GetSharedModule 
didn't report the old module:

  // GetSharedModule is not guaranteed to find the old shared module, for
  // instance in the common case where you pass in the UUID, it is only
  // going to find the one module matching the UUID.  In fact, it has no
  // good way to know what the "old module" relevant to this target is,
  // since there might be many copies of a module with this file spec in
  // various running debug sessions, but only one of them will belong to
  // this target. So let's remove the UUID from the module list, and look
  // in the target's module list. Only do this if there is SOMETHING else
  // in the module spec...
  if (!old_module_sp) {
if (module_spec.GetUUID().IsValid() &&
!module_spec.GetFileSpec().GetFilename().IsEmpty() &&
!module_spec.GetFileSpec().GetDirectory().IsEmpty()) {
  ModuleSpec module_spec_copy(module_spec.GetFileSpec());
  module_spec_copy.GetUUID().Clear();
  
  ModuleList found_modules;
  m_images.FindModules(module_spec_copy, found_modules);
  if (found_modules.GetSize() == 1)
old_module_sp = found_modules.GetModuleAtIndex(0);
}

ProcessMinidump::ReadModuleList calls into GetOrCreateModule without a UUID 
because it needs to handle the case that the thing reported in the uuid field 
of the minidump is actually a hash of the text section rather than a standard 
uuid, so it's possible that other cases usually have uuids and get saved by 
that fallback code, perhaps?

Another thing that's potentially unique for minidumps is that they will often 
try to resolve the executable twice -- once in ResolveExecutable, but then a 
second time if the executable appears in the module list in the minidump (which 
it should).

I've looked a bit at the codepaths used when loading ELF core dumps, and they 
don't have this module list iteration but rather call DidAttach on the dynamic 
loader to populate the target module list.  I'm not familiar with the details 
of the dynamic loader code or how it avoids running into this issue.

I'm also under the impression that opening dumps with user-specified sysroots 
on Linux is not a frequently-used scenario, because this is the fourth bug in 
that area that my team has discovered, and I don't think we were otherwise 
doing anything particularly exotic.  This patch isn't sysroot-specific, but 
having a sysroot specified alters how GetSharedModule is called (with different 
directories and search paths), and I wasn't hitting the key codepath when I 
tried to reduce the repro by removing the sysroot specification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89157

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


[Lldb-commits] [PATCH] D87173: Ignores functions that have a range starting outside of a code section

2020-10-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

echo `` is funny and creative, but I doubt it will work on windows. :) The way 
that other tests deal with that is they put the commands to run into a file, 
and then run

  %lldb -o 'settings set interpreter.stop-command-source-on-error false' -s 
commands

For the command file, we have several options on how to create it:

- a separate `Input/...` file
- create it in the test with a sequence of `echo` commands
- use the llvm split-file utility to create it automatically from a single file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87173

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


[Lldb-commits] [PATCH] D90393: [lldb/test] Simplify/generalize YAMLModuleTester

2020-10-29 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: aprantl, JDevlieghere.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
labath requested review of this revision.

The class only supports a single DWARF unit (needed for my new test), and it
reimplements chunks of object and symbol file classes. We can just make it use
the real thing, save some LOC and get the full feature set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90393

Files:
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h

Index: lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
===
--- lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
+++ lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H
 #define LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H
 
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
 #include "Plugins/SymbolFile/DWARF/DWARFUnit.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
@@ -22,17 +23,16 @@
 /// DWARF expressions on it.
 class YAMLModuleTester {
 protected:
-  SubsystemRAII subsystems;
-  llvm::StringMap> m_sections_map;
+  SubsystemRAII
+  subsystems;
   lldb::ModuleSP m_module_sp;
-  lldb::ObjectFileSP m_objfile_sp;
-  DWARFUnitSP m_dwarf_unit;
-  std::unique_ptr m_symfile_dwarf;
+  DWARFUnit *m_dwarf_unit;
 
 public:
   /// Parse the debug info sections from the YAML description.
-  YAMLModuleTester(llvm::StringRef yaml_data, llvm::StringRef triple);
-  DWARFUnitSP GetDwarfUnit() const { return m_dwarf_unit; }
+  YAMLModuleTester(llvm::StringRef yaml_data);
+  DWARFUnit *GetDwarfUnit() const { return m_dwarf_unit; }
   lldb::ModuleSP GetModule() const { return m_module_sp; }
 };
 
Index: lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
===
--- lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
+++ lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
@@ -7,112 +7,20 @@
 //===--===//
 
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
+#include "TestingSupport/TestUtilities.h"
 #include "lldb/Core/Section.h"
 #include "llvm/ObjectYAML/DWARFEmitter.h"
 
 using namespace lldb_private;
 
-/// A mock module holding an object file parsed from YAML.
-class YAMLModule : public lldb_private::Module {
-public:
-  YAMLModule(ArchSpec ) : Module(FileSpec("test"), arch) {}
-  void SetObjectFile(lldb::ObjectFileSP obj_file) { m_objfile_sp = obj_file; }
-  ObjectFile *GetObjectFile() override { return m_objfile_sp.get(); }
-};
+YAMLModuleTester::YAMLModuleTester(llvm::StringRef yaml_data) {
+  llvm::Expected File = TestFile::fromYaml(yaml_data);
+  EXPECT_THAT_EXPECTED(File, llvm::Succeeded());
 
-/// A mock object file that can be parsed from YAML.
-class YAMLObjectFile : public lldb_private::ObjectFile {
-  const lldb::ModuleSP m_module_sp;
-  llvm::StringMap> _section_map;
-  /// Because there is only one DataExtractor in the ObjectFile
-  /// interface, all sections are copied into a contiguous buffer.
-  std::vector m_buffer;
+  m_module_sp = std::make_shared(File->moduleSpec());
+  auto  = *llvm::cast(m_module_sp->GetSymbolFile());
 
-public:
-  YAMLObjectFile(const lldb::ModuleSP _sp,
- llvm::StringMap> )
-  : ObjectFile(module_sp, _sp->GetFileSpec(), /*file_offset*/ 0,
-   /*length*/ 0, /*data_sp*/ nullptr, /*data_offset*/ 0),
-m_module_sp(module_sp), m_section_map(map) {}
-
-  /// Callback for initializing the module's list of sections.
-  void CreateSections(SectionList _section_list) override {
-lldb::offset_t total_bytes = 0;
-for (auto  : m_section_map)
-  total_bytes += entry.getValue()->getBufferSize();
-m_buffer.reserve(total_bytes);
-m_data =
-DataExtractor(m_buffer.data(), total_bytes, lldb::eByteOrderLittle, 4);
-
-lldb::user_id_t sect_id = 1;
-for (auto  : m_section_map) {
-  llvm::StringRef name = entry.getKey();
-  lldb::SectionType sect_type =
-  llvm::StringSwitch(name)
-  .Case("debug_info", lldb::eSectionTypeDWARFDebugInfo)
-  .Case("debug_abbrev", lldb::eSectionTypeDWARFDebugAbbrev)
-  .Case("debug_str", lldb::eSectionTypeDWARFDebugStr);
-  auto  = entry.getValue();
-  lldb::addr_t file_vm_addr = 0;
-  lldb::addr_t vm_size = 0;
-  lldb::offset_t file_offset = m_buffer.size();
-  lldb::offset_t 

[Lldb-commits] [PATCH] D90325: [lldb][NFC] Refactor getUUID functionality

2020-10-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks for cleaning this up. A couple of comments inline.




Comment at: lldb/include/lldb/Utility/UUID.h:41
+  /// Create a UUID from CvRecordPdb70.
+  static UUID fromData(const CvRecordPdb70 *debug_info,
+   bool swapByteOrder = true);

I'd name this like `fromCvRecord` or something. Also, replace the pointer by a 
reference, please.



Comment at: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp:70
+return UUID::fromData(pdb70_uuid,
+  !GetArchitecture().GetTriple().isOSBinFormatELF());
   } else if (cv_signature == CvSignature::ElfBuildId)

This is the only place which passes false, right?
If that's true, I think it would be better to drop this argument, and do 
something special here. That would give as an opportunity to call out the fact 
that breakpad (used to) put elf build-ids into this field. This is a 
sufficiently weird thing to merit drawing extra attention to it. Maybe 
something like:
```
if (isBinFormatELF()) {
  // Older versions of breakpad used to write the (first 16 bytes of) ELF build 
into this field.
  return UUID::fromOptionalData(pdb70_uuid->Uuid, sizeof(pdb70_uuid->Uuid))
}
return UUID::fromCvRecord(*pdb70_uuid);  
```



Comment at: lldb/source/Utility/UUID.cpp:38
 
+UUID UUID::fromData(const UUID::CvRecordPdb70 *debug_info, bool swapByteOrder) 
{
+  UUID::CvRecordPdb70 swapped;

You could just take the argument by value, and then byte-swap it in-place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90325

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


[Lldb-commits] [lldb] 8cc49be - [lldb] Use reverse connection method for lldb-server tests

2020-10-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-10-29T13:49:51+01:00
New Revision: 8cc49bec2e067808e4b4d091a351fd66616d7b18

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

LOG: [lldb] Use reverse connection method for lldb-server tests

This fixes an flakyness is all gdb-remote tests. These tests have been
(mildly) flaky since we started using "localhost" instead of 127.0.0.1
in the test suite. The reason is that lldb-server needs to create two
sockets (v4 and v6) to listen for localhost connections. The algorithm
it uses first tries to select a random port (bind(localhost:0)) for the
first address, and then bind the same port for the second one.

The creating of the second socket can fail as there's no guarantee that
port will be available -- it seems that the (linux) kernel tries to
choose an unused port for the first socket (I've had to create thousands
of sockets to reproduce this reliably), but this can apparantly fail
when the system is under load (and our test suite creates a _lot_ of
sockets).

The socket creationg operation is considered successful if it creates at
least one socket is created, but the test harness has no way of knowing
which one it is, so it can end up connecting to the wrong address.

I'm not aware of a way to atomically create two sockets bound to the
same port. One way to fix this would be to make lldb-server report the
address is it listening on instead of just the port. However, this would
be a breaking change and it's not clear to me that's worth it (the
algorithm works pretty well under normal circumstances).

Instead, this patch sidesteps that problem by using "reverse"
connections. This way, the test harness is responsible for creating the
listening socket so it can pass the address that it has managed to open.
It also results in much simpler code overall.

To preserve test coverage for the named pipe method, I've moved the
relevant code to a dedicated test. To avoid original problem, this test
passes raw addresses (as obtained by getaddrinfo(localhost)) instead of
"localhost".

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

Added: 
lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py

Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Removed: 
lldb/test/API/tools/lldb-server/commandline/TestStubReverseConnect.py



diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index 7d7b61c8610d..a0e3cb362944 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -100,9 +100,6 @@ def setUp(self):
 self.test_sequence = GdbRemoteTestSequence(self.logger)
 self.set_inferior_startup_launch()
 self.port = self.get_next_port()
-self.named_pipe_path = None
-self.named_pipe = None
-self.named_pipe_fd = None
 self.stub_sends_two_stop_notifications_on_kill = False
 if configuration.lldb_platform_url:
 if configuration.lldb_platform_url.startswith('unix-'):
@@ -154,87 +151,12 @@ def get_next_port(self):
 def reset_test_sequence(self):
 self.test_sequence = GdbRemoteTestSequence(self.logger)
 
-def create_named_pipe(self):
-# Create a temp dir and name for a pipe.
-temp_dir = tempfile.mkdtemp()
-named_pipe_path = os.path.join(temp_dir, "stub_port_number")
-
-# Create the named pipe.
-os.mkfifo(named_pipe_path)
-
-# Open the read side of the pipe in non-blocking mode.  This will
-# return right away, ready or not.
-named_pipe_fd = os.open(named_pipe_path, os.O_RDONLY | os.O_NONBLOCK)
-
-# Create the file for the named pipe.  Note this will follow semantics 
of
-# a non-blocking read side of a named pipe, which has 
diff erent semantics
-# than a named pipe opened for read in non-blocking mode.
-named_pipe = os.fdopen(named_pipe_fd, "r")
-self.assertIsNotNone(named_pipe)
-
-def shutdown_named_pipe():
-# Close the pipe.
-try:
-named_pipe.close()
-except:
-print("failed to close named pipe")
-None
-
-# Delete the pipe.
-try:
-os.remove(named_pipe_path)
-except:
-print("failed to delete named pipe: 
{}".format(named_pipe_path))
-None
-
-# Delete the temp directory.
-try:
-os.rmdir(temp_dir)
-except:
-print(
-"failed to delete temp 

[Lldb-commits] [PATCH] D90313: [lldb] Use reverse connection method for lldb-server tests

2020-10-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8cc49bec2e06: [lldb] Use reverse connection method for 
lldb-server tests (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90313

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
  lldb/test/API/tools/lldb-server/commandline/TestStubReverseConnect.py

Index: lldb/test/API/tools/lldb-server/commandline/TestStubReverseConnect.py
===
--- lldb/test/API/tools/lldb-server/commandline/TestStubReverseConnect.py
+++ /dev/null
@@ -1,105 +0,0 @@
-from __future__ import print_function
-
-import errno
-import gdbremote_testcase
-import lldbgdbserverutils
-import re
-import select
-import socket
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class TestStubReverseConnect(gdbremote_testcase.GdbRemoteTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-def setUp(self):
-# Set up the test.
-gdbremote_testcase.GdbRemoteTestCaseBase.setUp(self)
-
-# Create a listener on a local port.
-self.listener_socket = self.create_listener_socket()
-self.assertIsNotNone(self.listener_socket)
-self.listener_port = self.listener_socket.getsockname()[1]
-
-def create_listener_socket(self):
-try:
-sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-except OSError as e:
-if e.errno != errno.EAFNOSUPPORT:
-raise
-sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
-self.assertIsNotNone(sock)
-
-sock.settimeout(self.DEFAULT_TIMEOUT)
-if sock.family == socket.AF_INET:
-bind_addr = ("127.0.0.1", 0)
-elif sock.family == socket.AF_INET6:
-bind_addr = ("::1", 0)
-sock.bind(bind_addr)
-sock.listen(1)
-
-def tear_down_listener():
-try:
-sock.shutdown(socket.SHUT_RDWR)
-except:
-# ignore
-None
-
-self.addTearDownHook(tear_down_listener)
-return sock
-
-def reverse_connect_works(self):
-# Indicate stub startup should do a reverse connect.
-appended_stub_args = ["--reverse-connect"]
-if self.debug_monitor_extra_args:
-self.debug_monitor_extra_args += appended_stub_args
-else:
-self.debug_monitor_extra_args = appended_stub_args
-
-self.stub_hostname = "127.0.0.1"
-self.port = self.listener_port
-
-triple = self.dbg.GetSelectedPlatform().GetTriple()
-if re.match(".*-.*-.*-android", triple):
-self.forward_adb_port(
-self.port,
-self.port,
-"reverse",
-self.stub_device)
-
-# Start the stub.
-server = self.launch_debug_monitor(logfile=sys.stdout)
-self.assertIsNotNone(server)
-self.assertTrue(
-lldbgdbserverutils.process_is_running(
-server.pid, True))
-
-# Listen for the stub's connection to us.
-(stub_socket, address) = self.listener_socket.accept()
-self.assertIsNotNone(stub_socket)
-self.assertIsNotNone(address)
-print("connected to stub {} on {}".format(
-address, stub_socket.getsockname()))
-
-# Verify we can do the handshake.  If that works, we'll call it good.
-self.do_handshake(stub_socket)
-
-# Clean up.
-stub_socket.shutdown(socket.SHUT_RDWR)
-
-@debugserver_test
-@skipIfDarwinEmbedded #  lldb-server tests not updated to work on ios etc yet
-def test_reverse_connect_works_debugserver(self):
-self.init_debugserver_test(use_named_pipe=False)
-self.set_inferior_startup_launch()
-self.reverse_connect_works()
-
-@llgs_test
-@skipIfRemote  # reverse connect is not a supported use case for now
-def test_reverse_connect_works_llgs(self):
-self.init_llgs_test(use_named_pipe=False)
-self.set_inferior_startup_launch()
-self.reverse_connect_works()
Index: lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
===
--- /dev/null
+++ lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py
@@ -0,0 +1,89 @@
+from __future__ import print_function
+
+import gdbremote_testcase
+import select
+import socket
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestGdbRemoteConnection(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+mydir = 

[Lldb-commits] [PATCH] D82864: [lldb] Replace host-typed Scalar accessors with [SZ]ExtOrTruncInt

2020-10-29 Thread Pavel Labath via Phabricator via lldb-commits
labath abandoned this revision.
labath added a comment.

Just abandoning. I believe I've removed the most egregious parts of the Scalar 
class now. There's still room for improvement, but that requires a fresh start 
anyway...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82864

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


[Lldb-commits] [lldb] 075f661 - [lldb] Unbreak the build after a recent PowerPC change

2020-10-29 Thread David Zarzycki via lldb-commits

Author: David Zarzycki
Date: 2020-10-29T05:56:38-04:00
New Revision: 075f661d01f856192c236b6256f18bc697e28e1b

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

LOG: [lldb] Unbreak the build after a recent PowerPC change

40dd4d5233d9f81705a24d91b48d2620e487b89d introduced two new types.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3f6da8ef49d6..6a5c5cb69ac6 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4819,6 +4819,12 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
   break;
 
+// PowerPC -- Matrix Multiply Assist
+case clang::BuiltinType::VectorPair:
+case clang::BuiltinType::VectorQuad:
+  break;
+
+// ARM -- Scalable Vector Extension
 case clang::BuiltinType::SveBool:
 case clang::BuiltinType::SveInt8:
 case clang::BuiltinType::SveInt8x2:



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


[Lldb-commits] [lldb] 749f13e - [lldb] Correct --help output for qemu rootfs script

2020-10-29 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2020-10-29T09:57:32Z
New Revision: 749f13e7635aebcda978ee2e42f5569ab7f0fafc

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

LOG: [lldb] Correct --help output for qemu rootfs script

It was printing "Usage:" twice.

Reviewed By: omjavaid

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

Added: 


Modified: 
lldb/scripts/lldb-test-qemu/rootfs.sh

Removed: 




diff  --git a/lldb/scripts/lldb-test-qemu/rootfs.sh 
b/lldb/scripts/lldb-test-qemu/rootfs.sh
index 0491f4be0bc2..33ff278c1702 100644
--- a/lldb/scripts/lldb-test-qemu/rootfs.sh
+++ b/lldb/scripts/lldb-test-qemu/rootfs.sh
@@ -3,7 +3,6 @@
 set -e
 
 print_usage() {
-  echo "Usage:"
   echo "Usage: $(basename $0) [options]"
   echo -e "Creates a Ubuntu root file system image.\n"
   echo -e "  --help\t\t\tDisplay this information."



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


[Lldb-commits] [PATCH] D90225: [lldb] Correct --help output for qemu rootfs script

2020-10-29 Thread David Spickett via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG749f13e7635a: [lldb] Correct --help output for qemu rootfs 
script (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90225

Files:
  lldb/scripts/lldb-test-qemu/rootfs.sh


Index: lldb/scripts/lldb-test-qemu/rootfs.sh
===
--- lldb/scripts/lldb-test-qemu/rootfs.sh
+++ lldb/scripts/lldb-test-qemu/rootfs.sh
@@ -3,7 +3,6 @@
 set -e
 
 print_usage() {
-  echo "Usage:"
   echo "Usage: $(basename $0) [options]"
   echo -e "Creates a Ubuntu root file system image.\n"
   echo -e "  --help\t\t\tDisplay this information."


Index: lldb/scripts/lldb-test-qemu/rootfs.sh
===
--- lldb/scripts/lldb-test-qemu/rootfs.sh
+++ lldb/scripts/lldb-test-qemu/rootfs.sh
@@ -3,7 +3,6 @@
 set -e
 
 print_usage() {
-  echo "Usage:"
   echo "Usage: $(basename $0) [options]"
   echo -e "Creates a Ubuntu root file system image.\n"
   echo -e "  --help\t\t\tDisplay this information."
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D82864: [lldb] Replace host-typed Scalar accessors with [SZ]ExtOrTruncInt

2020-10-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil requested changes to this revision.
jankratochvil added a comment.
This revision now requires changes to proceed.

This patch no longer applies, it needs a rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82864

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


[Lldb-commits] [PATCH] D82864: [lldb] Replace host-typed Scalar accessors with [SZ]ExtOrTruncInt

2020-10-29 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: lldb/source/Core/ValueObject.cpp:467
   bool ret;
-  ret = scalar_value.ULongLong(1) != 0;
+  ret = scalar_value != 0;
   error.Clear();

mib wrote:
> Any reason why this is not inlined in the definition ?
IMO this patch does only the renaming, it should not do unrelated code cleanups.
For example by `s/ZExtOrTruncInt/ULongLong/ s/SExtOrTruncInt/SLongLong/` + 
clang-format one should get zero-sized patch to verify there are no unintended 
changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82864

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


[Lldb-commits] [PATCH] D83180: Set generic error in SBError SetErrorToGenericError

2020-10-29 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor resigned from this revision.
teemperor added a comment.
Herald added a reviewer: JDevlieghere.

D90151  landed and addressed/tested this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83180

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


[Lldb-commits] [PATCH] D88387: Create "skinny corefiles" for Mach-O with process save-core / reading

2020-10-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 301531.
jasonmolenda added a comment.

Update to address previous review comments.  (1) Update SBMemoryRegionInfo API 
to provide access to the dirty page information.  (2) Update the 'memory 
region' command output to print the dirty page list. (3) Update the 'process 
save-core' command to take a --style option with accepts an enum for the type 
of corefile.  (4) Update 'process save-core' text to explain the limitations of 
a modified-memory-only corefile.  (5) Add a 
API/functionalities/gdb_remote_client test with a stub that returns the region 
infos with these new fields, and tests the SBMemoryRegionInfo object filled in 
on the debugger side.  I think that's everything.

There's still a hang when running the GDBRemoteCommunicationClientTest.cpp 
tests (GDBRemoteCommunicationClientTest::GetMemoryRegionInfo and 
GDBRemoteCommunicationClientTest::GetMemoryRegionInfoInvalidResponse) that I 
haven't gotten to the bottom of yet, but I thought I'd update the patchset on 
the phab with where I am now, while I work through this last issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88387

Files:
  lldb/bindings/interface/SBMemoryRegionInfo.i
  lldb/docs/lldb-gdb-remote.txt
  lldb/include/lldb/API/SBMemoryRegionInfo.h
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  lldb/source/API/SBMemoryRegionInfo.cpp
  lldb/source/API/SBProcess.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/PluginManager.cpp
  lldb/source/Interpreter/CommandObject.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
  lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/test/API/macosx/skinny-corefile/Makefile
  lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
  lldb/test/API/macosx/skinny-corefile/main.c
  lldb/test/API/macosx/skinny-corefile/present.c
  lldb/test/API/macosx/skinny-corefile/present.h
  lldb/test/API/macosx/skinny-corefile/to-be-removed.c
  lldb/test/API/macosx/skinny-corefile/to-be-removed.h
  lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py
  lldb/tools/debugserver/source/DNBDefs.h
  lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp
  lldb/tools/debugserver/source/RNBRemote.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -327,6 +327,10 @@
 return client.GetMemoryRegionInfo(addr, region_info);
   });
 
+  // We need to have issued a qHostInfo packet in the debug session
+  // before we see a qMemoryRegionInfo packet.  In a real debug session,
+  // lldb would send the qHostInfo if it hadn't been sent yet.
+  HandlePacket(server, "qHostInfo", "ptrsize:8;endian:little;");
   HandlePacket(server,
   "qMemoryRegionInfo:a000",
   "start:a000;size:2000;permissions:rx;name:2f666f6f2f6261722e736f;");
@@ -352,6 +356,10 @@
 return client.GetMemoryRegionInfo(addr, region_info);
   });
 
+  // We need to have issued a qHostInfo packet in the debug session
+  // before we see a qMemoryRegionInfo packet.  In a real debug session,
+  // lldb would send the qHostInfo if it hadn't been sent yet.
+  HandlePacket(server, "qHostInfo", "ptrsize:8;endian:little;");
   HandlePacket(server, "qMemoryRegionInfo:4000", "start:4000;size:;");
   if (XMLDocument::XMLEnabled()) {
 // In case we have XML support, this will also do a "qXfer:memory-map".
Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4422,7 +4423,7 @@
 __FILE__, __LINE__, p, "Invalid address in qMemoryRegionInfo packet");
   }
 
-  DNBRegionInfo region_info = {0, 0, 0};
+  DNBRegionInfo