[Lldb-commits] [PATCH] D65386: [lldb][NFC] Use an enum instead of chars when handling options [WIP]

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D65386#1605119 , @JDevlieghere 
wrote:

> The current patch is fine I think and I think Pavel's suggestion sounds good, 
> as long as it's well documented.


We could make that less magical by including the name of the "setter" method in 
the tablegen file instead of relying on some convention for deriving it from 
the setting name. Ideally, in the longer term, I think we shouldn't even need 
to generate the "SetOptionValue" method, as I think there should be a way to 
write a generic, non-generated piece of code which loops over available 
settings and calls the appropriate setter method. But that may be easier to 
achieve once there is a single source of truth for all "SetOptionValue" methods 
(i.e., tablegen).

The thing I don't like about the enum approach is that it adds another layer to 
the option-setting code, whereas I think that the main problem is that the 
option-setting code has one too many layers already.

Also, -1 to checking in generated code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65386



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


[Lldb-commits] [PATCH] D65409: [ProcessWindows] Choose a register context file by prepocessor

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The change looks fine to me. I also agree with @compnerd's comments.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65409



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


[Lldb-commits] [PATCH] D65432: [lldb] [test/lldb-vscode] Use realpath to match vscode behavior

2019-07-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: aadsm, krytarowski, xiaobai, jfb.
Herald added a subscriber: dexonsmith.
mgorny added a comment.

FTR, the failure fixed by this is: 
http://lab.llvm.org:8011/builders/netbsd-amd64/builds/21195/steps/run%20unit%20tests/logs/FAIL%3A%20lldb-Suite%3A%3ATestVSCode_launch.py


Compare the directory paths returned by lldb-vscode against realpaths
rather than apparent paths.  This matches lldb-vscode behavior
and therefore fixes test failures when one of the parent directories
of the source tree is a symlink.


https://reviews.llvm.org/D65432

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py


Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -68,7 +68,8 @@
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.realpath(
+os.path.split(os.path.split(program)[0])[0])
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +97,8 @@
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.realpath(
+os.path.split(os.path.split(program)[0])[0])
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,


Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -68,7 +68,8 @@
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.realpath(
+os.path.split(os.path.split(program)[0])[0])
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +97,8 @@
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.realpath(
+os.path.split(os.path.split(program)[0])[0])
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65432: [lldb] [test/lldb-vscode] Use realpath to match vscode behavior

2019-07-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

FTR, the failure fixed by this is: 
http://lab.llvm.org:8011/builders/netbsd-amd64/builds/21195/steps/run%20unit%20tests/logs/FAIL%3A%20lldb-Suite%3A%3ATestVSCode_launch.py


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

https://reviews.llvm.org/D65432



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


[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

You might want to have a look at https://reviews.llvm.org/D65409 which might 
fix (some of?)  the issues mentioned here.

I don't know if this is relevant or not, but I thought I'd say that on linux we 
also effectively aren't able to debug a 64-bit process with a 32-bit 
lldb(-server). (effectively = that's not entirely true, and the situation is a 
bit more subtle, but the overall effect is the same).


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [PATCH] D65432: [lldb] [test/lldb-vscode] Use realpath to match vscode behavior

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

LG, just please replace `os.path.split(foo)[0]` by `os.path.dirname(foo)`.


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

https://reviews.llvm.org/D65432



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


[Lldb-commits] [lldb] r367290 - [lldb] [test/lldb-vscode] Use os.path.dirname() [NFC]

2019-07-30 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Jul 30 00:47:16 2019
New Revision: 367290

URL: http://llvm.org/viewvc/llvm-project?rev=367290&view=rev
Log:
[lldb] [test/lldb-vscode] Use os.path.dirname() [NFC]

Replace os.path.split()[0] with os.path.dirname().  Suggested by Pavel
Labath in D65432.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py?rev=367290&r1=367289&r2=367290&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 Tue Jul 30 00:47:16 2019
@@ -68,7 +68,7 @@ class TestVSCode_launch(lldbvscode_testc
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.dirname(os.path.dirname(program))
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +96,7 @@ class TestVSCode_launch(lldbvscode_testc
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.split(os.path.split(program)[0])[0]
+program_parent_dir = os.path.dirname(os.path.dirname(program))
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,
@@ -124,7 +124,7 @@ class TestVSCode_launch(lldbvscode_testc
 Tests the "sourcePath" will set the target.source-map.
 '''
 program = self.getBuildArtifact("a.out")
-program_dir = os.path.split(program)[0]
+program_dir = os.path.dirname(program)
 self.build_and_launch(program,
   sourcePath=program_dir)
 output = self.get_console()
@@ -170,7 +170,7 @@ class TestVSCode_launch(lldbvscode_testc
 enabled.
 '''
 program = self.getBuildArtifact("a.out")
-program_dir = os.path.split(program)[0]
+program_dir = os.path.dirname(program)
 glob = os.path.join(program_dir, '*.out')
 self.build_and_launch(program, args=[glob], shellExpandArguments=True)
 self.continue_to_exit()
@@ -195,7 +195,7 @@ class TestVSCode_launch(lldbvscode_testc
 disabled.
 '''
 program = self.getBuildArtifact("a.out")
-program_dir = os.path.split(program)[0]
+program_dir = os.path.dirname(program)
 glob = os.path.join(program_dir, '*.out')
 self.build_and_launch(program,
   args=[glob],


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


[Lldb-commits] [lldb] r367291 - [lldb] [test/lldb-vscode] Use realpath to match vscode behavior

2019-07-30 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Jul 30 00:47:22 2019
New Revision: 367291

URL: http://llvm.org/viewvc/llvm-project?rev=367291&view=rev
Log:
[lldb] [test/lldb-vscode] Use realpath to match vscode behavior

Compare the directory paths returned by lldb-vscode against realpaths
rather than apparent paths.  This matches lldb-vscode behavior
and therefore fixes test failures when one of the parent directories
of the source tree is a symlink.

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py?rev=367291&r1=367290&r2=367291&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 Tue Jul 30 00:47:22 2019
@@ -68,7 +68,8 @@ class TestVSCode_launch(lldbvscode_testc
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +97,8 @@ class TestVSCode_launch(lldbvscode_testc
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,


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


[Lldb-commits] [PATCH] D65432: [lldb] [test/lldb-vscode] Use realpath to match vscode behavior

2019-07-30 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367291: [lldb] [test/lldb-vscode] Use realpath to match 
vscode behavior (authored by mgorny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65432?vs=212280&id=212283#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65432

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -68,7 +68,8 @@
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +97,8 @@
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,


Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -68,7 +68,8 @@
 directory.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 self.build_and_launch(program,
   cwd=program_parent_dir)
 self.continue_to_exit()
@@ -96,7 +97,8 @@
 the lldb-vscode debug adaptor.
 '''
 program = self.getBuildArtifact("a.out")
-program_parent_dir = os.path.dirname(os.path.dirname(program))
+program_parent_dir = os.path.realpath(
+os.path.dirname(os.path.dirname(program)))
 commands = ['platform shell echo cwd = $PWD']
 self.build_and_launch(program,
   debuggerRoot=program_parent_dir,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65329: SymbolVendor: Move locking into the Symbol Files

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D65329#1604847 , @clayborg wrote:

> We will need to watch future submissions closely as this increases the chance 
> that someone will extend a SymbolFile by overriding a virtual function and 
> forget to lock.


I've though about addressing that by moving the actual implementations into 
private versions of these functions, and putting the locking into public 
functions which would just take the lock and then call the private version 
(essentially doing the same thing as it's done now, only without the methods 
being on different classes). I didn't do that now because:
a) it wouldn't make SymbolFileDWARF consistent anyway as it already has private 
methods which take the module lock
b) it forces a certain locking pattern on all the subclasses, whereas some 
subclasses could potentially want to implement a different locking strategy


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

https://reviews.llvm.org/D65329



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


[Lldb-commits] [lldb] r367298 - SymbolVendor: Move locking into the Symbol Files

2019-07-30 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jul 30 01:20:05 2019
New Revision: 367298

URL: http://llvm.org/viewvc/llvm-project?rev=367298&view=rev
Log:
SymbolVendor: Move locking into the Symbol Files

Summary:
The last bit of functionality in SymbolVendor passthrough functions is
the locking the module mutex. While it may be nice doing the locking in
a central place, we weren't really succesful in doing that right now,
because some SymbolFile function could still be called without going
through the SymbolVendor. This meant in SymbolFileDWARF (the only
battle-tested symbol file implementation) roughly a half of the
functions was taking additional locks and another half was asserting
that the lock is already held. By making the SymbolFile responsible for
locking, we can at least make the situation in SymbolFileDWARF more
consistent.

Reviewers: clayborg, JDevlieghere, jingham, jdoerfert

Subscribers: aprantl, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp?rev=367298&r1=367297&r2=367298&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp Tue 
Jul 30 01:20:05 2019
@@ -228,6 +228,7 @@ size_t SymbolFileBreakpad::ParseFunction
 }
 
 bool SymbolFileBreakpad::ParseLineTable(CompileUnit &comp_unit) {
+  std::lock_guard guard(GetModuleMutex());
   CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data;
 
   if (!data.line_table_up)
@@ -239,6 +240,7 @@ bool SymbolFileBreakpad::ParseLineTable(
 
 bool SymbolFileBreakpad::ParseSupportFiles(CompileUnit &comp_unit,
FileSpecList &support_files) {
+  std::lock_guard guard(GetModuleMutex());
   CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data;
   if (!data.support_files)
 ParseLineTableAndSupportFiles(comp_unit, data);
@@ -251,6 +253,7 @@ uint32_t
 SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr,
  SymbolContextItem resolve_scope,
  SymbolContext &sc) {
+  std::lock_guard guard(GetModuleMutex());
   if (!(resolve_scope & (eSymbolContextCompUnit | eSymbolContextLineEntry)))
 return 0;
 
@@ -275,6 +278,7 @@ SymbolFileBreakpad::ResolveSymbolContext
 uint32_t SymbolFileBreakpad::ResolveSymbolContext(
 const FileSpec &file_spec, uint32_t line, bool check_inlines,
 lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
+  std::lock_guard guard(GetModuleMutex());
   if (!(resolve_scope & eSymbolContextCompUnit))
 return 0;
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=367298&r1=367297&r2=367298&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jul 30 
01:20:05 2019
@@ -197,8 +197,6 @@ SymbolFile *SymbolFileDWARF::CreateInsta
 }
 
 TypeList &SymbolFileDWARF::GetTypeList() {
-  // This method can be called without going through the symbol vendor so we
-  // need to lock the module.
   std::lock_guard guard(GetModuleMutex());
   if (SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile())
 return debug_map_symfile->GetTypeList();
@@ -279,7 +277,7 @@ size_t SymbolFileDWARF::GetTypes(SymbolC
  TypeClass type_mask, TypeList &type_list)
 
 {
-  ASSERT_MODULE_LOCK(this);
+  std::lock_guard guard(GetModuleMutex());
   TypeSet type_set;
 
   CompileUnit *comp_unit = nullptr;
@@ -754,7 +752,7 @@ bool SymbolFileDWARF::FixupAddress(Addre
   return true;
 }
 lldb::LanguageType SymbolFileDWARF::ParseLanguage(CompileUnit &comp_unit) {
-  ASSERT_MODULE_LOCK(this);
+  std::lock_guard guard(GetModuleMutex());
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
   if (dwarf_cu)
 return dwarf_cu->GetLanguageType();
@@ -763,7 +761,7 @@ lldb::LanguageType SymbolFileDWARF::Pars
 }
 
 size_t SymbolFileDWARF::ParseFunctions(CompileUn

[Lldb-commits] [PATCH] D65329: SymbolVendor: Move locking into the Symbol Files

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367298: SymbolVendor: Move locking into the Symbol Files 
(authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65329

Files:
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/trunk/source/Symbol/SymbolFile.cpp
  lldb/trunk/source/Symbol/SymbolVendor.cpp

Index: lldb/trunk/source/Symbol/SymbolVendor.cpp
===
--- lldb/trunk/source/Symbol/SymbolVendor.cpp
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp
@@ -76,135 +76,83 @@
 }
 
 size_t SymbolVendor::GetNumCompileUnits() {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->GetNumCompileUnits();
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->GetNumCompileUnits();
   return 0;
 }
 
 lldb::LanguageType SymbolVendor::ParseLanguage(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseLanguage(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseLanguage(comp_unit);
   return eLanguageTypeUnknown;
 }
 
 size_t SymbolVendor::ParseFunctions(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseFunctions(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseFunctions(comp_unit);
   return 0;
 }
 
 bool SymbolVendor::ParseLineTable(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseLineTable(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseLineTable(comp_unit);
   return false;
 }
 
 bool SymbolVendor::ParseDebugMacros(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseDebugMacros(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseDebugMacros(comp_unit);
   return false;
 }
 bool SymbolVendor::ParseSupportFiles(CompileUnit &comp_unit,
  FileSpecList &support_files) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseSupportFiles(comp_unit, support_files);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseSupportFiles(comp_unit, support_files);
   return false;
 }
 
 bool SymbolVendor::ParseIsOptimized(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseIsOptimized(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseIsOptimized(comp_unit);
   return false;
 }
 
 bool SymbolVendor::ParseImportedModules(
 const SymbolContext &sc, std::vector &imported_modules) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseImportedModules(sc, imported_modules);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseImportedModules(sc, imported_modules);
   return false;
 }
 
 size_t SymbolVendor::ParseBlocksRecursive(Function &func) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseBlocksRecursive(func);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseBlocksRecursive(func);
   return 0;
 }
 
 size_t SymbolVendor::ParseTypes(CompileUnit &comp_unit) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_file_up)
-  return m_sym_file_up->ParseTypes(comp_unit);
-  }
+  if (m_sym_file_up)
+return m_sym_file_up->ParseTypes(comp_unit);
   return 0;
 }
 
 size_t SymbolVendor::ParseVariablesForContext(const SymbolContext &sc) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-if (m_sym_

[Lldb-commits] [PATCH] D65401: SymbolVendor: Remove the object file member variable

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D65401#1604870 , @clayborg wrote:

> So previously the SymbolVendor would only make a strong reference to the 
> object file if it didn't match the object file of the module. Now it always 
> makes one. Might be ok since the Module owns the SymbolVendor and thus owns 
> the SymbolFile. We should make sure we don't end up keeping an object file 
> alive when a module goes away due to multiple strong references. I am 
> guessing it will be ok, but good to verify.


I've checked that the ObjectFile goes away when the owning Module is destroyed 
(e.g., in response to SBDebugger::MemoryPressureDetected), but I don't think 
this patch actually changes anything in terms of who-owns-who. The SymbolVendor 
was already storing a pointer to the object file even in case this was the main 
module object file (it stored the pointer "in case the object file is 
different", but the actual storing was unconditional).


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

https://reviews.llvm.org/D65401



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


[Lldb-commits] [lldb] r367299 - PECOFF: Fix a "memset clearing an object of non-trivial type" warning

2019-07-30 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jul 30 01:42:42 2019
New Revision: 367299

URL: http://llvm.org/viewvc/llvm-project?rev=367299&view=rev
Log:
PECOFF: Fix a "memset clearing an object of non-trivial type" warning

This time, the warning pointed to an actual problem, because the
coff_opt_header structure contained a std::vector. I guess this happened
to work because the all-zero state was a valid representation of an
empty vector, but its not a good idea to rely on that.

I remove the memset, and have the structure clear its members in the
constructor instead.

Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=367299&r1=367298&r2=367299&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Tue Jul 30 
01:42:42 2019
@@ -267,11 +267,10 @@ ObjectFilePECOFF::ObjectFilePECOFF(const
lldb::offset_t file_offset,
lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_dos_header(), m_coff_header(), m_coff_header_opt(), m_sect_headers(),
+  m_dos_header(), m_coff_header(), m_sect_headers(),
   m_entry_point_address(), m_deps_filespec(), m_owningbin() {
   ::memset(&m_dos_header, 0, sizeof(m_dos_header));
   ::memset(&m_coff_header, 0, sizeof(m_coff_header));
-  ::memset(&m_coff_header_opt, 0, sizeof(m_coff_header_opt));
 }
 
 ObjectFilePECOFF::ObjectFilePECOFF(const lldb::ModuleSP &module_sp,
@@ -279,11 +278,10 @@ ObjectFilePECOFF::ObjectFilePECOFF(const
const lldb::ProcessSP &process_sp,
addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_dos_header(), m_coff_header(), m_coff_header_opt(), m_sect_headers(),
+  m_dos_header(), m_coff_header(), m_sect_headers(),
   m_entry_point_address(), m_deps_filespec(), m_owningbin() {
   ::memset(&m_dos_header, 0, sizeof(m_dos_header));
   ::memset(&m_coff_header, 0, sizeof(m_coff_header));
-  ::memset(&m_coff_header_opt, 0, sizeof(m_coff_header_opt));
 }
 
 ObjectFilePECOFF::~ObjectFilePECOFF() {}

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h?rev=367299&r1=367298&r2=367299&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h Tue Jul 30 
01:42:42 2019
@@ -171,36 +171,36 @@ protected:
   } data_directory_t;
 
   typedef struct coff_opt_header {
-uint16_t magic;
-uint8_t major_linker_version;
-uint8_t minor_linker_version;
-uint32_t code_size;
-uint32_t data_size;
-uint32_t bss_size;
-uint32_t entry;
-uint32_t code_offset;
-uint32_t data_offset;
+uint16_t magic = 0;
+uint8_t major_linker_version = 0;
+uint8_t minor_linker_version = 0;
+uint32_t code_size = 0;
+uint32_t data_size = 0;
+uint32_t bss_size = 0;
+uint32_t entry = 0;
+uint32_t code_offset = 0;
+uint32_t data_offset = 0;
 
-uint64_t image_base;
-uint32_t sect_alignment;
-uint32_t file_alignment;
-uint16_t major_os_system_version;
-uint16_t minor_os_system_version;
-uint16_t major_image_version;
-uint16_t minor_image_version;
-uint16_t major_subsystem_version;
-uint16_t minor_subsystem_version;
-uint32_t reserved1;
-uint32_t image_size;
-uint32_t header_size;
-uint32_t checksum;
-uint16_t subsystem;
-uint16_t dll_flags;
-uint64_t stack_reserve_size;
-uint64_t stack_commit_size;
-uint64_t heap_reserve_size;
-uint64_t heap_commit_size;
-uint32_t loader_flags;
+uint64_t image_base = 0;
+uint32_t sect_alignment = 0;
+uint32_t file_alignment = 0;
+uint16_t major_os_system_version = 0;
+uint16_t minor_os_system_version = 0;
+uint16_t major_image_version = 0;
+uint16_t minor_image_version = 0;
+uint16_t major_subsystem_version = 0;
+uint16_t minor_subsystem_version = 0;
+uint32_t reserved1 = 0;
+uint32_t image_size = 0;
+uint32_t header_size = 0;
+uint32_t checksum = 0;
+uint16_t subsystem = 0;
+uint16_t dll_flags = 0;
+uint64_t stack_reserve_size = 0;
+uint64_t stack_commit_size = 0;
+uint64_t heap_reserve_size = 0;
+uint64_t heap_commit_size = 0;
+uint32_t loader_flags = 0;
 //   

[Lldb-commits] [PATCH] D65435: SymbolVendor: Introduce Module::GetSymbolFile

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, clayborg, jingham.

This is the next step in avoiding funneling all SymbolFile calls through
the SymbolVendor. Right now, it is just a convenience function, but it
allows us to update all calls to SymbolVendor functions to access the
SymbolFile directly. Once all call sites have been updated, we can
remove the GetSymbolVendor member function.

This patch just updates the calls to GetSymbolVendor, which were calling
it just so they could fetch the underlying symbol file. Other calls will
be done in follow-ups.


https://reviews.llvm.org/D65435

Files:
  include/lldb/Core/Module.h
  source/Commands/CommandObjectTarget.cpp
  source/Core/Module.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Symbol/Block.cpp
  source/Symbol/Function.cpp
  source/Symbol/UnwindTable.cpp

Index: source/Symbol/UnwindTable.cpp
===
--- source/Symbol/UnwindTable.cpp
+++ source/Symbol/UnwindTable.cpp
@@ -182,11 +182,7 @@
   return m_arm_unwind_up.get();
 }
 
-SymbolFile *UnwindTable::GetSymbolFile() {
-  if (SymbolVendor *vendor = m_module.GetSymbolVendor())
-return vendor->GetSymbolFile();
-  return nullptr;
-}
+SymbolFile *UnwindTable::GetSymbolFile() { return m_module.GetSymbolFile(); }
 
 ArchSpec UnwindTable::GetArchitecture() { return m_module.GetArchitecture(); }
 
Index: source/Symbol/Function.cpp
===
--- source/Symbol/Function.cpp
+++ source/Symbol/Function.cpp
@@ -428,14 +428,8 @@
   ModuleSP module_sp = CalculateSymbolContextModule();
 
   if (module_sp) {
-SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
-
-if (sym_vendor) {
-  SymbolFile *sym_file = sym_vendor->GetSymbolFile();
-
-  if (sym_file)
-return sym_file->GetDeclContextForUID(GetID());
-}
+if (SymbolFile *sym_file = module_sp->GetSymbolFile())
+  return sym_file->GetDeclContextForUID(GetID());
   }
   return CompilerDeclContext();
 }
@@ -449,12 +443,7 @@
 if (!sc.module_sp)
   return nullptr;
 
-SymbolVendor *sym_vendor = sc.module_sp->GetSymbolVendor();
-
-if (sym_vendor == nullptr)
-  return nullptr;
-
-SymbolFile *sym_file = sym_vendor->GetSymbolFile();
+SymbolFile *sym_file = sc.module_sp->GetSymbolFile();
 
 if (sym_file == nullptr)
   return nullptr;
Index: source/Symbol/Block.cpp
===
--- source/Symbol/Block.cpp
+++ source/Symbol/Block.cpp
@@ -464,8 +464,7 @@
 
 SymbolFile *Block::GetSymbolFile() {
   if (ModuleSP module_sp = CalculateSymbolContextModule())
-if (SymbolVendor *sym_vendor = module_sp->GetSymbolVendor())
-  return sym_vendor->GetSymbolFile();
+return module_sp->GetSymbolFile();
   return nullptr;
 }
 
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3723,10 +3723,8 @@
   if (m_debug_map_symfile == nullptr && !m_debug_map_module_wp.expired()) {
 lldb::ModuleSP module_sp(m_debug_map_module_wp.lock());
 if (module_sp) {
-  SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
-  if (sym_vendor)
-m_debug_map_symfile =
-(SymbolFileDWARFDebugMap *)sym_vendor->GetSymbolFile();
+  m_debug_map_symfile =
+  (SymbolFileDWARFDebugMap *)module_sp->GetSymbolFile();
 }
   }
   return m_debug_map_symfile;
Index: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===
--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -72,112 +72,106 @@
 FileSpec module_spec = module.GetFileSpec();
 
 if (module_spec) {
-  SymbolVendor *symbols = module.GetSymbolVendor();
-  if (symbols) {
-SymbolFile *symfile = symbols->GetSymbolFile();
-if (symfile) {
-  ObjectFile *objfile = symfile->GetObjectFile();
-  if (objfile) {
-FileSpec symfile_spec(objfile->GetFileSpec());
-if (symfile_spec && 
-strcasestr (symfile_spec.GetPath().c_str(), 
-".dSYM/Contents/Resources/DWARF") != nullptr &&
-FileSystem::Instance().Exists(symfile_spec)) {
-  while (module_spec.GetFilename()) {
-std::string module_basename(
-module_spec.GetFilename().GetCString());
-std::string original_module_basename(module_basename);
-
-bool was_keyword = false;
-
-// FIXME: for Python, we cannot allow certain characters in
-// module
-// filen

[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

Hm... this patch spectacularly fails for me with about 100 failures. Are you 
sure you ran the test suite with this change?

I took a brief look at `x86-64-ymm-write.test` as it was easiest to debug. It 
looks like the test fails with: `error: Failed to write register 'ymm0' with 
value '{0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 
0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 
0x1e 0x1f}'`

After enabling the gdb-remote log, I see that lldb now attempts to implement 
the "register write" command via the `G` packet, and lldb-server does not 
support that. If we want this new setting to control register writing as well, 
then I guess we'll need to add appropriate support in lldb-server. However, it 
that case we might also need to fix register writing in lldb in this scenario, 
as I did not see lldb issueing a `g` command before `G`, which leads me to 
believe that some of the `G` data was garbage.

Due to the potential need to issue a `g` packet before we write a single 
register (i.e., issue two large packets instead of a single small packet), I 
don't think we should tie the usage of `g` and `G` together. I haven't looked 
at what it would take to implement that though...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [PATCH] D65330: [lldb][docs] Update documentation for monorepo and CMake caches

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 212304.
sgraenitz added a comment.

Add lld note to Windows section


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65330

Files:
  lldb/docs/resources/build.rst

Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -78,23 +78,85 @@
 * If you are building both Clang and LLDB together, be sure to also check out
   libc++, which is a required for testing on macOS.
 
-Building LLDB with CMake & Ninja
-
+Building LLDB with CMake
+
+
+The LLVM project is migrating to a single monolithic respository for LLVM and
+its subprojects. This is the recommended way to build LLDB. Check out the
+source-tree with git:
+
+::
+
+  > git clone https://github.com/llvm/llvm-project.git
 
 CMake is a cross-platform build-generator tool. CMake does not build the
-project, it generates the files needed by your build tool. Assuming you're
-using Ninja, the invocation looks like this:
+project, it generates the files needed by your build tool. The recommended
+build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio
+may be used as well. Please also read `Building LLVM with CMake
+`_.
+
+Regular in-tree builds
+**
+
+Create a new directory for your build-tree. From there run CMake and point it
+to the ``llvm`` directory in the source-tree:
 
 ::
 
-  > cmake -G Ninja  
+  > cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [] path/to/llvm-project/llvm
 
-Once CMake has configured your build, you can run ``ninja`` to build LLDB.
+We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which
+subprojects to build in addition to LLVM (for more options see
+:ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
+require ``lld``. Add it to the list in order to run all tests. Once CMake is done,
+run ninja to perform the actual build. We pass ``lldb`` here as the target, so
+it only builds what is necessary to run the lldb driver:
 
 ::
 
   > ninja lldb
 
+Standalone builds
+*
+
+This is another way to build LLDB. We can use the same source-tree as we
+checked out above, but now we will have two build-trees:
+
+* the main build-tree for LLDB in ``/path/to/lldb-build``
+* a provided build-tree for LLVM and Clang in ``/path/to/llvm-build``
+
+Run CMake with ``-B`` pointing to a new directory for the provided build-tree
+and the positional argument pointing to the ``llvm`` directory in the
+source-tree. Note that we leave out LLDB here and only include Clang.
+Then we build the ``ALL`` target with ninja:
+
+::
+
+  > cmake -B /path/to/llvm-build -G Ninja \
+  -DLLVM_ENABLE_PROJECTS=clang \
+  [] /path/to/llvm-project/llvm
+  > ninja
+
+Now run CMake a second time with ``-B`` pointing to a new directory for the
+main build-tree and the positional argument pointing to the ``lldb`` directory
+in the source-tree. In order to find the provided build-tree, the build-system
+needs the options ``LLVM_DIR`` and ``Clang_DIR`` (CMake variables are
+case-sensitive!):
+
+::
+
+  > cmake -B /path/to/lldb-build -G Ninja \
+  -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
+  -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
+  [] /path/to/llvm-project/lldb
+  > ninja lldb
+
+
+.. _CommonCMakeOptions:
+
+Common CMake options
+
+
 Following is a description of some of the most important CMake variables which
 you are likely to encounter. A variable FOO is set by adding ``-DFOO=value`` to
 the CMake command line.
@@ -128,7 +190,11 @@
 test execution.
 
 Windows
-***
+^^^
+
+On Windows the LLDB test suite requires lld. Either add ``lld`` to
+``LLVM_ENABLE_PROJECTS`` or disable the test suite with
+``LLDB_ENABLE_TESTS=OFF``.
 
 Although the following CMake variables are by no means Windows specific, they
 are commonly used on Windows.
@@ -161,8 +227,27 @@
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
+
+Building with ninja is both faster and simpler than building with Visual Studio,
+but chances are you still want to debug LLDB with an IDE. One solution is to run
+cmake twice and generate the output into two different folders. One for
+compiling (the ninja folder), and one for editing, browsing and debugging.
+
+Follow the previous instructions in one directory, and generate a Visual Studio
+project in another directory.
+
+::
+
+  > cmake -G "Visual Studio 15 2017 Win64" -Thost=x64  
+
+Then you can open the .sln file in Visual Studio, set lldb as the startup
+project, and use F5 to run it. You need only edit the project settings to set
+the executable and the working directory to point to binaries inside of the
+ninja tr

[Lldb-commits] [lldb] r367302 - [lldb][docs] Update documentation for monorepo and CMake caches

2019-07-30 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jul 30 03:21:28 2019
New Revision: 367302

URL: http://llvm.org/viewvc/llvm-project?rev=367302&view=rev
Log:
[lldb][docs] Update documentation for monorepo and CMake caches

Summary: The lldb build system made good progress in the last months, but 
documentation was still lacking behind. Here's a patch to catch up.

Reviewers: JDevlieghere, jingham, labath, stella.stamenova, teemperor, jryans, 
kastiglione, xiaobai, compnerd, zturner

Reviewed By: labath, stella.stamenova, jryans

Subscribers: clayborg, amccarth, friss, lldb-commits, #lldb

Tags: #lldb

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

Modified:
lldb/trunk/docs/resources/build.rst

Modified: lldb/trunk/docs/resources/build.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=367302&r1=367301&r2=367302&view=diff
==
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Tue Jul 30 03:21:28 2019
@@ -78,23 +78,85 @@ macOS
 * If you are building both Clang and LLDB together, be sure to also check out
   libc++, which is a required for testing on macOS.
 
-Building LLDB with CMake & Ninja
-
+Building LLDB with CMake
+
+
+The LLVM project is migrating to a single monolithic respository for LLVM and
+its subprojects. This is the recommended way to build LLDB. Check out the
+source-tree with git:
+
+::
+
+  > git clone https://github.com/llvm/llvm-project.git
 
 CMake is a cross-platform build-generator tool. CMake does not build the
-project, it generates the files needed by your build tool. Assuming you're
-using Ninja, the invocation looks like this:
+project, it generates the files needed by your build tool. The recommended
+build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio
+may be used as well. Please also read `Building LLVM with CMake
+`_.
+
+Regular in-tree builds
+**
+
+Create a new directory for your build-tree. From there run CMake and point it
+to the ``llvm`` directory in the source-tree:
+
+::
+
+  > cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [] 
path/to/llvm-project/llvm
+
+We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which
+subprojects to build in addition to LLVM (for more options see
+:ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
+require ``lld``. Add it to the list in order to run all tests. Once CMake is 
done,
+run ninja to perform the actual build. We pass ``lldb`` here as the target, so
+it only builds what is necessary to run the lldb driver:
+
+::
+
+  > ninja lldb
+
+Standalone builds
+*
+
+This is another way to build LLDB. We can use the same source-tree as we
+checked out above, but now we will have two build-trees:
+
+* the main build-tree for LLDB in ``/path/to/lldb-build``
+* a provided build-tree for LLVM and Clang in ``/path/to/llvm-build``
+
+Run CMake with ``-B`` pointing to a new directory for the provided build-tree
+and the positional argument pointing to the ``llvm`` directory in the
+source-tree. Note that we leave out LLDB here and only include Clang.
+Then we build the ``ALL`` target with ninja:
 
 ::
 
-  > cmake -G Ninja  
+  > cmake -B /path/to/llvm-build -G Ninja \
+  -DLLVM_ENABLE_PROJECTS=clang \
+  [] /path/to/llvm-project/llvm
+  > ninja
 
-Once CMake has configured your build, you can run ``ninja`` to build LLDB.
+Now run CMake a second time with ``-B`` pointing to a new directory for the
+main build-tree and the positional argument pointing to the ``lldb`` directory
+in the source-tree. In order to find the provided build-tree, the build-system
+needs the options ``LLVM_DIR`` and ``Clang_DIR`` (CMake variables are
+case-sensitive!):
 
 ::
 
+  > cmake -B /path/to/lldb-build -G Ninja \
+  -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
+  -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
+  [] /path/to/llvm-project/lldb
   > ninja lldb
 
+
+.. _CommonCMakeOptions:
+
+Common CMake options
+
+
 Following is a description of some of the most important CMake variables which
 you are likely to encounter. A variable FOO is set by adding ``-DFOO=value`` to
 the CMake command line.
@@ -128,7 +190,11 @@ It is strongly recommend to use a releas
 test execution.
 
 Windows
-***
+^^^
+
+On Windows the LLDB test suite requires lld. Either add ``lld`` to
+``LLVM_ENABLE_PROJECTS`` or disable the test suite with
+``LLDB_ENABLE_TESTS=OFF``.
 
 Although the following CMake variables are by no means Windows specific, they
 are commonly used on Windows.
@@ -161,8 +227,27 @@ Sample command line:
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
+
+Building with ninja is both faster and simpler than building wi

[Lldb-commits] [PATCH] D65330: [lldb][docs] Update documentation for monorepo and CMake caches

2019-07-30 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367302: [lldb][docs] Update documentation for monorepo and 
CMake caches (authored by stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65330?vs=212304&id=212306#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65330

Files:
  lldb/trunk/docs/resources/build.rst

Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -78,23 +78,85 @@
 * If you are building both Clang and LLDB together, be sure to also check out
   libc++, which is a required for testing on macOS.
 
-Building LLDB with CMake & Ninja
-
+Building LLDB with CMake
+
+
+The LLVM project is migrating to a single monolithic respository for LLVM and
+its subprojects. This is the recommended way to build LLDB. Check out the
+source-tree with git:
+
+::
+
+  > git clone https://github.com/llvm/llvm-project.git
 
 CMake is a cross-platform build-generator tool. CMake does not build the
-project, it generates the files needed by your build tool. Assuming you're
-using Ninja, the invocation looks like this:
+project, it generates the files needed by your build tool. The recommended
+build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio
+may be used as well. Please also read `Building LLVM with CMake
+`_.
+
+Regular in-tree builds
+**
+
+Create a new directory for your build-tree. From there run CMake and point it
+to the ``llvm`` directory in the source-tree:
 
 ::
 
-  > cmake -G Ninja  
+  > cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [] path/to/llvm-project/llvm
 
-Once CMake has configured your build, you can run ``ninja`` to build LLDB.
+We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which
+subprojects to build in addition to LLVM (for more options see
+:ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
+require ``lld``. Add it to the list in order to run all tests. Once CMake is done,
+run ninja to perform the actual build. We pass ``lldb`` here as the target, so
+it only builds what is necessary to run the lldb driver:
 
 ::
 
   > ninja lldb
 
+Standalone builds
+*
+
+This is another way to build LLDB. We can use the same source-tree as we
+checked out above, but now we will have two build-trees:
+
+* the main build-tree for LLDB in ``/path/to/lldb-build``
+* a provided build-tree for LLVM and Clang in ``/path/to/llvm-build``
+
+Run CMake with ``-B`` pointing to a new directory for the provided build-tree
+and the positional argument pointing to the ``llvm`` directory in the
+source-tree. Note that we leave out LLDB here and only include Clang.
+Then we build the ``ALL`` target with ninja:
+
+::
+
+  > cmake -B /path/to/llvm-build -G Ninja \
+  -DLLVM_ENABLE_PROJECTS=clang \
+  [] /path/to/llvm-project/llvm
+  > ninja
+
+Now run CMake a second time with ``-B`` pointing to a new directory for the
+main build-tree and the positional argument pointing to the ``lldb`` directory
+in the source-tree. In order to find the provided build-tree, the build-system
+needs the options ``LLVM_DIR`` and ``Clang_DIR`` (CMake variables are
+case-sensitive!):
+
+::
+
+  > cmake -B /path/to/lldb-build -G Ninja \
+  -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
+  -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
+  [] /path/to/llvm-project/lldb
+  > ninja lldb
+
+
+.. _CommonCMakeOptions:
+
+Common CMake options
+
+
 Following is a description of some of the most important CMake variables which
 you are likely to encounter. A variable FOO is set by adding ``-DFOO=value`` to
 the CMake command line.
@@ -128,7 +190,11 @@
 test execution.
 
 Windows
-***
+^^^
+
+On Windows the LLDB test suite requires lld. Either add ``lld`` to
+``LLVM_ENABLE_PROJECTS`` or disable the test suite with
+``LLDB_ENABLE_TESTS=OFF``.
 
 Although the following CMake variables are by no means Windows specific, they
 are commonly used on Windows.
@@ -161,8 +227,27 @@
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
+
+Building with ninja is both faster and simpler than building with Visual Studio,
+but chances are you still want to debug LLDB with an IDE. One solution is to run
+cmake twice and generate the output into two different folders. One for
+compiling (the ninja folder), and one for editing, browsing and debugging.
+
+Follow the previous instructions in one directory, and generate a Visual Studio
+project in another directory.
+
+::
+
+  > cmake -G "Visual Studio 15 2

[Lldb-commits] [PATCH] D65437: [lldb][docs] Update landing page for monorepo

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: jryans, clayborg, amccarth, labath.
Herald added a subscriber: arphaman.
Herald added a project: LLDB.

Following up from D65330 , here's an update 
for the landing page.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65437

Files:
  lldb/docs/index.rst
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -301,6 +301,8 @@
 
   > DESTDIR=/path/to/lldb-install ninja -C /path/to/lldb-build check-lldb 
install-distribution
 
+.. _CMakeGeneratedXcodeProject:
+
 Build LLDB standalone for development with Xcode:
 
 ::
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -80,27 +80,31 @@
 Get Involved
 
 
-To check out the code, use:
+Check out the LLVM source-tree with git and find the sources in the `lldb`
+subdirectory:
 
-svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
+::
 
-Note that LLDB generally builds from top-of-trunk
+  > git clone https://github.com/llvm/llvm-project.git
 
-* On macOS with Xcode
-* On Linux and FreeBSD (with clang and libstdc++/libc++)
-* On NetBSD (with GCC and clang and libstdc++/libc++)
-* On Windows with VS 2012 or higher using CMake
+Note that LLDB generally builds from top-of-trunk using CMake and Ninja.
+Additionally it builds:
 
-See the LLDB Build Page for platform-specific build instructions.
+* on macOS with a :ref:`generated Xcode project `
+* on Linux and FreeBSD with clang and libstdc++/libc++
+* on NetBSD with GCC/clang and libstdc++/libc++
+* on Windows with a generated project for VS 2017 or higher
+
+See the :doc:`LLDB Build Page ` for build instructions.
 
 Discussions about LLDB should go to the `lldb-dev
 `__ mailing list. Commit
-messages for the lldb SVN module are automatically sent to the `lldb-commits
+messages are automatically sent to the `lldb-commits
 `__ mailing list , and
 this is also the preferred mailing list for patch submissions.
 
-See the Projects page if you are looking for some interesting areas to
-contribute to lldb.
+See the :doc:`Projects page ` if you are looking for some
+interesting areas to contribute to lldb.
 
 .. toctree::
:hidden:


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -301,6 +301,8 @@
 
   > DESTDIR=/path/to/lldb-install ninja -C /path/to/lldb-build check-lldb install-distribution
 
+.. _CMakeGeneratedXcodeProject:
+
 Build LLDB standalone for development with Xcode:
 
 ::
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -80,27 +80,31 @@
 Get Involved
 
 
-To check out the code, use:
+Check out the LLVM source-tree with git and find the sources in the `lldb`
+subdirectory:
 
-svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
+::
 
-Note that LLDB generally builds from top-of-trunk
+  > git clone https://github.com/llvm/llvm-project.git
 
-* On macOS with Xcode
-* On Linux and FreeBSD (with clang and libstdc++/libc++)
-* On NetBSD (with GCC and clang and libstdc++/libc++)
-* On Windows with VS 2012 or higher using CMake
+Note that LLDB generally builds from top-of-trunk using CMake and Ninja.
+Additionally it builds:
 
-See the LLDB Build Page for platform-specific build instructions.
+* on macOS with a :ref:`generated Xcode project `
+* on Linux and FreeBSD with clang and libstdc++/libc++
+* on NetBSD with GCC/clang and libstdc++/libc++
+* on Windows with a generated project for VS 2017 or higher
+
+See the :doc:`LLDB Build Page ` for build instructions.
 
 Discussions about LLDB should go to the `lldb-dev
 `__ mailing list. Commit
-messages for the lldb SVN module are automatically sent to the `lldb-commits
+messages are automatically sent to the `lldb-commits
 `__ mailing list , and
 this is also the preferred mailing list for patch submissions.
 
-See the Projects page if you are looking for some interesting areas to
-contribute to lldb.
+See the :doc:`Projects page ` if you are looking for some
+interesting areas to contribute to lldb.
 
 .. toctree::
:hidden:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65437: [lldb][docs] Update landing page for monorepo

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

@clayborg I added a direct link to Xcode project generation here. Is that fine?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65437



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


[Lldb-commits] [PATCH] D65330: [lldb][docs] Update documentation for monorepo and CMake caches

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz marked 3 inline comments as done.
sgraenitz added inline comments.



Comment at: lldb/docs/resources/build.rst:90
+
+  > git clone https://github.com/llvm/llvm-project.git
 

sgraenitz wrote:
> jryans wrote:
> > This could be done in a separate patch, but I happened to notice that [Get 
> > Involved section on the LLDB main 
> > page](https://lldb.llvm.org/index.html#get-involved) currently suggests 
> > Subversion at the moment. It would be nice to have this updated to Git as 
> > well.
> +1 (in a separate patch)
D65437


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65330



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


[Lldb-commits] [lldb] r367307 - [lldb][NFC] Check in crashing test case

2019-07-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Jul 30 05:20:03 2019
New Revision: 367307

URL: http://llvm.org/viewvc/llvm-project?rev=367307&view=rev
Log:
[lldb][NFC] Check in crashing test case

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/TestCompletionCrash1.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/main.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/Makefile?rev=367307&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/Makefile
 Tue Jul 30 05:20:03 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/TestCompletionCrash1.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/TestCompletionCrash1.py?rev=367307&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/TestCompletionCrash1.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/TestCompletionCrash1.py
 Tue Jul 30 05:20:03 2019
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), 
[decorators.skipIf(bugnumber="rdar://53659341")])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/main.cpp?rev=367307&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash1/main.cpp
 Tue Jul 30 05:20:03 2019
@@ -0,0 +1,12 @@
+namespace std {
+struct a {
+  a() {}
+  a(a &&);
+};
+template  struct au {
+  a ay;
+  ~au() { //%self.dbg.GetCommandInterpreter().HandleCompletion("e ", len("e 
"), 0, -1, lldb.SBStringList())
+  }
+};
+}
+int main() { std::au{}; }


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


[Lldb-commits] [lldb] r367308 - [lldb] Fix crash when tab-completing in multi-line expr

2019-07-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Jul 30 05:31:24 2019
New Revision: 367308

URL: http://llvm.org/viewvc/llvm-project?rev=367308&view=rev
Log:
[lldb] Fix crash when tab-completing in multi-line expr

Summary:
Tab completing inside the multiline expression command can cause LLDB to crash. 
The easiest way
to do this is to go inside a frame with at least one local variable and then 
try to complete:

(lldb) expr
1. a[tab]

Reason for this was some mixup when we calculate the cursor position. Obviously 
we should calculate
the offset inside the string by doing 'end - start', but we are doing 'start - 
end' (which causes the offset to
become -1 which will lead to some out-of-bounds reading).

Fixes rdar://51754005

I don't see any way to test this as the *multiline* expression completion is 
completely untested at the moment
and I don't think we have any existing code for testing infrastructure for it.

Reviewers: shafik, davide, labath

Reviewed By: labath

Subscribers: abidh, lldb-commits, davide, clayborg, labath

Tags: #lldb

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
Modified:
lldb/trunk/source/Core/IOHandler.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile?rev=367308&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
 Tue Jul 30 05:31:24 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py?rev=367308&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 Tue Jul 30 05:31:24 2019
@@ -0,0 +1,52 @@
+"""
+Test completion for multiline expressions.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class MultilineCompletionTest(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
+
+def setUp(self):
+TestBase.setUp(self)
+self.source = 'main.c'
+
+def expect_string(self, string):
+import pexpect
+"""This expects for "string", with timeout & EOF being test fails."""
+try:
+self.child.expect_exact(string)
+except pexpect.EOF:
+self.fail("Got EOF waiting for '%s'" % (string))
+except pexpect.TIMEOUT:
+self.fail("Timed out waiting for '%s'" % (string))
+
+@expectedFailureAll(
+oslist=["windows"],
+bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+def test_basic_completion(self):
+"""Test that we can complete a simple multiline expression"""
+self.build()
+self.setTearDownCleanup()
+
+import pexpect
+exe = self.getBuildArtifact("a.out")
+prompt = "(lldb) "
+
+run_commands = ' -o "b main" -o "r"'
+self.child = pexpect.spawn(
+'%s %s %s %s' %
+(lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
+child = self.child
+
+self.expect_string(prompt)
+self.child.sendline("expr")
+self.expect_string("terminate with an empty line to evaluate")
+self.child.send("to_\t")
+self.expect_string("to_complete")
+
+self.deletePexpectChild()

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c?rev=367308&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completi

[Lldb-commits] [PATCH] D64995: [lldb] Fix crash when tab-completing in multi-line expr

2019-07-30 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367308: [lldb] Fix crash when tab-completing in multi-line 
expr (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64995?vs=212163&id=212317#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64995

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
  lldb/trunk/source/Core/IOHandler.cpp


Index: lldb/trunk/source/Core/IOHandler.cpp
===
--- lldb/trunk/source/Core/IOHandler.cpp
+++ lldb/trunk/source/Core/IOHandler.cpp
@@ -233,7 +233,7 @@
 matches, descriptions);
   case Completion::Expression: {
 CompletionResult result;
-CompletionRequest request(current_line, current_line - cursor,
+CompletionRequest request(current_line, cursor - current_line,
   skip_first_n_matches, max_matches, result);
 CommandCompletions::InvokeCommonCompletionCallbacks(
 io_handler.GetDebugger().GetCommandInterpreter(),
Index: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+  lldb_enable_attach();
+  int to_complete = 0;
+  return to_complete;
+}
Index: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
@@ -0,0 +1,52 @@
+"""
+Test completion for multiline expressions.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class MultilineCompletionTest(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
+
+def setUp(self):
+TestBase.setUp(self)
+self.source = 'main.c'
+
+def expect_string(self, string):
+import pexpect
+"""This expects for "string", with timeout & EOF being test fails."""
+try:
+self.child.expect_exact(string)
+except pexpect.EOF:
+self.fail("Got EOF waiting for '%s'" % (string))
+except pexpect.TIMEOUT:
+self.fail("Timed out waiting for '%s'" % (string))
+
+@expectedFailureAll(
+oslist=["windows"],
+bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+def test_basic_completion(self):
+"""Test that we can complete a simple multiline expression"""
+self.build()
+self.setTearDownCleanup()
+
+import pexpect
+exe = self.getBuildArtifact("a.out")
+prompt = "(lldb) "
+
+run_commands = ' -o "b main" -o "r"'
+self.child = pexpect.spawn(
+'%s %s %s %s' %
+(lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
+child = self.child
+
+self.expect_string(prompt)
+self.child.sendline("expr")
+self.expect_string("terminate with an empty line to evaluate")
+self.child.send("to_\t")
+self.expect_string("to_complete")
+
+self.deletePexpectChild()
Index: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules


Index: lldb/trunk/source/Core/IOHandler.cpp
===
--- lldb/trunk/source/Core/IOHandler.cpp
+++ lldb/trunk/source/Core/IOHandler.cpp
@@ -233,7 +233,7 @@
 matches, descriptions);
   case Completion::Expression: {
 CompletionResult result;
-CompletionRequest request(current_line, current_line - cursor,
+CompletionRequest request(current_line, cursor - current_line,
  

Re: [Lldb-commits] [lldb] r367308 - [lldb] Fix crash when tab-completing in multi-line expr

2019-07-30 Thread Hans Wennborg via lldb-commits
Hi Raphael,

Since this just landed, let's have it bake in trunk a little bit, and
then I'll merge it.

Thanks,
Hans

On Tue, Jul 30, 2019 at 2:36 PM Raphael “Teemperor” Isemann
 wrote:
>
> Hi Hans,
>
> Can you cherry-pick this to the 9.0 release? The issue is really easy to hit 
> when using LLDB and the fix is obvious&safe.
>
> Thanks!
> - Raphael
>
> > On Jul 30, 2019, at 2:31 PM, Raphael Isemann via lldb-commits 
> >  wrote:
> >
> > Author: teemperor
> > Date: Tue Jul 30 05:31:24 2019
> > New Revision: 367308
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=367308&view=rev
> > Log:
> > [lldb] Fix crash when tab-completing in multi-line expr
> >
> > Summary:
> > Tab completing inside the multiline expression command can cause LLDB to 
> > crash. The easiest way
> > to do this is to go inside a frame with at least one local variable and 
> > then try to complete:
> >
> >(lldb) expr
> >1. a[tab]
> >
> > Reason for this was some mixup when we calculate the cursor position. 
> > Obviously we should calculate
> > the offset inside the string by doing 'end - start', but we are doing 
> > 'start - end' (which causes the offset to
> > become -1 which will lead to some out-of-bounds reading).
> >
> > Fixes rdar://51754005
> >
> > I don't see any way to test this as the *multiline* expression completion 
> > is completely untested at the moment
> > and I don't think we have any existing code for testing infrastructure for 
> > it.
> >
> > Reviewers: shafik, davide, labath
> >
> > Reviewed By: labath
> >
> > Subscribers: abidh, lldb-commits, davide, clayborg, labath
> >
> > Tags: #lldb
> >
> > Differential Revision: https://reviews.llvm.org/D64995
> >
> > Added:
> >
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/
> >
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
> >
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
> >
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/main.c
> > Modified:
> >lldb/trunk/source/Core/IOHandler.cpp
> >
> > Added: 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
> > URL: 
> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile?rev=367308&view=auto
> > ==
> > --- 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
> >  (added)
> > +++ 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/Makefile
> >  Tue Jul 30 05:31:24 2019
> > @@ -0,0 +1,3 @@
> > +LEVEL = ../../make
> > +C_SOURCES := main.c
> > +include $(LEVEL)/Makefile.rules
> >
> > Added: 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
> > URL: 
> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py?rev=367308&view=auto
> > ==
> > --- 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
> >  (added)
> > +++ 
> > lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
> >  Tue Jul 30 05:31:24 2019
> > @@ -0,0 +1,52 @@
> > +"""
> > +Test completion for multiline expressions.
> > +"""
> > +
> > +import lldb
> > +from lldbsuite.test.decorators import *
> > +from lldbsuite.test.lldbtest import *
> > +
> > +class MultilineCompletionTest(TestBase):
> > +
> > +mydir = TestBase.compute_mydir(__file__)
> > +NO_DEBUG_INFO_TESTCASE = True
> > +
> > +def setUp(self):
> > +TestBase.setUp(self)
> > +self.source = 'main.c'
> > +
> > +def expect_string(self, string):
> > +import pexpect
> > +"""This expects for "string", with timeout & EOF being test 
> > fails."""
> > +try:
> > +self.child.expect_exact(string)
> > +except pexpect.EOF:
> > +self.fail("Got EOF waiting for '%s'" % (string))
> > +except pexpect.TIMEOUT:
> > +self.fail("Timed out waiting for '%s'" % (string))
> > +
> > +@expectedFailureAll(
> > +oslist=["windows"],
> > +bugnumber="llvm.org/pr22274: need a pexpect replacement for 
> > windows")
> > +def test_basic_completion(self):
> > +"""Test that we can complete a simple multiline expression"""
> > +self.build()
> > +self.setTearDownCleanup()
> > +
> > +import pexpect
> > +exe = self.getBuildArtifact("a.out")
> > +prompt = "(lldb) "
> > +
> > +run_commands = ' -o "b main" -o "r"'
> > +self.child = pexpect.spawn(

[Lldb-commits] [lldb] r367309 - [lldb][NFC] Fix import-std-module tests that relied on fix-its to pass

2019-07-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Jul 30 06:11:59 2019
New Revision: 367309

URL: http://llvm.org/viewvc/llvm-project?rev=367309&view=rev
Log:
[lldb][NFC] Fix import-std-module tests that relied on fix-its to pass

These tests currently pass, but they rely on fix-its in our expression
parser to pass because they have some typos.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py?rev=367309&r1=367308&r2=367309&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py
 Tue Jul 30 06:11:59 2019
@@ -25,12 +25,12 @@ class TestDbgInfoContentDeque(TestBase):
 self.runCmd("settings set target.import-std-module true")
 
 self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-self.expect("expr (int)a.front()->a", substrs=['(int) $1 = 3'])
-self.expect("expr (int)a.back()->a", substrs=['(int) $2 = 2'])
+self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
+self.expect("expr (int)a.back().a", substrs=['(int) $2 = 2'])
 
 self.expect("expr std::reverse(a.begin(), a.end())")
-self.expect("expr (int)a.front()->a", substrs=['(int) $3 = 2'])
-self.expect("expr (int)a.back()->a", substrs=['(int) $4 = 3'])
+self.expect("expr (int)a.front().a", substrs=['(int) $3 = 2'])
+self.expect("expr (int)a.back().a", substrs=['(int) $4 = 3'])
 
 self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2'])
 self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3'])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py?rev=367309&r1=367308&r2=367309&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py
 Tue Jul 30 06:11:59 2019
@@ -25,7 +25,7 @@ class TestDbgInfoContentForwardList(Test
 self.runCmd("settings set target.import-std-module true")
 
 self.expect("expr (size_t)std::distance(a.begin(), a.end())", 
substrs=['(size_t) $0 = 3'])
-self.expect("expr (int)a.front()->a", substrs=['(int) $1 = 3'])
+self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
 
 self.expect("expr (int)(a.begin()->a)", substrs=['(int) $2 = 3'])
 


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


[Lldb-commits] [PATCH] D65437: [lldb][docs] Update landing page for monorepo

2019-07-30 Thread J. Ryan Stinnett via Phabricator via lldb-commits
jryans accepted this revision.
jryans added a comment.

Thanks for working on this! 😁




Comment at: lldb/docs/index.rst:104
 `__ mailing list , and
 this is also the preferred mailing list for patch submissions.
 

At some point, we should clarify that Phabricator is where reviews happen these 
days, but that's an LLVM-wide issue (see the [recent 
RFC](https://lists.llvm.org/pipermail/llvm-dev/2019-June/133162.html) and 
D63488 hoping to clarify).

Perhaps LLDB can update its own pages independently of that process, but once 
again, I suppose that's a separate topic and separate patch from this one. 😅 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65437



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


[Lldb-commits] [PATCH] D65436: [docs] Add git to list of Software requirements

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 212336.
sgraenitz added a comment.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Move git version comment into a footnote in git-llvm section


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65436

Files:
  lldb/docs/resources/build.rst
  llvm/docs/GettingStarted.rst

Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -160,9 +160,9 @@
 Software
 
 
-Compiling LLVM requires that you have several software packages installed. The
-table below lists those required packages. The Package column is the usual name
-for the software package that LLVM depends on. The Version column provides
+Working with LLVM requires that you have several software packages installed.
+The table below lists those required packages. The Package column is the usual
+name for the software package that LLVM depends on. The Version column provides
 "known to work" versions of the package. The Notes column describes how LLVM
 uses the package and provides other details.
 
@@ -503,8 +503,8 @@
 
 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add it
 to your path, you can push committed changes upstream with ``git llvm
-push``. While this creates a Subversion checkout and patches it under the hood,
-it does not require you to have interaction with it.
+push``\ :sup:`1`. While this creates a Subversion checkout and patches it under
+the hood, it does not require you to have interaction with it.
 
 .. code-block:: console
 
@@ -525,6 +525,10 @@
 tell you what it would have done. That can be useful if you're unsure whether
 the right thing will happen.
 
+.. note::
+
+   #. The helper script works with git versions >=2.9.3
+
 Reverting a change when using Git
 ^
 
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -78,23 +78,85 @@
 * If you are building both Clang and LLDB together, be sure to also check out
   libc++, which is a required for testing on macOS.
 
-Building LLDB with CMake & Ninja
-
+Building LLDB with CMake
+
+
+The LLVM project is migrating to a single monolithic respository for LLVM and
+its subprojects. This is the recommended way to build LLDB. Check out the
+source-tree with git:
+
+::
+
+  > git clone https://github.com/llvm/llvm-project.git
 
 CMake is a cross-platform build-generator tool. CMake does not build the
-project, it generates the files needed by your build tool. Assuming you're
-using Ninja, the invocation looks like this:
+project, it generates the files needed by your build tool. The recommended
+build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio
+may be used as well. Please also read `Building LLVM with CMake
+`_.
+
+Regular in-tree builds
+**
+
+Create a new directory for your build-tree. From there run CMake and point it
+to the ``llvm`` directory in the source-tree:
 
 ::
 
-  > cmake -G Ninja  
+  > cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [] path/to/llvm-project/llvm
 
-Once CMake has configured your build, you can run ``ninja`` to build LLDB.
+We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which
+subprojects to build in addition to LLVM (for more options see
+:ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
+require ``lld``. Add it to the list in order to run all tests. Once CMake is done,
+run ninja to perform the actual build. We pass ``lldb`` here as the target, so
+it only builds what is necessary to run the lldb driver:
 
 ::
 
   > ninja lldb
 
+Standalone builds
+*
+
+This is another way to build LLDB. We can use the same source-tree as we
+checked out above, but now we will have two build-trees:
+
+* the main build-tree for LLDB in ``/path/to/lldb-build``
+* a provided build-tree for LLVM and Clang in ``/path/to/llvm-build``
+
+Run CMake with ``-B`` pointing to a new directory for the provided build-tree
+and the positional argument pointing to the ``llvm`` directory in the
+source-tree. Note that we leave out LLDB here and only include Clang.
+Then we build the ``ALL`` target with ninja:
+
+::
+
+  > cmake -B /path/to/llvm-build -G Ninja \
+  -DLLVM_ENABLE_PROJECTS=clang \
+  [] /path/to/llvm-project/llvm
+  > ninja
+
+Now run CMake a second time with ``-B`` pointing to a new directory for the
+main build-tree and the positional argument pointing to the ``lldb`` directory
+in the source-tree. In order to find the provided build-tree, the build-system
+needs the options ``LLVM_DIR`` and ``Clang_DIR`` (CMa

[Lldb-commits] [PATCH] D65436: [docs] Add git to list of Software requirements

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 212338.
sgraenitz added a comment.

Remove lldb documentation updates I just added accidentally


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65436

Files:
  llvm/docs/GettingStarted.rst


Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -160,9 +160,9 @@
 Software
 
 
-Compiling LLVM requires that you have several software packages installed. The
-table below lists those required packages. The Package column is the usual name
-for the software package that LLVM depends on. The Version column provides
+Working with LLVM requires that you have several software packages installed.
+The table below lists those required packages. The Package column is the usual
+name for the software package that LLVM depends on. The Version column provides
 "known to work" versions of the package. The Notes column describes how LLVM
 uses the package and provides other details.
 
@@ -503,8 +503,8 @@
 
 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add 
it
 to your path, you can push committed changes upstream with ``git llvm
-push``. While this creates a Subversion checkout and patches it under the hood,
-it does not require you to have interaction with it.
+push``\ :sup:`1`. While this creates a Subversion checkout and patches it under
+the hood, it does not require you to have interaction with it.
 
 .. code-block:: console
 
@@ -525,6 +525,10 @@
 tell you what it would have done. That can be useful if you're unsure whether
 the right thing will happen.
 
+.. note::
+
+   #. The helper script works with git versions >=2.9.3
+
 Reverting a change when using Git
 ^
 


Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -160,9 +160,9 @@
 Software
 
 
-Compiling LLVM requires that you have several software packages installed. The
-table below lists those required packages. The Package column is the usual name
-for the software package that LLVM depends on. The Version column provides
+Working with LLVM requires that you have several software packages installed.
+The table below lists those required packages. The Package column is the usual
+name for the software package that LLVM depends on. The Version column provides
 "known to work" versions of the package. The Notes column describes how LLVM
 uses the package and provides other details.
 
@@ -503,8 +503,8 @@
 
 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add it
 to your path, you can push committed changes upstream with ``git llvm
-push``. While this creates a Subversion checkout and patches it under the hood,
-it does not require you to have interaction with it.
+push``\ :sup:`1`. While this creates a Subversion checkout and patches it under
+the hood, it does not require you to have interaction with it.
 
 .. code-block:: console
 
@@ -525,6 +525,10 @@
 tell you what it would have done. That can be useful if you're unsure whether
 the right thing will happen.
 
+.. note::
+
+   #. The helper script works with git versions >=2.9.3
+
 Reverting a change when using Git
 ^
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65436: [docs] Add git to list of Software requirements

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 212340.
sgraenitz added a comment.

Undo `Compiling -> Working with`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65436

Files:
  llvm/docs/GettingStarted.rst


Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -503,8 +503,8 @@
 
 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add 
it
 to your path, you can push committed changes upstream with ``git llvm
-push``. While this creates a Subversion checkout and patches it under the hood,
-it does not require you to have interaction with it.
+push``\ :sup:`1`. While this creates a Subversion checkout and patches it under
+the hood, it does not require you to have interaction with it.
 
 .. code-block:: console
 
@@ -525,6 +525,10 @@
 tell you what it would have done. That can be useful if you're unsure whether
 the right thing will happen.
 
+.. note::
+
+   #. The helper script works with git versions >=2.9.3
+
 Reverting a change when using Git
 ^
 


Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -503,8 +503,8 @@
 
 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add it
 to your path, you can push committed changes upstream with ``git llvm
-push``. While this creates a Subversion checkout and patches it under the hood,
-it does not require you to have interaction with it.
+push``\ :sup:`1`. While this creates a Subversion checkout and patches it under
+the hood, it does not require you to have interaction with it.
 
 .. code-block:: console
 
@@ -525,6 +525,10 @@
 tell you what it would have done. That can be useful if you're unsure whether
 the right thing will happen.
 
+.. note::
+
+   #. The helper script works with git versions >=2.9.3
+
 Reverting a change when using Git
 ^
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65436: [docs] Add git to list of Software requirements

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

> If we want to add git at all, we should probably mention it somewhere else. 
> I'm not sure where that would be - I suppose somewhere where it makes sense 
> to worry about the minimum version, e.g. where the git-llvm script is 
> concerned.

Agree, changed that.

> See the llvm-commits replies to r365917; at least one code owner is stuck 
> with 1.8.3.

This is here: 
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190715/674326.html

> The only real requirement here is "whatever the oldest version someone's 
> actually used recently". Couple that with git not being a core requirement, 
> I'd rather just say nothing, unless we had an affirmative intent to /not/ 
> support some particular version.

It may complicate the git-llvm script, but it seems to work so far, so fair 
enough.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65436



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


[Lldb-commits] [PATCH] D65450: Add llvm-style RTTI to ObjectFile hierarchy

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: xiaobai, JDevlieghere.
Herald added subscribers: MaskRay, arichardson, mgorny, emaste.
Herald added a reviewer: espindola.

On the heels of D62934 , this patch uses the 
same approach to introduce
llvm RTTI support to the ObjectFile hierarchy. It also replaces the
existing uses of GetPluginName doing run-time type checks with
llvm::dyn_cast and friends.

This formally introduces new dependencies from some other plugins to
ObjectFile plugins. However, I believe this is fine because:

- these dependencies were already kind of there, and the only reason we could 
get away with not modeling them explicitly was because the code was relying on 
magically knowing what will GetPluginName() return for a particular kind of 
object files.
- the dependencies themselves are logical (it makes sense for SymbolVendorELF 
to depend on ObjectFileELF), or at least don't actively get in the way (the 
JitLoaderGDB->MachO thing).
- they don't introduce any new dependency loops as ObjectFile plugins don't 
depend on any other plugins


https://reviews.llvm.org/D65450

Files:
  include/lldb/Symbol/ObjectFile.h
  source/Plugins/JITLoader/GDB/CMakeLists.txt
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
  source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  source/Plugins/SymbolVendor/ELF/CMakeLists.txt
  source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
  source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
  source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
  source/Symbol/ObjectFile.cpp

Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -26,6 +26,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+char ObjectFile::ID;
+
 ObjectFileSP
 ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t file_size,
Index: source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
===
--- source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -10,6 +10,7 @@
 
 #include 
 
+#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
@@ -97,15 +98,11 @@
   if (!module_sp)
 return NULL;
 
-  ObjectFile *obj_file = module_sp->GetObjectFile();
+  ObjectFile *obj_file =
+  llvm::dyn_cast_or_null(module_sp->GetObjectFile());
   if (!obj_file)
 return NULL;
 
-  static ConstString obj_file_macho("mach-o");
-  ConstString obj_name = obj_file->GetPluginName();
-  if (obj_name != obj_file_macho)
-return NULL;
-
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat,
  "SymbolVendorMacOSX::CreateInstance (module = %s)",
Index: source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
===
--- source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
+++ source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
@@ -7,4 +7,5 @@
 lldbCore
 lldbHost
 lldbSymbol
+lldbPluginObjectFileMachO
   )
Index: source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
===
--- source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -10,6 +10,7 @@
 
 #include 
 
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
@@ -61,15 +62,11 @@
   if (!module_sp)
 return nullptr;
 
-  ObjectFile *obj_file = module_sp->GetObjectFile();
+  ObjectFileELF *obj_file =
+  llvm::dyn_cast_or_null(module_sp->GetObjectFile());
   if (!obj_file)
 return nullptr;
 
-  static ConstString obj_file_elf("elf");
-  ConstString obj_name = obj_file->GetPluginName();
-  if (obj_name != obj_file_elf)
-return nullptr;
-
   lldb_private::UUID uuid = obj_file->GetUUID();
   if (!uuid)
 return nullptr;
Index: source/Plugins/SymbolVendor/ELF/CMakeLists.txt
===
--- sour

[Lldb-commits] [PATCH] D55319: [CMake] Proposal: Prefer LLDB_VERSION over plist value in EmbedAppleVersion.cmake

2019-07-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz abandoned this revision.
sgraenitz added a comment.

This was fixed quite some time ago.


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

https://reviews.llvm.org/D55319



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


[Lldb-commits] [PATCH] D65409: [ProcessWindows] Choose a register context file by prepocessor

2019-07-30 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 212363.
tatyana-krasnukha added a comment.

Addressed comments


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65409

Files:
  Common/CMakeLists.txt
  Common/x64/RegisterContextWindows_x64.cpp
  Common/x64/RegisterContextWindows_x64.h
  Common/x86/RegisterContextWindows_x86.cpp
  Common/x86/RegisterContextWindows_x86.h

Index: Common/x86/RegisterContextWindows_x86.h
===
--- Common/x86/RegisterContextWindows_x86.h
+++ Common/x86/RegisterContextWindows_x86.h
@@ -9,6 +9,8 @@
 #ifndef liblldb_RegisterContextWindows_x86_H_
 #define liblldb_RegisterContextWindows_x86_H_
 
+#if defined(__i386__) || defined(_M_IX86)
+
 #include "RegisterContextWindows.h"
 #include "lldb/lldb-forward.h"
 
@@ -44,4 +46,6 @@
 };
 }
 
+#endif // defined(__i386__) || defined(_M_IX86)
+
 #endif // #ifndef liblldb_RegisterContextWindows_x86_H_
Index: Common/x86/RegisterContextWindows_x86.cpp
===
--- Common/x86/RegisterContextWindows_x86.cpp
+++ Common/x86/RegisterContextWindows_x86.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#if defined(__i386__) || defined(_M_IX86)
+
 #include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Utility/RegisterValue.h"
@@ -282,3 +284,5 @@
   reg_value.SetUInt32(value);
   return true;
 }
+
+#endif // defined(__i386__) || defined(_M_IX86)
Index: Common/x64/RegisterContextWindows_x64.h
===
--- Common/x64/RegisterContextWindows_x64.h
+++ Common/x64/RegisterContextWindows_x64.h
@@ -9,6 +9,8 @@
 #ifndef liblldb_RegisterContextWindows_x64_H_
 #define liblldb_RegisterContextWindows_x64_H_
 
+#if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
+
 #include "RegisterContextWindows.h"
 #include "lldb/lldb-forward.h"
 
@@ -40,4 +42,6 @@
 };
 }
 
+#endif // defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
+
 #endif // #ifndef liblldb_RegisterContextWindows_x64_H_
Index: Common/x64/RegisterContextWindows_x64.cpp
===
--- Common/x64/RegisterContextWindows_x64.cpp
+++ Common/x64/RegisterContextWindows_x64.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
+
 #include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Utility/RegisterValue.h"
@@ -534,3 +536,5 @@
   return ::SetThreadContext(
   wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context);
 }
+
+#endif // defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
Index: Common/CMakeLists.txt
===
--- Common/CMakeLists.txt
+++ Common/CMakeLists.txt
@@ -7,6 +7,9 @@
   ProcessWindowsLog.cpp
   RegisterContextWindows.cpp
   TargetThreadWindows.cpp
+  x64/RegisterContextWindows_x64.cpp
+  x86/RegisterContextWindows_x86.cpp
+  # TODO add support for ARM (NT) and ARM64
 
   LINK_LIBS
 lldbCore
@@ -20,13 +23,3 @@
   LINK_COMPONENTS
 Support
   )
-
-# TODO add support for ARM (NT) and ARM64
-# TODO build these unconditionally as we cannot do cross-debugging or WoW
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
-  target_sources(lldbPluginProcessWindowsCommon PRIVATE
-x64/RegisterContextWindows_x64.cpp)
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i?86|X86")
-  target_sources(lldbPluginProcessWindowsCommon PRIVATE
-x86/RegisterContextWindows_x86.cpp)
-endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65249: [NFC] use C++11 in AlignOf.h, remove AlignedCharArray

2019-07-30 Thread JF Bastien via Phabricator via lldb-commits
jfb closed this revision.
jfb added a comment.

https://reviews.llvm.org/rL367282


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65249



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


[Lldb-commits] [lldb] r367331 - [dotest] Remove multiprocessing

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 09:42:47 2019
New Revision: 367331

URL: http://llvm.org/viewvc/llvm-project?rev=367331&view=rev
Log:
[dotest] Remove multiprocessing

Now that the Xcode project is removed, I want to focus on dotest as a
test framework, and remove its driver capabilities for which we already
rely on llvm's lit. Removing multiprocessing is the first step in that
direction.

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

Removed:
lldb/trunk/packages/Python/lldbsuite/test/dosep.py
Modified:
lldb/trunk/docs/resources/test.rst
lldb/trunk/packages/Python/lldbsuite/test/configuration.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/docs/resources/test.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/test.rst?rev=367331&r1=367330&r2=367331&view=diff
==
--- lldb/trunk/docs/resources/test.rst (original)
+++ lldb/trunk/docs/resources/test.rst Tue Jul 30 09:42:47 2019
@@ -88,22 +88,6 @@ Many more options that are available. To
 
> python dotest.py -h
 
-The ``dotest.py`` script runs tests in parallel by default. To disable the
-parallel test running feature, use the ``--no-multiprocess`` flag. The number
-of concurrent tests is controlled by the ``LLDB_TEST_THREADS`` environment
-variable or the ``--threads command`` line parameter. The default value is the
-number of CPU cores on your system.
-
-The parallel test running feature will handle an additional ``--test-subdir
-SUBDIR`` arg. When specified, ``SUBDIR`` is relative to the root test directory
-and will limit all parallel test running to that subdirectory's tree of tests.
-
-The parallel test runner will run all tests within a given directory serially,
-but will run multiple directories concurrently. Thus, as a test writer, we
-provide serialized test run semantics within a directory. Note child
-directories are considered entirely separate, so two child directories could be
-running in parallel with a parent directory.
-
 Running the Test Suite Remotely
 ---
 
@@ -157,7 +141,7 @@ A quick guide to getting started with PT
 #. If you want to enabled mixed mode debugging, check Enable native code 
debugging (this slows down debugging, so enable it only on an as-needed basis.)
 #. Set the command line for the test suite to run.
 #. Right click the project in solution explorer and choose the Debug tab.
-#. Enter the arguments to dotest.py. Note you must add --no-multiprocess
+#. Enter the arguments to dotest.py.
 #. Example command options:
 
 ::
@@ -178,8 +162,6 @@ A quick guide to getting started with PT
-p TestPaths.py
# Root of test tree
D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test
-   # Required in order to be able to debug the test.
-   --no-multiprocess
 
 ::
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=367331&r1=367330&r2=367331&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Tue Jul 30 
09:42:47 2019
@@ -117,12 +117,6 @@ test_build_dir = None
 # takes precedence.
 exclusive_test_subdir = None
 
-# Parallel execution settings
-is_inferior_test_runner = False
-num_threads = None
-no_multiprocess_test_runner = False
-test_runner_name = None
-
 # Test results handling globals
 results_filename = None
 results_port = None

Removed: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=367330&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py (removed)
@@ -1,1770 +0,0 @@
-"""
-Run the test suite using a separate process for each test file.
-
-Each test will run with a time limit of 10 minutes by default.
-
-Override the default time limit of 10 minutes by setting
-the environment variable LLDB_TEST_TIMEOUT.
-
-E.g., export LLDB_TEST_TIMEOUT=10m
-
-Override the time limit for individual tests by setting
-the environment variable LLDB_[TEST NAME]_TIMEOUT.
-
-E.g., export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m
-
-Set to "0" to run without time limit.
-
-E.g., export LLDB_TEST_TIMEOUT=0
-orexport LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0
-
-To collect core files for timed out tests,
-do the following before running dosep.py
-
-OSX
-ulimit -c unlimited
-sudo sysctl -w kern.corefile=core.%P
-
-Linux:
-ulimit -c unlimited
-echo core.%p | sudo tee /proc/sys/kernel/core_pattern
-"""
-
-f

[Lldb-commits] [PATCH] D65114: [LLDB] Add utility to streamline Xcode project generation.

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere abandoned this revision.
JDevlieghere added a comment.

It's been a week and so far I haven't seen any complaints. Also I think the 
documentation Stefan added on lldb.llvm.org look good enough that we may not 
need a script.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65114



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


[Lldb-commits] [PATCH] D65311: [dotest] Remove multiprocessing

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367331: [dotest] Remove multiprocessing (authored by 
JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65311?vs=211862&id=212371#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65311

Files:
  lldb/trunk/docs/resources/test.rst
  lldb/trunk/packages/Python/lldbsuite/test/configuration.py
  lldb/trunk/packages/Python/lldbsuite/test/dosep.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
  lldb/trunk/test/CMakeLists.txt

Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -119,13 +119,6 @@
 set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
 set_property(GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY ${LLDB_DOTEST_ARGS})
 
-add_python_test_target(check-lldb-single
-  ${LLDB_SOURCE_DIR}/test/dotest.py
-  "--no-multiprocess;${LLDB_DOTEST_ARGS}"
-  "Testing LLDB with args: ${LLDB_DOTEST_ARGS}"
-  )
-set_target_properties(check-lldb-single PROPERTIES FOLDER "lldb misc")
-
 # If tests crash cause LLDB to crash, or things are otherwise unstable, or if machine-parsable
 # output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target.
 add_custom_target(check-lldb)
Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py
@@ -117,12 +117,6 @@
 # takes precedence.
 exclusive_test_subdir = None
 
-# Parallel execution settings
-is_inferior_test_runner = False
-num_threads = None
-no_multiprocess_test_runner = False
-test_runner_name = None
-
 # Test results handling globals
 results_filename = None
 results_port = None
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -148,9 +148,6 @@
 
 Writing logs into different files per test case::
 
-This option is particularly useful when multiple dotest instances are created
-by dosep.py
-
 $ ./dotest.py --channel "lldb all"
 
 $ ./dotest.py --channel "lldb all" --channel "gdb-remote packets"
@@ -360,17 +357,6 @@
 if any([x.startswith('-') for x in args.f]):
 usage(parser)
 configuration.filters.extend(args.f)
-# Shut off multiprocessing mode when additional filters are specified.
-# The rational is that the user is probably going after a very specific
-# test and doesn't need a bunch of parallel test runners all looking for
-# it in a frenzy.  Also, '-v' now spits out all test run output even
-# on success, so the standard recipe for redoing a failing test (with -v
-# and a -f to filter to the specific test) now causes all test scanning
-# (in parallel) to print results for do-nothing runs in a very distracting
-# manner.  If we really need filtered parallel runs in the future, consider
-# adding a --no-output-on-success that prevents -v from setting
-# output-on-success.
-configuration.no_multiprocess_test_runner = True
 
 if args.l:
 configuration.skip_long_running_test = False
@@ -428,23 +414,8 @@
 if do_help:
 usage(parser)
 
-if args.no_multiprocess:
-configuration.no_multiprocess_test_runner = True
-
-if args.inferior:
-configuration.is_inferior_test_runner = True
-
-if args.num_threads:
-configuration.num_threads = args.num_threads
-
-if args.test_subdir:
-configuration.exclusive_test_subdir = args.test_subdir
-
-if args.test_runner_name:
-configuration.test_runner_name = args.test_runner_name
-
 # Capture test results-related args.
-if args.curses and not args.inferior:
+if args.curses:
 # Act as if the following args were set.
 args.results_formatter = "lldbsuite.test_event.formatter.curses.Curses"
 args.results_file = "stdout"
@@ -466,9 +437,8 @@
 if args.results_formatter_options:
 configuration.results_formatter_options = args.results_formatter_options
 
-# Default to using the BasicResultsFormatter if no formatter is specified
-# and we're not a test inferior.
-if not args.inferior and configuration.results_formatter_name is None:
+# Default to using the BasicResultsFormatter if no formatter is specified.
+if configuration.result

[Lldb-commits] [PATCH] D65409: [ProcessWindows] Choose a register context file by prepocessor

2019-07-30 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

I wonder if directories `x86` and `x64` are needed. Should I remove them to 
make hierarchy consistent with D63165 ?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65409



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


[Lldb-commits] [PATCH] D65409: [ProcessWindows] Choose a register context file by prepocessor

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

In D65409#1606619 , @tatyana-krasnukha 
wrote:

> I wonder if directories `x86` and `x64` are needed. Should I remove them to 
> make hierarchy consistent with D63165 ?


I don't have any opinion on that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65409



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


[Lldb-commits] [PATCH] D65450: Add llvm-style RTTI to ObjectFile hierarchy

2019-07-30 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.

LGTM


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

https://reviews.llvm.org/D65450



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


[Lldb-commits] [lldb] r367338 - [Reproducers] Fix incorrect help message

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 11:06:38 2019
New Revision: 367338

URL: http://llvm.org/viewvc/llvm-project?rev=367338&view=rev
Log:
[Reproducers] Fix incorrect help message

The help message mentioned the `log` command (probably because I copied
it from there originally).

Modified:
lldb/trunk/source/Commands/CommandObjectReproducer.cpp

Modified: lldb/trunk/source/Commands/CommandObjectReproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectReproducer.cpp?rev=367338&r1=367337&r2=367338&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectReproducer.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp Tue Jul 30 11:06:38 
2019
@@ -102,8 +102,8 @@ CommandObjectReproducer::CommandObjectRe
 CommandInterpreter &interpreter)
 : CommandObjectMultiword(
   interpreter, "reproducer",
-  "Commands to inspect and manipulate the reproducer functionality.",
-  "log  []") {
+  "Commands for manipulate the reproducer functionality.",
+  "reproducer  []") {
   LoadSubCommand(
   "generate",
   CommandObjectSP(new CommandObjectReproducerGenerate(interpreter)));


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


[Lldb-commits] [PATCH] D65469: Remove `bugreport` command

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, jasonmolenda.
JDevlieghere added a project: LLDB.
Herald added a subscriber: mgorny.

The bugreport command exists to create domain-specific bug reports. Currently 
it has one implementation for filing bugs on the unwinder. As far as we can 
tell, it has never been of use. Although not exactly the same as the 
reproducers, it's a bit confusing to have two parallel command trees for (kind 
of) the same thing.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65469

Files:
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectBugreport.cpp
  lldb/source/Commands/CommandObjectBugreport.h
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -16,7 +16,6 @@
 
 #include "Commands/CommandObjectApropos.h"
 #include "Commands/CommandObjectBreakpoint.h"
-#include "Commands/CommandObjectBugreport.h"
 #include "Commands/CommandObjectCommands.h"
 #include "Commands/CommandObjectDisassemble.h"
 #include "Commands/CommandObjectExpression.h"
@@ -443,8 +442,6 @@
   m_command_dict["apropos"] = CommandObjectSP(new CommandObjectApropos(*this));
   m_command_dict["breakpoint"] =
   CommandObjectSP(new CommandObjectMultiwordBreakpoint(*this));
-  m_command_dict["bugreport"] =
-  CommandObjectSP(new CommandObjectMultiwordBugreport(*this));
   m_command_dict["command"] =
   CommandObjectSP(new CommandObjectMultiwordCommands(*this));
   m_command_dict["disassemble"] =
Index: lldb/source/Commands/CommandObjectBugreport.h
===
--- lldb/source/Commands/CommandObjectBugreport.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//===-- CommandObjectBugreport.h *- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef liblldb_CommandObjectBugreport_h_
-#define liblldb_CommandObjectBugreport_h_
-
-#include "lldb/Interpreter/CommandObjectMultiword.h"
-
-namespace lldb_private {
-
-// CommandObjectMultiwordBugreport
-
-class CommandObjectMultiwordBugreport : public CommandObjectMultiword {
-public:
-  CommandObjectMultiwordBugreport(CommandInterpreter &interpreter);
-
-  ~CommandObjectMultiwordBugreport() override;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectBugreport_h_
Index: lldb/source/Commands/CommandObjectBugreport.cpp
===
--- lldb/source/Commands/CommandObjectBugreport.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-//===-- CommandObjectBugreport.cpp --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "CommandObjectBugreport.h"
-
-#include 
-
-
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/OptionGroupOutputFile.h"
-#include "lldb/Target/Thread.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// "bugreport unwind"
-
-class CommandObjectBugreportUnwind : public CommandObjectParsed {
-public:
-  CommandObjectBugreportUnwind(CommandInterpreter &interpreter)
-  : CommandObjectParsed(
-interpreter, "bugreport unwind",
-"Create a bugreport for a bug in the stack unwinding code.",
-nullptr),
-m_option_group(), m_outfile_options() {
-m_option_group.Append(&m_outfile_options, LLDB_OPT_SET_ALL,
-  LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
-m_option_group.Finalize();
-  }
-
-  ~CommandObjectBugreportUnwind() override {}
-
-  Options *GetOptions() override { return &m_option_group; }
-
-protected:
-  bool DoExecute(Args &command, CommandReturnObject &result) override {
-StringList commands;
-commands.AppendString("thread backtrace");
-
-Thread *thread = m_exe_ctx.GetThreadPtr();
-if (thread) {
-  char command_buffer[256];
-
-  uint32_t frame_count = thread->GetStackFrameCount();
-  for (uint32_t i = 0; i < frame_count; ++i) {
-StackFrameSP frame = thread->GetStackFrameAtIndex(i);
-lldb::addr_t pc = frame->GetStackID().GetPC();
-
-snprintf(command_buffer, sizeof(command_buffer),
- "disassemble --bytes --address 0x%" PRIx64, pc);
-commands.AppendString(command

[Lldb-commits] [PATCH] D65469: Remove `bugreport` command

2019-07-30 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

I wanted to remove it a while ago, but Jason told me he found this useful, so I 
would wait for his opinion.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65469



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


[Lldb-commits] [PATCH] D65469: Remove `bugreport` command

2019-07-30 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Other than that, I have no objections.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65469



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


[Lldb-commits] [PATCH] D65414: Fix ClangASTContext::CreateParameterDeclaration to not call addDecl

2019-07-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@stella.stamenova that is unfortunate but not surprising. I don't have a way to 
test a fix locally. Is there anyone who might be able to help me iterate over a 
fix or maybe a new maintainer of the PDB parsing?


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

https://reviews.llvm.org/D65414



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


[Lldb-commits] [lldb] r367358 - [SymbolFile] SymbolFileDWARF::ParseLineTable should lock its module

2019-07-30 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jul 30 14:22:17 2019
New Revision: 367358

URL: http://llvm.org/viewvc/llvm-project?rev=367358&view=rev
Log:
[SymbolFile] SymbolFileDWARF::ParseLineTable should lock its module

As of svn rL367298, SymbolFileDWARF locks the module in many cases where
it needs to parse some aspect of the DWARF symbol file.
SymbolFileDWARF::ParseLineTable needs to lock the module because
SymbolVendor::ParseLineTable no longer locks it.

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=367358&r1=367357&r2=367358&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jul 30 
14:22:17 2019
@@ -928,7 +928,7 @@ static void ParseDWARFLineTableCallback(
 }
 
 bool SymbolFileDWARF::ParseLineTable(CompileUnit &comp_unit) {
-  ASSERT_MODULE_LOCK(this);
+  std::lock_guard guard(GetModuleMutex());
   if (comp_unit.GetLineTable() != nullptr)
 return true;
 


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


[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-07-30 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Oh, sorry about that. I was relying on `ninja check`, which runs okay for me.

  > ninja check
  [0/1] Running the LLVM regression tests
  Testing Time: 583.96s
Expected Passes: 32141
Expected Failures  : 147
Unsupported Tests  : 438

How can I invoke those other tests? (in case it's relevant, here's my cmake 
command `cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS='lldb;clang;libcxx'`)

About not tying `G` and `g` together, maybe could we remove this branch 
?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [lldb] r367360 - [Symbol] Use llvm::Expected when getting TypeSystems

2019-07-30 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jul 30 15:12:34 2019
New Revision: 367360

URL: http://llvm.org/viewvc/llvm-project?rev=367360&view=rev
Log:
[Symbol] Use llvm::Expected when getting TypeSystems

Summary:
This commit achieves the following:
- Functions used to return a `TypeSystem *` return an
  `llvm::Expected` now. This means that the result of a call
  is always checked, forcing clients to move more carefully.
- `TypeSystemMap::GetTypeSystemForLanguage` will either return an Error or a
  non-null pointer to a TypeSystem.

Reviewers: JDevlieghere, davide, compnerd

Subscribers: jdoerfert, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/Breakpoint/Watchpoint.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ValueObjectRegister.cpp
lldb/trunk/source/DataFormatters/VectorType.cpp
lldb/trunk/source/Expression/Materializer.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/ThreadPlanTracer.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=367360&r1=367359&r2=367360&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Jul 30 15:12:34 2019
@@ -812,7 +812,8 @@ public:
 
   bool GetIsDynamicLinkEditor();
 
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
+  llvm::Expected
+  GetTypeSystemForLanguage(lldb::LanguageType language);
 
   // Special error functions that can do printf style formatting that will
   // prepend the message with something appropriate for this module (like the

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=367360&r1=367359&r2=367360&view=diff
==
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Tue Jul 30 15:12:34 2019
@@ -201,7 +201,7 @@ public:
 
   virtual void PreloadSymbols();
 
-  virtual lldb_private::TypeSystem *
+  virtual llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language);
 
   virtual CompilerDeclContext

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=367360&r1=367359&r2=367360&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Tue Jul 30 15:12:34 2019
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/APSInt.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Error.h"
 
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
@@ -491,18 +492,15 @@ public:
   // callback to keep iterating, false to stop iterating.
   void ForEach(std::function const &callback);
 
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
-   Module *module, bool can_create);
-
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType lang

[Lldb-commits] [PATCH] D65122: [Symbol] Use llvm::Expected when getting TypeSystems

2019-07-30 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367360: [Symbol] Use llvm::Expected when getting TypeSystems 
(authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65122?vs=212232&id=212451#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65122

Files:
  lldb/trunk/include/lldb/Core/Module.h
  lldb/trunk/include/lldb/Symbol/SymbolFile.h
  lldb/trunk/include/lldb/Symbol/TypeSystem.h
  lldb/trunk/include/lldb/Target/Target.h
  lldb/trunk/source/API/SBModule.cpp
  lldb/trunk/source/Breakpoint/Watchpoint.cpp
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Core/ValueObjectRegister.cpp
  lldb/trunk/source/DataFormatters/VectorType.cpp
  lldb/trunk/source/Expression/Materializer.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
  lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
  lldb/trunk/source/Symbol/SymbolFile.cpp
  lldb/trunk/source/Symbol/Type.cpp
  lldb/trunk/source/Symbol/TypeSystem.cpp
  lldb/trunk/source/Target/StackFrame.cpp
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/source/Target/ThreadPlanTracer.cpp
  lldb/trunk/tools/lldb-test/lldb-test.cpp

Index: lldb/trunk/include/lldb/Symbol/SymbolFile.h
===
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h
@@ -201,7 +201,7 @@
 
   virtual void PreloadSymbols();
 
-  virtual lldb_private::TypeSystem *
+  virtual llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language);
 
   virtual CompilerDeclContext
Index: lldb/trunk/include/lldb/Symbol/TypeSystem.h
===
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/APSInt.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Error.h"
 
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
@@ -491,18 +492,15 @@
   // callback to keep iterating, false to stop iterating.
   void ForEach(std::function const &callback);
 
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
-   Module *module, bool can_create);
-
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
-   Target *target, bool can_create);
+  llvm::Expected
+  GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
+   bool can_create);
+
+  llvm::Expected
+  GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
+   bool can_create);
 
 protected:
-  // This function does not take the map mutex, and should only be called from
-  // functions that do take the mutex.
-  void AddToMap(lldb::LanguageType language,
-lldb::TypeSystemSP const &type_system_sp);
-
   typedef std::map collection;
   mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
   ///multi-threaded environments.
Index: lldb/trunk/include/lldb/Core/Module.h
===
--- lldb/trunk/include/lldb/Core/Module.h
+++ lldb/trunk/include/lldb/Core/Module.h
@@ -812,7 +812,8 @@
 
   bool GetIsDynamicLinkEditor();
 
-  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
+  llvm::Expected
+  GetTypeSystemForLanguage(lldb::LanguageType language);
 
   // Special error functions that can do printf style formatting that will
   // prepend the message with something appropriate for this module (like the
Index: lldb/trunk/include/lldb/Target/Target.h
===

[Lldb-commits] [PATCH] D65482: [DAGCombiner] Add an option to control whether or not to enable store merging

2019-07-30 Thread Wei Mi via Phabricator via lldb-commits
wmi created this revision.
wmi added a reviewer: tejohnson.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add an option to control whether or not to enable store merging in dag combiner 
so we can workaround some bug more easily.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65482

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -111,6 +111,11 @@
   MaySplitLoadIndex("combiner-split-load-index", cl::Hidden, cl::init(true),
 cl::desc("DAG combiner may split indexing from loads"));
 
+static cl::opt
+EnableStoreMerging("combiner-store-merging", cl::Hidden, cl::init(true),
+   cl::desc("DAG combiner enable merging multiple stores "
+"into a wider store"));
+
 static cl::opt TokenFactorInlineLimit(
 "combiner-tokenfactor-inline-limit", cl::Hidden, cl::init(2048),
 cl::desc("Limit the number of operands to inline for Token Factors"));
@@ -15521,7 +15526,7 @@
 }
 
 bool DAGCombiner::MergeConsecutiveStores(StoreSDNode *St) {
-  if (OptLevel == CodeGenOpt::None)
+  if (OptLevel == CodeGenOpt::None || !EnableStoreMerging)
 return false;
 
   EVT MemVT = St->getMemoryVT();


Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -111,6 +111,11 @@
   MaySplitLoadIndex("combiner-split-load-index", cl::Hidden, cl::init(true),
 cl::desc("DAG combiner may split indexing from loads"));
 
+static cl::opt
+EnableStoreMerging("combiner-store-merging", cl::Hidden, cl::init(true),
+   cl::desc("DAG combiner enable merging multiple stores "
+"into a wider store"));
+
 static cl::opt TokenFactorInlineLimit(
 "combiner-tokenfactor-inline-limit", cl::Hidden, cl::init(2048),
 cl::desc("Limit the number of operands to inline for Token Factors"));
@@ -15521,7 +15526,7 @@
 }
 
 bool DAGCombiner::MergeConsecutiveStores(StoreSDNode *St) {
-  if (OptLevel == CodeGenOpt::None)
+  if (OptLevel == CodeGenOpt::None || !EnableStoreMerging)
 return false;
 
   EVT MemVT = St->getMemoryVT();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65482: [DAGCombiner] Add an option to control whether or not to enable store merging

2019-07-30 Thread Teresa Johnson via Phabricator via lldb-commits
tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65482



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


[Lldb-commits] [lldb] r367363 - [TableGen] Reuse typedef across emitters (NFC)

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 15:50:37 2019
New Revision: 367363

URL: http://llvm.org/viewvc/llvm-project?rev=367363&view=rev
Log:
[TableGen] Reuse typedef across emitters (NFC)

This moves the std::map typedef into the header so it can be reused by
all the emitter implementations.

Modified:
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBTableGenBackends.h

Modified: lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp?rev=367363&r1=367362&r2=367363&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp Tue Jul 30 15:50:37 2019
@@ -20,14 +20,11 @@
 #include 
 
 using namespace llvm;
-
-/// Map of command names to their associated records. Also makes sure our
-/// commands are sorted in a deterministic way.
-typedef std::map> RecordsByCommand;
+using namespace lldb_private;
 
 /// Groups all records by their command.
-static RecordsByCommand getCommandList(std::vector Options) {
-  RecordsByCommand result;
+static RecordsByName getCommandList(std::vector Options) {
+  RecordsByName result;
   for (Record *Option : Options)
 result[Option->getValueAsString("Command").str()].push_back(Option);
   return result;
@@ -187,14 +184,10 @@ static void emitOptions(std::string Comm
 }
 
 void lldb_private::EmitOptionDefs(RecordKeeper &Records, raw_ostream &OS) {
-
-  std::vector Options = Records.getAllDerivedDefinitions("Option");
-
   emitSourceFileHeader("Options for LLDB command line commands.", OS);
 
-  RecordsByCommand ByCommand = getCommandList(Options);
-
-  for (auto &CommandRecordPair : ByCommand) {
+  std::vector Options = Records.getAllDerivedDefinitions("Option");
+  for (auto &CommandRecordPair : getCommandList(Options)) {
 emitOptions(CommandRecordPair.first, CommandRecordPair.second, OS);
   }
 }

Modified: lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp?rev=367363&r1=367362&r2=367363&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp Tue Jul 30 15:50:37 
2019
@@ -19,14 +19,11 @@
 #include 
 
 using namespace llvm;
-
-/// Map of properties definitions to their associated records. Also makes sure
-/// our property definitions are sorted in a deterministic way.
-typedef std::map> RecordsByDefinition;
+using namespace lldb_private;
 
 /// Groups all properties by their definition.
-static RecordsByDefinition getPropertyList(std::vector Properties) {
-  RecordsByDefinition result;
+static RecordsByName getPropertyList(std::vector Properties) {
+  RecordsByName result;
   for (Record *Property : Properties)
 result[Property->getValueAsString("Definition").str()].push_back(Property);
   return result;

Modified: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBTableGenBackends.h?rev=367363&r1=367362&r2=367363&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBTableGenBackends.h (original)
+++ lldb/trunk/utils/TableGen/LLDBTableGenBackends.h Tue Jul 30 15:50:37 2019
@@ -16,11 +16,13 @@
 #ifndef LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H
 #define LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H
 
+#include 
 #include 
 
 namespace llvm {
 class raw_ostream;
 class RecordKeeper;
+class Record;
 } // namespace llvm
 
 using llvm::raw_ostream;
@@ -28,6 +30,10 @@ using llvm::RecordKeeper;
 
 namespace lldb_private {
 
+/// Map of names to their associated records. This map also ensures that our
+/// records are sorted in a deterministic way.
+typedef std::map> RecordsByName;
+
 void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyEnumDefs(RecordKeeper &RK, raw_ostream &OS);


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


[Lldb-commits] [PATCH] D65482: [DAGCombiner] Add an option to control whether or not to enable store merging

2019-07-30 Thread Wei Mi via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367365: [DAGCombiner] Add an option to control whether or 
not to enable store merging. (authored by wmi, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D65482?vs=212456&id=212465#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65482

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -111,6 +111,11 @@
   MaySplitLoadIndex("combiner-split-load-index", cl::Hidden, cl::init(true),
 cl::desc("DAG combiner may split indexing from loads"));
 
+static cl::opt
+EnableStoreMerging("combiner-store-merging", cl::Hidden, cl::init(true),
+   cl::desc("DAG combiner enable merging multiple stores "
+"into a wider store"));
+
 static cl::opt TokenFactorInlineLimit(
 "combiner-tokenfactor-inline-limit", cl::Hidden, cl::init(2048),
 cl::desc("Limit the number of operands to inline for Token Factors"));
@@ -15521,7 +15526,7 @@
 }
 
 bool DAGCombiner::MergeConsecutiveStores(StoreSDNode *St) {
-  if (OptLevel == CodeGenOpt::None)
+  if (OptLevel == CodeGenOpt::None || !EnableStoreMerging)
 return false;
 
   EVT MemVT = St->getMemoryVT();


Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -111,6 +111,11 @@
   MaySplitLoadIndex("combiner-split-load-index", cl::Hidden, cl::init(true),
 cl::desc("DAG combiner may split indexing from loads"));
 
+static cl::opt
+EnableStoreMerging("combiner-store-merging", cl::Hidden, cl::init(true),
+   cl::desc("DAG combiner enable merging multiple stores "
+"into a wider store"));
+
 static cl::opt TokenFactorInlineLimit(
 "combiner-tokenfactor-inline-limit", cl::Hidden, cl::init(2048),
 cl::desc("Limit the number of operands to inline for Token Factors"));
@@ -15521,7 +15526,7 @@
 }
 
 bool DAGCombiner::MergeConsecutiveStores(StoreSDNode *St) {
-  if (OptLevel == CodeGenOpt::None)
+  if (OptLevel == CodeGenOpt::None || !EnableStoreMerging)
 return false;
 
   EVT MemVT = St->getMemoryVT();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r367368 - [SymbolFilePDB] Fix windows bots after rL367360

2019-07-30 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jul 30 16:48:03 2019
New Revision: 367368

URL: http://llvm.org/viewvc/llvm-project?rev=367368&view=rev
Log:
[SymbolFilePDB] Fix windows bots after rL367360

SymbolFilePDB tests were using GetTypeSystemForLanguage but weren't
changed to accomodate the use of an llvm::Expected. I adjusted them
accordingly.

Modified:
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=367368&r1=367367&r2=367368&view=diff
==
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Tue Jul 30 
16:48:03 2019
@@ -390,8 +390,12 @@ TEST_F(SymbolFilePDBTests, TestNestedCla
   llvm::DenseSet searched_files;
   TypeMap results;
 
-  auto clang_ast_ctx = llvm::dyn_cast_or_null(
-  symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus));
+  auto clang_ast_ctx_or_err =
+  symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+  ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded());
+
+  auto clang_ast_ctx =
+  llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get());
   EXPECT_NE(nullptr, clang_ast_ctx);
 
   EXPECT_EQ(1u, symfile->FindTypes(ConstString("Class"), nullptr, false, 0,
@@ -440,8 +444,12 @@ TEST_F(SymbolFilePDBTests, TestClassInNa
   llvm::DenseSet searched_files;
   TypeMap results;
 
-  auto clang_ast_ctx = llvm::dyn_cast_or_null(
-  symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus));
+  auto clang_ast_ctx_or_err =
+  symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+  ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded());
+
+  auto clang_ast_ctx =
+  llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get());
   EXPECT_NE(nullptr, clang_ast_ctx);
 
   auto ast_ctx = clang_ast_ctx->getASTContext();


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


[Lldb-commits] [PATCH] D65489: Tablegen option enum value elements

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: teemperor.
JDevlieghere added a project: LLDB.
Herald added a subscriber: mgorny.

Option enum value elements are used by both properties and options. They're 
another good canidate for tablegen'ing.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65489

Files:
  lldb/include/lldb/Core/OptionEnumValueElementsBase.td
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/CoreOptionEnumValueElements.td
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/utils/TableGen/CMakeLists.txt
  lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
  lldb/utils/TableGen/LLDBTableGen.cpp
  lldb/utils/TableGen/LLDBTableGenBackends.h

Index: lldb/utils/TableGen/LLDBTableGenBackends.h
===
--- lldb/utils/TableGen/LLDBTableGenBackends.h
+++ lldb/utils/TableGen/LLDBTableGenBackends.h
@@ -37,6 +37,7 @@
 void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyEnumDefs(RecordKeeper &RK, raw_ostream &OS);
+void EmitOptionEnumValueElements(RecordKeeper &RK, raw_ostream &OS);
 
 } // namespace lldb_private
 
Index: lldb/utils/TableGen/LLDBTableGen.cpp
===
--- lldb/utils/TableGen/LLDBTableGen.cpp
+++ lldb/utils/TableGen/LLDBTableGen.cpp
@@ -27,6 +27,7 @@
   GenOptionDefs,
   GenPropertyDefs,
   GenPropertyEnumDefs,
+  GenOptionEnumValueElements,
 };
 
 static cl::opt Action(
@@ -40,6 +41,9 @@
clEnumValN(GenPropertyDefs, "gen-lldb-property-defs",
   "Generate lldb property definitions"),
clEnumValN(GenPropertyEnumDefs, "gen-lldb-property-enum-defs",
+  "Generate lldb property enum definitions"),
+   clEnumValN(GenOptionEnumValueElements,
+  "gen-lldb-option-enum-value-elements",
   "Generate lldb property enum definitions")));
 
 static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
@@ -59,6 +63,9 @@
   case GenPropertyEnumDefs:
 EmitPropertyEnumDefs(Records, OS);
 break;
+  case GenOptionEnumValueElements:
+EmitOptionEnumValueElements(Records, OS);
+break;
   }
   return false;
 }
Index: lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
===
--- /dev/null
+++ lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
@@ -0,0 +1,96 @@
+//===- LLDBOptionEnumValueElementsEmitter.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// These tablegen backends emits LLDB's option enum value elements.
+//
+//===--===//
+
+#include "LLDBTableGenBackends.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/StringMatcher.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include 
+#include 
+
+using namespace llvm;
+using namespace lldb_private;
+
+/// Groups all Enums by their name.
+static RecordsByName getEnumList(std::vector Enums) {
+  RecordsByName result;
+  for (Record *Enum : Enums)
+result[Enum->getValueAsString("Enum").str()].push_back(Enum);
+  return result;
+}
+
+static void emitOptionEnumValueElement(Record *R, raw_ostream &OS) {
+  OS << "  {";
+
+  // Emit the enum value.
+  if (R->getValue("HasNamespace"))
+OS << R->getValueAsString("Namespace") << "::";
+  OS << "e";
+  OS << R->getName();
+  OS << ", ";
+
+  // Emit the string value.
+  if (auto V = R->getValue("StringValue")) {
+OS << "\"";
+OS << V->getValue()->getAsUnquotedString();
+OS << "\"";
+  } else {
+OS << "\"\"";
+  }
+  OS << ", ";
+
+  // Emit the usage string.
+  if (auto V = R->getValue("Usage")) {
+OS << "\"";
+OS << V->getValue()->getAsUnquotedString();
+OS << "\"";
+  } else {
+OS << "\"\"";
+  }
+
+  OS << "},\n";
+}
+
+/// Emits all option enum value elements to the raw_ostream.
+static void emitOptionEnumValueElements(std::string EnumName,
+std::vector EnumRecords,
+raw_ostream &OS) {
+  // Generate the macro that the user needs to define before including the
+  // *.inc file.
+  std::string NeededMacro = "LLDB_OPTION_ENUM_VALUE_ELEMENTS_" + EnumName;
+  std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
+
+  // One file can contain more than one enum, so we need put them behind macros
+  // and ask the user to define the macro for the enums that are needed.
+  OS << "// Option enum value ele

[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-30 Thread Aaron Smith via Phabricator via lldb-commits
asmith marked 2 inline comments as done.
asmith added a comment.

I don't see anything else to address in this review. Comments?




Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp:141
+GetRegisterInfo_WoW64(const lldb_private::ArchSpec &arch) {
+  // A WoW64 register info is the same as the i386's.
+  std::vector &g_register_infos =

labath wrote:
> Hui wrote:
> > labath wrote:
> > > Why is all of this complexity necessary? Couldn't you just switch on the 
> > > target architecture in `CreateRegisterInfoInterface` in 
> > > NativeRegisterContextWindows_x86_64.cpp and create either 
> > > `RegisterContextWindows_WoW64` or `RegisterContextWindows_x86_64` ?
> > > 
> > > In fact, if RegisterContextWindows_WoW64 is identical to 
> > > RegisterContextWindows_i386, then why do you even need the _WoW64 version 
> > > of the class in the first place? FWIW, linux also does not have a 
> > > RegisterContextLinux_32_bit_process_on_64_bit_kernel class...
> > I think WoW64 is i686 that shall deserve a separate arch specific 
> > implementation?
> I am sorry, but I don't follow. Can you repeat the question?
> 
> (FWIW, I don't believe that the fact that two things are different from a 
> certain point of view justifies copy-pasting (at least) 150 LOC. If you think 
> it's confusing to use something called "i386" in things dealing with WoW64, 
> you can always typedef the WOW64 context to it, or rename the i386 context to 
> something more generic.)
I don't want this to block the review and have removed the code.


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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [lldb] r367375 - [TableGen] Include vector

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 17:20:55 2019
New Revision: 367375

URL: http://llvm.org/viewvc/llvm-project?rev=367375&view=rev
Log:
[TableGen] Include vector

Fixes "no member named 'vector' in namespace 'std'" compile error.

Modified:
lldb/trunk/utils/TableGen/LLDBTableGenBackends.h

Modified: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBTableGenBackends.h?rev=367375&r1=367374&r2=367375&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBTableGenBackends.h (original)
+++ lldb/trunk/utils/TableGen/LLDBTableGenBackends.h Tue Jul 30 17:20:55 2019
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 namespace llvm {
 class raw_ostream;


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


[Lldb-commits] [PATCH] D65492: Adjust a ValueObjectChild's offset when the child is a bitfield

2019-07-30 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jingham, jasonmolenda.
Herald added a project: LLDB.

If a bitfield doesn't fit into the child_byte_size'd window at 
child_byte_offset, move the window (= child_byte_offset) forward until it fits.

This was not in the big-endian-derived DWARF 2 bitfield attributes because 
their offsets were counted from the end of the window, so they always fit.

rdar://problem/53132189


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65492

Files:
  lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
  lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
  lldb/source/Core/ValueObject.cpp


Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -618,6 +618,18 @@
 if (!child_name_str.empty())
   child_name.SetCString(child_name_str.c_str());
 
+// If a bitfield doesn't fit into the child_byte_size'd window at
+// child_byte_offset, move the window (= child_byte_offset)
+// forward until it fits.
+uint32_t child_bit_size = child_byte_size * 8;
+if (child_bitfield_bit_size + child_bitfield_bit_offset > child_bit_size) {
+  uint32_t overhang_bits =
+  (child_bitfield_bit_size + child_bitfield_bit_offset) - 
child_bit_size;
+  uint32_t overhang_bytes = (overhang_bits + 7) / 8;
+  child_byte_offset += overhang_bytes;
+  child_bitfield_bit_offset -= overhang_bytes * 8;
+}
+
 valobj = new ValueObjectChild(
 *this, child_compiler_type, child_name, child_byte_size,
 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
Index: lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
===
--- lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
@@ -90,6 +90,14 @@
 packed.b = 10;
 packed.c = 0x7112233;
 
+struct LargePackedBits {
+unsigned long a: 36;
+unsigned long b: 36;
+} __attribute__((packed));
+
+struct LargePackedBits large_packed =
+  (struct LargePackedBits){ 0xc, 0xd };
+
 return 0;    Set break point at this line.
 
 }
Index: lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
===
--- lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
@@ -148,6 +148,9 @@
 '(uint8_t:1) b17 = \'\\0\'',
 ])
 
+self.expect("v/x large_packed", VARIABLES_DISPLAYED_CORRECTLY,
+substrs=["a = 0x000c", "b = 
0x000deee"])
+
 
 @add_test_categories(['pyapi'])
 # BitFields exhibit crashes in record layout on Windows


Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -618,6 +618,18 @@
 if (!child_name_str.empty())
   child_name.SetCString(child_name_str.c_str());
 
+// If a bitfield doesn't fit into the child_byte_size'd window at
+// child_byte_offset, move the window (= child_byte_offset)
+// forward until it fits.
+uint32_t child_bit_size = child_byte_size * 8;
+if (child_bitfield_bit_size + child_bitfield_bit_offset > child_bit_size) {
+  uint32_t overhang_bits =
+  (child_bitfield_bit_size + child_bitfield_bit_offset) - child_bit_size;
+  uint32_t overhang_bytes = (overhang_bits + 7) / 8;
+  child_byte_offset += overhang_bytes;
+  child_bitfield_bit_offset -= overhang_bytes * 8;
+}
+
 valobj = new ValueObjectChild(
 *this, child_compiler_type, child_name, child_byte_size,
 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
Index: lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
===
--- lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
@@ -90,6 +90,14 @@
 packed.b = 10;
 packed.c = 0x7112233;
 
+struct LargePackedBits {
+unsigned long a: 36;
+unsigned long b: 36;
+} __attribute__((packed));
+
+struct LargePackedBits large_packed =
+  (struct LargePackedBits){ 0xc, 0xd };
+
 return 0;    Set break point at this line.
 
 }
Index: lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
===
--- lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py

[Lldb-commits] [PATCH] D65493: Modernize atomic detection and usage

2019-07-30 Thread JF Bastien via Phabricator via lldb-commits
jfb created this revision.
jfb added reviewers: rnk, Bigcheese, __simt__.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, kadircet, 
arphaman, dexonsmith, jkorous, hiraditya, mgorny.
Herald added projects: clang, LLDB, LLVM.

Some of the cmake checks are obsolete and make bootstrapping an LLVM build 
painful: we only need to check for libatomic which we can do in pure C, no need 
for C++ . That leads us to Atomic.h which we can get rid of.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65493

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  lldb/source/Utility/CMakeLists.txt
  llvm/cmake/modules/CheckAtomic.cmake
  llvm/include/llvm/Support/Atomic.h
  llvm/include/llvm/Support/Threading.h
  llvm/lib/Support/Atomic.cpp
  llvm/lib/Support/Windows/Threading.inc

Index: llvm/lib/Support/Windows/Threading.inc
===
--- llvm/lib/Support/Windows/Threading.inc
+++ llvm/lib/Support/Windows/Threading.inc
@@ -16,11 +16,6 @@
 #include "WindowsSupport.h"
 #include 
 
-// Windows will at times define MemoryFence.
-#ifdef MemoryFence
-#undef MemoryFence
-#endif
-
 namespace {
   struct ThreadInfo {
 void(*func)(void*);
Index: llvm/lib/Support/Atomic.cpp
===
--- llvm/lib/Support/Atomic.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- Atomic.cpp - Atomic Operations --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-//
-//  This file implements atomic operations.
-//
-//===--===//
-
-#include "llvm/Support/Atomic.h"
-#include "llvm/Config/llvm-config.h"
-
-using namespace llvm;
-
-#if defined(_MSC_VER)
-#include 
-
-// We must include windows.h after intrin.h.
-#include 
-#undef MemoryFence
-#endif
-
-#if defined(__GNUC__) || (defined(__IBMCPP__) && __IBMCPP__ >= 1210)
-#define GNU_ATOMICS
-#endif
-
-void sys::MemoryFence() {
-#if LLVM_HAS_ATOMICS == 0
-  return;
-#else
-#  if defined(GNU_ATOMICS)
-  __sync_synchronize();
-#  elif defined(_MSC_VER)
-  MemoryBarrier();
-#  else
-# error No memory fence implementation for your platform!
-#  endif
-#endif
-}
-
-sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
-  sys::cas_flag new_value,
-  sys::cas_flag old_value) {
-#if LLVM_HAS_ATOMICS == 0
-  sys::cas_flag result = *ptr;
-  if (result == old_value)
-*ptr = new_value;
-  return result;
-#elif defined(GNU_ATOMICS)
-  return __sync_val_compare_and_swap(ptr, old_value, new_value);
-#elif defined(_MSC_VER)
-  return InterlockedCompareExchange(ptr, new_value, old_value);
-#else
-#  error No compare-and-swap implementation for your platform!
-#endif
-}
Index: llvm/include/llvm/Support/Threading.h
===
--- llvm/include/llvm/Support/Threading.h
+++ llvm/include/llvm/Support/Threading.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
+#include 
 #include  // So we can check the C++ standard lib macros.
 #include 
 
@@ -41,8 +42,6 @@
 
 #if LLVM_THREADING_USE_STD_CALL_ONCE
 #include 
-#else
-#include "llvm/Support/Atomic.h"
 #endif
 
 namespace llvm {
@@ -69,7 +68,7 @@
 
 #if LLVM_THREADING_USE_STD_CALL_ONCE
 
-  typedef std::once_flag once_flag;
+  using once_flag = std::once_flag;
 
 #else
 
@@ -81,7 +80,7 @@
   /// This structure must be used as an opaque object. It is a struct to force
   /// autoinitialization and behave like std::once_flag.
   struct once_flag {
-volatile sys::cas_flag status = Uninitialized;
+std::atomic status = ATOMIC_VAR_INIT(Uninitialized);
   };
 
 #endif
@@ -104,23 +103,22 @@
 std::call_once(flag, std::forward(F),
std::forward(ArgList)...);
 #else
-// For other platforms we use a generic (if brittle) version based on our
-// atomics.
-sys::cas_flag old_val = sys::CompareAndSwap(&flag.status, Wait, Uninitialized);
-if (old_val == Uninitialized) {
+InitStatus Expect = Uninitialized;
+bool Success = flag.status.compare_exchange_strong(Expect, Wait);
+if (Success) {
   std::forward(F)(std::forward(ArgList)...);
-  sys::MemoryFence();
+  std::atomic_thread_fence(std::memory_order_seq_cst);
   TsanIgnoreWritesBegin();
   TsanHappensBefore(&flag.status);
   flag.status = Done;
   TsanIgnoreWritesEnd();
 } else {
   // Wait until any thread doing the call has finished.
-  sys::cas_flag tmp = flag.status;
-  sys::MemoryFence();
+  InitStatus tmp = flag.status

[Lldb-commits] [PATCH] D65493: Modernize atomic detection and usage

2019-07-30 Thread JF Bastien via Phabricator via lldb-commits
jfb updated this revision to Diff 212479.
jfb added a comment.

- Remove from cmake


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65493

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  lldb/source/Utility/CMakeLists.txt
  llvm/cmake/modules/CheckAtomic.cmake
  llvm/include/llvm/Support/Atomic.h
  llvm/include/llvm/Support/Threading.h
  llvm/lib/Support/Atomic.cpp
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/Windows/Threading.inc

Index: llvm/lib/Support/Windows/Threading.inc
===
--- llvm/lib/Support/Windows/Threading.inc
+++ llvm/lib/Support/Windows/Threading.inc
@@ -16,11 +16,6 @@
 #include "WindowsSupport.h"
 #include 
 
-// Windows will at times define MemoryFence.
-#ifdef MemoryFence
-#undef MemoryFence
-#endif
-
 namespace {
   struct ThreadInfo {
 void(*func)(void*);
Index: llvm/lib/Support/CMakeLists.txt
===
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -165,7 +165,6 @@
   Z3Solver.cpp
 
 # System
-  Atomic.cpp
   DynamicLibrary.cpp
   Errno.cpp
   Host.cpp
Index: llvm/lib/Support/Atomic.cpp
===
--- llvm/lib/Support/Atomic.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- Atomic.cpp - Atomic Operations --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-//
-//  This file implements atomic operations.
-//
-//===--===//
-
-#include "llvm/Support/Atomic.h"
-#include "llvm/Config/llvm-config.h"
-
-using namespace llvm;
-
-#if defined(_MSC_VER)
-#include 
-
-// We must include windows.h after intrin.h.
-#include 
-#undef MemoryFence
-#endif
-
-#if defined(__GNUC__) || (defined(__IBMCPP__) && __IBMCPP__ >= 1210)
-#define GNU_ATOMICS
-#endif
-
-void sys::MemoryFence() {
-#if LLVM_HAS_ATOMICS == 0
-  return;
-#else
-#  if defined(GNU_ATOMICS)
-  __sync_synchronize();
-#  elif defined(_MSC_VER)
-  MemoryBarrier();
-#  else
-# error No memory fence implementation for your platform!
-#  endif
-#endif
-}
-
-sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
-  sys::cas_flag new_value,
-  sys::cas_flag old_value) {
-#if LLVM_HAS_ATOMICS == 0
-  sys::cas_flag result = *ptr;
-  if (result == old_value)
-*ptr = new_value;
-  return result;
-#elif defined(GNU_ATOMICS)
-  return __sync_val_compare_and_swap(ptr, old_value, new_value);
-#elif defined(_MSC_VER)
-  return InterlockedCompareExchange(ptr, new_value, old_value);
-#else
-#  error No compare-and-swap implementation for your platform!
-#endif
-}
Index: llvm/include/llvm/Support/Threading.h
===
--- llvm/include/llvm/Support/Threading.h
+++ llvm/include/llvm/Support/Threading.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
+#include 
 #include  // So we can check the C++ standard lib macros.
 #include 
 
@@ -41,8 +42,6 @@
 
 #if LLVM_THREADING_USE_STD_CALL_ONCE
 #include 
-#else
-#include "llvm/Support/Atomic.h"
 #endif
 
 namespace llvm {
@@ -69,7 +68,7 @@
 
 #if LLVM_THREADING_USE_STD_CALL_ONCE
 
-  typedef std::once_flag once_flag;
+  using once_flag = std::once_flag;
 
 #else
 
@@ -81,7 +80,7 @@
   /// This structure must be used as an opaque object. It is a struct to force
   /// autoinitialization and behave like std::once_flag.
   struct once_flag {
-volatile sys::cas_flag status = Uninitialized;
+std::atomic status = ATOMIC_VAR_INIT(Uninitialized);
   };
 
 #endif
@@ -104,23 +103,22 @@
 std::call_once(flag, std::forward(F),
std::forward(ArgList)...);
 #else
-// For other platforms we use a generic (if brittle) version based on our
-// atomics.
-sys::cas_flag old_val = sys::CompareAndSwap(&flag.status, Wait, Uninitialized);
-if (old_val == Uninitialized) {
+InitStatus Expect = Uninitialized;
+bool Success = flag.status.compare_exchange_strong(Expect, Wait);
+if (Success) {
   std::forward(F)(std::forward(ArgList)...);
-  sys::MemoryFence();
+  std::atomic_thread_fence(std::memory_order_seq_cst);
   TsanIgnoreWritesBegin();
   TsanHappensBefore(&flag.status);
   flag.status = Done;
   TsanIgnoreWritesEnd();
 } else {
   // Wait until any thread doing the call has finished.
-  sys::cas_flag tmp = flag.status;
-  sys::MemoryFence();
+  InitStatus tmp = fl

[Lldb-commits] [lldb] r367377 - [TableGen] Move helpers into LLDBTableGenUtils.

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 17:47:00 2019
New Revision: 367377

URL: http://llvm.org/viewvc/llvm-project?rev=367377&view=rev
Log:
[TableGen] Move helpers into LLDBTableGenUtils.

Instead of polluting the LLDBTableGenBackends header with helpers used
by both emitters, move them into a separate files.

Added:
lldb/trunk/utils/TableGen/LLDBTableGenUtils.cpp
lldb/trunk/utils/TableGen/LLDBTableGenUtils.h
Modified:
lldb/trunk/utils/TableGen/CMakeLists.txt
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBTableGenBackends.h

Modified: lldb/trunk/utils/TableGen/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/CMakeLists.txt?rev=367377&r1=367376&r2=367377&view=diff
==
--- lldb/trunk/utils/TableGen/CMakeLists.txt (original)
+++ lldb/trunk/utils/TableGen/CMakeLists.txt Tue Jul 30 17:47:00 2019
@@ -10,6 +10,7 @@ else()
 LLDBOptionDefEmitter.cpp
 LLDBPropertyDefEmitter.cpp
 LLDBTableGen.cpp
+LLDBTableGenUtils.cpp
 )
   set_target_properties(lldb-tblgen PROPERTIES FOLDER "LLDB tablegenning")
 endif()

Modified: lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp?rev=367377&r1=367376&r2=367377&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp Tue Jul 30 17:47:00 2019
@@ -12,24 +12,16 @@
 
//===--===//
 
 #include "LLDBTableGenBackends.h"
+#include "LLDBTableGenUtils.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/TableGen/Record.h"
 #include "llvm/TableGen/StringMatcher.h"
 #include "llvm/TableGen/TableGenBackend.h"
-#include 
 #include 
 
 using namespace llvm;
 using namespace lldb_private;
 
-/// Groups all records by their command.
-static RecordsByName getCommandList(std::vector Options) {
-  RecordsByName result;
-  for (Record *Option : Options)
-result[Option->getValueAsString("Command").str()].push_back(Option);
-  return result;
-}
-
 namespace {
 struct CommandOption {
   std::vector GroupsArg;
@@ -187,7 +179,7 @@ void lldb_private::EmitOptionDefs(Record
   emitSourceFileHeader("Options for LLDB command line commands.", OS);
 
   std::vector Options = Records.getAllDerivedDefinitions("Option");
-  for (auto &CommandRecordPair : getCommandList(Options)) {
+  for (auto &CommandRecordPair : getRecordsByName(Options, "Command")) {
 emitOptions(CommandRecordPair.first, CommandRecordPair.second, OS);
   }
 }

Modified: lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp?rev=367377&r1=367376&r2=367377&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBPropertyDefEmitter.cpp Tue Jul 30 17:47:00 
2019
@@ -11,24 +11,16 @@
 
//===--===//
 
 #include "LLDBTableGenBackends.h"
+#include "LLDBTableGenUtils.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/TableGen/Record.h"
 #include "llvm/TableGen/StringMatcher.h"
 #include "llvm/TableGen/TableGenBackend.h"
-#include 
 #include 
 
 using namespace llvm;
 using namespace lldb_private;
 
-/// Groups all properties by their definition.
-static RecordsByName getPropertyList(std::vector Properties) {
-  RecordsByName result;
-  for (Record *Property : Properties)
-result[Property->getValueAsString("Definition").str()].push_back(Property);
-  return result;
-}
-
 static void emitPropertyEnum(Record *Property, raw_ostream &OS) {
   OS << "eProperty";
   OS << Property->getName();
@@ -156,7 +148,7 @@ void lldb_private::EmitPropertyDefs(Reco
 
   std::vector Properties =
   Records.getAllDerivedDefinitions("Property");
-  for (auto &PropertyRecordPair : getPropertyList(Properties)) {
+  for (auto &PropertyRecordPair : getRecordsByName(Properties, "Definition")) {
 emityProperties(PropertyRecordPair.first, PropertyRecordPair.second, OS);
   }
 }
@@ -167,7 +159,7 @@ void lldb_private::EmitPropertyEnumDefs(
 
   std::vector Properties =
   Records.getAllDerivedDefinitions("Property");
-  for (auto &PropertyRecordPair : getPropertyList(Properties)) {
+  for (auto &PropertyRecordPair : getRecordsByName(Properties, "Definition")) {
 emitPropertyEnum(PropertyRecordPair.first, PropertyRecordPair.second, OS);
   }
 }

Modified: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBTableGenBackends.h?rev=367377&r1=367376&r2=367377&v

[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-30 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 212482.
xiaobai added a comment.

Update GetScatchTypeSystems to account for changes to TypeSystem usage


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

https://reviews.llvm.org/D64964

Files:
  include/lldb/Target/Target.h
  source/API/SBTarget.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2153,6 +2153,34 @@
 create_on_demand);
 }
 
+std::vector Target::GetScratchTypeSystems(bool create_on_demand) {
+  if (!m_valid)
+return {};
+
+  std::vector scratch_type_systems;
+
+  std::set languages_for_types;
+  std::set languages_for_expressions;
+
+  Language::GetLanguagesSupportingTypeSystems(languages_for_types,
+  languages_for_expressions);
+
+  for (auto lang : languages_for_expressions) {
+auto type_system_or_err =
+GetScratchTypeSystemForLanguage(lang, create_on_demand);
+if (!type_system_or_err)
+  LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET),
+ type_system_or_err.takeError(),
+ "Language '{}' has expression support but no scratch type "
+ "system available",
+ Language::GetNameForLanguageType(lang));
+else
+  scratch_type_systems.emplace_back(&type_system_or_err.get());
+  }
+
+  return scratch_type_systems;
+}
+
 PersistentExpressionState *
 Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
   auto type_system_or_err = GetScratchTypeSystemForLanguage(language, true);
Index: source/API/SBTarget.cpp
===
--- source/API/SBTarget.cpp
+++ source/API/SBTarget.cpp
@@ -44,11 +44,11 @@
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Host/Host.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Language.h"
@@ -1858,11 +1858,12 @@
 }
 
 // No matches, search for basic typename matches
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(ClangASTContext::GetBasicType(
-  clang_ast->getASTContext(), const_typename)));
+for (auto *type_system :
+ target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+  if (auto type = type_system->GetBuiltinTypeByName(const_typename))
+return LLDB_RECORD_RESULT(SBType(type));
   }
+
   return LLDB_RECORD_RESULT(SBType());
 }
 
@@ -1872,10 +1873,10 @@
 
   TargetSP target_sp(GetSP());
   if (target_sp) {
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(
-  ClangASTContext::GetBasicType(clang_ast->getASTContext(), type)));
+for (auto *type_system :
+ target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+  if (auto compiler_type = type_system->GetBasicTypeFromAST(type))
+return LLDB_RECORD_RESULT(SBType(compiler_type));
   }
   return LLDB_RECORD_RESULT(SBType());
 }
@@ -1918,10 +1919,11 @@
 
 if (sb_type_list.GetSize() == 0) {
   // No matches, search for basic typename matches
-  ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-  if (clang_ast)
-sb_type_list.Append(SBType(ClangASTContext::GetBasicType(
-clang_ast->getASTContext(), const_typename)));
+  for (auto *type_system :
+   target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+if (auto compiler_type =
+type_system->GetBuiltinTypeByName(const_typename))
+  sb_type_list.Append(SBType(compiler_type));
 }
   }
   return LLDB_RECORD_RESULT(sb_type_list);
Index: include/lldb/Target/Target.h
===
--- include/lldb/Target/Target.h
+++ include/lldb/Target/Target.h
@@ -1026,6 +1026,8 @@
   GetScratchTypeSystemForLanguage(lldb::LanguageType language,
   bool create_on_demand = true);
 
+  std::vector GetScratchTypeSystems(bool create_on_demand = true);
+
   PersistentExpressionState *
   GetPersistentExpressionStateForLanguage(lldb::LanguageType language);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-30 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 212483.
xiaobai added a comment.

Removed argument to GetScratchTypeSystems from SBTarget


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

https://reviews.llvm.org/D64964

Files:
  include/lldb/Target/Target.h
  source/API/SBTarget.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2153,6 +2153,34 @@
 create_on_demand);
 }
 
+std::vector Target::GetScratchTypeSystems(bool create_on_demand) {
+  if (!m_valid)
+return {};
+
+  std::vector scratch_type_systems;
+
+  std::set languages_for_types;
+  std::set languages_for_expressions;
+
+  Language::GetLanguagesSupportingTypeSystems(languages_for_types,
+  languages_for_expressions);
+
+  for (auto lang : languages_for_expressions) {
+auto type_system_or_err =
+GetScratchTypeSystemForLanguage(lang, create_on_demand);
+if (!type_system_or_err)
+  LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET),
+ type_system_or_err.takeError(),
+ "Language '{}' has expression support but no scratch type "
+ "system available",
+ Language::GetNameForLanguageType(lang));
+else
+  scratch_type_systems.emplace_back(&type_system_or_err.get());
+  }
+
+  return scratch_type_systems;
+}
+
 PersistentExpressionState *
 Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
   auto type_system_or_err = GetScratchTypeSystemForLanguage(language, true);
Index: source/API/SBTarget.cpp
===
--- source/API/SBTarget.cpp
+++ source/API/SBTarget.cpp
@@ -44,11 +44,11 @@
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Host/Host.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Language.h"
@@ -1858,11 +1858,11 @@
 }
 
 // No matches, search for basic typename matches
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(ClangASTContext::GetBasicType(
-  clang_ast->getASTContext(), const_typename)));
+for (auto *type_system : target_sp->GetScratchTypeSystems())
+  if (auto type = type_system->GetBuiltinTypeByName(const_typename))
+return LLDB_RECORD_RESULT(SBType(type));
   }
+
   return LLDB_RECORD_RESULT(SBType());
 }
 
@@ -1872,10 +1872,9 @@
 
   TargetSP target_sp(GetSP());
   if (target_sp) {
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(
-  ClangASTContext::GetBasicType(clang_ast->getASTContext(), type)));
+for (auto *type_system : target_sp->GetScratchTypeSystems())
+  if (auto compiler_type = type_system->GetBasicTypeFromAST(type))
+return LLDB_RECORD_RESULT(SBType(compiler_type));
   }
   return LLDB_RECORD_RESULT(SBType());
 }
@@ -1918,10 +1917,10 @@
 
 if (sb_type_list.GetSize() == 0) {
   // No matches, search for basic typename matches
-  ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-  if (clang_ast)
-sb_type_list.Append(SBType(ClangASTContext::GetBasicType(
-clang_ast->getASTContext(), const_typename)));
+  for (auto *type_system : target_sp->GetScratchTypeSystems())
+if (auto compiler_type =
+type_system->GetBuiltinTypeByName(const_typename))
+  sb_type_list.Append(SBType(compiler_type));
 }
   }
   return LLDB_RECORD_RESULT(sb_type_list);
Index: include/lldb/Target/Target.h
===
--- include/lldb/Target/Target.h
+++ include/lldb/Target/Target.h
@@ -1026,6 +1026,8 @@
   GetScratchTypeSystemForLanguage(lldb::LanguageType language,
   bool create_on_demand = true);
 
+  std::vector GetScratchTypeSystems(bool create_on_demand = true);
+
   PersistentExpressionState *
   GetPersistentExpressionStateForLanguage(lldb::LanguageType language);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-30 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.

Thanks!


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

https://reviews.llvm.org/D64964



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


[Lldb-commits] [PATCH] D65489: Tablegen option enum value elements

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 212485.
JDevlieghere added a comment.

Rebase


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

https://reviews.llvm.org/D65489

Files:
  lldb/include/lldb/Core/OptionEnumValueElementsBase.td
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/CoreOptionEnumValueElements.td
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/utils/TableGen/CMakeLists.txt
  lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
  lldb/utils/TableGen/LLDBTableGen.cpp
  lldb/utils/TableGen/LLDBTableGenBackends.h

Index: lldb/utils/TableGen/LLDBTableGenBackends.h
===
--- lldb/utils/TableGen/LLDBTableGenBackends.h
+++ lldb/utils/TableGen/LLDBTableGenBackends.h
@@ -32,6 +32,7 @@
 void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyDefs(RecordKeeper &RK, raw_ostream &OS);
 void EmitPropertyEnumDefs(RecordKeeper &RK, raw_ostream &OS);
+void EmitOptionEnumValueElements(RecordKeeper &RK, raw_ostream &OS);
 
 } // namespace lldb_private
 
Index: lldb/utils/TableGen/LLDBTableGen.cpp
===
--- lldb/utils/TableGen/LLDBTableGen.cpp
+++ lldb/utils/TableGen/LLDBTableGen.cpp
@@ -27,6 +27,7 @@
   GenOptionDefs,
   GenPropertyDefs,
   GenPropertyEnumDefs,
+  GenOptionEnumValueElements,
 };
 
 static cl::opt Action(
@@ -40,6 +41,9 @@
clEnumValN(GenPropertyDefs, "gen-lldb-property-defs",
   "Generate lldb property definitions"),
clEnumValN(GenPropertyEnumDefs, "gen-lldb-property-enum-defs",
+  "Generate lldb property enum definitions"),
+   clEnumValN(GenOptionEnumValueElements,
+  "gen-lldb-option-enum-value-elements",
   "Generate lldb property enum definitions")));
 
 static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
@@ -59,6 +63,9 @@
   case GenPropertyEnumDefs:
 EmitPropertyEnumDefs(Records, OS);
 break;
+  case GenOptionEnumValueElements:
+EmitOptionEnumValueElements(Records, OS);
+break;
   }
   return false;
 }
Index: lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
===
--- /dev/null
+++ lldb/utils/TableGen/LLDBOptionEnumValueElementsEmitter.cpp
@@ -0,0 +1,89 @@
+//===- LLDBOptionEnumValueElementsEmitter.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// These tablegen backends emits LLDB's option enum value elements.
+//
+//===--===//
+
+#include "LLDBTableGenBackends.h"
+#include "LLDBTableGenUtils.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/StringMatcher.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include 
+#include 
+
+using namespace llvm;
+using namespace lldb_private;
+
+static void emitOptionEnumValueElement(Record *R, raw_ostream &OS) {
+  OS << "  {";
+
+  // Emit the enum value.
+  if (R->getValue("HasNamespace"))
+OS << R->getValueAsString("Namespace") << "::";
+  OS << "e";
+  OS << R->getName();
+  OS << ", ";
+
+  // Emit the string value.
+  if (auto V = R->getValue("StringValue")) {
+OS << "\"";
+OS << V->getValue()->getAsUnquotedString();
+OS << "\"";
+  } else {
+OS << "\"\"";
+  }
+  OS << ", ";
+
+  // Emit the usage string.
+  if (auto V = R->getValue("Usage")) {
+OS << "\"";
+OS << V->getValue()->getAsUnquotedString();
+OS << "\"";
+  } else {
+OS << "\"\"";
+  }
+
+  OS << "},\n";
+}
+
+/// Emits all option enum value elements to the raw_ostream.
+static void emitOptionEnumValueElements(std::string EnumName,
+std::vector EnumRecords,
+raw_ostream &OS) {
+  // Generate the macro that the user needs to define before including the
+  // *.inc file.
+  std::string NeededMacro = "LLDB_OPTION_ENUM_VALUE_ELEMENTS_" + EnumName;
+  std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
+
+  // One file can contain more than one enum, so we need put them behind macros
+  // and ask the user to define the macro for the enums that are needed.
+  OS << "// Option enum value elements for " << EnumName << "\n";
+  OS << "#ifdef " << NeededMacro << "\n";
+  OS << "static constexpr OptionEnumValueElement g_" << EnumName << "[] = {\n";
+  for (Record *R : EnumRecords)
+emitOptionEnumValueElement(R, OS);
+  OS << "};\n";
+  // We undefine the macro for the user like Clang's include files are doing it.
+  OS << "#und

[Lldb-commits] [PATCH] D64993: Fix PC adjustment in StackFrame::GetSymbolContext

2019-07-30 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet added a comment.

@jasonmolenda @clayborg ping.  To clarify, the issue this fixes is, using test 
functionalities/signal/handle-abrt as an example:

  #include 
  #include 
  #include 
  
  void handler(int sig)
  {
  printf("Set a breakpoint here.\n");
  exit(0);
  }
  
  void abort_caller() {
  abort();
  }
  
  int main()
  {
  if (signal(SIGABRT, handler) == SIG_ERR)
  {
  perror("signal");
  return 1;
  }
  
  abort_caller();
  return 2;
  }

When stopped at the breakpoint in "handler", backtrace currently gives this:

  (lldb) bt
  * thread #1, name = 'sigtest', stop reason = breakpoint 1.1
* frame #0: 0x00400651 sigtest`handler(sig=6) at main.c:7
  frame #1: 0x77a424b0 libc.so.6`___lldb_unnamed_symbol1$$libc.so.6 
+ 1<- the symbol context of this frame is the issue
  frame #2: 0x77a42428 libc.so.6`__GI_raise(sig=6) at raise.c:54
  frame #3: 0x77a4402a libc.so.6`__GI_abort at abort.c:89
  frame #4: 0x0040066e sigtest`abort_caller() at main.c:12
  frame #5: 0x004006a2 sigtest`main at main.c:23
  frame #6: 0x77a2d830 
libc.so.6`__libc_start_main(main=(sigtest`main at main.c:16), argc=1, 
argv=0x7fffe328, init=, fini=, 
rtld_fini=, stack_end=0x7fffe318) at libc-start.c:291
  frame #7: 0x00400579 sigtest`_start + 41

the pc of frame 1 is actually on the first byte of the relevant function, not 
following a call:

  (lldb) frame select 1
  frame #1: 0x77a424b0 libc.so.6`___lldb_unnamed_symbol1$$libc.so.6 + 1
  libc.so.6`__restore_rt:
  ->  0x77a424b0 <+0>: movq   $0xf, %rax
  0x77a424b7 <+7>: syscall 
  0x77a424b9 <+9>: nopl   (%rax)
  
  libc.so.6`__GI___libc_sigaction:
  0x77a424c0 <+0>: subq   $0xd0, %rsp
  (lldb) disassemble -s '$pc - 2'
  0x77a424ae:   addb   %al, (%rax)
  libc.so.6`__restore_rt:
  ->  0x77a424b0 <+0>:  movq   $0xf, %rax
  0x77a424b7 <+7>:  syscall 
  0x77a424b9 <+9>:  nopl   (%rax)
  
  libc.so.6`__GI___libc_sigaction:
  0x77a424c0 <+0>:  subq   $0xd0, %rsp
  0x77a424c7 <+7>:  testq  %rsi, %rsi
  0x77a424ca <+10>: movq   %rdx, %r8

With this fix, we instead get this backtrace:

  (lldb) bt
  * thread #1, name = 'sigtest', stop reason = breakpoint 1.1
* frame #0: 0x00400651 sigtest`handler(sig=6) at main.c:7
  frame #1: 0x77a424b0 libc.so.6`__restore_rt
<-- correct symbol context here
  frame #2: 0x77a42428 libc.so.6`__GI_raise(sig=6) at raise.c:54
  frame #3: 0x77a4402a libc.so.6`__GI_abort at abort.c:89
  frame #4: 0x0040066e sigtest`abort_caller() at main.c:12
  frame #5: 0x004006a2 sigtest`main at main.c:23
  frame #6: 0x77a2d830 
libc.so.6`__libc_start_main(main=(sigtest`main at main.c:16), argc=1, 
argv=0x7fffe328, init=, fini=, 
rtld_fini=, stack_end=0x7fffe318) at libc-start.c:291
  frame #7: 0x00400579 sigtest`_start + 41


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64993



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


[Lldb-commits] [lldb] r367384 - [StringList] Change LongestCommonPrefix API

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 20:26:10 2019
New Revision: 367384

URL: http://llvm.org/viewvc/llvm-project?rev=367384&view=rev
Log:
[StringList] Change LongestCommonPrefix API

When investigating a completion bug I got confused by the API.
LongestCommonPrefix finds the longest common prefix of the strings in
the string list. Instead of returning that string through an output
argument, just return it by value.

Modified:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Utility/StringList.cpp
lldb/trunk/unittests/Utility/StringListTest.cpp

Modified: lldb/trunk/include/lldb/Utility/StringList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringList.h?rev=367384&r1=367383&r2=367384&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringList.h (original)
+++ lldb/trunk/include/lldb/Utility/StringList.h Tue Jul 30 20:26:10 2019
@@ -69,7 +69,7 @@ public:
 
   void Clear();
 
-  void LongestCommonPrefix(std::string &common_prefix);
+  std::string LongestCommonPrefix();
 
   void InsertStringAtIndex(size_t idx, const std::string &str);
 

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=367384&r1=367383&r2=367384&view=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Tue Jul 30 20:26:10 2019
@@ -243,8 +243,7 @@ int IOHandlerDelegate::IOHandlerComplete
 
 size_t num_matches = request.GetNumberOfMatches();
 if (num_matches > 0) {
-  std::string common_prefix;
-  matches.LongestCommonPrefix(common_prefix);
+  std::string common_prefix = matches.LongestCommonPrefix();
   const size_t partial_name_len = request.GetCursorArgumentPrefix().size();
 
   // If we matched a unique single command, add a space... Only do this if

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=367384&r1=367383&r2=367384&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jul 30 20:26:10 
2019
@@ -1857,8 +1857,7 @@ int CommandInterpreter::HandleCompletion
 // element 0, otherwise put an empty string in element 0.
 std::string command_partial_str = request.GetCursorArgumentPrefix().str();
 
-std::string common_prefix;
-matches.LongestCommonPrefix(common_prefix);
+std::string common_prefix = matches.LongestCommonPrefix();
 const size_t partial_name_len = command_partial_str.size();
 common_prefix.erase(0, partial_name_len);
 

Modified: lldb/trunk/source/Utility/StringList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringList.cpp?rev=367384&r1=367383&r2=367384&view=diff
==
--- lldb/trunk/source/Utility/StringList.cpp (original)
+++ lldb/trunk/source/Utility/StringList.cpp Tue Jul 30 20:26:10 2019
@@ -100,10 +100,9 @@ void StringList::Join(const char *separa
 
 void StringList::Clear() { m_strings.clear(); }
 
-void StringList::LongestCommonPrefix(std::string &common_prefix) {
-  common_prefix.clear();
+std::string StringList::LongestCommonPrefix() {
   if (m_strings.empty())
-return;
+return {};
 
   auto args = llvm::makeArrayRef(m_strings);
   llvm::StringRef prefix = args.front();
@@ -115,7 +114,7 @@ void StringList::LongestCommonPrefix(std
 }
 prefix = prefix.take_front(count);
   }
-  common_prefix = prefix;
+  return prefix.str();
 }
 
 void StringList::InsertStringAtIndex(size_t idx, const char *str) {

Modified: lldb/trunk/unittests/Utility/StringListTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StringListTest.cpp?rev=367384&r1=367383&r2=367384&view=diff
==
--- lldb/trunk/unittests/Utility/StringListTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StringListTest.cpp Tue Jul 30 20:26:10 2019
@@ -214,8 +214,7 @@ TEST(StringListTest, SplitIntoLinesEmpty
 
 TEST(StringListTest, LongestCommonPrefixEmpty) {
   StringList s;
-  std::string prefix = "this should be cleared";
-  s.LongestCommonPrefix(prefix);
+  std::string prefix = s.LongestCommonPrefix();
   EXPECT_EQ("", prefix);
 }
 
@@ -226,8 +225,7 @@ TEST(StringListTest, LongestCommonPrefix
   s.AppendString("foo");
   s.AppendString("foozar");
 
-  std::string prefix = "this should be cleared";
-  s.LongestCommonPrefix(prefix);
+  std::string prefix = s.LongestCommonPrefix();
   EXPECT_EQ("fo

[Lldb-commits] [lldb] r367385 - [CompletionRequest] Remove unimplemented members.

2019-07-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jul 30 20:48:29 2019
New Revision: 367385

URL: http://llvm.org/viewvc/llvm-project?rev=367385&view=rev
Log:
[CompletionRequest] Remove unimplemented members.

Completion requests have two fields that are essentially unimplemented:
`m_match_start_point` and `m_max_return_elements`. This would've been
okay, if it wasn't for the fact that this caused a bunch of useless
parameters to be passed around. Occasionally there would be a comment or
assert saying that they are not supported. This patch removes them.

Modified:
lldb/trunk/include/lldb/Core/IOHandler.h
lldb/trunk/include/lldb/Expression/REPL.h
lldb/trunk/include/lldb/Host/Editline.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Utility/CompletionRequest.h
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Expression/REPL.cpp
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Utility/CompletionRequest.cpp
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=367385&r1=367384&r2=367385&view=diff
==
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Tue Jul 30 20:48:29 2019
@@ -200,7 +200,6 @@ public:
 
   virtual int IOHandlerComplete(IOHandler &io_handler, const char 
*current_line,
 const char *cursor, const char *last_char,
-int skip_first_n_matches, int max_matches,
 StringList &matches, StringList &descriptions);
 
   virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; 
}
@@ -417,7 +416,6 @@ private:
 
   static int AutoCompleteCallback(const char *current_line, const char *cursor,
   const char *last_char,
-  int skip_first_n_matches, int max_matches,
   StringList &matches, StringList 
&descriptions,
   void *baton);
 #endif
@@ -452,7 +450,6 @@ public:
 
   int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
 const char *cursor, const char *last_char,
-int skip_first_n_matches, int max_matches,
 StringList &matches, StringList &descriptions) 
override;
 
   void IOHandlerInputComplete(IOHandler &io_handler,

Modified: lldb/trunk/include/lldb/Expression/REPL.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/REPL.h?rev=367385&r1=367384&r2=367385&view=diff
==
--- lldb/trunk/include/lldb/Expression/REPL.h (original)
+++ lldb/trunk/include/lldb/Expression/REPL.h Tue Jul 30 20:48:29 2019
@@ -105,7 +105,6 @@ public:
 
   int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
 const char *cursor, const char *last_char,
-int skip_first_n_matches, int max_matches,
 StringList &matches, StringList &descriptions) 
override;
 
 protected:

Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=367385&r1=367384&r2=367385&view=diff
==
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Tue Jul 30 20:48:29 2019
@@ -99,7 +99,6 @@ typedef int (*FixIndentationCallbackType
 
 typedef int (*CompleteCallbackType)(const char *current_line,
 const char *cursor, const char *last_char,
-int skip_first_n_matches, int max_matches,
 StringList &matches,
 StringList &descriptions, void *baton);
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=367385&r1=367384&r2=367385&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Jul 30 
20:48:29 2019
@@ -325,8 +325,7 @@ public:
   //
   // FIXME: Only max_return_elements == -1 is supported at present.
   int HandleCompletion(const char *current_line, const char *cursor,
-   const char *last_char, int match_start_point,
-

[Lldb-commits] [PATCH] D65498: Fix completion for functions in anonymous namespaces

2019-07-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, teemperor, jingham.
JDevlieghere added a project: LLDB.
Herald added subscribers: abidh, aprantl.

I was going through some of the old bugs and came across PR21069 which I was 
able to reproduce. The issue is that we match the regex `^foo` against the 
`DW_AT_name` in the DWARF, which for our anonymous function is indeed `foo`. 
However, when we get the function name from the symbol context, the result is 
`(anonymous namespace)::foo()`. This throws off completions, which assumes that 
it's appending to whatever is already present on the input, resulting in a 
bogus `b fooonymous\ namespace)::foo()`.

I'm not super familiar with the completion framework, so please let me know if 
there's a better way to solve this issue.

https://bugs.llvm.org/show_bug.cgi?id=21069


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65498

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
  lldb/source/Commands/CommandCompletions.cpp


Index: lldb/source/Commands/CommandCompletions.cpp
===
--- lldb/source/Commands/CommandCompletions.cpp
+++ lldb/source/Commands/CommandCompletions.cpp
@@ -471,7 +471,11 @@
 for (uint32_t i = 0; i < sc_list.GetSize(); i++) {
   if (sc_list.GetContextAtIndex(i, sc)) {
 ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
-if (!func_name.IsEmpty())
+// Ensure that the function name matches the regex. This is more than a
+// sanity check. It is possible that the demangled function name does
+// not start with the prefix, for example when it's in an anonymous
+// namespace.
+if (!func_name.IsEmpty() && m_regex.Execute(func_name.GetStringRef()))
   m_match_set.insert(func_name);
   }
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
+++ lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
@@ -7,6 +7,8 @@
 }
 };
 
+namespace { int Quux (void) { return 0; } }
+
 struct Container { int MemberVar; };
 
 int main()
@@ -17,5 +19,6 @@
 
 Container container;
 Container *ptr_container = &container;
+int q = Quux();
 return container.MemberVar = 3; // Break here
 }
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -297,3 +297,6 @@
 self.complete_from_to('breakpoint set -n Fo',
   'breakpoint set -n Foo::Bar(int,\\ int)',
   turn_off_re_match=True)
+# No completion for Qu because the candidate is
+# (anonymous namespace)::Quux().
+self.complete_from_to('breakpoint set -n Qu', '')


Index: lldb/source/Commands/CommandCompletions.cpp
===
--- lldb/source/Commands/CommandCompletions.cpp
+++ lldb/source/Commands/CommandCompletions.cpp
@@ -471,7 +471,11 @@
 for (uint32_t i = 0; i < sc_list.GetSize(); i++) {
   if (sc_list.GetContextAtIndex(i, sc)) {
 ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
-if (!func_name.IsEmpty())
+// Ensure that the function name matches the regex. This is more than a
+// sanity check. It is possible that the demangled function name does
+// not start with the prefix, for example when it's in an anonymous
+// namespace.
+if (!func_name.IsEmpty() && m_regex.Execute(func_name.GetStringRef()))
   m_match_set.insert(func_name);
   }
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
+++ lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp
@@ -7,6 +7,8 @@
 }
 };
 
+namespace { int Quux (void) { return 0; } }
+
 struct Container { int MemberVar; };
 
 int main()
@@ -17,5 +19,6 @@
 
 Container container;
 Container *ptr_container = &container;
+int q = Quux();
 return container.MemberVar = 3; // Break here
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ lldb/packages/Python/lldbsuite/test/functionalitie

[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62931#1607221 , @guiandrade wrote:

> Oh, sorry about that. I was relying on `ninja check`, which runs okay for me.
>
>   > ninja check
>[0/1] Running the LLVM regression tests
>Testing Time: 583.96s
>  Expected Passes: 32141
>  Expected Failures  : 147
>  Unsupported Tests  : 438
>   
>
> How can I invoke those other tests? (in case it's relevant, here's my cmake 
> command `cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS='lldb;clang;libcxx'`)


LLDB tests can be run with the "check-lldb" target. There's also "check-all" 
which would run *all* tests, but that's usually overkill.

> About not tying `G` and `g` together, maybe could we remove this branch 
> ?

That would be fine for lldb-server, but I am not sure how would that play with 
other stubs. As I understand it, the main reason this read-all-at-once logic 
was introduced was to handle stubs which did not implement `p`/`P` packets, so 
we may not be able to just start sending `P` unconditionally. @clayborg or 
@jasonmolenda can probably say more about that...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [PATCH] D65489: Tablegen option enum value elements

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Why do we need a separate backend for this? Couldn't this be emitted as a part 
of the same `#include "XXXProperties.inc"` which defines the property 
definition? The two logically belong together, and the only reason they were 
separate variables in the first place was the limitations of constexpr global 
variables...


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

https://reviews.llvm.org/D65489



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


[Lldb-commits] [PATCH] D65498: Fix completion for functions in anonymous namespaces

2019-07-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I don't immediately see a better way to fix this, but I'm not terribly familiar 
with this machinery either. I guess one day we may want to extend the 
completion machinery to be able to expand "foo" into "(anonymous 
namespace)::foobar", but that's likely to be a larger undertaking...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65498



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