[Lldb-commits] [PATCH] D55002: [NativePDB] Fix ast-reconstruction test on x86

2018-11-30 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy added a comment.

Thank you for the review!
Please, commit this for me? I have no commit access.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55002



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


[Lldb-commits] [lldb] r347974 - [Target] Do not skip a stop on a breakpoint if a plan was completed

2018-11-30 Thread Aleksandr Urakov via lldb-commits
Author: aleksandr.urakov
Date: Fri Nov 30 01:45:52 2018
New Revision: 347974

URL: http://llvm.org/viewvc/llvm-project?rev=347974&view=rev
Log:
[Target] Do not skip a stop on a breakpoint if a plan was completed

Summary:
This patch fixes the next situation. On Windows clang-cl makes no stub before
the main function, so the main function is located exactly on module entry
point. May be it is the same on other platforms. So consider the following
sequence:

- set a breakpoint on main and stop there;
- try to evaluate expression, which requires a code execution on the debuggee
  side. Such an execution always returns to the module entry, and the plan waits
  for it there;
- the plan understands that it is complete now and removes its breakpoint. But
  the breakpoint site is still there, because we also have a breakpoint on
  entry;
- StopInfo analyzes a situation. It sees that we have stopped on the breakpoint
  site, and it sees that the breakpoint site has owners, and no one logical
  breakpoint is internal (because the plan is already completed and it have
  removed its breakpoint);
- StopInfo thinks that it's a user breakpoint and skips it to avoid recursive
  computations;
- the program continues.

So in this situation the program continues without a stop right after
the expression evaluation. To avoid this an additional check that
the plan was completed was added.

Reviewers: jingham, zturner, boris.ulasevich

Reviewed by: jingham

Tags: #lldb

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c
Modified:
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/scripts/interface/SBModule.i
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=347974&r1=347973&r2=347974&view=diff
==
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Fri Nov 30 01:45:52 2018
@@ -309,6 +309,7 @@ public:
   lldb::SBFileSpec GetSymbolFileSpec() const;
 
   lldb::SBAddress GetObjectFileHeaderAddress() const;
+  lldb::SBAddress GetObjectFileEntryPointAddress() const;
 
 private:
   friend class SBAddress;

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile?rev=347974&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
 Fri Nov 30 01:45:52 2018
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py?rev=347974&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
 Fri Nov 30 01:45:52 2018
@@ -0,0 +1,34 @@
+"""
+Tests expressions evaluation when the breakpoint on module's entry is set.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+class ExprEntryBPTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_expr_entry_bp(self):
+"""Tests expressions evaluation when the breakpoint on module's entry 
is set."""
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.c")
+
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", 
self.main_source_file)
+
+self.assertEqual(1, bkpt.GetNumLocations())
+entry = 
bkpt.GetLocationAtIndex(0).GetAddress().GetModule().GetObjectFileEntryPointAddress()
+self.assertTrue(entry.IsValid(), "Can't get a module entry point")
+
+entry_bp = target.BreakpointCreateBySBAddress(entry)
+self.assertTrue(entry_bp.IsValid(), "Can't set a breakpoint on the 
module entry point")
+
+result = target.EvaluateExpression("sum(7, 1)")
+self.assertTrue(result.IsValid(

[Lldb-commits] [PATCH] D53761: [Target] Do not skip a stop on a breakpoint if a plan was completed

2018-11-30 Thread Aleksandr Urakov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB347974: [Target] Do not skip a stop on a breakpoint if a 
plan was completed (authored by aleksandr.urakov, committed by ).

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D53761

Files:
  include/lldb/API/SBModule.h
  packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
  
packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
  packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c
  scripts/interface/SBModule.i
  source/API/SBModule.cpp
  source/Target/StopInfo.cpp

Index: source/API/SBModule.cpp
===
--- source/API/SBModule.cpp
+++ source/API/SBModule.cpp
@@ -591,3 +591,14 @@
   }
   return sb_addr;
 }
+
+lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
+  lldb::SBAddress sb_addr;
+  ModuleSP module_sp(GetSP());
+  if (module_sp) {
+ObjectFile *objfile_ptr = module_sp->GetObjectFile();
+if (objfile_ptr)
+  sb_addr.ref() = objfile_ptr->GetEntryPointAddress();
+  }
+  return sb_addr;
+}
Index: source/Target/StopInfo.cpp
===
--- source/Target/StopInfo.cpp
+++ source/Target/StopInfo.cpp
@@ -329,6 +329,19 @@
 // commands when we see the same breakpoint hit a second time.
 
 m_should_stop_is_valid = true;
+
+// It is possible that the user has a breakpoint at the same site
+// as the completed plan had (e.g. user has a breakpoint
+// on a module entry point, and `ThreadPlanCallFunction` ends
+// also there). We can't find an internal breakpoint in the loop
+// later because it was already removed on the plan completion.
+// So check if the plan was completed, and stop if so.
+if (thread_sp->CompletedPlanOverridesBreakpoint()) {
+  m_should_stop = true;
+  thread_sp->ResetStopInfo();
+  return;
+}
+
 if (log)
   log->Printf("StopInfoBreakpoint::PerformAction - Hit a "
   "breakpoint while running an expression,"
Index: scripts/interface/SBModule.i
===
--- scripts/interface/SBModule.i
+++ scripts/interface/SBModule.i
@@ -332,6 +332,9 @@
 lldb::SBAddress
 GetObjectFileHeaderAddress() const;
 
+lldb::SBAddress
+GetObjectFileEntryPointAddress() const;
+
 bool
 operator == (const lldb::SBModule &rhs) const;
  
Index: include/lldb/API/SBModule.h
===
--- include/lldb/API/SBModule.h
+++ include/lldb/API/SBModule.h
@@ -309,6 +309,7 @@
   lldb::SBFileSpec GetSymbolFileSpec() const;
 
   lldb::SBAddress GetObjectFileHeaderAddress() const;
+  lldb::SBAddress GetObjectFileEntryPointAddress() const;
 
 private:
   friend class SBAddress;
Index: packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
===
--- packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
+++ packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
Index: packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
===
--- packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
+++ packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py
@@ -0,0 +1,34 @@
+"""
+Tests expressions evaluation when the breakpoint on module's entry is set.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+class ExprEntryBPTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_expr_entry_bp(self):
+"""Tests expressions evaluation when the breakpoint on module's entry is set."""
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.c")
+
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", self.main_source_file)
+
+self.assertEqual(1, bkpt.GetNumLocations())
+entry = bkpt.GetLocationAtIndex(0).GetAddress().GetModule().GetObjectFileEntryPointAddress()
+self.assertTrue(entry.IsValid(), "Can't get a module entry point")
+
+entry_bp = target.BreakpointCreateBySBAddress(entry)
+self.assertTrue(entry_bp.IsValid(), "Can't set a breakpoint on the module entry point")
+
+result = target.EvaluateExpression("sum(7, 1)")
+self.assertTrue(result.IsValid(), "Can't evaluate e

[Lldb-commits] [lldb] r347975 - [NativePDB] Fix ast-reconstruction test on x86

2018-11-30 Thread Aleksandr Urakov via lldb-commits
Author: aleksandr.urakov
Date: Fri Nov 30 01:50:11 2018
New Revision: 347975

URL: http://llvm.org/viewvc/llvm-project?rev=347975&view=rev
Log:
[NativePDB] Fix ast-reconstruction test on x86

Summary:
This patch fixes ast-reconstruction.cpp test on x86 platform.

Patch by: leonid.mashinskiy

Reviewers: zturner, stella.stamenova

Reviewed By: zturner

Subscribers: aleksandr.urakov, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=347975&r1=347974&r2=347975&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov 30 
01:50:11 2018
@@ -92,11 +92,11 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialE) TE = TE_A
 // CHECK: (A::B::C) ABCInt = (ABCMember = 0)
 // CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x{{0+}})
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x{{0+}})
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x{{0+}})
 // CHECK: (A::D) AD = {}
 // CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.


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


[Lldb-commits] [PATCH] D55002: [NativePDB] Fix ast-reconstruction test on x86

2018-11-30 Thread Aleksandr Urakov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347975: [NativePDB] Fix ast-reconstruction test on x86 
(authored by aleksandr.urakov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55002?vs=175681&id=176055#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55002

Files:
  lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp


Index: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -92,11 +92,11 @@
 // CHECK: (TrivialE) TE = TE_A
 // CHECK: (A::B::C) ABCInt = (ABCMember = 0)
 // CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x{{0+}})
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x{{0+}})
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x{{0+}})
 // CHECK: (A::D) AD = {}
 // CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.


Index: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -92,11 +92,11 @@
 // CHECK: (TrivialE) TE = TE_A
 // CHECK: (A::B::C) ABCInt = (ABCMember = 0)
 // CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x{{0+}})
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x{{0+}})
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x{{0+}})
 // CHECK: (A::D) AD = {}
 // CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55114: [CMake] Add LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR for custom dSYM target directory on Darwin

2018-11-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added a reviewer: beanz.
Herald added subscribers: aprantl, mgorny.

When using `LLVM_EXTERNALIZE_DEBUGINFO` in LLDB, the default dSYM location for 
the shared library in LLDB.framework is inside the framework bundle. With 
`LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR` we can easily fix that. I consider it a 
useful feature to be able to set a global output directory for external debug 
info (rather then having a target-specific one). Only implemented for Darwin so 
far.


Repository:
  rL LLVM

https://reviews.llvm.org/D55114

Files:
  cmake/modules/AddLLVM.cmake


Index: cmake/modules/AddLLVM.cmake
===
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1597,6 +1597,13 @@
 endif()
   endif()
 
+  if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR)
+if(APPLE)
+  set(output_name "$.dSYM")
+  set(output_path 
"-o=${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}")
+endif()
+  endif()
+
   if(APPLE)
 if(CMAKE_CXX_FLAGS MATCHES "-flto"
   OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
@@ -1609,7 +1616,7 @@
   set(CMAKE_DSYMUTIL xcrun dsymutil)
 endif()
 add_custom_command(TARGET ${name} POST_BUILD
-  COMMAND ${CMAKE_DSYMUTIL} $
+  COMMAND ${CMAKE_DSYMUTIL} ${output_path} $
   ${strip_command}
   )
   else()


Index: cmake/modules/AddLLVM.cmake
===
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1597,6 +1597,13 @@
 endif()
   endif()
 
+  if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR)
+if(APPLE)
+  set(output_name "$.dSYM")
+  set(output_path "-o=${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}")
+endif()
+  endif()
+
   if(APPLE)
 if(CMAKE_CXX_FLAGS MATCHES "-flto"
   OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
@@ -1609,7 +1616,7 @@
   set(CMAKE_DSYMUTIL xcrun dsymutil)
 endif()
 add_custom_command(TARGET ${name} POST_BUILD
-  COMMAND ${CMAKE_DSYMUTIL} $
+  COMMAND ${CMAKE_DSYMUTIL} ${output_path} $
   ${strip_command}
   )
   else()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55038: [Reproducers] Change how reproducers are initialized.

2018-11-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D55038#1314026 , @JDevlieghere 
wrote:

> Test didn't run. Is there a way to REQUIRE either darwin or linux?


I think the canonical way to do that would be to define a new feature in lit, 
which gets set when the target supports remote debugging and then use that 
feature in the REQUIRES directive.




Comment at: source/Utility/Reproducer.cpp:41-42
+Reproducer::Reproducer(ReproducerMode mode, llvm::Optional root) {
+  // It's unfortunate that we have to do so much I/O here that can fail. The
+  // best we can do is not initialize the reproducer.
+  switch (mode) {

JDevlieghere wrote:
> labath wrote:
> > It should be possible to bubble this all the way up to the 
> > `SBDebugger::Initialize` call. Is there a reason to not do that?
> Do you mean having the private Initialize function return an error (and an 
> SBError for the SB variant)?
Yes, that's what I meant. Up until now, our initialization functions were 
mostly just hooking up various pointers, which are things that can't 
(shouldn't) fail, but if now a simple typo in the reproducer path can cause the 
initialization to fail, then I think it would be good to report that.


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

https://reviews.llvm.org/D55038



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


[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2018-11-30 Thread Leonid Mashinskiy via Phabricator via lldb-commits
leonid.mashinskiy created this revision.
leonid.mashinskiy added reviewers: zturner, asmith, stella.stamenova, 
aleksandr.urakov.
leonid.mashinskiy added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, aprantl, mgorny.

This patch makes LLDB able to retrieve proper values for function arguments and 
local variables stored in PDB relative to VFRAME register.

Patch contains retrieval of corresponding FPO table entries from PDB and a 
generic translator from FPO programs to DWARF expressions to get correct VFRAME 
value.

Patch also improves variables-locations.test and makes this test passable on 
x86.

Related to D53086 


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55122

Files:
  lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
  lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
  lit/SymbolFile/PDB/variables-locations.test
  source/Plugins/SymbolFile/PDB/CMakeLists.txt
  source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.cpp
  source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.h
  source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.cpp
  source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.h
  source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
  source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -951,12 +951,25 @@
 
   Variable::RangeList ranges;
   SymbolContextScope *context_scope = sc.comp_unit;
-  if (scope == eValueTypeVariableLocal) {
+  if (scope == eValueTypeVariableLocal || scope == eValueTypeVariableArgument) {
 if (sc.function) {
-  context_scope = sc.function->GetBlock(true).FindBlockByID(
-  pdb_data.getLexicalParentId());
-  if (context_scope == nullptr)
-context_scope = sc.function;
+  Block &function_block = sc.function->GetBlock(true);
+  Block *block =
+  function_block.FindBlockByID(pdb_data.getLexicalParentId());
+  if (!block)
+block = &function_block;
+
+  context_scope = block;
+
+  for (size_t i = 0, num_ranges = block->GetNumRanges(); i < num_ranges;
+   ++i) {
+AddressRange range;
+if (!block->GetRangeAtIndex(i, range))
+  continue;
+
+ranges.Append(range.GetBaseAddress().GetFileAddress(),
+  range.GetByteSize());
+  }
 }
   }
 
@@ -969,7 +982,7 @@
 
   bool is_constant;
   DWARFExpression location = ConvertPDBLocationToDWARFExpression(
-  GetObjectFile()->GetModule(), pdb_data, is_constant);
+  GetObjectFile()->GetModule(), pdb_data, ranges, is_constant);
 
   var_sp = std::make_shared(
   var_uid, var_name.c_str(), mangled_cstr, type_sp, scope, context_scope,
Index: source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
===
--- source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
+++ source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
@@ -11,6 +11,7 @@
 #define lldb_Plugins_SymbolFile_PDB_PDBLocationToDWARFExpression_h_
 
 #include "lldb/Core/Module.h"
+#include "lldb/Symbol/Variable.h"
 
 namespace lldb_private {
 class DWARFExpression;
@@ -31,6 +32,9 @@
 /// @param[in] symbol
 /// The symbol with a location information to convert.
 ///
+/// @param[in] ranges
+/// Ranges where this variable is valid.
+///
 /// @param[out] is_constant
 /// Set to \b true if the result expression is a constant value data,
 /// and \b false if it is a DWARF bytecode.
@@ -41,5 +45,6 @@
 lldb_private::DWARFExpression
 ConvertPDBLocationToDWARFExpression(lldb::ModuleSP module,
 const llvm::pdb::PDBSymbolData &symbol,
+const lldb_private::Variable::RangeList &ranges,
 bool &is_constant);
 #endif
Index: source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
===
--- source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
+++ source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
@@ -8,488 +8,63 @@
 //===--===//
 
 #include "PDBLocationToDWARFExpression.h"
+#include "CodeViewRegisterMapping.h"
+#include "PDBFPOProgramToDWARFExpression.h"
 
 #include "lldb/Core/Section.h"
 #include "lldb/Core/StreamBuffer.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Symbol/Variable.h"
 #include "lldb/Utility/DataBufferHeap.h"
 
 #include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
 
-#include "

Re: [Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2018-11-30 Thread Zachary Turner via lldb-commits
It would be great if future work could go towards the native pdb plugin. To
be honest, I’m trying very hard to get it to the point that the DIA plugin
can be deleted, so large pieces of new functionality that only go to the
DIA plugin are, in a way, wasted effort. I’m currently working on getting
all of the tests in SymbolFile/PDB to pass with the other plugin, and there
are only 2 remaining issues, neither of which is related to the plugin but
rather clang.

So I think it’s very close.

Would it be possible to start making this transition now and reimplement
this patch on the other plugin?
On Fri, Nov 30, 2018 at 6:44 AM Leonid Mashinskiy via Phabricator <
revi...@reviews.llvm.org> wrote:

> leonid.mashinskiy created this revision.
> leonid.mashinskiy added reviewers: zturner, asmith, stella.stamenova,
> aleksandr.urakov.
> leonid.mashinskiy added a project: LLDB.
> Herald added subscribers: lldb-commits, JDevlieghere, aprantl, mgorny.
>
> This patch makes LLDB able to retrieve proper values for function
> arguments and local variables stored in PDB relative to VFRAME register.
>
> Patch contains retrieval of corresponding FPO table entries from PDB and a
> generic translator from FPO programs to DWARF expressions to get correct
> VFRAME value.
>
> Patch also improves variables-locations.test and makes this test passable
> on x86.
>
> Related to D53086 
>
>
> Repository:
>   rLLDB LLDB
>
> https://reviews.llvm.org/D55122
>
> Files:
>   lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
>   lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
>   lit/SymbolFile/PDB/variables-locations.test
>   source/Plugins/SymbolFile/PDB/CMakeLists.txt
>   source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.cpp
>   source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.h
>   source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.cpp
>   source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.h
>   source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
>   source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
>   source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55128: [CMake] Store path to vendor-specific headers in clang-headers target property

2018-11-30 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: aprantl, JDevlieghere, davide, friss, dexonsmith.
Herald added a subscriber: mgorny.

LLDB.framework wants a copy these headers. With this change LLDB can easily 
glob for the list of files:

  get_target_property(clang_include_dir clang-headers RUNTIME_OUTPUT_DIRECTORY)
  file(GLOB_RECURSE clang_vendor_headers RELATIVE ${clang_include_dir} 
"${clang_include_dir}/*")

By default `RUNTIME_OUTPUT_DIRECTORY` is unset for custom targets like 
`clang-headers`.
Not sure if there is a read&write property that matches the purpose better.

What do you think?


Repository:
  rC Clang

https://reviews.llvm.org/D55128

Files:
  lib/Headers/CMakeLists.txt


Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -144,7 +144,7 @@
   list(APPEND out_files ${dst})
 endforeach( f )
 
-add_custom_command(OUTPUT ${output_dir}/arm_neon.h 
+add_custom_command(OUTPUT ${output_dir}/arm_neon.h
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
   COMMAND ${CMAKE_COMMAND} -E copy_if_different 
${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h ${output_dir}/arm_neon.h
   COMMENT "Copying clang's arm_neon.h...")
@@ -156,7 +156,9 @@
 list(APPEND out_files ${output_dir}/arm_fp16.h)
 
 add_custom_target(clang-headers ALL DEPENDS ${out_files})
-set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
+set_target_properties(clang-headers PROPERTIES
+  FOLDER "Misc"
+  RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
 
 install(
   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h


Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -144,7 +144,7 @@
   list(APPEND out_files ${dst})
 endforeach( f )
 
-add_custom_command(OUTPUT ${output_dir}/arm_neon.h 
+add_custom_command(OUTPUT ${output_dir}/arm_neon.h
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
   COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h ${output_dir}/arm_neon.h
   COMMENT "Copying clang's arm_neon.h...")
@@ -156,7 +156,9 @@
 list(APPEND out_files ${output_dir}/arm_fp16.h)
 
 add_custom_target(clang-headers ALL DEPENDS ${out_files})
-set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
+set_target_properties(clang-headers PROPERTIES
+  FOLDER "Misc"
+  RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
 
 install(
   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55128: [CMake] Store path to vendor-specific headers in clang-headers target property

2018-11-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.

This makes sense to me. I'm don't know if there's a better property but I think 
this matches the intended use, so I think it is fine.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55128



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


Re: [Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2018-11-30 Thread Aleksandr Urakov via lldb-commits
Ah, it looks like my fail. I had an old piece of code, which retrieves an
FPO program for the old PDB plugin, and have shared it with Leonid (we are
colleagues). Sure, we will move this to the new plugin (and it looks like
it's not so difficult).

Am Fr., 30. Nov. 2018, 18:39 hat Zachary Turner 
geschrieben:

> It would be great if future work could go towards the native pdb plugin.
> To be honest, I’m trying very hard to get it to the point that the DIA
> plugin can be deleted, so large pieces of new functionality that only go to
> the DIA plugin are, in a way, wasted effort. I’m currently working on
> getting all of the tests in SymbolFile/PDB to pass with the other plugin,
> and there are only 2 remaining issues, neither of which is related to the
> plugin but rather clang.
>
> So I think it’s very close.
>
> Would it be possible to start making this transition now and reimplement
> this patch on the other plugin?
> On Fri, Nov 30, 2018 at 6:44 AM Leonid Mashinskiy via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> leonid.mashinskiy created this revision.
>> leonid.mashinskiy added reviewers: zturner, asmith, stella.stamenova,
>> aleksandr.urakov.
>> leonid.mashinskiy added a project: LLDB.
>> Herald added subscribers: lldb-commits, JDevlieghere, aprantl, mgorny.
>>
>> This patch makes LLDB able to retrieve proper values for function
>> arguments and local variables stored in PDB relative to VFRAME register.
>>
>> Patch contains retrieval of corresponding FPO table entries from PDB and
>> a generic translator from FPO programs to DWARF expressions to get correct
>> VFRAME value.
>>
>> Patch also improves variables-locations.test and makes this test passable
>> on x86.
>>
>> Related to D53086 
>>
>>
>> Repository:
>>   rLLDB LLDB
>>
>> https://reviews.llvm.org/D55122
>>
>> Files:
>>   lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
>>   lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
>>   lit/SymbolFile/PDB/variables-locations.test
>>   source/Plugins/SymbolFile/PDB/CMakeLists.txt
>>   source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.cpp
>>   source/Plugins/SymbolFile/PDB/CodeViewRegisterMapping.h
>>   source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.cpp
>>   source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.h
>>   source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
>>   source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
>>   source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

2018-11-30 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

It looks like after this change went in, the tests on Windows starting timing 
out instead of completing. The last run before the change took about 2 minutes 
and starting with the first run with this change, they're running for 40 
minutes before being killed:

After:
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1774

Before:
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1773

Can you fix this today or pull the change out?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D53759



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


[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2018-11-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like how you've separated out the conversion function doing the actual 
conversion. That should make it easy to write unit tests for it (including 
tests for malformed input). Can you add something like that? I am particularly 
interested in what will the merging code do when it encounters reference loops.

However, I find the usage of shared_ptr in the parsing code overkill. Surely we 
can come up with something better when the lifetime of all of the objects is 
local to the translation function. I think the most llvm-y solution would be to 
use a BumpPtrAllocator to create all nodes, and then just dispose of that when 
the function returns. (this assumes the nodes are trivially destructible, which 
it looks like they will be after they stop storing shared_ptrs).




Comment at: source/Plugins/SymbolFile/PDB/PDBFPOProgramToDWARFExpression.cpp:203
+private:
+  const std::map &m_dependent_programs;
+};

use `llvm::DenseMap` ?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55122



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


Re: [Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

2018-11-30 Thread Aleksandr Urakov via lldb-commits
I'm already OOO today, feel free to revert it.

Am Fr., 30. Nov. 2018, 20:15 hat Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> geschrieben:

> stella.stamenova added a comment.
>
> It looks like after this change went in, the tests on Windows starting
> timing out instead of completing. The last run before the change took about
> 2 minutes and starting with the first run with this change, they're running
> for 40 minutes before being killed:
>
> After:
> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1774
>
> Before:
> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1773
>
> Can you fix this today or pull the change out?
>
>
> Repository:
>   rL LLVM
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D53759/new/
>
> https://reviews.llvm.org/D53759
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r348009 - Revert "[PDB] Support PDB-backed expressions evaluation"

2018-11-30 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Fri Nov 30 09:29:54 2018
New Revision: 348009

URL: http://llvm.org/viewvc/llvm-project?rev=348009&view=rev
Log:
Revert "[PDB] Support PDB-backed expressions evaluation"

This reverts commit dec87759523b2f22fcff3325bc2cd543e4cda0e7.

This commit caused the tests on Windows to run forever rather than complete.
Reverting until the commit can be fixed to not stall.

Removed:
lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp
lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script
lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script
lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script
lldb/trunk/lit/SymbolFile/PDB/expressions.test
Modified:
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp?rev=348008&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp (removed)
@@ -1,20 +0,0 @@
-namespace N0 {
-namespace N1 {
-
-char *buf0 = nullptr;
-char buf1[] = {0, 1, 2, 3, 4, 5, 6, 7};
-
-char sum(char *buf, int size) {
-  char result = 0;
-  for (int i = 0; i < size; i++)
-result += buf[i];
-  return result;
-}
-
-} // namespace N1
-} // namespace N0
-
-int main() {
-  char result = N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1));
-  return 0;
-}

Removed: lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script?rev=348008&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script (removed)
@@ -1,7 +0,0 @@
-breakpoint set --file ExpressionsTest.cpp --line 19
-run
-print result
-print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
-print N1::sum(N1::buf1, sizeof(N1::buf1))
-print sum(buf1, sizeof(buf1))
-print sum(buf1, 10)

Removed: lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script?rev=348008&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script (removed)
@@ -1 +0,0 @@
-print sum(buf0, 1)

Removed: lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script?rev=348008&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script (removed)
@@ -1,2 +0,0 @@
-print sum(buf0, result - 28)
-print sum(buf1 + 3, 3)

Removed: lldb/trunk/lit/SymbolFile/PDB/expressions.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/expressions.test?rev=348008&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/expressions.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/expressions.test (removed)
@@ -1,36 +0,0 @@
-REQUIRES: system-windows, msvc
-RUN: %msvc_cl /Zi /GS- /c %S/Inputs/ExpressionsTest.cpp /Fo%t.obj
-RUN: %msvc_link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
-RUN: %lldb -b -s %S/Inputs/ExpressionsTest0.script -s 
%S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- 
%t.exe 2>&1 | FileCheck %s
-
-// Check the variable value through `print`
-CHECK: (lldb) print result
-CHECK: (char) $0 = '\x1c'
-
-// Call the function just like in the code
-CHECK: (lldb) print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
-CHECK: (char) $1 = '\x1c'
-
-// Try the relaxed namespaces search
-CHECK: (lldb) print N1::sum(N1::buf1, sizeof(N1::buf1))
-CHECK: (char) $2 = '\x1c'
-
-// Try the relaxed variables and functions search
-CHECK: (lldb) print sum(buf1, sizeof(buf1))
-CHECK: (char) $3 = '\x1c'
-
-// Make a crash during expression calculation
-CHECK: (lldb) print sum(buf1, 10)
-CHECK: The process has been returned to the state before expression evaluation.
-
-// Make one

[Lldb-commits] [lldb] r348010 - Skip TestRequireHWBreakpoints on Windows

2018-11-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Nov 30 09:31:20 2018
New Revision: 348010

URL: http://llvm.org/viewvc/llvm-project?rev=348010&view=rev
Log:
Skip TestRequireHWBreakpoints on Windows

The test assumes that HW breakpoints are not implemented by the debug
server. Windows doesn't use these and might actually support HW
breakpoints so these tests are expected fail because they don't raise
the expected error.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py?rev=348010&r1=348009&r2=348010&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
 Fri Nov 30 09:31:20 2018
@@ -27,6 +27,7 @@ class BreakpointLocationsTestCase(TestBa
 breakpoint = target.BreakpointCreateByLocation("main.c", 1)
 self.assertTrue(breakpoint.IsHardware())
 
+@skipIfWindows
 def test_step_range(self):
 """Test stepping when hardware breakpoints are required."""
 self.build()
@@ -47,6 +48,7 @@ class BreakpointLocationsTestCase(TestBa
 self.assertTrue("Could not create hardware breakpoint for thread plan"
 in error.GetCString())
 
+@skipIfWindows
 def test_step_out(self):
 """Test stepping out when hardware breakpoints are required."""
 self.build()
@@ -66,6 +68,7 @@ class BreakpointLocationsTestCase(TestBa
 self.assertTrue("Could not create hardware breakpoint for thread plan"
 in error.GetCString())
 
+@skipIfWindows
 def test_step_over(self):
 """Test stepping over when hardware breakpoints are required."""
 self.build()
@@ -84,6 +87,7 @@ class BreakpointLocationsTestCase(TestBa
 'Could not create hardware breakpoint for thread plan'
 ])
 
+@skipIfWindows
 def test_step_until(self):
 """Test stepping until when hardware breakpoints are required."""
 self.build()


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


Re: [Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

2018-11-30 Thread Stella Stamenova via lldb-commits
I reverted it. Thanks.

From: Aleksandr Urakov 
Sent: Friday, November 30, 2018 9:25 AM
To: reviews+d53759+public+b214dcdd73261...@reviews.llvm.org
Cc: Zachary Turner ; aaron.lee.smith 
; Stella Stamenova ; 
llvm-comm...@lists.llvm.org; pa...@labath.sk; 15dacaoy...@gmail.com; 
apra...@apple.com; jdevliegh...@apple.com; teempe...@gmail.com; 
lldb-commits@lists.llvm.org; sani...@subpath.org; chi...@raincode.com; 
b.gia...@gmail.com
Subject: Re: [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

I'm already OOO today, feel free to revert it.

Am Fr., 30. Nov. 2018, 20:15 hat Stella Stamenova via Phabricator 
mailto:revi...@reviews.llvm.org>> geschrieben:
stella.stamenova added a comment.

It looks like after this change went in, the tests on Windows starting timing 
out instead of completing. The last run before the change took about 2 minutes 
and starting with the first run with this change, they're running for 40 
minutes before being killed:

After:
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1774

Before:
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1773

Can you fix this today or pull the change out?


Repository:
rL LLVM

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

https://reviews.llvm.org/D53759


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


[Lldb-commits] [PATCH] D55114: [CMake] Add LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR for custom dSYM target directory on Darwin

2018-11-30 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Looks reasonable, thanks!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55114



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


[Lldb-commits] [PATCH] D55038: [Reproducers] Change how reproducers are initialized.

2018-11-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 176161.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

Make initialize return an error.


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

https://reviews.llvm.org/D55038

Files:
  include/lldb/API/SBDebugger.h
  include/lldb/API/SBDefines.h
  include/lldb/API/SBFileSpec.h
  include/lldb/API/SBInitializerOptions.h
  include/lldb/Core/Debugger.h
  include/lldb/Host/HostInfoBase.h
  include/lldb/Initialization/SystemInitializer.h
  include/lldb/Initialization/SystemInitializerCommon.h
  include/lldb/Initialization/SystemLifetimeManager.h
  include/lldb/Utility/Reproducer.h
  lit/Reproducer/Inputs/GDBRemoteCapture.in
  lit/Reproducer/Inputs/GDBRemoteReplay.in
  lit/Reproducer/Inputs/simple.c
  lit/Reproducer/TestDriverOptions.test
  lit/Reproducer/TestGDBRemoteRepro.test
  packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/Makefile
  
packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/TestGdbRemoteReproducer.py
  scripts/interface/SBDebugger.i
  scripts/interface/SBInitializerOptions.i
  scripts/lldb.swig
  source/API/CMakeLists.txt
  source/API/SBDebugger.cpp
  source/API/SBInitializerOptions.cpp
  source/API/SystemInitializerFull.cpp
  source/API/SystemInitializerFull.h
  source/Commands/CommandObjectReproducer.cpp
  source/Core/Debugger.cpp
  source/Host/common/HostInfoBase.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Initialization/SystemLifetimeManager.cpp
  source/Utility/Reproducer.cpp
  tools/driver/Driver.cpp
  tools/driver/Options.td
  tools/lldb-server/SystemInitializerLLGS.cpp
  tools/lldb-server/SystemInitializerLLGS.h
  tools/lldb-server/lldb-server.cpp
  tools/lldb-test/SystemInitializerTest.cpp
  tools/lldb-test/SystemInitializerTest.h
  tools/lldb-test/lldb-test.cpp
  unittests/Utility/ReproducerTest.cpp

Index: unittests/Utility/ReproducerTest.cpp
===
--- unittests/Utility/ReproducerTest.cpp
+++ unittests/Utility/ReproducerTest.cpp
@@ -32,10 +32,18 @@
   static char ID;
 };
 
+class DummyReproducer : public Reproducer {
+public:
+  DummyReproducer() : Reproducer(){};
+
+  using Reproducer::SetCapture;
+  using Reproducer::SetReplay;
+};
+
 char DummyProvider::ID = 0;
 
 TEST(ReproducerTest, SetCapture) {
-  Reproducer reproducer;
+  DummyReproducer reproducer;
 
   // Initially both generator and loader are unset.
   EXPECT_EQ(nullptr, reproducer.GetGenerator());
@@ -59,7 +67,7 @@
 }
 
 TEST(ReproducerTest, SetReplay) {
-  Reproducer reproducer;
+  DummyReproducer reproducer;
 
   // Initially both generator and loader are unset.
   EXPECT_EQ(nullptr, reproducer.GetGenerator());
@@ -80,7 +88,7 @@
 }
 
 TEST(GeneratorTest, Create) {
-  Reproducer reproducer;
+  DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
 Succeeded());
@@ -95,7 +103,7 @@
 }
 
 TEST(GeneratorTest, Get) {
-  Reproducer reproducer;
+  DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
 Succeeded());
@@ -109,7 +117,7 @@
 }
 
 TEST(GeneratorTest, GetOrCreate) {
-  Reproducer reproducer;
+  DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
 Succeeded());
Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -934,7 +934,7 @@
   cl::ParseCommandLineOptions(argc, argv, "LLDB Testing Utility\n");
 
   SystemLifetimeManager DebuggerLifetime;
-  DebuggerLifetime.Initialize(llvm::make_unique(),
+  DebuggerLifetime.Initialize(llvm::make_unique(), {},
   nullptr);
   CleanUp TerminateDebugger([&] { DebuggerLifetime.Terminate(); });
 
Index: tools/lldb-test/SystemInitializerTest.h
===
--- tools/lldb-test/SystemInitializerTest.h
+++ tools/lldb-test/SystemInitializerTest.h
@@ -26,7 +26,7 @@
   SystemInitializerTest();
   ~SystemInitializerTest() override;
 
-  void Initialize() override;
+  llvm::Error Initialize(const InitializerOptions &options) override;
   void Terminate() override;
 };
 
Index: tools/lldb-test/SystemInitializerTest.cpp
===
--- tools/lldb-test/SystemInitializerTest.cpp
+++ tools/lldb-test/SystemInitializerTest.cpp
@@ -111,8 +111,10 @@
 
 SystemInitializerTest::~SystemInitializerTest() {}
 
-void SystemInitializerTest::Initialize() {
-  SystemInitializerCommon::Initialize();
+llvm::Error
+SystemInitializerTest::Initialize(const InitializerOptions &options) {
+  if (auto e = SystemInitializerCommon::Initialize(options))
+return e;
 
   ObjectFileELF::Initialize();
   ObjectFileMachO::Initialize();
@@ -231,6 +233,8 @@
   // AFTER Plug

[Lldb-commits] [PATCH] D55038: [Reproducers] Change how reproducers are initialized.

2018-11-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D55038#1314336 , @labath wrote:

> In D55038#1314026 , @JDevlieghere 
> wrote:
>
> > Test didn't run. Is there a way to REQUIRE either darwin or linux?
>
>
> I think the canonical way to do that would be to define a new feature in lit, 
> which gets set when the target supports remote debugging and then use that 
> feature in the REQUIRES directive.


I've changed the check to non-windows (as it wouldn't compile there anyway). Is 
there anything not covered by this that would warrant this new feature?


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

https://reviews.llvm.org/D55038



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


[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2018-11-30 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo created this revision.
lemo added reviewers: labath, zturner, amccarth.
lemo added a project: LLDB.
Herald added subscribers: jfb, abidh, arphaman.

A few changes required to enable the use of the native PDB reader when 
debugging minidumps:

1. Consume PDBs even if the module binary is not available Implementing a 
PlaceholderObjectFile to complement the existing PlaceholderModule

2. Use the minidump exception record if present

3. Relax the PDB file search As noted in the comments this is a stop-gap until 
we add a proper SymbolVendor

Overall this is a modest step towards improving the minidump debugging 
experience. But more importantly,
it enables the basic consumption of PDBs using the NativePDB(TM) reader as a 
foundation to add more functionality incrementally.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55142

Files:
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
  source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
  source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
  source/Plugins/SymbolFile/NativePDB/PdbIndex.h
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Index: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -30,6 +30,7 @@
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Utility/UUID.h"
 
 #include "llvm/DebugInfo/CodeView/CVRecord.h"
 #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
@@ -102,33 +103,53 @@
 }
 
 static std::unique_ptr
-loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
-  // Try to find a matching PDB for an EXE.
+loadMatchingPDBFile(lldb_private::ObjectFile *obj_file,
+llvm::BumpPtrAllocator &allocator) {
   using namespace llvm::object;
-  auto expected_binary = createBinary(exe_path);
 
-  // If the file isn't a PE/COFF executable, fail.
-  if (!expected_binary) {
-llvm::consumeError(expected_binary.takeError());
-return nullptr;
-  }
-  OwningBinary binary = std::move(*expected_binary);
+  // Try to find a matching PDB for an EXE.
+  std::string pdb_file;
+  llvm::codeview::GUID guid;
 
-  auto *obj = llvm::dyn_cast(binary.getBinary());
-  if (!obj)
-return nullptr;
-  const llvm::codeview::DebugInfo *pdb_info = nullptr;
+  auto expected_binary = createBinary(obj_file->GetFileSpec().GetPath());
+  if (expected_binary) {
+OwningBinary binary = std::move(*expected_binary);
 
-  // If it doesn't have a debug directory, fail.
-  llvm::StringRef pdb_file;
-  auto ec = obj->getDebugPDBInfo(pdb_info, pdb_file);
-  if (ec)
-return nullptr;
+auto *obj = llvm::dyn_cast(binary.getBinary());
+if (!obj)
+  return nullptr;
+const llvm::codeview::DebugInfo *pdb_info = nullptr;
+
+// If it doesn't have a debug directory, fail.
+llvm::StringRef pdb_file_name_ref;
+if (obj->getDebugPDBInfo(pdb_info, pdb_file_name_ref))
+  return nullptr;
+pdb_file = pdb_file_name_ref;
+
+// Extract the debug GUID from the debug directory
+memcpy(&guid, pdb_info->PDB70.Signature, sizeof(guid));
+  } else {
+// TODO: If the file isn't a PE/COFF executable, look for the PDB in the
+//  current directly. This provides a basic solution for debugging minidumps
+//  although it's only a stop-gap until we implement a proper SymbolVendor
+//  for PDBs.
+llvm::consumeError(expected_binary.takeError());
+pdb_file =
+obj_file->GetFileSpec().GetFileNameStrippingExtension().GetCString();
+pdb_file += ".pdb";
+
+// Extract the debug GUID from the ObjectFile
+lldb_private::UUID uuid;
+obj_file->GetUUID(&uuid);
+auto uuid_bytes = uuid.GetBytes();
+lldbassert(uuid_bytes.size() == sizeof(llvm::codeview::GUID) + 4);
+memcpy(&guid, uuid_bytes.data(), sizeof(guid));
+  }
 
   // if the file doesn't exist, is not a pdb, or doesn't have a matching guid,
   // fail.
   llvm::file_magic magic;
-  ec = llvm::identify_magic(pdb_file, magic);
+  auto ec = llvm::identify_magic(pdb_file, magic);
   if (ec || magic != llvm::file_magic::pdb)
 return nullptr;
   std::unique_ptr pdb = loadPDBFile(pdb_file, allocator);
@@ -140,11 +161,11 @@
 llvm::consumeError(expected_info.takeError());
 return nullptr;
   }
-  llvm::codeview::GUID guid;
-  memcpy(&guid, pdb_info->PDB70.Signature, 16);
 
+  // TODO: we need to compare the age, in addition to the GUID
   if (expected_info->getGuid() != guid)
 return nullptr;
+
   return pdb;
 }
 
@@ -521,7 +542,7 @@
   if (!m_index) {
 // Lazily load and match the PDB file, but only do this once.
 std::unique_ptr file_up =
-   

[Lldb-commits] [lldb] r348040 - Add a test to verify that lldb can load a kext binary.

2018-11-30 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Nov 30 13:33:00 2018
New Revision: 348040

URL: http://llvm.org/viewvc/llvm-project?rev=348040&view=rev
Log:
Add a test to verify that lldb can load a kext binary.

 

Added:
lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/
lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py
lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml

Added: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py?rev=348040&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py 
Fri Nov 30 13:33:00 2018
@@ -0,0 +1,38 @@
+"""
+Test loading of a kext binary.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LoadKextTestCase(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+#super(LoadKextTestCase, self).setUp()
+#self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def test_load_kext(self):
+"""Test that lldb can load a kext binary."""
+
+# Create kext from YAML.
+self.yaml2obj("mykext.yaml", self.getBuildArtifact("mykext"))
+
+target = self.dbg.CreateTarget(self.getBuildArtifact("mykext"))
+
+self.assertTrue(target.IsValid())
+
+self.assertEqual(target.GetNumModules(), 1)
+mod = target.GetModuleAtIndex(0)
+self.assertEqual(mod.GetFileSpec().GetFilename(), "mykext")

Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml?rev=348040&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml Fri 
Nov 30 13:33:00 2018
@@ -0,0 +1,222 @@
+--- !mach-o
+FileHeader:  
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x000B
+  ncmds:   7
+  sizeofcmds:  520
+  flags:   0x0085
+  reserved:0x
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 152
+segname: __TEXT
+vmaddr:  0
+vmsize:  4096
+fileoff: 0
+filesize:4096
+maxprot: 7
+initprot:5
+nsects:  1
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x0F60
+size:158
+offset:  0x0F60
+align:   4
+reloff:  0x
+nreloc:  0
+flags:   0x8400
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - cmd: LC_SEGMENT_64
+cmdsize: 152
+segname: __DATA
+vmaddr:  4096
+vmsize:  4096
+fileoff: 4096
+filesize:4096
+maxprot: 7
+initprot:3
+nsects:  1
+flags:   0
+Sections:
+  - sectname:__data
+segname: __DATA
+addr:0x1000
+size:220
+offset:  0x1000
+align:   3
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __LINKEDIT
+vmaddr:  8192
+vmsize:  4096
+fileoff: 8192
+filesize:800
+maxprot: 7
+initprot:1
+nsects:  0
+flags:   0
+  - cmd: LC_SYMTAB
+cmdsize: 24
+symoff:  8224
+nsyms:   19
+stroff:  8528
+strsize: 464
+  - cmd: LC_DYSYMTAB
+cmdsize: 80
+ilocalsym:   0
+nlocalsym:   16
+iextdefsym:  16
+nextdefsym:  3
+iundefsym:   19
+nundefsym:   0
+tocoff:  0
+ntoc:0
+modtaboff:   0
+nmodtab: 0
+extrefsymoff:0
+nextrefsyms:   

[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2018-11-30 Thread Rui Ueyama via Phabricator via lldb-commits
ruiu added a comment.

But 2GB is perhaps still too big and I guess a large part of it can be for dead 
sections. If we fix this, I'd like to fix it in a proper way so that we can 
completely eliminate debug info for dead sections.

rocallahan, can I ask why Rust passes all object files to the linker and use 
`-gc-sections` to eliminate unused part of these files?

One possible way to fix it is to pass `--start-lib` to the linker before any 
object file paths in the command line. That option gives archive file semantics 
to object files, so if you option, each object file is treated as if that were 
in an archive file containing that the single object file. (Note that 
`--start-lib` is a positional option just like `--start-group`, so all files 
between `--start-lib` and `--end-lib` get that special treament.)


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [lldb] r348055 - [windows] Fix two minor bugs on Windows

2018-11-30 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Fri Nov 30 16:18:19 2018
New Revision: 348055

URL: http://llvm.org/viewvc/llvm-project?rev=348055&view=rev
Log:
[windows] Fix two minor bugs on Windows

1. In ProcessWindows if we fail to allocate memory, we need to return 
LLDB_INVALID_ADDRESS rather than 0 or nullptr as that is the invalid address 
that LLDB looks for
2. In RegisterContextWindows in ReadAllRegisterValues, always create a new 
buffer. This is what the other platforms do and data_sp is always null in all 
tested scenarios on Windows as well

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=348055&r1=348054&r2=348055&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Fri Nov 
30 16:18:19 2018
@@ -722,7 +722,7 @@ lldb::addr_t ProcessWindows::DoAllocateM
 LLDB_LOG(log, "cannot allocate, there is no active debugger connection.");
 error.SetErrorString(
 "cannot allocate, there is no active debugger connection");
-return 0;
+return LLDB_INVALID_ADDRESS;
   }
 
   HostProcess process = m_session_data->m_debugger->GetProcess();
@@ -732,7 +732,7 @@ lldb::addr_t ProcessWindows::DoAllocateM
   if (!result) {
 error.SetError(GetLastError(), eErrorTypeWin32);
 LLDB_LOG(log, "allocating failed with error: {0}", error);
-return 0;
+return LLDB_INVALID_ADDRESS;
   }
 
   return reinterpret_cast(result);

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp?rev=348055&r1=348054&r2=348055&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp 
Fri Nov 30 16:18:19 2018
@@ -40,12 +40,13 @@ void RegisterContextWindows::InvalidateA
 
 bool RegisterContextWindows::ReadAllRegisterValues(
 lldb::DataBufferSP &data_sp) {
+
   if (!CacheAllRegisterValues())
 return false;
-  if (data_sp->GetByteSize() < sizeof(m_context)) {
-data_sp.reset(new DataBufferHeap(sizeof(CONTEXT), 0));
-  }
+
+  data_sp.reset(new DataBufferHeap(sizeof(CONTEXT), 0));
   memcpy(data_sp->GetBytes(), &m_context, sizeof(m_context));
+
   return true;
 }
 


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


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-30 Thread Zachary Turner 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 rLLDB348058: [lit] Add a generic build script with a lit 
substitution. (authored by zturner, committed by ).
Herald added a subscriber: teemperor.

Changed prior to commit:
  https://reviews.llvm.org/D54914?vs=175561&id=176223#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54914

Files:
  lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lit/SymbolFile/NativePDB/bitfields.cpp
  lit/SymbolFile/NativePDB/disassembly.cpp
  lit/SymbolFile/NativePDB/function-types-builtins.cpp
  lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lit/SymbolFile/NativePDB/function-types-classes.cpp
  lit/SymbolFile/NativePDB/global-classes.cpp
  lit/SymbolFile/NativePDB/globals-bss.cpp
  lit/SymbolFile/NativePDB/globals-fundamental.cpp
  lit/SymbolFile/NativePDB/nested-types.cpp
  lit/SymbolFile/NativePDB/s_constant.cpp
  lit/SymbolFile/NativePDB/simple-breakpoints.cpp
  lit/SymbolFile/NativePDB/source-list.cpp
  lit/SymbolFile/NativePDB/tag-types.cpp
  lit/helper/build.py
  lit/helper/toolchain.py

Index: lit/SymbolFile/NativePDB/function-types-classes.cpp
===
--- lit/SymbolFile/NativePDB/function-types-classes.cpp
+++ lit/SymbolFile/NativePDB/function-types-classes.cpp
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can display function signatures with class types.
-// RUN: %clang_cl /Z7 /GS- /GR- /c -fstandalone-debug -Xclang -fkeep-static-consts /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/function-types-classes.lldbinit | FileCheck %s
 
Index: lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
===
--- lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
+++ lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
@@ -1,8 +1,7 @@
 // clang-format off
 // REQUIRES: lld
 
-// RUN: %clang_cl -m32 /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
+// RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s
 
Index: lit/SymbolFile/NativePDB/globals-fundamental.cpp
===
--- lit/SymbolFile/NativePDB/globals-fundamental.cpp
+++ lit/SymbolFile/NativePDB/globals-fundamental.cpp
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/globals-fundamental.lldbinit | FileCheck %s
 
Index: lit/SymbolFile/NativePDB/disassembly.cpp
===
--- lit/SymbolFile/NativePDB/disassembly.cpp
+++ lit/SymbolFile/NativePDB/disassembly.cpp
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can show disassembly and source.
-// RUN: %clang_cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
 
@@ -19,21 +18,21 @@
 
 
 // CHECK:  (lldb) disassemble --flavor=intel -m -n main
-// CHECK: 13   int foo() { return 42; }
-// CHECK-NEXT:14
-// CHECK-NEXT: ** 15   int main(int argc, char **argv) {
+// CHECK: 12   int foo() { return 42; }
+// CHECK-NEXT:13
+// CHECK-NEXT: ** 14   int main(int argc, char **argv) {
 // CHECK:  disassembly.cpp.tmp.exe`main:
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>:  subrsp, 0x38
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>:  movdword ptr [rsp + 0x34], 0x0
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+12>: movqword ptr [rsp + 0x28], rdx
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+17>: movdword ptr [rsp + 0x24], ecx
-// CHECK:  ** 16 foo();
-// CHECK:  disassembly.cpp.tmp.exe[{{.*}}] <+21>: call   {{.*}}   ; foo at disassembly.cpp:13
+// CHECK:  ** 15 foo();
+// CHECK:  disassembly.cpp.tmp.exe[{{.*}}] <+21>: call   {{.*}}   ; foo at disassembly.cpp:12
 /

[Lldb-commits] [lldb] r348058 - [lit] Add a generic build script with a lit substitution.

2018-11-30 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov 30 16:22:21 2018
New Revision: 348058

URL: http://llvm.org/viewvc/llvm-project?rev=348058&view=rev
Log:
[lit] Add a generic build script with a lit substitution.

This adds a script called build.py as well as a lit substitution
called %build that we can use to invoke it.  The idea is that
this allows a lit test to build test inferiors without having
to worry about architecture / platform specific differences,
command line syntax, finding / configurationg a proper toolchain,
and other issues.  They can simply write something like:

%build --arch=32 -o %t.exe %p/Inputs/foo.cpp

and it will just work.  This paves the way for being able to
run lit tests with multiple configurations, platforms, and
compilers with a single test.

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

Added:
lldb/trunk/lit/helper/build.py
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp
lldb/trunk/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp
lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp
lldb/trunk/lit/SymbolFile/NativePDB/s_constant.cpp
lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp
lldb/trunk/lit/helper/toolchain.py

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=348058&r1=348057&r2=348058&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov 30 
16:22:21 2018
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test various interesting cases for AST reconstruction.
-// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-reconstruction.lldbinit 2>&1 | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp?rev=348058&r1=348057&r2=348058&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp Fri Nov 30 16:22:21 2018
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test various interesting cases for AST reconstruction.
-// RUN: %clang_cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c 
/Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=348058&r1=348057&r2=348058&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Nov 30 16:22:21 2018
@@ -2,8 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can show disassembly and source.
-// RUN: %clang_cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
 
@@ -19,21 +18,21 @@ int main(int argc, char **argv) {
 
 
 // CHECK:  (lldb) disassemble --flavor=intel -m -n main
-// CHECK: 13   int foo() { return 42; }
-// CHECK-NEXT:14
-// CHECK-NEXT: ** 15   int main(int argc, char **argv) {
+// CHECK: 12   int foo() { return 42; }
+// CHECK-NEXT:13
+// CHECK-NEXT: ** 14   int main(int argc, char **argv) {
 // CHECK:  disassembly.cpp.tmp.exe`main:
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>:  subrsp, 0x38
 // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>:  movdword ptr [rsp + 
0x34], 0x0
 // CHECK-NEXT: disassembly.cpp

[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2018-11-30 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

This looks good to me, save for a couple comment nits.




Comment at: source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp:155
+//
+// TODO: revisit this check since it fires for apparently valid PDBs
+//

Every apparently valid PDB or certain ones?  If it's particular ones, then 
perhaps we should create a bug report with a repro to make it easier to 
investigate in the future.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:133
+// TODO: If the file isn't a PE/COFF executable, look for the PDB in the
+//  current directly. This provides a basic solution for debugging 
minidumps
+//  although it's only a stop-gap until we implement a proper SymbolVendor

Did you mean "directory" instead of "directly"?

Also, this is worded as a TODO, but it describes the current situation.  
Describing the current situation is fine, but I'd like the TODO to more clearly 
say what's do be done.  I gather that's "implement a proper SymbolVendor."


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55142



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


[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2018-11-30 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:60
+  void Dump(Stream *s) override { *s << "PlaceholderObjectFile\n"; }
+  uint32_t GetAddressByteSize() const override { return 0; }
+  uint32_t GetDependentModules(FileSpecList &file_list) override { return 0; }

Should we return something valid for this function?



Comment at: source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h:92
+
+  bool HasIndexForModule(uint16_t modi) const;
 };

This method name is a little bit confusing.  Is it referring to a numeric index 
like 1, 2, 3, 4, 5.  Or a `CompilandIndexItem`?  I would call this something 
like `HasCompilandInfo(uint16_t modi)`



Comment at: source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp:132-135
+if (so.segment == 0) {
+  lldbassert(so.offset == 0);
+  continue;
+}

What kind of symbols have a segment and offset of 0?



Comment at: source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp:150-157
 // The odds of an error in some function such as GetSegmentAndOffset or
 // MakeVirtualAddress are much higher than the odds of encountering bad
 // debug info, so assert that this item was inserted in the map as opposed
 // to having already been there.
-lldbassert(insert_result.second);
+//
+// TODO: revisit this check since it fires for apparently valid PDBs
+//

If we're going to comment it out, then just delete the code IMO.

Do you have some llvm-pdbutil output that demonstrates this on a valid PDB?  I 
guess we'd be looking for 2 symbols with the same Virtual Address.  Seems odd 
to have that, but maybe an example of where it's happening would make it clear 
whether this is actually a valid case.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:106
 static std::unique_ptr
-loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
-  // Try to find a matching PDB for an EXE.
+loadMatchingPDBFile(lldb_private::ObjectFile *obj_file,
+llvm::BumpPtrAllocator &allocator) {

Perhaps `obj_file` should be a reference just to clarify that it can't be null.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:114-115
 
-  auto *obj = llvm::dyn_cast(binary.getBinary());
-  if (!obj)
-return nullptr;
-  const llvm::codeview::DebugInfo *pdb_info = nullptr;
+  auto expected_binary = createBinary(obj_file->GetFileSpec().GetPath());
+  if (expected_binary) {
+OwningBinary binary = std::move(*expected_binary);

Instead of trying to load it as a PE/COFF fail and then trying something else 
if it fails (hoping that it's a minidump), perhaps we could use 
`llvm::identify_magic()` to figure out what it is actually is first.  That 
function currently cannot detect a Windows minidump, but we coudl teach it to 
support that.  I think that would make this code more logical.  

```
if (type == exe) {
} else if (type == minidump) {
} else {
  // actual error
}
```


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55142



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