[Lldb-commits] [lldb] r332922 - Work around some odd instruction single-step behavior on macOS.

2018-05-21 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon May 21 17:06:55 2018
New Revision: 332922

URL: http://llvm.org/viewvc/llvm-project?rev=332922=rev
Log:
Work around some odd instruction single-step behavior on macOS.

We've seen some cases on macOS where you go to instruction single
step (over a breakpoint), and single step returns but the instruction
hasn't been executed (and the pc hasn't moved.)  The 
ThreadPlanStepOverBreakpoint
used to handle this case by accident, but the patches to handle two adjacent
breakpoints broke that accident.

This patch fixes the logic of ExplainsStop to explicitly handle the case where
the pc didn't move.  It also adds a WillPop that re-enables the breakpoint we
were stepping over.  We never want an unexpected path through the plan to
fool us into not doing that.

I have no idea how to make this bug happen.  It is very inconsistent when it
occurs IRL.  We really need a full MockProcess Plugin before we can start to 
write
tests for this sort of system hiccup.



Modified:
lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h?rev=332922=332921=332922=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h Mon May 21 
17:06:55 2018
@@ -31,6 +31,7 @@ public:
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
   bool WillStop() override;
+  void WillPop() override;
   bool MischiefManaged() override;
   void ThreadDestroyed() override;
   void SetAutoContinue(bool do_it);

Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme?rev=332922=332921=332922=diff
==
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme Mon May 
21 17:06:55 2018
@@ -26,10 +26,18 @@
   buildConfiguration = "Debug"
   selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
   selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-  language = ""
   shouldUseLaunchSchemeArgsEnv = "YES">
   
   
+  
+ 
+ 
+  
   
   

@@ -37,22 +45,22 @@
   buildConfiguration = "DebugClang"
   selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
   selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-  language = ""
-  launchStyle = "0"
+  launchStyle = "1"
   useCustomWorkingDirectory = "NO"
   ignoresPersistentStateOnLaunch = "NO"
   debugDocumentVersioning = "YES"
   debugServiceExtension = "internal"
   allowLocationSimulation = "YES">
-  
+  
  
  
-  
+  
   
   


Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=332922=332921=332922=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Mon May 21 
17:06:55 2018
@@ -68,27 +68,47 @@ bool ThreadPlanStepOverBreakpoint::DoPla
 // next instruction also contained a breakpoint.
 StopReason reason = stop_info_sp->GetStopReason();
 
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+
+if (log)
+  log->Printf("Step over breakpoint stopped for reason: %s.", 
+  Thread::StopReasonAsCString(reason));
+  
 switch (reason) {
-case eStopReasonTrace:
-case eStopReasonNone:
-  return true;
-case eStopReasonBreakpoint:
-  // It's a little surprising that we stop here for a breakpoint hit.
-  // However, when you single step ONTO a breakpoint we still want to call
-  // that a breakpoint hit, and trigger the actions, etc.  Otherwise you
-  // would see the PC at the breakpoint without having triggered the
-  // actions, then you'd continue, the PC wouldn't change, and you'd see
-  // the breakpoint hit, which would be odd. So the lower levels fake "step
-  // onto breakpoint address" and return that as a breakpoint hit.  So our
-  // trace step COULD appear as a breakpoint hit if the next instruction
-  // also contained a breakpoint.  We don't want to handle that, since we
-  // really don't know what 

[Lldb-commits] [lldb] r332914 - Fix the Xcode project for the refactoring of the

2018-05-21 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon May 21 15:41:28 2018
New Revision: 332914

URL: http://llvm.org/viewvc/llvm-project?rev=332914=rev
Log:
Fix the Xcode project for the refactoring of the
DWARF reader.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=332914=332913=332914=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon May 21 15:41:28 2018
@@ -753,6 +753,9 @@
4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644813B40B82003BDF98 /* 
AppleObjCTrampolineHandler.cpp */; };
4CCA645813B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 4CCA644A13B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.cpp */; };
4CD0BD0F134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CD0BD0E134BFADF00CB44D4 /* 
ValueObjectDynamicValue.cpp */; };
+   4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
+   4CD44CFC20B37C440003557C /* ManualDWARFIndex.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 4CD44CF920B37C440003557C /* 
ManualDWARFIndex.cpp */; };
+   4CD44CFD20B37C440003557C /* AppleDWARFIndex.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp 
*/; };
4CDB8D6D1DBA91B6006C5B13 /* LibStdcppUniquePointer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D671DBA91A6006C5B13 /* 
LibStdcppUniquePointer.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
4CE4EFAA1E8999B900A80C06 /* PlatformOpenBSD.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp 
*/; };
@@ -2653,6 +2656,12 @@
4CCA644B13B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = ""; };
4CD0BD0C134BFAB600CB44D4 /* ValueObjectDynamicValue.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name 
= ValueObjectDynamicValue.h; path = 
include/lldb/Core/ValueObjectDynamicValue.h; sourceTree = ""; };
4CD0BD0E134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectDynamicValue.cpp; path = 
source/Core/ValueObjectDynamicValue.cpp; sourceTree = ""; };
+   4CD44CF820B37C440003557C /* DWARFIndex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFIndex.cpp; sourceTree = ""; };
+   4CD44CF920B37C440003557C /* ManualDWARFIndex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ManualDWARFIndex.cpp; sourceTree = ""; };
+   4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = AppleDWARFIndex.cpp; sourceTree = ""; };
+   4CD44CFE20B37C570003557C /* DWARFIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWARFIndex.h; 
sourceTree = ""; };
+   4CD44CFF20B37C580003557C /* AppleDWARFIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleDWARFIndex.h; 
sourceTree = ""; };
+   4CD44D0020B37C580003557C /* ManualDWARFIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
ManualDWARFIndex.h; sourceTree = ""; };
4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = LibStdcppUniquePointer.cpp; path = 
Language/CPlusPlus/LibStdcppUniquePointer.cpp; sourceTree = ""; };
4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibStdcppTuple.cpp; path = Language/CPlusPlus/LibStdcppTuple.cpp; 
sourceTree = ""; };
4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = PlatformOpenBSD.cpp; sourceTree = ""; };
@@ -3914,6 +3923,8 @@
260C89B210F57C5600BB2B04 /* DWARF */ = {
isa = 

[Lldb-commits] [PATCH] D46726: build: use cmake to find the libedit content

2018-05-21 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd updated this revision to Diff 147874.
compnerd added a comment.

fix regex


https://reviews.llvm.org/D46726

Files:
  CMakeLists.txt
  cmake/modules/FindLibEdit.cmake
  scripts/Python/modules/readline/CMakeLists.txt


Index: scripts/Python/modules/readline/CMakeLists.txt
===
--- scripts/Python/modules/readline/CMakeLists.txt
+++ scripts/Python/modules/readline/CMakeLists.txt
@@ -6,9 +6,12 @@
 # Build the readline python module
 include_directories(${PYTHON_INCLUDE_DIR})
 add_library(readline SHARED readline.cpp)
+target_include_directories(readline
+   PRIVATE
+ ${libedit_INCLUDE_DIRS})

 if (NOT LLDB_DISABLE_LIBEDIT)
-  target_link_libraries(readline ${PYTHON_LIBRARY} edit)
+  target_link_libraries(readline ${PYTHON_LIBRARY} ${libedit_LIBRARIES})
 else()
   target_link_libraries(readline ${PYTHON_LIBRARY})
 endif()
Index: cmake/modules/FindLibEdit.cmake
===
--- /dev/null
+++ cmake/modules/FindLibEdit.cmake
@@ -0,0 +1,62 @@
+#.rst:
+# FindLibEdit
+# ---
+#
+# Find libedit library and headers
+#
+# The module defines the following variables:
+#
+# ::
+#
+#   libedit_FOUND - true if libedit was found
+#   libedit_INCLUDE_DIRS  - include search path
+#   libedit_LIBRARIES - libraries to link
+#   libedit_VERSION   - version number
+
+if(libedit_INCLUDE_DIRS AND libedit_LIBRARIES)
+  set(libedit_FOUND TRUE)
+else()
+  find_package(PkgConfig QUIET)
+  pkg_check_modules(PC_LIBEDIT QUIET libedit)
+
+  find_path(libedit_INCLUDE_DIRS
+NAMES
+  histedit.h
+HINTS
+  ${PC_LIBEDIT_INCLUDEDIR}
+  ${PC_LIBEDIT_INCLUDE_DIRS}
+  ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+  find_library(libedit_LIBRARIES
+   NAMES
+ edit libedit
+   HINTS
+ ${PC_LIBEDIT_LIBDIR}
+ ${PC_LIBEDIT_LIBRARY_DIRS}
+ ${CMAKE_INSTALL_FULL_LIBDIR})
+
+  if(libedit_INCLUDE_DIRS AND EXISTS "${libedit_INCLUDE_DIRS}/histedit.h")
+file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h"
+ libedit_major_version_str
+ REGEX "^#define[ \t]+LIBEDIT_MAJOR[ \t]+[0-9]+")
+string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MAJOR[ \t]+([0-9]+)" "\\1"
+   LIBEDIT_MAJOR_VERSION "${libedit_major_version_str}")
+
+file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h"
+ libedit_minor_version_str
+ REGEX "^#define[ \t]+LIBEDIT_MINOR[ \t]+[0-9]+")
+string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MINOR[ \t]+([0-9]+)" "\\1"
+   LIBEDIT_MINOR_VERSION "${libedit_minor_version_str}")
+
+set(libedit_VERSION_STRING 
"${libedit_major_version}.${libedit_minor_version}")
+  endif()
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(libedit
+REQUIRED_VARS
+  libedit_INCLUDE_DIRS
+  libedit_LIBRARIES
+VERSION_VAR
+  libedit_VERSION_STRING)
+  mark_as_advanced(libedit_INCLUDE_DIRS libedit_LIBRARIES)
+endif()
+
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -29,6 +29,8 @@
 set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables 
the use of editline.")
 if (LLDB_DISABLE_LIBEDIT)
   add_definitions( -DLLDB_DISABLE_LIBEDIT )
+else()
+  find_package(LibEdit REQUIRED)
 endif()

 if(APPLE)


Index: scripts/Python/modules/readline/CMakeLists.txt
===
--- scripts/Python/modules/readline/CMakeLists.txt
+++ scripts/Python/modules/readline/CMakeLists.txt
@@ -6,9 +6,12 @@
 # Build the readline python module
 include_directories(${PYTHON_INCLUDE_DIR})
 add_library(readline SHARED readline.cpp)
+target_include_directories(readline
+   PRIVATE
+ ${libedit_INCLUDE_DIRS})

 if (NOT LLDB_DISABLE_LIBEDIT)
-  target_link_libraries(readline ${PYTHON_LIBRARY} edit)
+  target_link_libraries(readline ${PYTHON_LIBRARY} ${libedit_LIBRARIES})
 else()
   target_link_libraries(readline ${PYTHON_LIBRARY})
 endif()
Index: cmake/modules/FindLibEdit.cmake
===
--- /dev/null
+++ cmake/modules/FindLibEdit.cmake
@@ -0,0 +1,62 @@
+#.rst:
+# FindLibEdit
+# ---
+#
+# Find libedit library and headers
+#
+# The module defines the following variables:
+#
+# ::
+#
+#   libedit_FOUND - true if libedit was found
+#   libedit_INCLUDE_DIRS  - include search path
+#   libedit_LIBRARIES - libraries to link
+#   libedit_VERSION   - version number
+
+if(libedit_INCLUDE_DIRS AND libedit_LIBRARIES)
+  set(libedit_FOUND TRUE)

[Lldb-commits] [PATCH] D46726: build: use cmake to find the libedit content

2018-05-21 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd added inline comments.



Comment at: cmake/modules/FindLibEdit.cmake:53-54
+set(libedit_VERSION_STRING 
"${libedit_major_version}.${libedit_minor_version}")
+unset(libedit_major_version)
+unset(libedit_minor_version)
+  endif()

labath wrote:
> compnerd wrote:
> > labath wrote:
> > > Do you really need to unset these? I would hope that this file is 
> > > evaluated in a fresh context, and it won't pollute the callers namespace 
> > > or anything..
> > I'm pretty sure that they get evaluated in the global context :-(.
> I just tried removing these and putting a `message` command after the 
> `find_package` call. The variables did not get exported.
> 
> However, I think we have a bigger issue here. If I apply your patch without 
> any modifications, I get an error first time I run it because of unrecognised 
> sequences in the regular expressions (`\s`, `\d`). I guess that's why you've 
> changed these to `[ \t]` and `[0-9]` in the first regex.
> 
> What particularly worries me is that the second time I ran cmake, without any 
> modifications, it succeeded, presumably because we took the true branch in 
> the `if` statement at the top. This looks wrong.
> 
> I think we should just remove the if check -- `find_path` and `find_library` 
> should already have caching internally, and if you want to cache the version 
> computation, then that should be guarded by a separate variable.
Sure, fixed the regex.  I think that we need to actually handle this this way 
unfortunately as otherwise we would not be able to specify the values at the 
command line to avoid the pkg-config search.


https://reviews.llvm.org/D46726



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


[Lldb-commits] [PATCH] D47147: DWARFIndex: Reduce duplication in the GetFunctions methods

2018-05-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Before I look too closely, we can probably add a DWARFDIE accessor function 
like:

  bool DWARFDIE::IsClassMethod() const;

Then this would allow each DWARFIndex to just check and we might be able to get 
rid of the 3 lists in GetFunctionsByBaseOrMethodName? Seems like it shouldn't 
be hard for the index to weed these things out. Or we can add a generic layer 
into the DWARFIndex base class that the different indexes can call to weed out 
the things that aren't wanted. The earlier we can weed things out the better. 
so the index might return 20 matches, but it would be nice to weed out any 
mismatches as soon as possible so we can avoid creating any clang AST types for 
the functions/methods if we don't need do.

The example I am thinking of is "search for all methods called 'erase'" where 
the index might just be able to lookup "erase" and get 20 matches, but then 
before we realize/make any clang AST types, we would quickly call 
"DWARFDIE::IsClassMethod()" on it to weed out any mismatches before we hand 
them back. Let me know if that makes sense or if I am missing anything. I would 
like the DWARFIndex class to be as dead simple as possible.


https://reviews.llvm.org/D47147



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


[Lldb-commits] [lldb] r332877 - Enable Python API for OpenBSD.

2018-05-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon May 21 12:47:45 2018
New Revision: 332877

URL: http://llvm.org/viewvc/llvm-project?rev=332877=rev
Log:
Enable Python API for OpenBSD.

Patch by David Carlier

Modified:
lldb/trunk/scripts/utilsOsType.py

Modified: lldb/trunk/scripts/utilsOsType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/utilsOsType.py?rev=332877=332876=332877=diff
==
--- lldb/trunk/scripts/utilsOsType.py (original)
+++ lldb/trunk/scripts/utilsOsType.py Mon May 21 12:47:45 2018
@@ -44,6 +44,7 @@ else:
   "FreeBSD",
   "Linux",
   "NetBSD",
+  "OpenBSD",
   "Windows",
   "kFreeBSD"]
 
@@ -91,6 +92,8 @@ def determine_os_type():
 eOSType = EnumOsType.Linux
 elif strOS.startswith("netbsd"):
 eOSType = EnumOsType.NetBSD
+elif strOS.startswith("openbsd"):
+eOSType = EnumOsType.OpenBSD
 elif strOS == "win32":
 eOSType = EnumOsType.Windows
 elif strOS.startswith("gnukfreebsd"):


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


[Lldb-commits] [PATCH] D47110: [LLDB, lldb-mi] Add option --synchronous.

2018-05-21 Thread Alexander Polyakov via Phabricator via lldb-commits
polyakov.alex updated this revision to Diff 147806.
polyakov.alex added a comment.

Moved the option parsing code down by the others.


Repository:
  rL LLVM

https://reviews.llvm.org/D47110

Files:
  tools/lldb-mi/MICmnResources.cpp
  tools/lldb-mi/MICmnResources.h
  tools/lldb-mi/MIDriver.cpp
  tools/lldb-mi/MIDriverMgr.cpp


Index: tools/lldb-mi/MIDriverMgr.cpp
===
--- tools/lldb-mi/MIDriverMgr.cpp
+++ tools/lldb-mi/MIDriverMgr.cpp
@@ -640,6 +640,7 @@
   MIRSRC(IDE_MI_APP_ARG_VERSION), MIRSRC(IDE_MI_APP_ARG_VERSION_LONG),
   MIRSRC(IDE_MI_APP_ARG_INTERPRETER), MIRSRC(IDE_MI_APP_ARG_SOURCE),
   MIRSRC(IDE_MI_APP_ARG_EXECUTEABLE),
+  MIRSRC(IDE_MI_APP_ARG_SYNCHRONOUS),
   CMIUtilString::Format(
   MIRSRC(IDE_MI_APP_ARG_APP_LOG),
   CMICmnLogMediumFile::Instance().GetFileName().c_str()),
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -382,6 +382,7 @@
 //  that are only handled by *this driver:
 //  --executable 
 //  --source  or -s 
+//  --synchronous
 //  The application's options --interpreter and --executable in code 
act
 //  very similar.
 //  The --executable is necessary to differentiate whether the MI 
Driver
@@ -397,6 +398,7 @@
 //  argument for a debug session. Using --interpreter on the command
 //  line does not
 //  issue additional commands to initialise a debug session.
+//  Option --synchronous disables an asynchronous mode in the lldb-mi 
driver.
 // Type:Overridden.
 // Args:argc- (R)   An integer that contains the count of arguments
 // that follow in
@@ -469,6 +471,8 @@
 // command line
   { // See fn description.
 bHaveExecutableLongOption = true;
+  } else if (strArg.compare("--synchronous") == 0) {
+CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().SetAsync(false);
   }
 }
   }
Index: tools/lldb-mi/MICmnResources.h
===
--- tools/lldb-mi/MICmnResources.h
+++ tools/lldb-mi/MICmnResources.h
@@ -77,6 +77,7 @@
   IDE_MI_APP_ARG_APP_LOG_DIR,
   IDE_MI_APP_ARG_EXAMPLE,
   IDE_MI_APP_ARG_EXECUTABLE,
+  IDE_MI_APP_ARG_SYNCHRONOUS,
 
   IDS_STDIN_ERR_INVALID_PROMPT,
   IDS_STDIN_ERR_THREAD_CREATION_FAILED,
Index: tools/lldb-mi/MICmnResources.cpp
===
--- tools/lldb-mi/MICmnResources.cpp
+++ tools/lldb-mi/MICmnResources.cpp
@@ -110,6 +110,8 @@
 {IDE_MI_APP_ARG_EXECUTABLE, "executable (NOT IMPLEMENTED)\n\tThe file "
 "path to the executable i.e. '\"C:\\My "
 "Dev\\foo.exe\"'."},
+{IDE_MI_APP_ARG_SYNCHRONOUS, "--synchronous\n\tBlock until each 
command "
+ "has finished executing.\n\tUsed for 
testing only."},
 {IDS_STDIN_ERR_INVALID_PROMPT,
  "Stdin. Invalid prompt description '%s'"},
 {IDS_STDIN_ERR_THREAD_CREATION_FAILED,


Index: tools/lldb-mi/MIDriverMgr.cpp
===
--- tools/lldb-mi/MIDriverMgr.cpp
+++ tools/lldb-mi/MIDriverMgr.cpp
@@ -640,6 +640,7 @@
   MIRSRC(IDE_MI_APP_ARG_VERSION), MIRSRC(IDE_MI_APP_ARG_VERSION_LONG),
   MIRSRC(IDE_MI_APP_ARG_INTERPRETER), MIRSRC(IDE_MI_APP_ARG_SOURCE),
   MIRSRC(IDE_MI_APP_ARG_EXECUTEABLE),
+  MIRSRC(IDE_MI_APP_ARG_SYNCHRONOUS),
   CMIUtilString::Format(
   MIRSRC(IDE_MI_APP_ARG_APP_LOG),
   CMICmnLogMediumFile::Instance().GetFileName().c_str()),
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -382,6 +382,7 @@
 //  that are only handled by *this driver:
 //  --executable 
 //  --source  or -s 
+//  --synchronous
 //  The application's options --interpreter and --executable in code act
 //  very similar.
 //  The --executable is necessary to differentiate whether the MI Driver
@@ -397,6 +398,7 @@
 //  argument for a debug session. Using --interpreter on the command
 //  line does not
 //  issue additional commands to initialise a debug session.
+//  Option --synchronous disables an asynchronous mode in the lldb-mi driver.
 // Type:Overridden.
 // Args:argc- (R)   An integer that contains the count of arguments
 // that follow in
@@ -469,6 +471,8 @@
 // command line
   { // See fn description.
 

[Lldb-commits] [PATCH] D47147: DWARFIndex: Reduce duplication in the GetFunctions methods

2018-05-21 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, clayborg.
Herald added a subscriber: aprantl.

This extracts the common bits out of the two implementations back into
the SymbolFileDWARF class. The goal was to make the function as similar
as possible to the other DWARFIndex methods (i.e, to restrict the work
of the index classes to DIE offset manipulation only, and leave the
offset interpretation to the caller).

To achieve this, i've split the function into three functions, for
looking up:

- full names
- objc methods
- methods and functions

The first two are trivial, and they just extract DIE offsets into an
array. The last one needed a slightly more complex interface, because of
the differences in how the two indexes operate -- manual index is able
to differentiate between methods and non-methods, while the apple table
is not. For this reason, the function returns three offset arrays
instead of just one. The first two are for DIEs which we know are/are
not methods, and the third one is for those we are unsure. In this case,
the caller needs to do extra work to tell them apart.


https://reviews.llvm.org/D47147

Files:
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
 
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
@@ -1475,7 +1476,7 @@
 size_t SymbolFileDWARF::GetObjCMethodDIEOffsets(ConstString class_name,
 DIEArray _die_offsets) {
   method_die_offsets.clear();
-  m_index->GetObjCMethods(class_name, method_die_offsets);
+  m_index->GetObjCMethodsForClass(class_name, method_die_offsets);
   return method_die_offsets.size();
 }
 
@@ -2214,6 +2215,9 @@
   if (!append)
 sc_list.Clear();
 
+  if (parent_decl_ctx && !parent_decl_ctx->IsValid())
+parent_decl_ctx = nullptr;
+
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
 return 0;
 
@@ -2230,16 +2234,121 @@
   if (info == NULL)
 return 0;
 
-  m_index->GetFunctions(name, *info,
-[this](const DWARFDIE , bool include_inlines,
-   lldb_private::SymbolContextList _list) {
-  return ResolveFunction(die, include_inlines, sc_list);
-},
-[this](lldb::user_id_t type_uid) {
-  return GetDeclContextContainingUID(type_uid);
-},
-parent_decl_ctx, name_type_mask, include_inlines,
-sc_list);
+  llvm::DenseSet resolved_dies;
+  if (name_type_mask & eFunctionNameTypeFull) {
+DIEArray offsets;
+m_index->GetFunctionsByFullName(name, offsets);
+for (const DIERef  : offsets) {
+  DWARFDIE die = info->GetDIE(ref);
+  if (!die) {
+m_index->ReportInvalidDIEOffset(ref.die_offset, name.GetStringRef());
+continue;
+  }
+  if (!DIEInDeclContext(parent_decl_ctx, die))
+continue; // The containing decl contexts don't match
+
+  if (resolved_dies.insert(die.GetDIE()).second)
+ResolveFunction(die, include_inlines, sc_list);
+}
+  }
+  if (name_type_mask & eFunctionNameTypeSelector && !parent_decl_ctx) {
+DIEArray offsets;
+m_index->GetObjCMethodsByName(name, offsets);
+
+// Now make sure these are actually ObjC methods.  In this case we can
+// simply look up the name, and if it is an ObjC method name, we're
+// good.
+for (const DIERef  : offsets) {
+  DWARFDIE die = info->GetDIE(ref);
+  if (!die) {
+m_index->ReportInvalidDIEOffset(ref.die_offset, name.GetStringRef());
+continue;
+  }
+  if (!ObjCLanguage::IsPossibleObjCMethodName(die.GetName()))
+continue;
+  if (resolved_dies.insert(die.GetDIE()).second)
+ResolveFunction(die, include_inlines, sc_list);
+}
+  }
+  if (((name_type_mask & eFunctionNameTypeMethod) && !parent_decl_ctx) ||
+  name_type_mask & eFunctionNameTypeBase) {
+DIEArray base_offsets, method_offsets, unknown_offsets;
+m_index->GetFunctionsByBaseOrMethodName(
+name, FunctionNameType(name_type_mask), base_offsets, method_offsets,
+unknown_offsets);
+
+for (const DIERef  : base_offsets) {
+  DWARFDIE die = info->GetDIE(ref);
+  if (!die) {
+m_index->ReportInvalidDIEOffset(ref.die_offset, 

[Lldb-commits] [PATCH] D47062: Suggest lldb-dotest to reproduce a failure.

2018-05-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 147787.
JDevlieghere added a comment.
Herald added a subscriber: mgorny.

Make this work for Windows


https://reviews.llvm.org/D47062

Files:
  packages/Python/lldbsuite/test/dosep.py
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/lldbtest_config.py
  utils/lldb-dotest/CMakeLists.txt
  utils/lldb-dotest/lldb-dotest.in

Index: utils/lldb-dotest/lldb-dotest.in
===
--- utils/lldb-dotest/lldb-dotest.in
+++ utils/lldb-dotest/lldb-dotest.in
@@ -3,7 +3,7 @@
 import sys
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args_str = '@LLDB_DOTEST_ARGS@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_WITH_WRAPPER@'
 
 if __name__ == '__main__':
 wrapper_args = sys.argv[1:]
Index: utils/lldb-dotest/CMakeLists.txt
===
--- utils/lldb-dotest/CMakeLists.txt
+++ utils/lldb-dotest/CMakeLists.txt
@@ -9,14 +9,20 @@
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+set(LLDB_DOTEST_WRAPPER ${LLDB_DOTEST_DIR}/lldb-dotest)
+set(LLDB_DOTEST_ARGS_WITH_WRAPPER ${LLDB_DOTEST_ARGS})
+list(APPEND LLDB_DOTEST_ARGS_WITH_WRAPPER --dotest-wrapper "${LLDB_DOTEST_WRAPPER}")
 configure_file(
   lldb-dotest.in
-  ${LLDB_DOTEST_DIR}/lldb-dotest
+  ${LLDB_DOTEST_WRAPPER}
   )
   endforeach()
 else()
+  set(LLDB_DOTEST_WRAPPER ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest)
+  set(LLDB_DOTEST_ARGS_WITH_WRAPPER ${LLDB_DOTEST_ARGS})
+  list(APPEND LLDB_DOTEST_ARGS_WITH_WRAPPER --dotest-wrapper "${LLDB_DOTEST_WRAPPER}")
   configure_file(
 lldb-dotest.in
-${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest
+${LLDB_DOTEST_WRAPPER}
 )
 endif()
Index: packages/Python/lldbsuite/test/lldbtest_config.py
===
--- packages/Python/lldbsuite/test/lldbtest_config.py
+++ packages/Python/lldbsuite/test/lldbtest_config.py
@@ -21,3 +21,6 @@
 
 # path to the lldb command line executable tool
 lldbExec = None
+
+# path to lldb-dotest wrapper
+dotestWrapper = None
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1089,7 +1089,7 @@
 file=sbuf)
 
 def getRerunArgs(self):
-return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
+return "-f %s.%s" % (self.__class__.__name__, self._testMethodName)
 
 def getLogBasenameForCurrentTest(self, prefix=None):
 """
@@ -1186,18 +1186,13 @@
 benchmarks = False
 
 import datetime
-print(
-"Session info generated @",
+print("Session info generated @",
 datetime.datetime.now().ctime(),
 file=self.session)
-print(
-"To rerun this test, issue the following command from the 'test' directory:\n",
+print("To rerun this test, issue the following command:\n",
 file=self.session)
 print(
-"./dotest.py %s -v %s %s" %
-(self.getRunOptions(),
- ('+b' if benchmarks else '-t'),
-self.getRerunArgs()),
+"{} {}".format(lldbtest_config.dotestWrapper, self.getRerunArgs()),
 file=self.session)
 self.session.close()
 del self.session
@@ -1373,18 +1368,6 @@
 
 return False
 
-def getRunOptions(self):
-"""Command line option for -A and -C to run this test again, called from
-self.dumpSessionInfo()."""
-arch = self.getArchitecture()
-comp = self.getCompiler()
-option_str = ""
-if arch:
-option_str = "-A " + arch
-if comp:
-option_str += " -C " + comp
-return option_str
-
 def getDebugInfo(self):
 method = getattr(self, self.testMethodName)
 return getattr(method, "debug_info", None)
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -124,6 +124,11 @@
 '--executable',
 metavar='executable-path',
 help='The path to the lldb executable')
+group.add_argument(
+'--dotest-wrapper',
+dest='dotest_wrapper',
+metavar='executable-path',
+help='The path to the lldb-dotest executable')
 group.add_argument(
 '--server',
 metavar='server-path',
Index: 

[Lldb-commits] [PATCH] D47133: Enable ProcessMachCore plugin on non-apple platforms

2018-05-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D47133



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


[Lldb-commits] [PATCH] D47021: Fix PathMappingList for relative and empty paths after recent FileSpec normalization changes

2018-05-21 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332842: Fix PathMappingList for relative and empty paths 
after recent FileSpec… (authored by gclayton, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47021?vs=147587=147780#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47021

Files:
  lldb/trunk/include/lldb/Target/PathMappingList.h
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/source/Target/PathMappingList.cpp
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/source/Utility/FileSpec.cpp
  lldb/trunk/unittests/Target/CMakeLists.txt
  lldb/trunk/unittests/Target/PathMappingListTest.cpp
  lldb/trunk/unittests/Utility/FileSpecTest.cpp

Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -328,11 +328,7 @@
   bool hardware,
   LazyBool move_to_nearest_code) {
   FileSpec remapped_file;
-  ConstString remapped_path;
-  if (GetSourcePathMap().ReverseRemapPath(ConstString(file.GetPath().c_str()),
-  remapped_path))
-remapped_file.SetFile(remapped_path.AsCString(), false);
-  else
+  if (!GetSourcePathMap().ReverseRemapPath(file, remapped_file))
 remapped_file = file;
 
   if (check_inlines == eLazyBoolCalculate) {
Index: lldb/trunk/source/Target/PathMappingList.cpp
===
--- lldb/trunk/source/Target/PathMappingList.cpp
+++ lldb/trunk/source/Target/PathMappingList.cpp
@@ -14,6 +14,7 @@
 
 // Other libraries and framework includes
 // Project includes
+#include "lldb/lldb-private-enumerations.h"
 #include "lldb/Host/PosixApi.h"
 #include "lldb/Target/PathMappingList.h"
 #include "lldb/Utility/FileSpec.h"
@@ -23,6 +24,22 @@
 using namespace lldb;
 using namespace lldb_private;
 
+namespace {
+  // We must normalize our path pairs that we store because if we don't then
+  // things won't always work. We found a case where if we did:
+  // (lldb) settings set target.source-map . /tmp
+  // We would store a path pairs of "." and "/tmp" as raw strings. If the debug
+  // info contains "./foo/bar.c", the path will get normalized to "foo/bar.c".
+  // When PathMappingList::RemapPath() is called, it expects the path to start
+  // with the raw path pair, which doesn't work anymore because the paths have
+  // been normalized when the debug info was loaded. So we need to store
+  // nomalized path pairs to ensure things match up.
+  ConstString NormalizePath(const ConstString ) {
+// If we use "path" to construct a FileSpec, it will normalize the path for
+// us. We then grab the string and turn it back into a ConstString.
+return ConstString(FileSpec(path.GetStringRef(), false).GetPath());
+  }
+}
 //--
 // PathMappingList constructor
 //--
@@ -52,7 +69,7 @@
 void PathMappingList::Append(const ConstString ,
  const ConstString , bool notify) {
   ++m_mod_id;
-  m_pairs.push_back(pair(path, replacement));
+  m_pairs.emplace_back(pair(NormalizePath(path), NormalizePath(replacement)));
   if (notify && m_callback)
 m_callback(*this, m_callback_baton);
 }
@@ -77,7 +94,8 @@
 insert_iter = m_pairs.end();
   else
 insert_iter = m_pairs.begin() + index;
-  m_pairs.insert(insert_iter, pair(path, replacement));
+  m_pairs.emplace(insert_iter, pair(NormalizePath(path),
+NormalizePath(replacement)));
   if (notify && m_callback)
 m_callback(*this, m_callback_baton);
 }
@@ -88,7 +106,7 @@
   if (index >= m_pairs.size())
 return false;
   ++m_mod_id;
-  m_pairs[index] = pair(path, replacement);
+  m_pairs[index] = pair(NormalizePath(path), NormalizePath(replacement));
   if (notify && m_callback)
 m_callback(*this, m_callback_baton);
   return true;
@@ -134,58 +152,53 @@
 
 bool PathMappingList::RemapPath(const ConstString ,
 ConstString _path) const {
-  const char *path_cstr = path.GetCString();
-  // CLEANUP: Convert this function to use StringRefs internally instead
-  // of raw c-strings.
-  if (!path_cstr)
-return false;
-
-  const_iterator pos, end = m_pairs.end();
-  for (pos = m_pairs.begin(); pos != end; ++pos) {
-const size_t prefixLen = pos->first.GetLength();
-
-if (::strncmp(pos->first.GetCString(), path_cstr, prefixLen) == 0) {
-  std::string new_path_str(pos->second.GetCString());
-  new_path_str.append(path.GetCString() + prefixLen);
-  new_path.SetCString(new_path_str.c_str());
-  return true;
-}
+  std::string remapped;
+  if (RemapPath(path.GetStringRef(), remapped)) {
+

[Lldb-commits] [lldb] r332842 - Fix PathMappingList for relative and empty paths after recent FileSpec normalization changes

2018-05-21 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon May 21 07:14:36 2018
New Revision: 332842

URL: http://llvm.org/viewvc/llvm-project?rev=332842=rev
Log:
Fix PathMappingList for relative and empty paths after recent FileSpec 
normalization changes

PathMappingList was broken for relative and empty paths after normalization 
changes in FileSpec. There were also no tests for PathMappingList so I added 
those.

Changes include:

Change PathMappingList::ReverseRemapPath() to take FileSpec objects instead of 
ConstString. The only client of this was doing work to convert to and from 
ConstString objects for no reason.
Normalize all paths prefix and replacements that are added to the 
PathMappingList vector so they match the paths that have been already 
normalized in the debug info
Unify code in the two forms of PathMappingList::RemapPath() so only one 
contains the actual functionality. Prior to this, there were two versions of 
this code.
Use FileSpec::AppendPathComponent() and remove a long standing TODO so paths 
are correctly appended to each other.
Added tests for absolute, relative and empty paths.

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


Added:
lldb/trunk/unittests/Target/PathMappingListTest.cpp
Modified:
lldb/trunk/include/lldb/Target/PathMappingList.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Target/PathMappingList.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Utility/FileSpec.cpp
lldb/trunk/unittests/Target/CMakeLists.txt
lldb/trunk/unittests/Utility/FileSpecTest.cpp

Modified: lldb/trunk/include/lldb/Target/PathMappingList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/PathMappingList.h?rev=332842=332841=332842=diff
==
--- lldb/trunk/include/lldb/Target/PathMappingList.h (original)
+++ lldb/trunk/include/lldb/Target/PathMappingList.h Mon May 21 07:14:36 2018
@@ -90,7 +90,7 @@ public:
   bool RemapPath(llvm::StringRef path, std::string _path) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
-  bool ReverseRemapPath(const ConstString , ConstString _path) const;
+  bool ReverseRemapPath(const FileSpec , FileSpec ) const;
 
   //--
   /// Finds a source file given a file spec using the path remappings.

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=332842=332841=332842=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon May 21 07:14:36 2018
@@ -267,6 +267,7 @@
26680336116005EF008E1FE4 /* SBBreakpointLocation.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9AF16CC7114086A1007A7B3F /* 
SBBreakpointLocation.cpp */; };
26680337116005F1008E1FE4 /* SBBreakpoint.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9AF16A9C11402D5B007A7B3F /* SBBreakpoint.cpp */; 
};
2668035C11601108008E1FE4 /* LLDB.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 26680207115FD0ED008E1FE4 /* LLDB.framework */; };
+   2668A2EE20AF417D00D94111 /* PathMappingListTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2668A2ED20AF417D00D94111 /* 
PathMappingListTest.cpp */; };
266942001A6DC2AC0063BE93 /* MICmdArgContext.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 266941601A6DC2AB0063BE93 /* MICmdArgContext.cpp 
*/; };
266942011A6DC2AC0063BE93 /* MICmdArgSet.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 266941621A6DC2AB0063BE93 /* MICmdArgSet.cpp */; 
};
266942021A6DC2AC0063BE93 /* MICmdArgValBase.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 266941641A6DC2AB0063BE93 /* MICmdArgValBase.cpp 
*/; };
@@ -1755,6 +1756,7 @@
2666ADC31B3CB675001FAFD3 /* HexagonDYLDRendezvous.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = HexagonDYLDRendezvous.cpp; sourceTree = ""; };
2666ADC41B3CB675001FAFD3 /* HexagonDYLDRendezvous.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
HexagonDYLDRendezvous.h; sourceTree = ""; };
26680207115FD0ED008E1FE4 /* LLDB.framework */ = {isa = 
PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; 
path = LLDB.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+   2668A2ED20AF417D00D94111 /* PathMappingListTest.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PathMappingListTest.cpp; path = Target/PathMappingListTest.cpp; 
sourceTree = ""; };
2669415B1A6DC2AB0063BE93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = 

[Lldb-commits] [lldb] r332841 - Reland "[DWARF] Extract indexing code into a separate class hierarchy"

2018-05-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon May 21 07:12:52 2018
New Revision: 332841

URL: http://llvm.org/viewvc/llvm-project?rev=332841=rev
Log:
Reland "[DWARF] Extract indexing code into a separate class hierarchy"

After this commit, the xcode project will need to be updated to include
the new files added here.

Added:
lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp?rev=332841=auto
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (added)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp Mon May 21 
07:12:52 2018
@@ -0,0 +1,306 @@
+//===-- AppleDWARFIndex.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/SymbolFile/DWARF/AppleDWARFIndex.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDeclContext.h"
+#include "Plugins/SymbolFile/DWARF/DWARFUnit.h"
+#include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Symbol/Function.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+std::unique_ptr AppleDWARFIndex::Create(
+Module , DWARFDataExtractor apple_names,
+DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types,
+DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str) {
+  auto apple_names_table_up = llvm::make_unique(
+  apple_names, debug_str, ".apple_names");
+  if (!apple_names_table_up->IsValid())
+apple_names_table_up.reset();
+
+  auto apple_namespaces_table_up =
+  llvm::make_unique(
+  apple_namespaces, debug_str, ".apple_namespaces");
+  if (!apple_namespaces_table_up->IsValid())
+apple_namespaces_table_up.reset();
+
+  auto apple_types_table_up = llvm::make_unique(
+  apple_types, debug_str, ".apple_types");
+  if (!apple_types_table_up->IsValid())
+apple_types_table_up.reset();
+
+  auto apple_objc_table_up = llvm::make_unique(
+  apple_objc, debug_str, ".apple_objc");
+  if (!apple_objc_table_up->IsValid())
+apple_objc_table_up.reset();
+
+  if (apple_names_table_up || apple_names_table_up || apple_types_table_up ||
+  apple_objc_table_up)
+return llvm::make_unique(
+module, std::move(apple_names_table_up),
+std::move(apple_namespaces_table_up), std::move(apple_types_table_up),
+std::move(apple_objc_table_up));
+
+  return nullptr;
+}
+
+void AppleDWARFIndex::GetGlobalVariables(ConstString name, DIEArray ) {
+  if (!m_apple_names_up)
+return;
+
+  const char *name_cstr = name.GetCString();
+  llvm::StringRef basename;
+  llvm::StringRef context;
+
+  if (!CPlusPlusLanguage::ExtractContextAndIdentifier(name_cstr, context,
+  basename))
+basename = name_cstr;
+
+  m_apple_names_up->FindByName(basename, offsets);
+}
+
+void AppleDWARFIndex::GetGlobalVariables(const RegularExpression ,
+ DIEArray ) {
+  if (!m_apple_names_up)
+return;
+
+  DWARFMappedHash::DIEInfoArray hash_data;
+  if (m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data))
+DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
+}
+
+void AppleDWARFIndex::GetGlobalVariables(const DWARFUnit ,
+ DIEArray ) {
+  if (!m_apple_names_up)
+return;
+
+  DWARFMappedHash::DIEInfoArray hash_data;
+  if (m_apple_names_up->AppendAllDIEsInRange(
+  cu.GetOffset(), cu.GetNextCompileUnitOffset(), hash_data))
+DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
+}
+
+void AppleDWARFIndex::GetObjCMethods(ConstString class_name,
+ 

[Lldb-commits] [PATCH] D47110: [LLDB, lldb-mi] Add option --synchronous.

2018-05-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks fine, just move the option parsing code down by the others instead of 
having it before the checking for file args.




Comment at: tools/lldb-mi/MIDriver.cpp:441-444
+  if (strArg.compare("--synchronous") == 0) {
+CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().SetAsync(false);
+  }
+

This should be moved down by the other arguments (like to line 471 of this 
file, or 473 of old one)


Repository:
  rL LLVM

https://reviews.llvm.org/D47110



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


[Lldb-commits] [PATCH] D47133: Enable ProcessMachCore plugin on non-apple platforms

2018-05-21 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, jasonmolenda.
Herald added a subscriber: mgorny.

The plugin already builds fine on other platforms (linux, at least). All
that was necessary was to revitalize the hack in PlatformDarwinKernel
(not a very pretty hack, but it gets us going at least).

I haven't done a thorough investigation of the state of the plugin on
other platforms, but at least the two core file tests we have seem to
pass, so I enable them.


https://reviews.llvm.org/D47133

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
  
packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
  source/API/SystemInitializerFull.cpp
  source/Plugins/DynamicLoader/CMakeLists.txt
  source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  source/Plugins/Process/CMakeLists.txt

Index: source/Plugins/Process/CMakeLists.txt
===
--- source/Plugins/Process/CMakeLists.txt
+++ source/Plugins/Process/CMakeLists.txt
@@ -11,9 +11,9 @@
   add_subdirectory(Windows/Common)
 elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_subdirectory(MacOSX-Kernel)
-  add_subdirectory(mach-core)
 endif()
 add_subdirectory(gdb-remote)
 add_subdirectory(Utility)
 add_subdirectory(elf-core)
+add_subdirectory(mach-core)
 add_subdirectory(minidump)
Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
===
--- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
+++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
@@ -201,6 +201,7 @@
 // source/Host/macosx/cfcpp utilities.
 
 class PlatformDarwinKernel {
+public:
   static lldb_private::ConstString GetPluginNameStatic();
 };
 
Index: source/Plugins/DynamicLoader/CMakeLists.txt
===
--- source/Plugins/DynamicLoader/CMakeLists.txt
+++ source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,9 +1,6 @@
+add_subdirectory(Darwin-Kernel)
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
 add_subdirectory(Hexagon-DYLD)
 add_subdirectory(Windows-DYLD)
-
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  add_subdirectory(Darwin-Kernel)
-endif()
Index: source/API/SystemInitializerFull.cpp
===
--- source/API/SystemInitializerFull.cpp
+++ source/API/SystemInitializerFull.cpp
@@ -84,6 +84,7 @@
 #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
 #include "Plugins/Process/elf-core/ProcessElfCore.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include "Plugins/Process/mach-core/ProcessMachCore.h"
 #include "Plugins/Process/minidump/ProcessMinidump.h"
 #include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
@@ -104,7 +105,6 @@
 #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
 #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
 #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
-#include "Plugins/Process/mach-core/ProcessMachCore.h"
 #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
 #endif
 #include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
@@ -313,6 +313,7 @@
 
   JITLoaderGDB::Initialize();
   ProcessElfCore::Initialize();
+  ProcessMachCore::Initialize();
   minidump::ProcessMinidump::Initialize();
   MemoryHistoryASan::Initialize();
   AddressSanitizerRuntime::Initialize();
@@ -353,7 +354,6 @@
 #if defined(__APPLE__)
   SymbolVendorMacOSX::Initialize();
   ProcessKDP::Initialize();
-  ProcessMachCore::Initialize();
   PlatformAppleTVSimulator::Initialize();
   PlatformAppleWatchSimulator::Initialize();
   PlatformRemoteAppleTV::Initialize();
@@ -440,6 +440,7 @@
 
   JITLoaderGDB::Terminate();
   ProcessElfCore::Terminate();
+  ProcessMachCore::Terminate();
   minidump::ProcessMinidump::Terminate();
   MemoryHistoryASan::Terminate();
   AddressSanitizerRuntime::Terminate();
@@ -471,7 +472,6 @@
 
 #if defined(__APPLE__)
   DynamicLoaderDarwinKernel::Terminate();
-  ProcessMachCore::Terminate();
   ProcessKDP::Terminate();
   SymbolVendorMacOSX::Terminate();
   PlatformAppleTVSimulator::Terminate();
Index: packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
===
--- packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
+++ packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
@@ -7,7 +7,6 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipUnlessDarwin
 @no_debug_info_test
 def test_source_map(self):
 """Test target.source-map' functionality."""
Index: packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
===
--- 

[Lldb-commits] [lldb] r332833 - Improve coverage of the apple-tables test

2018-05-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon May 21 03:09:22 2018
New Revision: 332833

URL: http://llvm.org/viewvc/llvm-project?rev=332833=rev
Log:
Improve coverage of the apple-tables test

After closer examination, it turns out we mis-classify one of the
methods only if two of the structs have the same name. Since this was
meant to be a basic test, I rename one of the structs in the test so
that we have at least some coverage for the apple tables lookup.
Instead, I create an XFAILed test which specifically targets the
same-name case (and file a bug to track it).

Added:
lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp
Modified:
lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp?rev=332833=332832=332833=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp Mon May 21 03:09:22 
2018
@@ -16,6 +16,10 @@
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
 // RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t 
| \
+// RUN:   FileCheck --check-prefix=BASE %s
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=method 
%t | \
+// RUN:   FileCheck --check-prefix=METHOD %s
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t 
| \
 // RUN:   FileCheck --check-prefix=FULL %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
@@ -34,7 +38,7 @@
 // METHOD: Found 3 functions:
 // METHOD-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
 // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
-// METHOD-DAG: name = "ffbar()::sbar::foo()", mangled = 
"_ZZ5ffbarvEN4sbar3fooEv"
+// METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = 
"_ZZ5ffbarvEN4sbaz3fooEv"
 
 // FULL: Found 7 functions:
 // FULL-DAG: name = "foo()", mangled = "_Z3foov"
@@ -43,7 +47,7 @@
 // FULL-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
 // FULL-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
 // FULL-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
-// FULL-DAG: name = "ffbar()::sbar::foo()", mangled = "_ZZ5ffbarvEN4sbar3fooEv"
+// FULL-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
 
 // FULL-MANGLED: Found 1 functions:
 // FULL-DAG: name = "foo(int)", mangled = "_Z3fooi"
@@ -77,10 +81,10 @@ void sbar::foo() {}
 void sbar::foo(int) {}
 
 void ffbar() {
-  struct sbar {
+  struct sbaz {
 void foo() {}
   };
-  sbar a;
+  sbaz a;
   a.foo();
 }
 

Added: lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp?rev=332833=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-method-local-struct.cpp Mon May 21 
03:09:22 2018
@@ -0,0 +1,22 @@
+// llvm.org/pr37537
+// XFAIL: *
+
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=method 
%t | \
+// RUN:   FileCheck %s
+
+// CHECK-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
+// CHECK-DAG: name = "ffbar()::sbar::foo()", mangled = 
"_ZZ5ffbarvEN4sbar3fooEv"
+
+struct sbar {
+  void foo();
+};
+void sbar::foo() {}
+
+void ffbar() {
+  struct sbar {
+void foo() {}
+  };
+  sbar a;
+  a.foo();
+}


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


[Lldb-commits] [PATCH] D47064: Add some apple-tables lookup tests

2018-05-21 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332831: Add some apple-tables lookup tests (authored by 
labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47064

Files:
  lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
  lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
  lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
  lldb/trunk/lit/SymbolFile/DWARF/find-basic-variable.cpp


Index: lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
@@ -8,6 +8,14 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=FOO %s
+// RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // FOO: Found namespace: foo
 
Index: lldb/trunk/lit/SymbolFile/DWARF/find-basic-variable.cpp
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-variable.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-variable.cpp
@@ -10,6 +10,16 @@
 // RUN:   FileCheck --check-prefix=REGEX %s
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=foo --find=variable %t | \
+// RUN:   FileCheck --check-prefix=NAME %s
+// RUN: lldb-test symbols --regex --name=foo --find=variable %t | \
+// RUN:   FileCheck --check-prefix=REGEX %s
+// RUN: lldb-test symbols --name=not_there --find=variable %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // EMPTY: Found 0 variables:
 // NAME: Found 4 variables:
Index: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
@@ -14,6 +14,16 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t 
| \
+// RUN:   FileCheck --check-prefix=FULL %s
+// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=foo --context=context --find=function 
--function-flags=base %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=function %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // BASE: Found 4 functions:
 // BASE-DAG: name = "foo()", mangled = "_Z3foov"
Index: lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
@@ -8,6 +8,14 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=type %t | \
+// RUN:   FileCheck --check-prefix=NAME %s
+// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=type %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // EMPTY: Found 0 types:
 // NAME: Found 4 types:


Index: lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
===
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
@@ -8,6 +8,14 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=FOO %s
+// RUN: lldb-test symbols --name=foo 

[Lldb-commits] [lldb] r332831 - Add some apple-tables lookup tests

2018-05-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon May 21 02:27:16 2018
New Revision: 332831

URL: http://llvm.org/viewvc/llvm-project?rev=332831=rev
Log:
Add some apple-tables lookup tests

Summary:
Now that we are able to parse MachO files everywhere, we can write some
cross-platform tests for handling of apple accelerator tables. This
reruns the same lookup tests we have for manual indexes on MachO files
which will use the accelerator tables instead. This makes sure we return
the same results regardless of the method we used to access the debug
info.

The tests confirm we return the same results for looking up types,
namespaces and variables, but have found an inconsistency in the
treatment of function lookup. In the function case we mis-classify the
method "foo" declared in the local struct sbar (inside function ffbar).
We classify it as a function whereas it really is a method. Preliminary
analysis suggests this is because
DWARFASTParserClang::GetClangDeclContextForDIE returns null when given
the local "struct sbar" DIE. This causes us to get the wrong
CompilerDeclContext when we ask for the context of the inner foo, which
means CompilerDeclContext::ISStructUnionOrClass returns false.

Until this is fixed, I do not include the darwin versions of the "base"
and "method" function lookup tests.

Reviewers: JDevlieghere, clayborg

Subscribers: aprantl, ilya-biryukov, ioeric, lldb-commits

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

Modified:
lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
lldb/trunk/lit/SymbolFile/DWARF/find-basic-variable.cpp

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp?rev=332831=332830=332831=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp Mon May 21 02:27:16 
2018
@@ -14,6 +14,16 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t 
| \
+// RUN:   FileCheck --check-prefix=FULL %s
+// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=foo --context=context --find=function 
--function-flags=base %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=function %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // BASE: Found 4 functions:
 // BASE-DAG: name = "foo()", mangled = "_Z3foov"

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp?rev=332831=332830=332831=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-namespace.cpp Mon May 21 
02:27:16 2018
@@ -8,6 +8,14 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=FOO %s
+// RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=namespace %t | \
+// RUN:   FileCheck --check-prefix=EMPTY %s
 
 // FOO: Found namespace: foo
 

Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp?rev=332831=332830=332831=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-type.cpp Mon May 21 02:27:16 2018
@@ -8,6 +8,14 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+//
+// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: lldb-test symbols --name=foo --find=type %t | \
+// RUN:   FileCheck --check-prefix=NAME %s
+// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+// RUN: lldb-test symbols --name=not_there --find=type %t | \
+// RUN:   FileCheck 

[Lldb-commits] [PATCH] D47021: Fix PathMappingList for relative and empty paths after recent FileSpec normalization changes

2018-05-21 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.

looks good. I don't know if anyone else has an opinion on how should we treat 
"" for mapping purposes, but treating it as "." seems fine to me.




Comment at: unittests/Utility/FileSpecTest.cpp:300
+  for (const auto : not_relative) {
+FileSpec spec(path, false, FileSpec::Style::posix);
+EXPECT_FALSE(spec.IsRelative());

In tests like these, it's good to add something like `SCOPED_TRACE(path)` or 
similar. That way, when a test fails you will see which path caused the failure 
instead of just a generic "spec.IsRelative() is true" message.


https://reviews.llvm.org/D47021



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


[Lldb-commits] [PATCH] D47062: Suggest lldb-dotest to reproduce a failure.

2018-05-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looks fine to me, just make the path computation windows-compatible.




Comment at: packages/Python/lldbsuite/test/dotest.py:386
+if is_exe(lldbtest_config.lldbExec):
+lldbtest_config.dotestWrapper = "{}-dotest".format(
+  os.path.realpath(args.executable))

On windows, this will end up being `lldb.exe-dotest`


https://reviews.llvm.org/D47062



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