[Lldb-commits] [PATCH] D65129: Test load unloading of modules with libraries-svr4

2019-07-22 Thread António Afonso via Phabricator via lldb-commits
aadsm created this revision.
aadsm added reviewers: labath, clayborg, xiaobai.
Herald added subscribers: lldb-commits, srhines.
Herald added a project: LLDB.

This doubles the 3 tests running right now on linux by also executing each test 
with libraries-svr4 enabled.
Not sure if there's a better way to do this as I had to copy/paste all the 
decorators as well...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65129

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py


Index: 
lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -93,6 +93,13 @@
 "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" %
 (wd, err.GetCString()))
 
+def setSvr4Support(self, enabled):
+self.runCmd(
+"settings set plugin.process.gdb-remote.use-libraries-svr4 
{enabled}".format(
+enabled="true" if enabled else "false"
+)
+)
+
 # libloadunload_d.so does not appear in the image list because executable
 # dependencies are resolved relative to the debuggers PWD. Bug?
 @expectedFailureAll(oslist=["linux"])
@@ -224,6 +231,20 @@
 @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
 @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic 
libraries work differently
 def test_lldb_process_load_and_unload_commands(self):
+self.setSvr4Support(False)
+self.run_lldb_process_load_and_unload_commands()
+
+@expectedFailureAll(
+bugnumber="llvm.org/pr25805",
+hostoslist=["windows"],
+triple='.*-android')
+@skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
+@skipIfWindows  # Windows doesn't have dlopen and friends, dynamic 
libraries work differently
+def test_lldb_process_load_and_unload_commands_with_svr4(self):
+self.setSvr4Support(True)
+self.run_lldb_process_load_and_unload_commands()
+
+def run_lldb_process_load_and_unload_commands(self):
 """Test that lldb process load/unload command work correctly."""
 self.copy_shlibs_to_remote()
 
@@ -295,6 +316,15 @@
 
 @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
 def test_load_unload(self):
+self.setSvr4Support(False)
+self.run_load_unload()
+
+@skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
+def test_load_unload_with_svr4(self):
+self.setSvr4Support(True)
+self.run_load_unload()
+
+def run_load_unload(self):
 """Test breakpoint by name works correctly with dlopen'ing."""
 self.copy_shlibs_to_remote()
 
@@ -335,6 +365,16 @@
 @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
 @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic 
libraries work differently
 def test_step_over_load(self):
+self.setSvr4Support(False)
+self.run_step_over_load()
+
+@skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
+@skipIfWindows  # Windows doesn't have dlopen and friends, dynamic 
libraries work differently
+def test_step_over_load_with_svr4(self):
+self.setSvr4Support(True)
+self.run_step_over_load()
+
+def run_step_over_load(self):
 """Test stepping over code that loads a shared library works 
correctly."""
 self.copy_shlibs_to_remote()
 


Index: lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -93,6 +93,13 @@
 "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" %
 (wd, err.GetCString()))
 
+def setSvr4Support(self, enabled):
+self.runCmd(
+"settings set plugin.process.gdb-remote.use-libraries-svr4 {enabled}".format(
+enabled="true" if enabled else "false"
+)
+)
+
 # libloadunload_d.so does not appear in the image list because executable
 # dependencies are resolved relative to the debuggers PWD. Bug?
 @expectedFailureAll(oslist=["linux"])
@@ -224,6 +231,20 @@
 @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
 @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
 def test_lldb_process_load_and_unload_commands(self):
+self.setSvr4Support(False)

[Lldb-commits] [PATCH] D64013: Correctly use GetLoadedModuleList to take advantage of libraries-svr4

2019-07-22 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 211241.
aadsm added a comment.

Handle error returned by GetLoadedModuleList


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64013

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -200,9 +200,9 @@
 
   llvm::VersionTuple GetHostOSVersion() override;
 
-  size_t LoadModules(LoadedModuleInfoList _list) override;
+  llvm::Error LoadModules() override;
 
-  size_t LoadModules() override;
+  llvm::Expected GetLoadedModuleList() override;
 
   Status GetFileLoadAddress(const FileSpec , bool _loaded,
 lldb::addr_t _addr) override;
@@ -391,9 +391,6 @@
   // Query remote GDBServer for register information
   bool GetGDBServerRegisterInfo(ArchSpec );
 
-  // Query remote GDBServer for a detailed loaded library list
-  Status GetLoadedModuleList(LoadedModuleInfoList &);
-
   lldb::ModuleSP LoadModuleAtAddress(const FileSpec ,
  lldb::addr_t link_map,
  lldb::addr_t base_addr,
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2400,7 +2400,12 @@
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString();
   } else if (key.compare("library") == 0) {
-LoadModules();
+auto error = LoadModules();
+if (error) {
+  Log *log(
+  ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, std::move(error), "Failed to load modules: {0}");
+}
   } else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
 uint32_t reg = UINT32_MAX;
 if (!key.getAsInteger(16, reg))
@@ -2756,9 +2761,13 @@
 
   // the loaded module list can also provides a link map address
   if (addr == LLDB_INVALID_ADDRESS) {
-LoadedModuleInfoList list;
-if (GetLoadedModuleList(list).Success())
-  addr = list.m_link_map;
+llvm::Expected list = GetLoadedModuleList();
+if (!list) {
+  Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, list.takeError(), "Failed to read module list: {0}");
+} else {
+  addr = list->m_link_map;
+}
   }
 
   return addr;
@@ -4705,29 +4714,30 @@
   return m_register_info.GetNumRegisters() > 0;
 }
 
-Status ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList ) {
+llvm::Expected ProcessGDBRemote::GetLoadedModuleList() {
   // Make sure LLDB has an XML parser it can use first
   if (!XMLDocument::XMLEnabled())
-return Status(0, ErrorType::eErrorTypeGeneric);
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "XML parsing not available");
 
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS);
   if (log)
 log->Printf("ProcessGDBRemote::%s", __FUNCTION__);
 
+  LoadedModuleInfoList list;
   GDBRemoteCommunicationClient  = m_gdb_comm;
   bool can_use_svr4 = GetGlobalPluginProperties()->GetUseSVR4();
 
   // check that we have extended feature read support
   if (can_use_svr4 && comm.GetQXferLibrariesSVR4ReadSupported()) {
-list.clear();
-
 // request the loaded library list
 std::string raw;
 lldb_private::Status lldberr;
 
 if (!comm.ReadExtFeature(ConstString("libraries-svr4"), ConstString(""),
  raw, lldberr))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error in libraries-svr4 packet");
 
 // parse the xml file in memory
 if (log)
@@ -4735,11 +4745,14 @@
 XMLDocument doc;
 
 if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml"))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error reading noname.xml");
 
 XMLNode root_element = doc.GetRootElement("library-list-svr4");
 if (!root_element)
-  return Status();
+  

[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D65128#1596809 , @jingham wrote:

> Actually, I don't want this change as is.  Some logs - like the expression 
> and step logs - are laid out for readability, and LLDB_LOG automatically adds 
> the file & function which will make them much harder to read.
>
> We need a variant that doesn't inject this information, and then this change 
> should use that variant.  Or we can remove the file & function from LLDB_LOG 
> and decide to let the people add those as they wish.  I don't have a strong 
> opinion one way or the other, but I certainly don't want this extra noise in 
> the step or expression logs.


I agree with you. I always use LLDB_LOG, but not because it includes the file 
and function, but because it's consistent, it gives me the ability to use the 
LLVM formatter, and I don't have to explicitly check whether the log is NULL or 
not. I can only speak for myself of course.

@labath Since you added the macro, what's your take on this? Do you care a lot 
about the file and function, and should we have two macros, one that includes 
this and one that doesn't? Or should we have just one macro, and have users 
decide whether they need this information or not?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65128



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


[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Actually, I don't want this change as is.  Some logs - like the expression and 
step logs - are laid out for readability, and LLDB_LOG automatically adds the 
file & function which will make them much harder to read.

We need a variant that doesn't inject this information, and then this change 
should use that variant.  Or we can remove the file & function from LLDB_LOG 
and decide to let the people add those as they wish.  I don't have a strong 
opinion one way or the other, but I certainly don't want this extra noise in 
the step or expression logs.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65128



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


[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

IIUC, LLDB_LOG already adds the file and  function.  A bunch of these logs are 
also adding __FUNCTION__, so that's probably going to come out twice now.  You 
should probably remove the duplicates.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65128



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


[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, jingham, labath.
Herald added subscribers: teemperor, atanasyan, MaskRay, kbarton, 
fedor.sergeev, arichardson, javed.absar, nemanjai, sdardis, emaste, srhines.
Herald added a reviewer: martong.
Herald added a reviewer: espindola.
Herald added a reviewer: shafik.
Herald added a project: LLDB.

This patch replaces calls to log::Printf with the LLDB_LOG macro. This
has several advantages, such as automatically checking that log is not
NULL, and having access to the full power of LLVM's format function.
I've made log::Printf private to encourage the usage of the macro.

So instead of writing:

  if (log)
log->Printf("...", __args__);

You'd write:

  LLDB_LOG(log, "...", __args__);

This change was done mechanically with the command below. I replaced the
spurious if-checks with vim, since I know how to do multi-line
replacements with it.

  find . -type f -name '*.cpp' -exec \
  sed -i '' -E 's/log->Printf\(/LLDB_LOG\(log, /g' "{}" +


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65128

Files:
  lldb/include/lldb/Utility/Log.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBFrame.cpp
  lldb/source/API/SBTarget.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointResolver.cpp
  lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/AddressResolverFileLine.cpp
  lldb/source/Core/Communication.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectDynamicValue.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/DataFormatters/TypeCategoryMap.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Expression/IRInterpreter.cpp
  lldb/source/Expression/IRMemoryMap.cpp
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Expression/Materializer.cpp
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Host/common/Host.cpp
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/common/HostNativeThreadBase.cpp
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Host/common/NativeRegisterContext.cpp
  lldb/source/Host/common/Socket.cpp
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/source/Host/linux/HostInfoLinux.cpp
  lldb/source/Host/macosx/objcxx/Host.mm
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
  lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  

[Lldb-commits] [PATCH] D64583: [lldb][test_suite] Fix skipIfTargetAndroid decorator

2019-07-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366771: [lldb][test_suite] Fix skipIfTargetAndroid decorator 
(authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64583?vs=209325=211236#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64583

Files:
  lldb/trunk/packages/Python/lldbsuite/test/decorators.py


Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -596,11 +596,6 @@
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
-def skipIfTargetAndroid(func):
-return unittest2.skipIf(lldbplatformutil.target_is_android(),
-"skip on target Android")(func)
-
-
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any 
non-Windows platform."""
 return skipUnlessPlatform(["windows"])(func)
@@ -652,7 +647,7 @@
 "requires one of %s" % (", ".join(oslist)))
 
 
-def skipIfTargetAndroid(api_levels=None, archs=None):
+def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.
 
 Arguments:
@@ -665,7 +660,8 @@
 _skip_for_android(
 "skipping for android",
 api_levels,
-archs))
+archs),
+bugnumber)
 
 def skipUnlessSupportedTypeAttribute(attr):
 """Decorate the item to skip test unless Clang supports type 
__attribute__(attr)."""


Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -596,11 +596,6 @@
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
-def skipIfTargetAndroid(func):
-return unittest2.skipIf(lldbplatformutil.target_is_android(),
-"skip on target Android")(func)
-
-
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any non-Windows platform."""
 return skipUnlessPlatform(["windows"])(func)
@@ -652,7 +647,7 @@
 "requires one of %s" % (", ".join(oslist)))
 
 
-def skipIfTargetAndroid(api_levels=None, archs=None):
+def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.
 
 Arguments:
@@ -665,7 +660,8 @@
 _skip_for_android(
 "skipping for android",
 api_levels,
-archs))
+archs),
+bugnumber)
 
 def skipUnlessSupportedTypeAttribute(attr):
 """Decorate the item to skip test unless Clang supports type __attribute__(attr)."""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366771 - [lldb][test_suite] Fix skipIfTargetAndroid decorator

2019-07-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jul 22 17:41:00 2019
New Revision: 366771

URL: http://llvm.org/viewvc/llvm-project?rev=366771=rev
Log:
[lldb][test_suite] Fix skipIfTargetAndroid decorator

Summary:
Delete the duplicate func `skipIfTargetAndroid`
Fix the old one. It didn't work for missing an argument `bugnumber`, this 
somehow made the decorator failed

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

Patch by Wanyi Ye 

Modified:
lldb/trunk/packages/Python/lldbsuite/test/decorators.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=366771=366770=366771=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Jul 22 17:41:00 
2019
@@ -596,11 +596,6 @@ def skipIfWindows(func):
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
-def skipIfTargetAndroid(func):
-return unittest2.skipIf(lldbplatformutil.target_is_android(),
-"skip on target Android")(func)
-
-
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any 
non-Windows platform."""
 return skipUnlessPlatform(["windows"])(func)
@@ -652,7 +647,7 @@ def skipUnlessPlatform(oslist):
 "requires one of %s" % (", ".join(oslist)))
 
 
-def skipIfTargetAndroid(api_levels=None, archs=None):
+def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.
 
 Arguments:
@@ -665,7 +660,8 @@ def skipIfTargetAndroid(api_levels=None,
 _skip_for_android(
 "skipping for android",
 api_levels,
-archs))
+archs),
+bugnumber)
 
 def skipUnlessSupportedTypeAttribute(attr):
 """Decorate the item to skip test unless Clang supports type 
__attribute__(attr)."""


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


[Lldb-commits] [PATCH] D64771: [lldb][test_suite] skip tests of `libstdcpp` on Android and clean up

2019-07-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366770: [lldb][test_suite] skip tests of `libstdcpp` on 
Android and clean up (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64771?vs=209951=211233#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64771

Files:
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules


Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -1154,8 +1154,10 @@
 from lldbsuite.test import lldbplatformutil
 
 platform = lldbplatformutil.getPlatform()
+if lldbplatformutil.target_is_android():
+platform = "android"
 if platform == "linux":
-  return True, "libstdcxx always present"
+return True, "libstdcxx always present"
 return False, "Don't know how to build with libstdcxx on %s" % platform
 
 def checkLibstdcxxSupport():
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -72,24 +72,18 @@
 
 ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
-isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
-   -D__ANDROID_API__=$(API_LEVEL)
-ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+   -D__ANDROID_API__=$(API_LEVEL) \
+   -isystem 
$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)/usr/include
 
-ifeq (1,$(USE_LIBSTDCPP))
-   ARCH_CFLAGS += \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
 
-   ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
-else
-   ARCH_CXXFLAGS += \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
-   -isystem $(NDK_ROOT)/sources/android/support/include \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
-
-   ARCH_LDFLAGS += \
-   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
-   -lc++abi
-endif
+ARCH_CXXFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+   -isystem $(NDK_ROOT)/sources/android/support/include \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+
+ARCH_LDFLAGS += \
+   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+   -lc++abi \
+   -nostdlib++


Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -1154,8 +1154,10 @@
 from lldbsuite.test import lldbplatformutil
 
 platform = lldbplatformutil.getPlatform()
+if lldbplatformutil.target_is_android():
+platform = "android"
 if platform == "linux":
-  return True, "libstdcxx always present"
+return True, "libstdcxx always present"
 return False, "Don't know how to build with libstdcxx on %s" % platform
 
 def checkLibstdcxxSupport():
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -72,24 +72,18 @@
 
 ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
 	-isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
-	-D__ANDROID_API__=$(API_LEVEL)
-ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+	-D__ANDROID_API__=$(API_LEVEL) \
+	-isystem $(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)/usr/include
 
-ifeq (1,$(USE_LIBSTDCPP))
-	ARCH_CFLAGS += \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward

[Lldb-commits] [lldb] r366770 - [lldb][test_suite] skip tests of `libstdcpp` on Android and clean up

2019-07-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jul 22 17:28:26 2019
New Revision: 366770

URL: http://llvm.org/viewvc/llvm-project?rev=366770=rev
Log:
[lldb][test_suite] skip tests of `libstdcpp` on Android and clean up

Summary: Delete the android target from `libstdcpp` test category, since 
android no longer support libstdcxx

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: srhines, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=366770=366769=366770=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Jul 22 17:28:26 2019
@@ -1154,8 +1154,10 @@ def canRunLibstdcxxTests():
 from lldbsuite.test import lldbplatformutil
 
 platform = lldbplatformutil.getPlatform()
+if lldbplatformutil.target_is_android():
+platform = "android"
 if platform == "linux":
-  return True, "libstdcxx always present"
+return True, "libstdcxx always present"
 return False, "Don't know how to build with libstdcxx on %s" % platform
 
 def checkLibstdcxxSupport():

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=366770=366769=366770=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Mon Jul 22 
17:28:26 2019
@@ -72,24 +72,18 @@ endif
 
 ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
-isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
-   -D__ANDROID_API__=$(API_LEVEL)
-ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+   -D__ANDROID_API__=$(API_LEVEL) \
+   -isystem 
$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)/usr/include
 
-ifeq (1,$(USE_LIBSTDCPP))
-   ARCH_CFLAGS += \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
 
-   ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
-else
-   ARCH_CXXFLAGS += \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
-   -isystem $(NDK_ROOT)/sources/android/support/include \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+ARCH_CXXFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+   -isystem $(NDK_ROOT)/sources/android/support/include \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
 
-   ARCH_LDFLAGS += \
-   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
-   -lc++abi
-endif
+ARCH_LDFLAGS += \
+   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+   -lc++abi \
+   -nostdlib++


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


[Lldb-commits] [lldb] r366768 - [Logging] Replace LogIfAnyCategoriesSet with LLDB_LOG.

2019-07-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jul 22 16:48:01 2019
New Revision: 366768

URL: http://llvm.org/viewvc/llvm-project?rev=366768=rev
Log:
[Logging] Replace LogIfAnyCategoriesSet with LLDB_LOG.

This patch removes any remaining instances of LogIfAnyCategoriesSet and
replaces them with the LLDB_LOG macro. This in turn made it possible to
make Log::VAPrintf and Log::VAError private.

Modified:
lldb/trunk/include/lldb/Utility/Log.h
lldb/trunk/include/lldb/Utility/Logging.h
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Utility/Logging.cpp

Modified: lldb/trunk/include/lldb/Utility/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Log.h?rev=366768=366767=366768=diff
==
--- lldb/trunk/include/lldb/Utility/Log.h (original)
+++ lldb/trunk/include/lldb/Utility/Log.h Mon Jul 22 16:48:01 2019
@@ -144,12 +144,8 @@ public:
 
   void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
 
-  void VAPrintf(const char *format, va_list args);
-
   void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
-  void VAError(const char *format, va_list args);
-
   void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
   void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
@@ -161,6 +157,9 @@ public:
   bool GetVerbose() const;
 
 private:
+  void VAPrintf(const char *format, va_list args);
+  void VAError(const char *format, va_list args);
+
   Channel _channel;
 
   // The mutex makes sure enable/disable operations are thread-safe. The

Modified: lldb/trunk/include/lldb/Utility/Logging.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Logging.h?rev=366768=366767=366768=diff
==
--- lldb/trunk/include/lldb/Utility/Logging.h (original)
+++ lldb/trunk/include/lldb/Utility/Logging.h Mon Jul 22 16:48:01 2019
@@ -54,8 +54,6 @@ namespace lldb_private {
 
 class Log;
 
-void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...);
-
 Log *GetLogIfAllCategoriesSet(uint32_t mask);
 
 Log *GetLogIfAnyCategoriesSet(uint32_t mask);

Modified: lldb/trunk/source/Core/Communication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=366768=366767=366768=diff
==
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Mon Jul 22 16:48:01 2019
@@ -46,9 +46,10 @@ Communication::Communication(const char
   m_callback(nullptr), m_callback_baton(nullptr), m_close_on_eof(true)
 
 {
-  lldb_private::LogIfAnyCategoriesSet(
-  LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
-  "%p Communication::Communication (name = %s)", this, name);
+
+  LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
+  LIBLLDB_LOG_COMMUNICATION),
+   "%p Communication::Communication (name = %s)", this, name);
 
   SetEventName(eBroadcastBitDisconnected, "disconnected");
   SetEventName(eBroadcastBitReadThreadGotBytes, "got bytes");
@@ -61,10 +62,10 @@ Communication::Communication(const char
 }
 
 Communication::~Communication() {
-  lldb_private::LogIfAnyCategoriesSet(
-  LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
-  "%p Communication::~Communication (name = %s)", this,
-  GetBroadcasterName().AsCString());
+  LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
+  LIBLLDB_LOG_COMMUNICATION),
+   "%p Communication::~Communication (name = %s)", this,
+   GetBroadcasterName().AsCString());
   Clear();
 }
 
@@ -77,9 +78,8 @@ void Communication::Clear() {
 ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) {
   Clear();
 
-  lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION,
-  "%p Communication::Connect (url = %s)",
-  this, url);
+  LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION),
+   "%p Communication::Connect (url = %s)", this, url);
 
   lldb::ConnectionSP connection_sp(m_connection_sp);
   if (connection_sp)
@@ -90,8 +90,8 @@ ConnectionStatus Communication::Connect(
 }
 
 ConnectionStatus Communication::Disconnect(Status *error_ptr) {
-  lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION,
-  "%p Communication::Disconnect ()", this);
+  LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION),
+   "%p Communication::Disconnect ()", this);
 
   lldb::ConnectionSP connection_sp(m_connection_sp);
   if 

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

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Breakpoint/Watchpoint.cpp:45
+  if (log)
+log->Printf(
+"Watchpoint::Watchpoint(): Failed to set type.\nReason: %s",

```LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS), 
"Watchpoint::Watchpoint(): Failed to set type.\nReason: {}", 
llvm::toString(type_system_or_err.takeError())```



Comment at: source/Core/ValueObjectRegister.cpp:261
+  if (auto *exe_module = target->GetExecutableModulePointer()) {
+if (auto type_system_or_err =
+exe_module->GetTypeSystemForLanguage(eLanguageTypeC)) {

As a general note: I think it's good practice to use `llvm::consumeError` when 
discarding the error to make it explicit that it's not handled. This also makes 
it easier down the line to handle the error, e.g. by logging it.



Comment at: source/Expression/Materializer.cpp:875
+if (!type_system_or_err) {
+  err.SetErrorStringWithFormat(
+  "Couldn't dematerialize a result variable: "

Another possible alternative would be to join the errors (llvm::joinErrors) and 
use the resulting error to initialize the status. Not sure if that makes things 
better here though. 



Comment at: source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp:105
 
-lldb_private::TypeSystem *DWARFBaseDIE::GetTypeSystem() const {
-  if (m_cu)
+llvm::Expected DWARFBaseDIE::GetTypeSystem() const 
{
+  llvm::Error err = llvm::Error::success();

Seems like this could be a lot less complex with an early return:

```
if (!m_cu) {
return llvm::make_error(
"Unable to get TypeSystem, no compilation unit available",
llvm::inconvertibleErrorCode());
}
return m_cu->GetTypeSystem();
```



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:744
   ASSERT_MODULE_LOCK(this);
-  if (die.IsValid()) {
-TypeSystem *type_system =
-GetTypeSystemForLanguage(die.GetCU()->GetLanguageType());
-
-if (type_system) {
-  DWARFASTParser *dwarf_ast = type_system->GetDWARFParser();
-  if (dwarf_ast)
-return dwarf_ast->ParseFunctionFromDWARF(comp_unit, die);
-}
+  if (!die.IsValid()) {
+return nullptr;

Remove the braces for consistency with the `if`s below. 


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

https://reviews.llvm.org/D65122



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


[Lldb-commits] [PATCH] D64881: [Cmake] Use the modern way to find Python when possible

2019-07-22 Thread Hans Wennborg via Phabricator via lldb-commits
hans added a comment.

In D64881#1590204 , @amccarth wrote:

> An aside ...
>
> I'm still trying to get back to a buildable state the earlier changes, like 
> the one that tries to enforce version consistency between the libs and the 
> interpreter.  I'm currently bisecting to figure out what I hope is the final 
> blocker.


Do you have the revisions for these changes?

I built successfully at r363781, but now I can't build anymore.

I'm configuring with:

cmake -GNinja %cmake_flags% 
-DPYTHON_HOME=C:\Users\hwennborg\AppData\Local\Programs\Python\Python36-32

And get the error:

CMake Error at tools/lldb/cmake/modules/LLDBConfig.cmake:204 (message):

  Found incompatible Python interpreter (2.7.15) and Python libraries (3.6.4)

Uninstalling Python 2.7 is not an option for me.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64881



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


[Lldb-commits] [PATCH] D65123: Restore tests for lldb-server and lldb-vscode removed at rL366590

2019-07-22 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

Thanks for restoring them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65123



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


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

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

Also once we get one test going then it should be easy to add coverage for all 
sorts of scenarios. Who knows maybe we will find more bugs.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64995



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


[Lldb-commits] [PATCH] D64992: [lldb][NFC] Cleanup mentions and code related to lldb-mi

2019-07-22 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

@teemperor This diff deleted all lldb-server and lldb-vscode tests :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64992



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


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

2019-07-22 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: JDevlieghere, davide, compnerd.
Herald added a subscriber: jdoerfert.

This commit achieves the following:

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


https://reviews.llvm.org/D65122

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

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -528,11 +528,11 @@
   if (!symfile)
 return make_string_error("Module has no symbol file.");
 
-  auto clang_ast_ctx = llvm::dyn_cast_or_null(
-  symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus));
-  if (!clang_ast_ctx)
-return make_string_error("Can't retrieve Clang AST context.");
+  auto clang_ast_ctx_or_err = symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus);
+  if (!clang_ast_ctx_or_err)
+return make_string_error("Can't retrieve ClangASTContext");
 
+  auto clang_ast_ctx = llvm::dyn_cast_or_null(*clang_ast_ctx_or_err);
   auto ast_ctx = clang_ast_ctx->getASTContext();
   if (!ast_ctx)
 return make_string_error("Can't retrieve AST context.");
Index: source/Target/ThreadPlanTracer.cpp
===
--- source/Target/ThreadPlanTracer.cpp
+++ source/Target/ThreadPlanTracer.cpp
@@ -93,15 +93,15 @@
 
 TypeFromUser ThreadPlanAssemblyTracer::GetIntPointerType() {
   if (!m_intptr_type.IsValid()) {
-TargetSP target_sp(m_thread.CalculateTarget());
-if (target_sp) {
-  TypeSystem *type_system =
-  target_sp->GetScratchTypeSystemForLanguage(nullptr, eLanguageTypeC);
-  if (type_system)
+if (auto target_sp = m_thread.CalculateTarget()) {
+  if (auto type_system_or_err =
+  target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC)) {
+auto *type_system = *type_system_or_err;
 m_intptr_type =
 TypeFromUser(type_system->GetBuiltinTypeForEncodingAndBitSize(
 eEncodingUint,
 target_sp->GetArchitecture().GetAddressByteSize() * 8));
+  }
 }
   }
   return m_intptr_type;
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2143,16 +2143,12 @@
 target->SetExecutableModule(exe_module_sp, eLoadDependentsYes);
 }
 
-TypeSystem *Target::GetScratchTypeSystemForLanguage(Status *error,
-lldb::LanguageType language,
-bool create_on_demand) {
+llvm::Expected
+Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
+bool create_on_demand) {
   if (!m_valid)
 return nullptr;
 
-  if (error) {
-error->Clear();
-  }
-
   if (language == eLanguageTypeMipsAssembler // GNU AS and LLVM use it for all
  // assembly code
   || language == eLanguageTypeUnknown) {
@@ -2180,14 +2176,13 @@
 
 PersistentExpressionState *
 Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
-  TypeSystem *type_system =
-  GetScratchTypeSystemForLanguage(nullptr, 

[Lldb-commits] [lldb] r366745 - Remove Xcode project remnants

2019-07-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jul 22 14:51:04 2019
New Revision: 366745

URL: http://llvm.org/viewvc/llvm-project?rev=366745=rev
Log:
Remove Xcode project remnants

Removed:
lldb/trunk/scripts/generate-vers.pl
Modified:
lldb/trunk/tools/debugserver/source/CMakeLists.txt

Removed: lldb/trunk/scripts/generate-vers.pl
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/generate-vers.pl?rev=366744=auto
==
--- lldb/trunk/scripts/generate-vers.pl (original)
+++ lldb/trunk/scripts/generate-vers.pl (removed)
@@ -1,56 +0,0 @@
-#!/usr/bin/perl
-
-sub usage()
-{
-  print "Usage: generate-vers.pl /path/toproject.pbxproj program_name";
-  exit(0);
-}
-
-(scalar @ARGV == 2) or usage();
-
-open $pbxproj, $ARGV[0] or die "Couldn't open ".$ARGV[0];
-
-$lldb_version = None;
-$lldb_train = None;
-$lldb_revision = None;
-$lldb_version_string = None;
-
-$product_name = "lldb";
-
-while ($line = <$pbxproj>)
-{
-  chomp ($line);
-  
-  if ($lldb_version == None &&
-  $line =~ /CURRENT_PROJECT_VERSION = ([0-9]+).([0-9]+).([0-9]+)(.[0-9])?/)
-  {
-$lldb_version = $1;
-$lldb_train = $2;
-$lldb_revision = $3;
-$lldb_patchlevel = $4;
-
-if ($lldb_patchlevel != None)
-{
-  $lldb_version_string = 
$lldb_version.".".$lldb_train.".".$lldb_revision.".".$lldb_patchlevel;
-}
-else
-{
-  $lldb_version_string = $lldb_version.".".$lldb_train.".".$lldb_revision;
-} 
-  }
-}
-
-if (!$product_name || !$lldb_version_string)
-{
-  print "Couldn't get needed information from the .pbxproj";
-  exit(-1);
-}
-
-$uppercase_name = uc $product_name;
-$lowercase_name = lc $product_name;
-
-close $pbxproj;
-
-$file_string = " const unsigned char ".$ARGV[1]."VersionString[] __attribute__ 
((used)) = \"@(#)PROGRAM:".$uppercase_name."  
PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double 
".$ARGV[1]."VersionNumber __attribute__ ((used)) = 
(double)".$lldb_version.".".$lldb_train.";\n";
-
-print $file_string;

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=366745=366744=366745=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Mon Jul 22 14:51:04 2019
@@ -140,14 +140,6 @@ add_custom_command(OUTPUT ${generated_ma
 set(DEBUGSERVER_VERS_GENERATED_FILE 
${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
 set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES 
GENERATED 1)
 
-add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver
-  > ${DEBUGSERVER_VERS_GENERATED_FILE}
-  DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
-  )
-
 set(lldbDebugserverCommonSources
   DNBArch.cpp
   DNBBreakpoint.cpp


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


[Lldb-commits] [lldb] r366742 - Remove INSTALL.txt file

2019-07-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jul 22 14:33:43 2019
New Revision: 366742

URL: http://llvm.org/viewvc/llvm-project?rev=366742=rev
Log:
Remove INSTALL.txt file

Its contents are stale and much better documentation can be found either
online or in the docs directory.

Removed:
lldb/trunk/INSTALL.txt

Removed: lldb/trunk/INSTALL.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/INSTALL.txt?rev=366741=auto
==
--- lldb/trunk/INSTALL.txt (original)
+++ lldb/trunk/INSTALL.txt (removed)
@@ -1,18 +0,0 @@
-LLDB Installation Instructions
-==
-
-LLDB builds on Mac OS X (with Xcode) and Linux (with GCC or Clang).
-
-On Mac OS X, in addition to using Xcode you'll need to enable code signing
-on your system to either build lldb or debug using lldb.  Please see the code
-signing documentation in docs/code-signing.txt for more detailed directions.
-
-If you are building on Mac OS X and LLVM is not present in llvm/, then LLDB
-will check it out automatically.  The files in scripts/Xcode/repos determine
-which branches of LLVM/Clang are checked out, depending on the current
-LLDB branch, according to the algorithm in scripts/Xcode/repo.py.
-
-For instructions to build LLDB on Linux, or more details about supported
-compiler versions, other dependencies, and build flags, see:
-
-https://lldb.llvm.org/resources/build.html


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


[Lldb-commits] [lldb] r366741 - [Docs] Remove stale documentation

2019-07-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jul 22 14:26:50 2019
New Revision: 366741

URL: http://llvm.org/viewvc/llvm-project?rev=366741=rev
Log:
[Docs] Remove stale documentation

This removes a stale piece of documentation about building LLDB with the
Xcode project.

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

Modified: lldb/trunk/docs/resources/source.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/source.rst?rev=366741=366740=366741=diff
==
--- lldb/trunk/docs/resources/source.rst (original)
+++ lldb/trunk/docs/resources/source.rst Mon Jul 22 14:26:50 2019
@@ -10,27 +10,8 @@ repository also contains LLDB.
 
 Git browser: https://github.com/llvm/llvm-project/tree/master/lldb
 
-For macOS building from Xcode, simply checkout LLDB and then build
-from Xcode. The Xcode project will automatically detect that it is a
-fresh checkout, and checkout LLVM and Clang automatically. Unlike
-other platforms / build systems, it will use the following directory
-structure.
-
- ::
-
-  lldb
-  |
-  `-- llvm
-  |
-  +-- tools
-  |
-  `-- clang
-
-
-So updating your checkout will consist of updating LLDB, LLV<, and
-Clang in these locations.  Refer to the `Build Instructions
-`_ for more detailed instructions on how to build for a
-particular platform / build system combination.
+Refer to the `Build Instructions `_ for more detailed instructions
+on how to build for a particular platform / build system combination.
 
 Contributing to LLDB
 


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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366739: [LLDB] Remove the Xcode project (authored by 
JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65109?vs=211171=211191#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65109

Files:
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
  
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/launcherRootXPCService.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/launcherXPCService.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
  
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-python-test-suite.xcscheme
  lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
  lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata
  lldb/trunk/scripts/sort-pbxproj.rb



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


[Lldb-commits] [lldb] r366739 - [LLDB] Remove the Xcode project

2019-07-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Jul 22 14:20:23 2019
New Revision: 366739

URL: http://llvm.org/viewvc/llvm-project?rev=366739=rev
Log:
[LLDB] Remove the Xcode project

Finally, after a lot of hard work from a bunch of people, we're in a
state where we can unify LLDB's build system.

This patch removes the hand-maintained Xcode project in favor of using
CMake in combination with the Xcode generator. Going forward, we want to
focus our efforts on improving the generated Xcode project.

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

Removed:
lldb/trunk/lldb.xcodeproj/
lldb/trunk/lldb.xcworkspace/
lldb/trunk/scripts/sort-pbxproj.rb

Removed: lldb/trunk/scripts/sort-pbxproj.rb
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/sort-pbxproj.rb?rev=366738=auto
==
--- lldb/trunk/scripts/sort-pbxproj.rb (original)
+++ lldb/trunk/scripts/sort-pbxproj.rb (removed)
@@ -1,251 +0,0 @@
-#! /usr/bin/ruby
-#
-
-# A script to impose order on the Xcode project file, to make merging
-# across branches were many additional files are present, easier.
-
-
-
-
-## Sort the BuildFile and FileReference sections of an Xcode project file,
-## putting Apple/github-local files at the front to avoid merge conflicts.
-#
-## Run this in a directory with a project.pbxproj file.  The sorted version
-## is printed on standard output.
-#
-
-
-# Files with these words in the names will be sorted into a separate section;
-# they are only present in some repositories and so having them intermixed 
-# can lead to merge failures.
-segregated_filenames = ["Swift", "repl", "RPC"]
-
-def read_pbxproj(fn)
-beginning  = Array.new   # All lines before "PBXBuildFile section"
-files  = Array.new   # PBXBuildFile section lines -- sort these
-middle = Array.new   # All lines between PBXBuildFile and 
PBXFileReference sections
-refs   = Array.new   # PBXFileReference section lines -- sort these
-ending = Array.new   # All lines after PBXFileReference section
-
-all_lines = File.readlines fn
-
-state = 1 # "begin"
-all_lines.each do |l|
-l.chomp
-if state == 1 && l =~ /Begin PBXBuildFile section/
-beginning.push(l)
-state = 2
-next
-end
-if state == 2 && l =~ /End PBXBuildFile section/
-middle.push(l)
-state = 3
-next
-end
-if state == 3 && l =~ /Begin PBXFileReference section/
-middle.push(l)
-state = 4
-next
-end
-if state == 4 && l =~ /End PBXFileReference section/
-ending.push(l)
-state = 5
-next
-end
-
-if state == 1
-beginning.push(l)
-elsif state == 2
-files.push(l)
-elsif state == 3
-middle.push(l)
-elsif state == 4
-refs.push(l)
-else
-ending.push(l)
-end
-end
-
-return beginning, files, middle, refs, ending
-end
-
-xcodeproj_filename = nil
-[ "../lldb.xcodeproj/project.pbxproj", "lldb.xcodeproj/project.pbxproj", 
"project.pbxproj" ].each do |ent|
-if File.exists?(ent)
-xcodeproj_filename = ent
-break
-end
-end
-
-if xcodeproj_filename.nil?
-STDERR.puts "Could not find xcode project file to sort."
-exit(1)
-end
-
-beginning, files, middle, refs, ending = read_pbxproj(xcodeproj_filename)
-
-
-### If we're given a "canonical" project.pbxproj file, get the uuid and 
fileref ids for
-### every source file in this project.pbxproj and the canonical one, and fix 
any of
-### the identifiers that don't match in the project file we're updating.
-### this comes up when people add the file independently on different branches 
and it
-### gets different identifiers.
-
-if ARGV.size() > 0
-canonical_pbxproj = nil
-if ARGV.size == 2 && ARGV[0] == "--canonical"
-canonical_pbxproj = ARGV[1]
-elsif ARGV.size == 1 && ARGV[0] =~ /--canonical=(.+)/
-canonical_pbxproj = $1
-end
-
-if File.exists?(canonical_pbxproj)
-ignore1, canon_files, ignore2, ignore3, ignore4 = 
read_pbxproj(canonical_pbxproj)
-canon_files_by_filename = Hash.new { |k, v| k[v] = Array.new }
-
-canon_files.each do |l|
-# 2669421A1A6DC2AC0063BE93 /* MICmdCmdTarget.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 266941941A6DC2AC0063BE93 /* MICmdCmdTarget.cpp 
*/; };
-
-if l =~ /^\s+([A-F0-9]{24})\s+\/\*\s+(.*?)\sin.*?\*\/.*?fileRef = 
([A-F0-9]{24})\s.*$/
-uuid = $1
-filename = $2
-fileref = $3
-canon_files_by_filename[filename].push({ :uuid => uuid, 
:fileref => fileref })
-end
-end
-
-this_project_files = Hash.new { |k, v| k[v] = Array.new }
-
-files.each do |l|
-# 2669421A1A6DC2AC0063BE93 /* 

[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Let's move the discussion about the script to D65114 
.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65109



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


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

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: lanza, clayborg, sgraenitz, jasonmolenda.
Herald added a subscriber: teemperor.
Herald added a project: LLDB.
JDevlieghere added a comment.

Currently outstanding questions are:

@clayborg

> Not sure why we need two different build directories? Can we just use the 
> mono-repo style build and use "cmake -G Xcode"? Or is this just to appease 
> the Apple build process?

@lanza

> This could probably be just a 10 line make file that you just make -f 
> lldb/utils/xcode.mk. Not sure if you guys are a fan of this method, but we 
> tend to find it to be much more manageable than custom python scripts.


This is a follow-up to D65109  which removes 
the Xcode project. It seems that the script to generate the Xcode project was 
the most controversial, so I've split it off into a separate review.

>From the original patch:

> I created a new script to streamline the process: it creates two build 
> directories in the current directory. The first directory is for LLVM and 
> Clang which uses Ninja to build. The second directory is for LLBD, which 
> configures a standalone build using the Xcode generator.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65114

Files:
  lldb/utils/xcode.py


Index: lldb/utils/xcode.py
===
--- /dev/null
+++ lldb/utils/xcode.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import errno
+import subprocess
+import six
+from contextlib import contextmanager
+
+
+def mkdir(directory):
+try:
+os.makedirs(directory)
+except OSError as e:
+if e.errno != errno.EEXIST:
+raise
+
+
+@contextmanager
+def cwd(path):
+oldpwd = os.getcwd()
+os.chdir(path)
+try:
+yield
+finally:
+os.chdir(oldpwd)
+
+
+def build_llvm(llvm_path):
+"""Configures and builds LLVM & Clang with Ninja."""
+build_path = os.path.join(os.getcwd(), 'llvm-build')
+mkdir(build_path)
+with cwd(build_path):
+cmake_cmd = [
+"cmake {}".format(llvm_path), "-GNinja",
+"-DCMAKE_BUILD_TYPE='Release'", "-DLLVM_ENABLE_ASSERTIONS:BOOL=ON",
+"-DLLVM_ENABLE_PROJECTS='clang;libcxx;libcxxabi'"
+]
+subprocess.call(' '.join(cmake_cmd), shell=True)
+subprocess.call('ninja', shell=True)
+return build_path
+
+
+def configure_lldb(llvm_build_path, lldb_path, args):
+"""Configures an standalone build of LLDB with the Xcode generator."""
+build_path = os.path.join(os.getcwd(), 'lldb-build')
+cache_path = os.path.join(lldb_path, 'cmake', 'caches',
+  'Apple-lldb-Xcode.cmake')
+llvm_dir = os.path.join(llvm_build_path, 'lib', 'cmake', 'llvm')
+clang_dir = os.path.join(llvm_build_path, 'lib', 'cmake', 'clang')
+mkdir(build_path)
+with cwd(build_path):
+cmake_cmd = [
+"cmake {}".format(lldb_path), "-GXcode", "-C{}".format(cache_path),
+"-DLLVM_DIR='{}'".format(llvm_dir),
+"-DClang_DIR='{}'".format(clang_dir)
+]
+cmake_cmd.extend(args)
+subprocess.call(' '.join(cmake_cmd), shell=True)
+subprocess.call('open lldb.xcodeproj', shell=True)
+return build_path
+
+
+def main():
+"""Generate an Xcode project for LLDB from CMake.
+
+This scripts creates two build directories in the current directory: one
+for LLVM and one for LLDB. The LLVM build uses the Ninja generator, the
+LLDB build uses the Xcode generator.
+"""
+args = sys.argv[1:]
+lldb_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+llvm_path = os.path.join(os.path.dirname(lldb_path), 'llvm')
+
+if not os.path.exists(llvm_path):
+printf('This script only works with the LLVM monorepo')
+exit(1)
+
+llvm_build_path = build_llvm(llvm_path)
+lldb_build_path = configure_lldb(llvm_build_path, lldb_path, args)
+
+
+if __name__ == "__main__":
+main()


Index: lldb/utils/xcode.py
===
--- /dev/null
+++ lldb/utils/xcode.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import errno
+import subprocess
+import six
+from contextlib import contextmanager
+
+
+def mkdir(directory):
+try:
+os.makedirs(directory)
+except OSError as e:
+if e.errno != errno.EEXIST:
+raise
+
+
+@contextmanager
+def cwd(path):
+oldpwd = os.getcwd()
+os.chdir(path)
+try:
+yield
+finally:
+os.chdir(oldpwd)
+
+
+def build_llvm(llvm_path):
+"""Configures and builds LLVM & Clang with Ninja."""
+build_path = os.path.join(os.getcwd(), 'llvm-build')
+mkdir(build_path)
+with cwd(build_path):
+cmake_cmd = [
+"cmake {}".format(llvm_path), "-GNinja",
+"-DCMAKE_BUILD_TYPE='Release'", 

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

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Currently outstanding questions are:

@clayborg

> Not sure why we need two different build directories? Can we just use the 
> mono-repo style build and use "cmake -G Xcode"? Or is this just to appease 
> the Apple build process?

@lanza

> This could probably be just a 10 line make file that you just make -f 
> lldb/utils/xcode.mk. Not sure if you guys are a fan of this method, but we 
> tend to find it to be much more manageable than custom python scripts.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65114



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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.  scripts/sort-pbxproj.rb  can go too.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Nathan Lanza via Phabricator via lldb-commits
lanza added inline comments.



Comment at: lldb/utils/xcode.py:1
+#!/usr/bin/env python
+

This could probably be just a 10 line `make` file that you just `make -f 
lldb/utils/xcode.mk`. Not sure if you guys are a fan of this method, but we 
tend to find it to be much more manageable than custom python scripts. 

lldb-build:
cmake -E make_directory lldb-build
lldb-build/lldb.xcodeproj: llvm-build/build.ninja
 cmake -GXcode -Slldb -Blldb-build -C 
cmake/caches/Apple-lldb-Xcode.cmake 
 llvm-build:
 make -E make_directory llvm-build 
 llvm-build/build.ninja: llvm-build
 cmake -GNinja -Sllvm -Bllvm-build 
-DLLVM_ENABLE_PROJECTS='clang;libcxx;libcxxabi'


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D65109#1596294 , @clayborg wrote:

> I am fine with removing the Xcode project. Others should ok it too.
>
> > I've included a new script to streamline the process: it creates two build 
> > directories in the current directory. The first directory is for LLVM and 
> > Clang which uses Ninja to build. The second directory is for LLBD, which 
> > configures a standalone build using the Xcode generator.
>
> Not sure why we need two different build directories? Can we just use the 
> mono-repo style build and use "cmake -G Xcode"? Or is this just to appease 
> the Apple build process?


I'll defer to @sgraenitz to answer this since he did the work. :-)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I am fine with removing the Xcode project. Others should ok it too.

> I've included a new script to streamline the process: it creates two build 
> directories in the current directory. The first directory is for LLVM and 
> Clang which uses Ninja to build. The second directory is for LLBD, which 
> configures a standalone build using the Xcode generator.

Not sure why we need two different build directories? Can we just use the 
mono-repo style build and use "cmake -G Xcode"? Or is this just to appease the 
Apple build process?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D64042: [Symbol] Improve Variable::GetLanguage

2019-07-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366733: [Symbol] Improve Variable::GetLanguage (authored by 
xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64042?vs=207422=211174#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64042

Files:
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/Symbol/Variable.cpp


Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -1672,16 +1672,7 @@
   if (!GetVariable() || !GetVariable()->IsArtificial())
 return false;
 
-  LanguageType lang = eLanguageTypeUnknown;
-  if (auto *sym_ctx_scope = GetSymbolContextScope()) {
-if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
-  lang = func->GetLanguage();
-else if (auto *comp_unit =
- sym_ctx_scope->CalculateSymbolContextCompileUnit())
-  lang = comp_unit->GetLanguage();
-  }
-
-  if (auto *runtime = process->GetLanguageRuntime(lang))
+  if (auto *runtime = 
process->GetLanguageRuntime(GetVariable()->GetLanguage()))
 if (runtime->IsWhitelistedRuntimeValue(GetName()))
   return false;
 
Index: lldb/trunk/source/Symbol/Variable.cpp
===
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -54,10 +54,19 @@
 Variable::~Variable() {}
 
 lldb::LanguageType Variable::GetLanguage() const {
-  SymbolContext variable_sc;
-  m_owner_scope->CalculateSymbolContext(_sc);
-  if (variable_sc.comp_unit)
-return variable_sc.comp_unit->GetLanguage();
+  lldb::LanguageType lang = m_mangled.GuessLanguage();
+  if (lang != lldb::eLanguageTypeUnknown)
+return lang;
+
+  if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
+if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+  return lang;
+else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit())
+  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+return lang;
+  }
+
   return lldb::eLanguageTypeUnknown;
 }
 


Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -1672,16 +1672,7 @@
   if (!GetVariable() || !GetVariable()->IsArtificial())
 return false;
 
-  LanguageType lang = eLanguageTypeUnknown;
-  if (auto *sym_ctx_scope = GetSymbolContextScope()) {
-if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
-  lang = func->GetLanguage();
-else if (auto *comp_unit =
- sym_ctx_scope->CalculateSymbolContextCompileUnit())
-  lang = comp_unit->GetLanguage();
-  }
-
-  if (auto *runtime = process->GetLanguageRuntime(lang))
+  if (auto *runtime = process->GetLanguageRuntime(GetVariable()->GetLanguage()))
 if (runtime->IsWhitelistedRuntimeValue(GetName()))
   return false;
 
Index: lldb/trunk/source/Symbol/Variable.cpp
===
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -54,10 +54,19 @@
 Variable::~Variable() {}
 
 lldb::LanguageType Variable::GetLanguage() const {
-  SymbolContext variable_sc;
-  m_owner_scope->CalculateSymbolContext(_sc);
-  if (variable_sc.comp_unit)
-return variable_sc.comp_unit->GetLanguage();
+  lldb::LanguageType lang = m_mangled.GuessLanguage();
+  if (lang != lldb::eLanguageTypeUnknown)
+return lang;
+
+  if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
+if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+  return lang;
+else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit())
+  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+return lang;
+  }
+
   return lldb::eLanguageTypeUnknown;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366733 - [Symbol] Improve Variable::GetLanguage

2019-07-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jul 22 13:14:18 2019
New Revision: 366733

URL: http://llvm.org/viewvc/llvm-project?rev=366733=rev
Log:
[Symbol] Improve Variable::GetLanguage

Summary:
When trying to ascertain what language a variable belongs to, just
checking the compilation unit is often not enough. In r364845 I added a way to
check for a variable's language type, but didn't put it in Variable itself.
Let's go ahead and put it in Variable.

Reviewers: jingham, clayborg

Subscribers: jdoerfert, lldb-commits

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

Modified:
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Symbol/Variable.cpp

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=366733=366732=366733=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon Jul 22 13:14:18 2019
@@ -1672,16 +1672,7 @@ bool ValueObject::IsRuntimeSupportValue(
   if (!GetVariable() || !GetVariable()->IsArtificial())
 return false;
 
-  LanguageType lang = eLanguageTypeUnknown;
-  if (auto *sym_ctx_scope = GetSymbolContextScope()) {
-if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
-  lang = func->GetLanguage();
-else if (auto *comp_unit =
- sym_ctx_scope->CalculateSymbolContextCompileUnit())
-  lang = comp_unit->GetLanguage();
-  }
-
-  if (auto *runtime = process->GetLanguageRuntime(lang))
+  if (auto *runtime = 
process->GetLanguageRuntime(GetVariable()->GetLanguage()))
 if (runtime->IsWhitelistedRuntimeValue(GetName()))
   return false;
 

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=366733=366732=366733=diff
==
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Mon Jul 22 13:14:18 2019
@@ -54,10 +54,19 @@ Variable::Variable(
 Variable::~Variable() {}
 
 lldb::LanguageType Variable::GetLanguage() const {
-  SymbolContext variable_sc;
-  m_owner_scope->CalculateSymbolContext(_sc);
-  if (variable_sc.comp_unit)
-return variable_sc.comp_unit->GetLanguage();
+  lldb::LanguageType lang = m_mangled.GuessLanguage();
+  if (lang != lldb::eLanguageTypeUnknown)
+return lang;
+
+  if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
+if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+  return lang;
+else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit())
+  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+return lang;
+  }
+
   return lldb::eLanguageTypeUnknown;
 }
 


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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, jasonmolenda, clayborg, sgraenitz.
JDevlieghere added a project: LLDB.
Herald added subscribers: teemperor, jfb, srhines.

Finally, after a lot of hard work from a bunch of people, we're in a state 
where we can unify LLDB's build system. This patch removes the hand-maintained 
Xcode project in favor of using CMake in combination with the Xcode generator.

I've included a new script to streamline the process: it creates two build 
directories in the current directory. The first directory is for LLVM and 
Clang, and uses Ninja to build it. The second directory is for LLBD, which 
configures a standalone build using the Xcode generator.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65109

Files:
  lldb/lldb.xcodeproj/project.pbxproj
  lldb/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/launcherRootXPCService.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/launcherXPCService.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-python-test-suite.xcscheme
  lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
  lldb/lldb.xcworkspace/contents.xcworkspacedata
  lldb/utils/xcode.py



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


[Lldb-commits] [PATCH] D64013: Correctly use GetLoadedModuleList to take advantage of libraries-svr4

2019-07-22 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 211141.
aadsm added a comment.

Address comments, also checks the LoadModules return on DynamicLoaderWindowsDYLD


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64013

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -200,9 +200,9 @@
 
   llvm::VersionTuple GetHostOSVersion() override;
 
-  size_t LoadModules(LoadedModuleInfoList _list) override;
+  llvm::Error LoadModules() override;
 
-  size_t LoadModules() override;
+  llvm::Expected GetLoadedModuleList() override;
 
   Status GetFileLoadAddress(const FileSpec , bool _loaded,
 lldb::addr_t _addr) override;
@@ -391,9 +391,6 @@
   // Query remote GDBServer for register information
   bool GetGDBServerRegisterInfo(ArchSpec );
 
-  // Query remote GDBServer for a detailed loaded library list
-  Status GetLoadedModuleList(LoadedModuleInfoList &);
-
   lldb::ModuleSP LoadModuleAtAddress(const FileSpec ,
  lldb::addr_t link_map,
  lldb::addr_t base_addr,
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2400,7 +2400,12 @@
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString();
   } else if (key.compare("library") == 0) {
-LoadModules();
+auto error = LoadModules();
+if (error) {
+  Log *log(
+  ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, std::move(error), "failed to load modules: {0}");
+}
   } else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
 uint32_t reg = UINT32_MAX;
 if (!key.getAsInteger(16, reg))
@@ -2756,9 +2761,13 @@
 
   // the loaded module list can also provides a link map address
   if (addr == LLDB_INVALID_ADDRESS) {
-LoadedModuleInfoList list;
-if (GetLoadedModuleList(list).Success())
-  addr = list.m_link_map;
+llvm::Expected list = GetLoadedModuleList();
+if (!list) {
+  Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, list.takeError(), "failed to read module list: {0}");
+} else {
+  addr = list->m_link_map;
+}
   }
 
   return addr;
@@ -4705,29 +4714,30 @@
   return m_register_info.GetNumRegisters() > 0;
 }
 
-Status ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList ) {
+llvm::Expected ProcessGDBRemote::GetLoadedModuleList() {
   // Make sure LLDB has an XML parser it can use first
   if (!XMLDocument::XMLEnabled())
-return Status(0, ErrorType::eErrorTypeGeneric);
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "XML parsing not available");
 
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS);
   if (log)
 log->Printf("ProcessGDBRemote::%s", __FUNCTION__);
 
+  LoadedModuleInfoList list;
   GDBRemoteCommunicationClient  = m_gdb_comm;
   bool can_use_svr4 = GetGlobalPluginProperties()->GetUseSVR4();
 
   // check that we have extended feature read support
   if (can_use_svr4 && comm.GetQXferLibrariesSVR4ReadSupported()) {
-list.clear();
-
 // request the loaded library list
 std::string raw;
 lldb_private::Status lldberr;
 
 if (!comm.ReadExtFeature(ConstString("libraries-svr4"), ConstString(""),
  raw, lldberr))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error in libraries-svr4 packet");
 
 // parse the xml file in memory
 if (log)
@@ -4735,11 +4745,14 @@
 XMLDocument doc;
 
 if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml"))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error reading noname.xml");
 
 XMLNode root_element = doc.GetRootElement("library-list-svr4");
 if (!root_element)
-  return Status();
+  return llvm::createStringError(
+  

[Lldb-commits] [PATCH] D64042: [Symbol] Improve Variable::GetLanguage

2019-07-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Sounds reasonable.


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

https://reviews.llvm.org/D64042



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


[Lldb-commits] [PATCH] D62183: [Windows] Fix race condition between state changes

2019-07-22 Thread Adrian McCarthy via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366703: [Windows] Fix race condition between state changes 
(authored by amccarth, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62183?vs=210365=211136#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62183

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


Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -205,16 +205,6 @@
  m_session_data->m_debugger->GetProcess().GetProcessId(),
  GetPrivateState());
 
-ExceptionRecordSP active_exception =
-m_session_data->m_debugger->GetActiveException().lock();
-if (active_exception) {
-  // Resume the process and continue processing debug events.  Mask the
-  // exception so that from the process's view, there is no indication that
-  // anything happened.
-  m_session_data->m_debugger->ContinueAsyncException(
-  ExceptionResult::MaskException);
-}
-
 LLDB_LOG(log, "resuming {0} threads.", m_thread_list.GetSize());
 
 bool failed = false;
@@ -233,10 +223,19 @@
 
 if (failed) {
   error.SetErrorString("ProcessWindows::DoResume failed");
-  return error;
 } else {
   SetPrivateState(eStateRunning);
 }
+
+ExceptionRecordSP active_exception =
+m_session_data->m_debugger->GetActiveException().lock();
+if (active_exception) {
+  // Resume the process and continue processing debug events.  Mask the
+  // exception so that from the process's view, there is no indication that
+  // anything happened.
+  m_session_data->m_debugger->ContinueAsyncException(
+  ExceptionResult::MaskException);
+}
   } else {
 LLDB_LOG(log, "error: process {0} is in state {1}.  Returning...",
  m_session_data->m_debugger->GetProcess().GetProcessId(),


Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -205,16 +205,6 @@
  m_session_data->m_debugger->GetProcess().GetProcessId(),
  GetPrivateState());
 
-ExceptionRecordSP active_exception =
-m_session_data->m_debugger->GetActiveException().lock();
-if (active_exception) {
-  // Resume the process and continue processing debug events.  Mask the
-  // exception so that from the process's view, there is no indication that
-  // anything happened.
-  m_session_data->m_debugger->ContinueAsyncException(
-  ExceptionResult::MaskException);
-}
-
 LLDB_LOG(log, "resuming {0} threads.", m_thread_list.GetSize());
 
 bool failed = false;
@@ -233,10 +223,19 @@
 
 if (failed) {
   error.SetErrorString("ProcessWindows::DoResume failed");
-  return error;
 } else {
   SetPrivateState(eStateRunning);
 }
+
+ExceptionRecordSP active_exception =
+m_session_data->m_debugger->GetActiveException().lock();
+if (active_exception) {
+  // Resume the process and continue processing debug events.  Mask the
+  // exception so that from the process's view, there is no indication that
+  // anything happened.
+  m_session_data->m_debugger->ContinueAsyncException(
+  ExceptionResult::MaskException);
+}
   } else {
 LLDB_LOG(log, "error: process {0} is in state {1}.  Returning...",
  m_session_data->m_debugger->GetProcess().GetProcessId(),
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366703 - [Windows] Fix race condition between state changes

2019-07-22 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Jul 22 10:03:20 2019
New Revision: 366703

URL: http://llvm.org/viewvc/llvm-project?rev=366703=rev
Log:
[Windows] Fix race condition between state changes

Patch by Martin Andersson (martin.anders...@evoma.se)

If the process is resumed before the state is changed to "running"
there is a possibility (when single stepping) that the debugger stops
and changes the state to "stopped" before it is first changed to
"running". This causes the process to ignore the stop event (since
the state did not change) which in turn leads the DebuggerThread to
wait indefinitely for the exception predicate in HandleExceptionEvent.

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

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.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=366703=366702=366703=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Mon Jul 
22 10:03:20 2019
@@ -205,16 +205,6 @@ Status ProcessWindows::DoResume() {
  m_session_data->m_debugger->GetProcess().GetProcessId(),
  GetPrivateState());
 
-ExceptionRecordSP active_exception =
-m_session_data->m_debugger->GetActiveException().lock();
-if (active_exception) {
-  // Resume the process and continue processing debug events.  Mask the
-  // exception so that from the process's view, there is no indication that
-  // anything happened.
-  m_session_data->m_debugger->ContinueAsyncException(
-  ExceptionResult::MaskException);
-}
-
 LLDB_LOG(log, "resuming {0} threads.", m_thread_list.GetSize());
 
 bool failed = false;
@@ -233,10 +223,19 @@ Status ProcessWindows::DoResume() {
 
 if (failed) {
   error.SetErrorString("ProcessWindows::DoResume failed");
-  return error;
 } else {
   SetPrivateState(eStateRunning);
 }
+
+ExceptionRecordSP active_exception =
+m_session_data->m_debugger->GetActiveException().lock();
+if (active_exception) {
+  // Resume the process and continue processing debug events.  Mask the
+  // exception so that from the process's view, there is no indication that
+  // anything happened.
+  m_session_data->m_debugger->ContinueAsyncException(
+  ExceptionResult::MaskException);
+}
   } else {
 LLDB_LOG(log, "error: process {0} is in state {1}.  Returning...",
  m_session_data->m_debugger->GetProcess().GetProcessId(),


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


[Lldb-commits] [PATCH] D62183: [Windows] Fix race condition between state changes

2019-07-22 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

Yes, I can submit it for you, probably in the next hour or two.  Thanks for the 
patch!


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

https://reviews.llvm.org/D62183



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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-22 Thread David Tenty via Phabricator via lldb-commits
daltenty updated this revision to Diff 211104.
daltenty added a comment.

- Fix typo in comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251

Files:
  libcxx/utils/libcxx/util.py
  lldb/lit/lit.cfg.py
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/util.py
  llvm/utils/lit/tests/googletest-timeout.py
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/lit/tests/shtest-timeout.py

Index: llvm/utils/lit/tests/shtest-timeout.py
===
--- llvm/utils/lit/tests/shtest-timeout.py
+++ llvm/utils/lit/tests/shtest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # llvm.org/PR33944
 # UNSUPPORTED: system-windows
Index: llvm/utils/lit/tests/lit.cfg
===
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -1,6 +1,7 @@
 # -*- Python -*-
 
 import os
+import platform
 import sys
 
 import lit.formats
@@ -56,10 +57,10 @@
 os.path.dirname(__file__), ".coveragerc")
 
 # Add a feature to detect if psutil is available
-try:
-import psutil
-lit_config.note('Found python psutil module')
-config.available_features.add("python-psutil")
-except ImportError:
-lit_config.warning('Could not import psutil. Some tests will be skipped and'
-   ' the --timeout command line argument will not work.')
+supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
+if supported:
+config.available_features.add("lit-max-individual-test-time")
+else:
+lit_config.warning('Setting a timeout per test not supported. ' + errormsg
+   + ' Some tests will be skipped and the --timeout'
+ ' command line argument will not work.')
Index: llvm/utils/lit/tests/googletest-timeout.py
===
--- llvm/utils/lit/tests/googletest-timeout.py
+++ llvm/utils/lit/tests/googletest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # Check that the per test timeout is enforced when running GTest tests.
 #
Index: llvm/utils/lit/lit/util.py
===
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -423,34 +423,56 @@
 return out.decode()
 return None
 
+def killProcessAndChildrenIsSupported():
+"""
+Returns a tuple ( , )
+where
+`` is True if `killProcessAndChildren()` is supported on
+the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why the function is
+not supported.
+"""
+if platform.system() == 'AIX':
+return (True, "")
+try:
+import psutil  # noqa: F401
+return (True, "")
+except ImportError:
+return (False,  "Requires the Python psutil module but it could"
+" not be found. Try installing it via pip or via"
+" your operating system's package manager.")
 
 def killProcessAndChildren(pid):
 """This function kills a process with ``pid`` and all its running children
-(recursively). It is currently implemented using the psutil module which
-provides a simple platform neutral implementation.
+(recursively). It is currently implemented using the psutil module on some
+platforms which provides a simple platform neutral implementation.
 
-TODO: Reimplement this without using psutil so we can   remove
-our dependency on it.
+TODO: Reimplement this without using psutil on all platforms so we can
+remove our dependency on it.
 
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+else:
+import psutil
 try:
-# psutil >= 2.x
-children_iterator = psutilProc.children(recursive=True)
-except AttributeError:
-# psutil 1.x
-children_iterator = psutilProc.get_children(recursive=True)
-for child in children_iterator:
+psutilProc = psutil.Process(pid)
+# Handle the different psutil API versions
 try:
-child.kill()
-except psutil.NoSuchProcess:
-pass
-psutilProc.kill()
-except psutil.NoSuchProcess:
-pass
+# psutil >= 2.x
+children_iterator = psutilProc.children(recursive=True)
+except AttributeError:
+# psutil 1.x
+children_iterator = psutilProc.get_children(recursive=True)
+

[Lldb-commits] [lldb] r366692 - ELF: Fix a "memset clearing object of non-trivial type" warning

2019-07-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Jul 22 07:29:29 2019
New Revision: 366692

URL: http://llvm.org/viewvc/llvm-project?rev=366692=rev
Log:
ELF: Fix a "memset clearing object of non-trivial type" warning

Just delete the memset as the ELFHeader constructor already
zero-initializes the object. Also clean up the ObjectFileELF
constructors/desctructors while I'm in there.

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=366692=366691=366692=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Jul 22 
07:29:29 2019
@@ -721,27 +721,16 @@ ObjectFileELF::ObjectFileELF(const lldb:
  DataBufferSP _sp, lldb::offset_t data_offset,
  const FileSpec *file, lldb::offset_t file_offset,
  lldb::offset_t length)
-: ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_header(), m_uuid(), m_gnu_debuglink_file(), m_gnu_debuglink_crc(0),
-  m_program_headers(), m_section_headers(), m_dynamic_symbols(),
-  m_filespec_up(), m_entry_point_address(), m_arch_spec() {
+: ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset) {
   if (file)
 m_file = *file;
-  ::memset(_header, 0, sizeof(m_header));
 }
 
 ObjectFileELF::ObjectFileELF(const lldb::ModuleSP _sp,
  DataBufferSP _data_sp,
  const lldb::ProcessSP _sp,
  addr_t header_addr)
-: ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_header(), m_uuid(), m_gnu_debuglink_file(), m_gnu_debuglink_crc(0),
-  m_program_headers(), m_section_headers(), m_dynamic_symbols(),
-  m_filespec_up(), m_entry_point_address(), m_arch_spec() {
-  ::memset(_header, 0, sizeof(m_header));
-}
-
-ObjectFileELF::~ObjectFileELF() {}
+: ObjectFile(module_sp, process_sp, header_addr, header_data_sp) {}
 
 bool ObjectFileELF::IsExecutable() const {
   return ((m_header.e_type & ET_EXEC) != 0) || (m_header.e_entry != 0);

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=366692=366691=366692=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Mon Jul 22 
07:29:29 2019
@@ -56,8 +56,6 @@ struct ELFNote {
 /// the ObjectFile protocol.
 class ObjectFileELF : public lldb_private::ObjectFile {
 public:
-  ~ObjectFileELF() override;
-
   // Static Functions
   static void Initialize();
 
@@ -190,7 +188,7 @@ private:
 
   /// ELF .gnu_debuglink file and crc data if available.
   std::string m_gnu_debuglink_file;
-  uint32_t m_gnu_debuglink_crc;
+  uint32_t m_gnu_debuglink_crc = 0;
 
   /// Collection of program headers.
   ProgramHeaderColl m_program_headers;


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


[Lldb-commits] [PATCH] D65025: [Symbol] Improve TypeSystemMap mutex safety

2019-07-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I fear this will deadlock again now. The original reason for the 
m_clear_in_progress was:

> r260624 | jingham | 2016-02-11 16:03:19 -0800 (Thu, 11 Feb 2016) | 14 lines
> 
> When calling TypeSystemMap::Clear, objects being destroyed in the process of 
>  clearing the map ended up calling back into the TypeSystemMap to do lookups. 
>  
>  Not a good idea, and in this case it would cause a deadlock.
> 
> You would only see this when replacing the target contents after an exec, and 
> only if you 
>  had stopped before the exec, evaluated an expression, then continued
>  on to the point where you did the exec.
> 
> Fixed this by making sure the TypeSystemMap::Clear tears down the TypeSystems 
> in the map before clearing the map.
>  I also add an expression before exec to the TestExec.py so that we'll catch 
> this
>  issue if it crops up again in the future.
> 
> rdar://problem/24554920




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

https://reviews.llvm.org/D65025



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


[Lldb-commits] [PATCH] D65089: SymbolVendor: Move compile unit handling into the SymbolFile class

2019-07-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks good. Just one question about caching the calculated number of compile 
units.




Comment at: source/Symbol/SymbolFile.cpp:174-182
+uint32_t SymbolFile::GetNumCompileUnits() {
+  std::lock_guard guard(GetModuleMutex());
+  if (m_compile_units.empty()) {
+// Resize our array of compile unit shared pointers -- which will each
+// remain NULL until someone asks for the actual compile unit information.
+m_compile_units.resize(CalculateNumCompileUnits());
+  }

For symbol files without compile units we will end up calling into 
CalculateNumCompileUnits() many tines. Can we set a bool to indicate we have 
already calculated the number of compile units to avoid this? 


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

https://reviews.llvm.org/D65089



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


[Lldb-commits] [PATCH] D65089: SymbolVendor: Move compile unit handling into the SymbolFile class

2019-07-22 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, jingham, JDevlieghere.
Herald added a subscriber: jdoerfert.

SymbolFile classes are responsible for creating CompileUnit instances
and they already need to have a notion of the id<->CompileUnit mapping
(because of APIs like ParseCompileUnitAtIndex). However, the
SymbolVendor has remained as the thing responsible for caching created
units (which the SymbolFiles were calling via convoluted constructs like
"m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(...)").

This patch moves the responsibility of caching the units into the
SymbolFile class. It does this by moving the implementation of
SymbolVendor::{GetNumCompileUnits,GetCompileUnitAtIndex} into the
equivalent SymbolFile functions. The SymbolVendor functions become just
a passthrough much like the rest of SymbolVendor.

The original implementations of SymbolFile::GetNumCompileUnits is moved
to "CalculateNumCompileUnits", and are made protected, as the "Get"
function is the external api of the class.
SymbolFile::ParseCompileUnitAtIndex is made protected for the same
reason.

This is the first step in removing the SymbolVendor indirection, as
proposed in
http://lists.llvm.org/pipermail/lldb-dev/2019-June/015071.html. After
removing all interesting logic from the SymbolVendor class, I'll proceed
with removing the indirection itself.


https://reviews.llvm.org/D65089

Files:
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/SymbolVendor.cpp
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -558,7 +558,7 @@
   outs() << "Found " << comp_units_count << " compile units.\n";
 
   for (uint32_t i = 0; i < comp_units_count; i++) {
-lldb::CompUnitSP comp_unit = symfile->ParseCompileUnitAtIndex(i);
+lldb::CompUnitSP comp_unit = symfile->GetCompileUnitAtIndex(i);
 if (!comp_unit)
   return make_string_error("Connot parse compile unit {0}.", i);
 
Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -58,8 +58,7 @@
 
 // SymbolVendor constructor
 SymbolVendor::SymbolVendor(const lldb::ModuleSP _sp)
-: ModuleChild(module_sp), m_type_list(), m_compile_units(), m_sym_file_up(),
-  m_symtab() {}
+: ModuleChild(module_sp), m_type_list(), m_sym_file_up(), m_symtab() {}
 
 // Destructor
 SymbolVendor::~SymbolVendor() {}
@@ -76,44 +75,14 @@
   }
 }
 
-bool SymbolVendor::SetCompileUnitAtIndex(size_t idx, const CompUnitSP _sp) {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
-const size_t num_compile_units = GetNumCompileUnits();
-if (idx < num_compile_units) {
-  // Fire off an assertion if this compile unit already exists for now. The
-  // partial parsing should take care of only setting the compile unit
-  // once, so if this assertion fails, we need to make sure that we don't
-  // have a race condition, or have a second parse of the same compile
-  // unit.
-  assert(m_compile_units[idx].get() == nullptr);
-  m_compile_units[idx] = cu_sp;
-  return true;
-} else {
-  // This should NOT happen, and if it does, we want to crash and know
-  // about it
-  assert(idx < num_compile_units);
-}
-  }
-  return false;
-}
-
 size_t SymbolVendor::GetNumCompileUnits() {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
 std::lock_guard guard(module_sp->GetMutex());
-if (m_compile_units.empty()) {
-  if (m_sym_file_up) {
-// Resize our array of compile unit shared pointers -- which will each
-// remain NULL until someone asks for the actual compile unit
-// information. When this happens, the symbol file will be asked to
-// parse this compile unit information.
-m_compile_units.resize(m_sym_file_up->GetNumCompileUnits());
-  }
-}
+if (m_sym_file_up)
+  return m_sym_file_up->GetNumCompileUnits();
   }
-  return m_compile_units.size();
+  return 0;
 }
 
 lldb::LanguageType 

[Lldb-commits] [lldb] r366673 - [lldb][NFC] Tablegenify breakpoint

2019-07-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Jul 22 03:02:09 2019
New Revision: 366673

URL: http://llvm.org/viewvc/llvm-project?rev=366673=rev
Log:
[lldb][NFC] Tablegenify breakpoint

Modified:
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/Options.td
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=366673=366672=366673=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Mon Jul 22 03:02:09 
2019
@@ -45,19 +45,8 @@ static void AddBreakpointDescription(Str
 // Modifiable Breakpoint Options
 #pragma mark Modify::CommandOptions
 static constexpr OptionDefinition g_breakpoint_modify_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "ignore-count", 'i', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount,   "Set the 
number of times this breakpoint is skipped before stopping." },
-  { LLDB_OPT_SET_1, false, "one-shot", 'o', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "The 
breakpoint is deleted the first time it stop causes a stop." },
-  { LLDB_OPT_SET_1, false, "thread-index", 'x', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadIndex, "The 
breakpoint stops only for the thread whose index matches this argument." },
-  { LLDB_OPT_SET_1, false, "thread-id",'t', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadID,"The 
breakpoint stops only for the thread whose TID matches this argument." },
-  { LLDB_OPT_SET_1, false, "thread-name",  'T', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadName,  "The 
breakpoint stops only for the thread whose thread name matches this argument." 
},
-  { LLDB_OPT_SET_1, false, "queue-name",   'q', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeQueueName,   "The 
breakpoint stops only for threads in the queue whose name is given by this 
argument." },
-  { LLDB_OPT_SET_1, false, "condition",'c', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression,  "The 
breakpoint stops only if this condition expression evaluates to true." },
-  { LLDB_OPT_SET_1, false, "auto-continue",'G', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "The 
breakpoint will auto-continue after running its commands." },
-  { LLDB_OPT_SET_2, false, "enable",   'e', OptionParser::eNoArgument, 
  nullptr, {}, 0, eArgTypeNone,"Enable the breakpoint." },
-  { LLDB_OPT_SET_3, false, "disable",  'd', OptionParser::eNoArgument, 
  nullptr, {}, 0, eArgTypeNone,"Disable the breakpoint." },
-  { LLDB_OPT_SET_4, false, "command",  'C', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCommand, "A 
command to run when the breakpoint is hit, can be provided more than once, the 
commands will get run in order left to right." },
-// clang-format on
+#define LLDB_OPTIONS_breakpoint_modify
+#include "CommandOptions.inc"
 };
 class lldb_private::BreakpointOptionGroup : public OptionGroup
 {
@@ -193,10 +182,8 @@ public:
 
 };
 static constexpr OptionDefinition g_breakpoint_dummy_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', 
OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Act on Dummy 
breakpoints - i.e. breakpoints set before a file is provided, "
-  "which prime new targets." },
-// clang-format on
+#define LLDB_OPTIONS_breakpoint_dummy
+#include "CommandOptions.inc"
 };
 
 class BreakpointDummyOptionGroup : public OptionGroup
@@ -237,87 +224,9 @@ public:
 
 };
 
-// If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
-// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
-#define LLDB_OPT_NOT_10 (LLDB_OPT_SET_FROM_TO(1, 11) & ~LLDB_OPT_SET_10)
-#define LLDB_OPT_SKIP_PROLOGUE (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
-#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 11) & ~LLDB_OPT_SET_2 & 
~LLDB_OPT_SET_10)
-#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_FROM_TO(1, 8) & ~LLDB_OPT_SET_2)
-#define LLDB_OPT_MOVE_TO_NEAREST_CODE (LLDB_OPT_SET_1 | LLDB_OPT_SET_9)
-#define LLDB_OPT_EXPR_LANGUAGE (LLDB_OPT_SET_FROM_TO(3, 8))
-
 static constexpr OptionDefinition g_breakpoint_set_options[] = {
-// clang-format off
-  { LLDB_OPT_NOT_10,   false, "shlib",  's', 
OptionParser::eRequiredArgument, nullptr, {}, 
CommandCompletions::eModuleCompletion, eArgTypeShlibName,   "Set 
the breakpoint only in this shared library.  Can repeat this option "
-  "multiple times to specify multiple shared libraries." },
-  { LLDB_OPT_SET_ALL,  false,