[Lldb-commits] [lldb] cb6c9f7 - [lldb] Make gdbremote.py utility py2and3 compatible

2020-02-13 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-13T09:18:55+01:00
New Revision: cb6c9f731b657807124bcb5a6c1f8aecf25f120b

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

LOG: [lldb] Make gdbremote.py utility py2and3 compatible

Added: 


Modified: 
lldb/examples/python/gdbremote.py

Removed: 




diff  --git a/lldb/examples/python/gdbremote.py 
b/lldb/examples/python/gdbremote.py
index dcacbfccdaff..52601c09d3be 100755
--- a/lldb/examples/python/gdbremote.py
+++ b/lldb/examples/python/gdbremote.py
@@ -16,6 +16,7 @@
 # available.
 #--
 
+from __future__ import print_function
 import binascii
 import subprocess
 import json
@@ -324,10 +325,10 @@ def is_hex_byte(str):
 
 def get_hex_string_if_all_printable(str):
 try:
-s = binascii.unhexlify(str)
+s = binascii.unhexlify(str).decode()
 if all(c in string.printable for c in s):
 return s
-except TypeError:
+except (TypeError, binascii.Error, UnicodeDecodeError):
 pass
 return None
 
@@ -548,10 +549,10 @@ def get_hex_uint(self, byte_order, n=0):
 def get_key_value_pairs(self):
 kvp = list()
 if ';' in self.str:
-key_value_pairs = string.split(self.str, ';')
+key_value_pairs = self.str.split(';')
 for key_value_pair in key_value_pairs:
 if len(key_value_pair):
-kvp.append(string.split(key_value_pair, ':'))
+kvp.append(key_value_pair.split(':', 1))
 return kvp
 
 def split(self, ch):
@@ -678,7 +679,7 @@ def cmd_qXfer(options, cmd, args):
 
 
 def rsp_qXfer(options, cmd, cmd_args, rsp):
-data = string.split(cmd_args, ':')
+data = cmd_args.split(':')
 if data[0] == 'features':
 if data[1] == 'read':
 filename, extension = os.path.splitext(data[2])
@@ -825,8 +826,8 @@ def cmd_vCont(options, cmd, args):
 else:
 got_other_threads = 0
 s = ''
-for thread_action in string.split(args[1:], ';'):
-(short_action, thread) = string.split(thread_action, ':')
+for thread_action in args[1:].split(';'):
+(short_action, thread) = thread_action.split(':', 1)
 tid = int(thread, 16)
 if short_action == 'c':
 action = 'continue'
@@ -856,7 +857,7 @@ def rsp_vCont(options, cmd, cmd_args, rsp):
 if cmd_args == '?':
 # Skip the leading 'vCont;'
 rsp = rsp[6:]
-modes = string.split(rsp, ';')
+modes = rsp.split(';')
 s = "%s: supported extended continue modes include: " % (cmd)
 
 for i, mode in enumerate(modes):



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


[Lldb-commits] [PATCH] D74398: [lldb-server] jThreadsInfo returns stack memory

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

BTW, a the `lldb/examples/python/gdbremote.py` script for these kinds of things 
measurements. It takes a lldb log file produced like so: `log enable gdb-remote 
packets -T -f /tmp/gdb.log`, and it gives you some statistics about the various 
packets present there:

  #
  # Packet   Time (sec)  Percent Count  Latency
  #- --- --- -- ---
   x0.003926  37.15% 22  0.000178
   qRegisterInfo0.001462  13.83%135  0.11
   A0.001419  13.43%  1  0.001419
  ...

I'd be interested in seeing is how much does this extra work increase the 
latency of the jThreadsInfo packet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74398



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


[Lldb-commits] [PATCH] D73665: Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This looks good now. Thanks for your patience.




Comment at: 
lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py:68
+  [main_bp_line])
+if response:
+breakpoints = response['body']['breakpoints']

Under what conditions can `response` be None? Should this maybe be 
`assertIsNotNone(response)` instead ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73665



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


[Lldb-commits] [PATCH] D74451: [lldb/Plugins] Have one initializer per ABI plugin

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/API/SystemInitializerFull.cpp:27-34
+LLDB_PLUGIN_DECLARE(ABIAArch64);
+LLDB_PLUGIN_DECLARE(ABIARM);
 LLDB_PLUGIN_DECLARE(ABISysV_arc);
 LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
-LLDB_PLUGIN_DECLARE(ABISysV_mips);
-LLDB_PLUGIN_DECLARE(ABISysV_mips64);
-LLDB_PLUGIN_DECLARE(ABISysV_ppc);
-LLDB_PLUGIN_DECLARE(ABISysV_ppc64);
+LLDB_PLUGIN_DECLARE(ABIMips);
+LLDB_PLUGIN_DECLARE(ABIPowerPC);
 LLDB_PLUGIN_DECLARE(ABISysV_s390x);

Are you missing the equivalent changes in SystemInitializerTest ?


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

https://reviews.llvm.org/D74451



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


[Lldb-commits] [PATCH] D73067: [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks like a bad upload -- based on some earlier version of this patch and 
not master..


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D73067



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


[Lldb-commits] [PATCH] D73782: [lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Do you have any more comments on this patch, Greg?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73782



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


[Lldb-commits] [lldb] 5d3926a - [lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach

2020-02-13 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-13T10:32:15+01:00
New Revision: 5d3926a5a287618fea772c5be689f6c9fc2f6fc3

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

LOG: [lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach

- reduce indentation by removing the defensive
  GetID()!=INVALID_PROCESS_ID check -- this function is only called when
  an attach or launch succeeds
- replace LLDB_LOGF with LLDB_LOG

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3dfe21df500e..329656065822 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1026,123 +1026,87 @@ Status 
ProcessGDBRemote::ConnectToDebugserver(llvm::StringRef connect_url) {
 
 void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  LLDB_LOGF(log, "ProcessGDBRemote::%s()", __FUNCTION__);
-  if (GetID() != LLDB_INVALID_PROCESS_ID) {
-BuildDynamicRegisterInfo(false);
+  BuildDynamicRegisterInfo(false);
 
-// See if the GDB server supports the qHostInfo information
+  // See if the GDB server supports qHostInfo or qProcessInfo packets. Prefer
+  // qProcessInfo as it will be more specific to our process.
 
-// See if the GDB server supports the qProcessInfo packet, if so prefer
-// that over the Host information as it will be more specific to our
-// process.
+  const ArchSpec &remote_process_arch = m_gdb_comm.GetProcessArchitecture();
+  if (remote_process_arch.IsValid()) {
+process_arch = remote_process_arch;
+LLDB_LOG(log, "gdb-remote had process architecture, using {0} {1}",
+ process_arch.GetArchitectureName(),
+ process_arch.GetTriple().getTriple());
+  } else {
+process_arch = m_gdb_comm.GetHostArchitecture();
+LLDB_LOG(log,
+ "gdb-remote did not have process architecture, using gdb-remote "
+ "host architecture {0} {1}",
+ process_arch.GetArchitectureName(),
+ process_arch.GetTriple().getTriple());
+  }
 
-const ArchSpec &remote_process_arch = m_gdb_comm.GetProcessArchitecture();
-if (remote_process_arch.IsValid()) {
-  process_arch = remote_process_arch;
-  LLDB_LOGF(log,
-"ProcessGDBRemote::%s gdb-remote had process architecture, "
-"using %s %s",
-__FUNCTION__,
-process_arch.GetArchitectureName()
-? process_arch.GetArchitectureName()
-: "",
-process_arch.GetTriple().getTriple().c_str()
-? process_arch.GetTriple().getTriple().c_str()
-: "");
-} else {
-  process_arch = m_gdb_comm.GetHostArchitecture();
-  LLDB_LOGF(log,
-"ProcessGDBRemote::%s gdb-remote did not have process "
-"architecture, using gdb-remote host architecture %s %s",
-__FUNCTION__,
-process_arch.GetArchitectureName()
-? process_arch.GetArchitectureName()
-: "",
-process_arch.GetTriple().getTriple().c_str()
-? process_arch.GetTriple().getTriple().c_str()
-: "");
-}
+  if (process_arch.IsValid()) {
+const ArchSpec &target_arch = GetTarget().GetArchitecture();
+if (target_arch.IsValid()) {
+  LLDB_LOG(log, "analyzing target arch, currently {0} {1}",
+   target_arch.GetArchitectureName(),
+   target_arch.GetTriple().getTriple());
+
+  // If the remote host is ARM and we have apple as the vendor, then
+  // ARM executables and shared libraries can have mixed ARM
+  // architectures.
+  // You can have an armv6 executable, and if the host is armv7, then the
+  // system will load the best possible architecture for all shared
+  // libraries it has, so we really need to take the remote host
+  // architecture as our defacto architecture in this case.
+
+  if ((process_arch.GetMachine() == llvm::Triple::arm ||
+   process_arch.GetMachine() == llvm::Triple::thumb) &&
+  process_arch.GetTriple().getVendor() == llvm::Triple::Apple) {
+GetTarget().SetArchitecture(process_arch);
+LLDB_LOG(log,
+ "remote process is ARM/Apple, "
+ "setting target arch to {0} {1}",
+ process_arch.GetArchitectureName(),
+ process_arch.GetTriple().getTriple());
+  } else {
+// Fill in what is missing in

[Lldb-commits] [lldb] 91e0c25 - [lldb] Fix lldb-dotest

2020-02-13 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-13T14:31:08+01:00
New Revision: 91e0c258c2e80b180c0c99af322cb6bf09df86d4

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

LOG: [lldb] Fix lldb-dotest

to account for the new location of test files from 99451b445.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/configuration.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/configuration.py 
b/lldb/packages/Python/lldbsuite/test/configuration.py
index 91a223432b80..faf31e7dbcf8 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -97,7 +97,7 @@
 # By default, search from the script directory.
 # We can't use sys.path[0] to determine the script directory
 # because it doesn't work under a debugger
-testdirs = [os.path.dirname(os.path.realpath(__file__))]
+testdirs = [lldbsuite.lldb_test_root]
 
 # Separator string.
 separator = '-' * 70



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


[Lldb-commits] [PATCH] D74478: [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

2020-02-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D74478#1873581 , @shafik wrote:

> I can see how stripping `__1` would be nice but I seeing `(anonymous 
> namespace)` may be useful to know especially b/c it effects visibility and 
> linkage. It would be nicer if could make this optional and default it off but 
> be able to turn it back on.


You can always use the 'raw' output on variables (-R) for seeing all 
information about a variable and its type (including the full non-display 
name). Also I think the general consensus is that we print the types as close 
as possible as how the user is using them in the program (which is what for 
example Clang is doing in its diagnostics).

I updated the review description to better illustrate how verbose the 
anonymous/inline namespaces are in the type descriptions.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74478



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


[Lldb-commits] [PATCH] D74551: [lldb/dotest] Remove the "exclusive test subdir" concept

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: vsk, JDevlieghere.
Herald added a project: LLDB.

This was added in 2018 (r339929), when we were still using the
hand-rolled test runner.

It does not seem to be relevant anymore. In fact as far as I can tell,
it's a big no-op now as the exclusive_test_subdir variable is never set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74551

Files:
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1051,15 +1051,7 @@
 "netbsd" in target_platform or
 "windows" in target_platform)
 
-# Collect tests from the specified testing directories. If a test
-# subdirectory filter is explicitly specified, limit the search to that
-# subdirectory.
-exclusive_test_subdir = 
configuration.get_absolute_path_to_exclusive_test_subdir()
-if exclusive_test_subdir:
-dirs_to_search = [exclusive_test_subdir]
-else:
-dirs_to_search = configuration.testdirs
-for testdir in dirs_to_search:
+for testdir in configuration.testdirs:
 for (dirpath, dirnames, filenames) in os.walk(testdir):
 visit('Test', dirpath, filenames)
 
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -117,11 +117,6 @@
 # The clang module cache directory used by clang.
 clang_module_cache_dir = None
 
-# The only directory to scan for tests. If multiple test directories are
-# specified, and an exclusive test subdirectory is specified, the latter option
-# takes precedence.
-exclusive_test_subdir = None
-
 # Test results handling globals
 results_filename = None
 results_formatter_name = None
@@ -153,37 +148,6 @@
 return False
 
 
-def get_absolute_path_to_exclusive_test_subdir():
-"""
-If an exclusive test subdirectory is specified, return its absolute path.
-Otherwise return None.
-"""
-test_directory = os.path.dirname(os.path.realpath(__file__))
-
-if not exclusive_test_subdir:
-return
-
-if len(exclusive_test_subdir) > 0:
-test_subdir = os.path.join(test_directory, exclusive_test_subdir)
-if os.path.isdir(test_subdir):
-return test_subdir
-
-print('specified test subdirectory {} is not a valid directory\n'
-.format(test_subdir))
-
-
-def get_absolute_path_to_root_test_dir():
-"""
-If an exclusive test subdirectory is specified, return its absolute path.
-Otherwise, return the absolute path of the root test directory.
-"""
-test_subdir = get_absolute_path_to_exclusive_test_subdir()
-if test_subdir:
-return test_subdir
-
-return os.path.dirname(os.path.realpath(__file__))
-
-
 def get_filecheck_path():
 """
 Get the path to the FileCheck testing tool.


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1051,15 +1051,7 @@
 "netbsd" in target_platform or
 "windows" in target_platform)
 
-# Collect tests from the specified testing directories. If a test
-# subdirectory filter is explicitly specified, limit the search to that
-# subdirectory.
-exclusive_test_subdir = configuration.get_absolute_path_to_exclusive_test_subdir()
-if exclusive_test_subdir:
-dirs_to_search = [exclusive_test_subdir]
-else:
-dirs_to_search = configuration.testdirs
-for testdir in dirs_to_search:
+for testdir in configuration.testdirs:
 for (dirpath, dirnames, filenames) in os.walk(testdir):
 visit('Test', dirpath, filenames)
 
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -117,11 +117,6 @@
 # The clang module cache directory used by clang.
 clang_module_cache_dir = None
 
-# The only directory to scan for tests. If multiple test directories are
-# specified, and an exclusive test subdirectory is specified, the latter option
-# takes precedence.
-exclusive_test_subdir = None
-
 # Test results handling globals
 results_filename = None
 results_formatter_name = None
@@ -153,37 +148,6 @@
 return False
 
 
-def get_absolute_path_to_exclusive_test_subdir():
-"""
-If an exclusive test subdirectory is specified, return its absolute path.
-Otherwise return None.
-"""

[Lldb-commits] [lldb] 12e32d3 - [lldb] Introduce "RegInfoBasedABI"

2020-02-13 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-13T15:29:12+01:00
New Revision: 12e32d32d39332a678b6a7b88f2c5bd8eb70bd69

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

LOG: [lldb] Introduce "RegInfoBasedABI"

Summary:
This patch creates a new subclass of the ABI class in order to abstract away the
mechanism in which we "augment" register information. This enables alternate
augmentation strategies to be introduced.

All existing ABI classes have been modified to inherit from RegInfoBasedABI, but
they will be refactored in subsequent patches.

Reviewers: JDevlieghere, jasonmolenda

Subscribers: sdardis, nemanjai, kbarton, jrtc27, atanasyan, jsji, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Target/ABI.h
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h
lldb/source/Plugins/ABI/ARM/ABISysV_arm.h
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h
lldb/source/Plugins/ABI/Mips/ABISysV_mips.h
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h
lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
lldb/source/Plugins/ABI/X86/ABISysV_i386.h
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
lldb/source/Target/ABI.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index 1aff1e2f7817..4718fee61777 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -126,7 +126,7 @@ class ABI : public PluginInterface {
 
   llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; }
 
-  virtual void AugmentRegisterInfo(RegisterInfo &info);
+  virtual void AugmentRegisterInfo(RegisterInfo &info) = 0;
 
   virtual bool GetPointerReturnRegister(const char *&name) { return false; }
 
@@ -138,10 +138,6 @@ class ABI : public PluginInterface {
 assert(m_mc_register_info_up && "ABI must have MCRegisterInfo");
   }
 
-  bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
-
-  virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
-
   /// Utility function to construct a MCRegisterInfo using the ArchSpec triple.
   /// Plugins wishing to customize the construction can construct the
   /// MCRegisterInfo themselves.
@@ -155,6 +151,18 @@ class ABI : public PluginInterface {
   DISALLOW_COPY_AND_ASSIGN(ABI);
 };
 
+class RegInfoBasedABI : public ABI {
+public:
+  void AugmentRegisterInfo(RegisterInfo &info) override;
+
+protected:
+  using ABI::ABI;
+
+  bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
+
+  virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_ABI_h_

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h 
b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
index c7a91ba9c468..208d3a0b9fce 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
@@ -13,7 +13,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
 
-class ABIMacOSX_arm64 : public lldb_private::ABI {
+class ABIMacOSX_arm64 : public lldb_private::RegInfoBasedABI {
 public:
   ~ABIMacOSX_arm64() override = default;
 
@@ -93,11 +93,7 @@ class ABIMacOSX_arm64 : public lldb_private::ABI {
lldb_private::CompilerType &ast_type) const 
override;
 
 private:
-  ABIMacOSX_arm64(lldb::ProcessSP process_sp,
-  std::unique_ptr info_up)
-  : lldb_private::ABI(std::move(process_sp), std::move(info_up)) {
-// Call CreateInstance instead.
-  }
+  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance 
instead.
 };
 
 #endif // liblldb_ABIMacOSX_arm64_h_

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h 
b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
index 1bf5773e2db3..590f2cdc323a 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
+++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
@@ -12,7 +12,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h"
 
-class ABISysV_arm64 : public lldb_private::ABI {
+class ABISysV_arm64 : public lldb_private::RegInfoBasedABI {
 public:
   ~ABISysV_arm64() override = default;
 
@@ -92,11 +92,7 @@ class ABISysV_arm64 : public lldb_private::ABI {
lldb_private::CompilerType &ast_type) const 
override;
 
 private:
-  ABISysV_arm64(lldb::ProcessSP process_s

[Lldb-commits] [PATCH] D74243: [lldb] Introduce "RegInfoBasedABI"

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG12e32d32d393: [lldb] Introduce "RegInfoBasedABI" 
(authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74243

Files:
  lldb/include/lldb/Target/ABI.h
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h
  lldb/source/Plugins/ABI/ARM/ABISysV_arm.h
  lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h
  lldb/source/Plugins/ABI/Mips/ABISysV_mips.h
  lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h
  lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
  lldb/source/Plugins/ABI/X86/ABISysV_i386.h
  lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
  lldb/source/Target/ABI.cpp

Index: lldb/source/Target/ABI.cpp
===
--- lldb/source/Target/ABI.cpp
+++ lldb/source/Target/ABI.cpp
@@ -41,7 +41,7 @@
 
 ABI::~ABI() = default;
 
-bool ABI::GetRegisterInfoByName(ConstString name, RegisterInfo &info) {
+bool RegInfoBasedABI::GetRegisterInfoByName(ConstString name, RegisterInfo &info) {
   uint32_t count = 0;
   const RegisterInfo *register_info_array = GetRegisterInfoArray(count);
   if (register_info_array) {
@@ -212,7 +212,7 @@
   return info_up;
 }
 
-void ABI::AugmentRegisterInfo(RegisterInfo &info) {
+void RegInfoBasedABI::AugmentRegisterInfo(RegisterInfo &info) {
   if (info.kinds[eRegisterKindEHFrame] != LLDB_INVALID_REGNUM &&
   info.kinds[eRegisterKindDWARF] != LLDB_INVALID_REGNUM)
 return;
Index: lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
===
--- lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
+++ lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
@@ -12,7 +12,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h"
 
-class ABIWindows_x86_64 : public lldb_private::ABI {
+class ABIWindows_x86_64 : public lldb_private::RegInfoBasedABI {
 public:
   ~ABIWindows_x86_64() override = default;
 
@@ -91,11 +91,7 @@
   bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
 
 private:
-  ABIWindows_x86_64(lldb::ProcessSP process_sp,
-std::unique_ptr info_up)
-  : lldb_private::ABI(std::move(process_sp), std::move(info_up)) {
-// Call CreateInstance instead.
-  }
+  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
 };
 
 #endif // liblldb_ABISysV_x86_64_h_
Index: lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
===
--- lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
+++ lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
@@ -12,7 +12,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h"
 
-class ABISysV_x86_64 : public lldb_private::ABI {
+class ABISysV_x86_64 : public lldb_private::RegInfoBasedABI {
 public:
   ~ABISysV_x86_64() override = default;
 
@@ -98,11 +98,7 @@
   bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
 
 private:
-  ABISysV_x86_64(lldb::ProcessSP process_sp,
- std::unique_ptr info_up)
-  : lldb_private::ABI(std::move(process_sp), std::move(info_up)) {
-// Call CreateInstance instead.
-  }
+  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
 };
 
 #endif // liblldb_ABISysV_x86_64_h_
Index: lldb/source/Plugins/ABI/X86/ABISysV_i386.h
===
--- lldb/source/Plugins/ABI/X86/ABISysV_i386.h
+++ lldb/source/Plugins/ABI/X86/ABISysV_i386.h
@@ -12,7 +12,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h"
 
-class ABISysV_i386 : public lldb_private::ABI {
+class ABISysV_i386 : public lldb_private::RegInfoBasedABI {
 public:
   ~ABISysV_i386() override = default;
 
@@ -100,11 +100,7 @@
   bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
 
 private:
-  ABISysV_i386(lldb::ProcessSP process_sp,
-   std::unique_ptr info_up)
-  : lldb_private::ABI(std::move(process_sp), std::move(info_up)) {
-// Call CreateInstance instead.
-  }
+  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
 };
 
 #endif // liblldb_ABISysV_i386_h_
Index: lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
===
--- lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
+++ lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
@@ -13,7 +13,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/lldb-private.h

[Lldb-commits] [lldb] 7a0e98b - [llvm][lldb] Update links to ABI for the Arm Architecture. [NFC]

2020-02-13 Thread Francesco Petrogalli via lldb-commits

Author: Francesco Petrogalli
Date: 2020-02-13T14:57:53Z
New Revision: 7a0e98bc74a11b160c3eb0b5a52e9925c7038e3e

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

LOG: [llvm][lldb] Update links to ABI for the Arm Architecture. [NFC]

Added: 


Modified: 
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
llvm/docs/LangRef.rst

Removed: 




diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index b3fec9637772..ee38516e30bc 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -2023,7 +2023,7 @@ bool ABIMacOSX_arm64::CreateDefaultUnwindPlan(UnwindPlan 
&unwind_plan) {
 // volatile (and specifically only the lower 8 bytes of these regs), the rest
 // of the fp/SIMD registers are volatile.
 //
-// v. 
https://github.com/ARM-software/software-standards/blob/master/abi/aapcs64/
+// v. https://github.com/ARM-software/abi-aa/blob/master/aapcs64/
 
 // We treat x29 as callee preserved also, else the unwinder won't try to
 // retrieve fp saves.

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index a561ff6c13fb..2a61e0b19987 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1913,7 +1913,7 @@ attributes are supported:
 present in the IR Module. The signature of the vector variant is
 determined by the rules of the Vector Function ABI (VFABI)
 specifications of the target. For Arm and X86, the VFABI can be
-found at https://github.com/ARM-software/software-standards and
+found at https://github.com/ARM-software/abi-aa and
 https://software.intel.com/en-us/articles/vector-simd-function-abi,
 respectively.
 



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


[Lldb-commits] [PATCH] D74556: [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

2020-02-13 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: JDevlieghere, teemperor.
tatyana-krasnukha added a project: LLDB.
Herald added a subscriber: lldb-commits.

Some implementations (BreakpointResolverScripted) try calling the breakpoint's 
shared_from_this(),
that makes LLDB crash.

Added a test case that reproduced the issue.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74556

Files:
  lldb/include/lldb/Breakpoint/Breakpoint.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -127,12 +127,12 @@
 
   m_stop_hooks = target->m_stop_hooks;
 
-  for (BreakpointSP breakpoint_sp : target->m_breakpoint_list.Breakpoints()) {
+  for (const auto &breakpoint_sp : target->m_breakpoint_list.Breakpoints()) {
 if (breakpoint_sp->IsInternal())
   continue;
 
-BreakpointSP new_bp(new Breakpoint(*this, *breakpoint_sp.get()));
-AddBreakpoint(new_bp, false);
+BreakpointSP new_bp(Breakpoint::CopyFromBreakpoint(*this, *breakpoint_sp));
+AddBreakpoint(std::move(new_bp), false);
   }
 
   for (auto bp_name_entry : target->m_breakpoint_names) {
Index: lldb/source/Breakpoint/Breakpoint.cpp
===
--- lldb/source/Breakpoint/Breakpoint.cpp
+++ lldb/source/Breakpoint/Breakpoint.cpp
@@ -55,21 +55,26 @@
   m_being_created = false;
 }
 
-Breakpoint::Breakpoint(Target &new_target, Breakpoint &source_bp)
+Breakpoint::Breakpoint(Target &new_target, const Breakpoint &source_bp)
 : m_being_created(true), m_hardware(source_bp.m_hardware),
   m_target(new_target), m_name_list(source_bp.m_name_list),
   m_options_up(new BreakpointOptions(*source_bp.m_options_up)),
   m_locations(*this),
   m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols),
-  m_hit_count(0) {
-  // Now go through and copy the filter & resolver:
-  m_resolver_sp = source_bp.m_resolver_sp->CopyForBreakpoint(*this);
-  m_filter_sp = source_bp.m_filter_sp->CopyForBreakpoint(*this);
-}
+  m_hit_count(0) {}
 
 // Destructor
 Breakpoint::~Breakpoint() = default;
 
+BreakpointSP Breakpoint::CopyFromBreakpoint(Target& new_target,
+const Breakpoint& bp_to_copy_from) {
+  BreakpointSP bp(new Breakpoint(new_target, bp_to_copy_from));
+  // Now go through and copy the filter & resolver:
+  bp->m_resolver_sp = bp_to_copy_from.m_resolver_sp->CopyForBreakpoint(*bp);
+  bp->m_filter_sp = bp_to_copy_from.m_filter_sp->CopyForBreakpoint(*bp);
+  return bp;
+}
+
 // Serialization
 StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() {
   // Serialize the resolver:
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -40,8 +40,21 @@
 self.build()
 self.do_test_bad_options()
 
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+def test_copy_from_dummy_target(self):
+"""Make sure we don't crash during scripted breakpoint copy from dummy target"""
+self.build()
+self.do_test_copy_from_dummy_target()
+
 def make_target_and_import(self):
-target = lldbutil.run_to_breakpoint_make_target(self)
+target = self.make_target()
+self.import_resolver_script()
+return target
+
+def make_target(self):
+return lldbutil.run_to_breakpoint_make_target(self)
+
+def import_resolver_script(self):
 interp = self.dbg.GetCommandInterpreter()
 error = lldb.SBError()
 
@@ -52,7 +65,6 @@
 result = lldb.SBCommandReturnObject()
 interp.HandleCommand(command, result)
 self.assertTrue(result.Succeeded(), "com scr imp failed: %s"%(result.GetError()))
-return target
 
 def make_extra_args(self):
 json_string = '{"symbol":"break_on_me", "test1": "value1"}'
@@ -222,3 +234,23 @@
substrs=['Value: "a_value" missing matching key'])
 self.expect("break set -P resolver.Resolver -k a_key -k a_key -v another_value", error = True, msg="Missing value among args",
substrs=['Key: "a_key" missing value'])
+
+def do_test_copy_from_dummy_target(self):
+# Import breakpoint scripted resolver.
+self.import_resolver_script()
+
+# Create a scripted breakpoint.
+self.runCmd("breakpoint set -P resolver.Resolver -k symbol -v break_on_me",
+BREAKPOINT_CREATED)
+
+# This is the function to

[Lldb-commits] [PATCH] D74557: [lldb] Make BreakpointResolver hold weak_ptr instead of raw pointer to breakpoint

2020-02-13 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: JDevlieghere, teemperor.
tatyana-krasnukha added a project: LLDB.
Herald added a subscriber: lldb-commits.

This prevents calling Breakpoint::shared_from_this of an object that is not 
owned by any shared_ptr.

The patch is a consequence of D74556 


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74557

Files:
  lldb/include/lldb/Breakpoint/BreakpointResolver.h
  lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
  lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
  lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
  lldb/include/lldb/Breakpoint/BreakpointResolverName.h
  lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
  lldb/include/lldb/Target/LanguageRuntime.h
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointResolver.cpp
  lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Breakpoint/BreakpointResolverScripted.cpp
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  lldb/source/Target/LanguageRuntime.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -621,7 +621,7 @@
 const bool hardware = request_hardware || GetRequireHardwareBreakpoints();
 bp_sp.reset(new Breakpoint(*this, filter_sp, resolver_sp, hardware,
resolve_indirect_symbols));
-resolver_sp->SetBreakpoint(bp_sp.get());
+resolver_sp->SetBreakpoint(bp_sp);
 AddBreakpoint(bp_sp, internal);
   }
   return bp_sp;
Index: lldb/source/Target/LanguageRuntime.cpp
===
--- lldb/source/Target/LanguageRuntime.cpp
+++ lldb/source/Target/LanguageRuntime.cpp
@@ -154,17 +154,17 @@
   }
 
 protected:
-  BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override {
+  BreakpointResolverSP CopyForBreakpoint(BreakpointSP &breakpoint) override {
 BreakpointResolverSP ret_sp(
 new ExceptionBreakpointResolver(m_language, m_catch_bp, m_throw_bp));
-ret_sp->SetBreakpoint(&breakpoint);
+ret_sp->SetBreakpoint(breakpoint);
 return ret_sp;
   }
 
   bool SetActualResolver() {
-ProcessSP process_sp;
-if (m_breakpoint) {
-  process_sp = m_breakpoint->GetTarget().GetProcessSP();
+BreakpointSP breakpoint_sp = GetBreakpoint();
+if (breakpoint_sp) {
+  ProcessSP process_sp = breakpoint_sp->GetTarget().GetProcessSP();
   if (process_sp) {
 bool refreash_resolver = !m_actual_resolver_sp;
 if (m_language_runtime == nullptr) {
@@ -181,7 +181,7 @@
 
 if (refreash_resolver && m_language_runtime) {
   m_actual_resolver_sp = m_language_runtime->CreateExceptionResolver(
-  m_breakpoint, m_catch_bp, m_throw_bp);
+  breakpoint_sp, m_catch_bp, m_throw_bp);
 }
   } else {
 m_actual_resolver_sp.reset();
Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -58,7 +58,7 @@
 // for .expand kernels as a fallback.
 class RSBreakpointResolver : public BreakpointResolver {
 public:
-  RSBreakpointResolver(Breakpoint *bp, ConstString name)
+  RSBreakpointResolver(const lldb::BreakpointSP &bp, ConstString name)
   : BreakpointResolver(bp, BreakpointResolver::NameResolver),
 m_kernel_name(name) {}
 
@@ -77,9 +77,9 @@
   lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; }
 
   lldb::BreakpointResolverSP
-  CopyForBreakpoint(Breakpoint &breakpoint) override {
+  CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override {
 lldb::BreakpointResolverSP ret_sp(
-new RSBreakpointResolver(&breakpoint, m_kernel_name));
+new RSBreakpointResolver(breakpoint, m_kernel_nam

[Lldb-commits] [PATCH] D74558: [lldb] Make shared_from_this-related code safer

2020-02-13 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: JDevlieghere, teemperor.
tatyana-krasnukha added a project: LLDB.
Herald added subscribers: lldb-commits, abidh.

The idea is: the fewer classes make an assumption that a target object is 
already managed by a shared_ptr - the fewer ways to make a mistake.

Pass TargetSP to filters' CreateFromStructuredData, don't let them guess 
whether the target object is managed by a shared_ptr.

Make Breakpoint sure that m_target.shared_from_this() is safe by passing 
TargetSP to all its static Create*** member-functions.
This should be enough since Breakpoint's constructors are private/protected and 
never called directly (except by Target itself).

The patch is a consequence of D74556 .


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74558

Files:
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Core/SearchFilter.h
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Core/SearchFilter.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -131,7 +131,8 @@
 if (breakpoint_sp->IsInternal())
   continue;
 
-BreakpointSP new_bp(Breakpoint::CopyFromBreakpoint(*this, *breakpoint_sp));
+BreakpointSP new_bp(
+Breakpoint::CopyFromBreakpoint(shared_from_this(), *breakpoint_sp));
 AddBreakpoint(std::move(new_bp), false);
   }
 
@@ -1108,8 +1109,8 @@
 !Breakpoint::SerializedBreakpointMatchesNames(bkpt_data_sp, names))
   continue;
 
-BreakpointSP bkpt_sp =
-Breakpoint::CreateFromStructuredData(*this, bkpt_data_sp, error);
+BreakpointSP bkpt_sp = Breakpoint::CreateFromStructuredData(
+shared_from_this(), bkpt_data_sp, error);
 if (!error.Success()) {
   error.SetErrorStringWithFormat(
   "Error restoring breakpoint %zu from %s: %s.", i,
Index: lldb/source/Core/SearchFilter.cpp
===
--- lldb/source/Core/SearchFilter.cpp
+++ lldb/source/Core/SearchFilter.cpp
@@ -75,7 +75,8 @@
 SearchFilter::~SearchFilter() = default;
 
 SearchFilterSP SearchFilter::CreateFromStructuredData(
-Target &target, const StructuredData::Dictionary &filter_dict,
+const lldb::TargetSP& target_sp,
+const StructuredData::Dictionary &filter_dict,
 Status &error) {
   SearchFilterSP result_sp;
   if (!filter_dict.IsValid()) {
@@ -109,19 +110,19 @@
   switch (filter_type) {
   case Unconstrained:
 result_sp = SearchFilterForUnconstrainedSearches::CreateFromStructuredData(
-target, *subclass_options, error);
+target_sp, *subclass_options, error);
 break;
   case ByModule:
 result_sp = SearchFilterByModule::CreateFromStructuredData(
-target, *subclass_options, error);
+target_sp, *subclass_options, error);
 break;
   case ByModules:
 result_sp = SearchFilterByModuleList::CreateFromStructuredData(
-target, *subclass_options, error);
+target_sp, *subclass_options, error);
 break;
   case ByModulesAndCU:
 result_sp = SearchFilterByModuleListAndCU::CreateFromStructuredData(
-target, *subclass_options, error);
+target_sp, *subclass_options, error);
 break;
   case Exception:
 error.SetErrorString("Can't serialize exception breakpoints yet.");
@@ -212,7 +213,7 @@
 searcher.SearchCallback(*this, empty_sc, nullptr);
 return;
   }
-  
+
   DoModuleIteration(empty_sc, searcher);
 }
 
@@ -362,11 +363,11 @@
 //  Selects a shared library matching a given file spec, consulting the targets
 //  "black list".
 SearchFilterSP SearchFilterForUnconstrainedSearches::CreateFromStructuredData(
-Target &target, const StructuredData::Dictionary &data_dict,
+const lldb::TargetSP& target_sp,
+const StructuredData::Dictionary &data_dict,
 Status &error) {
   // No options for an unconstrained search.
-  return std::make_shared(
-  target.shared_from_this());
+  return std::make_shared(target_sp);
 }
 
 StructuredData::ObjectSP
@@ -472,7 +473,8 @@
 }
 
 SearchFilterSP SearchFilterByModule::CreateFromStructuredData(
-Target &target, const StructuredData::Dictionary &data_dict,
+const lldb::TargetSP& target_sp,
+const StructuredData::Dictionary &data_dict,
 Status &error) {
   StructuredData::Array *modules_array;
   bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList),
@@ -497,8 +499,7 @@
   }
   FileSpec module_spec(module);
 
-  return std::make_shared(target.shared_from_this(),
-module_spec);
+  return std::make_shared(target_sp, module_spec);
 }
 
 StructuredData::ObjectSP SearchFilterByModule::SerializeToStructuredData() {
@@ -617,14 +618,15 @@
 }
 
 SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData(
-Target &target, 

[Lldb-commits] [PATCH] D73782: [lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

LGTM, sorry for the delay!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73782



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


[Lldb-commits] [lldb] 9cb227f - Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

2020-02-13 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2020-02-13T08:23:19-08:00
New Revision: 9cb227f561f4e5491840694580abbe7c0123b358

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

LOG: Stop emitting a breakpoint for each location in a breakpoint when 
responding to breakpoint commands.

Summary: The VS Code DAP expects on response for each breakpoint that was 
requested. If we responsd with multiple entries for one breakpoint the VS Code 
UI gets out of date. Currently the VS code DAP doesn't handle one breakpoint 
with multiple locations. If this ever gets fixed we can modify our code.

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 
lldb/test/API/tools/lldb-vscode/breakpoint-events/Makefile

lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
lldb/test/API/tools/lldb-vscode/breakpoint-events/foo.cpp
lldb/test/API/tools/lldb-vscode/breakpoint-events/foo.h
lldb/test/API/tools/lldb-vscode/breakpoint-events/main.cpp

Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/tools/lldb-vscode/BreakpointBase.cpp
lldb/tools/lldb-vscode/BreakpointBase.h
lldb/tools/lldb-vscode/ExceptionBreakpoint.cpp
lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/tools/lldb-vscode/JSONUtils.h
lldb/tools/lldb-vscode/LLDBUtils.cpp
lldb/tools/lldb-vscode/LLDBUtils.h
lldb/tools/lldb-vscode/SourceBreakpoint.cpp
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index 199b80c8f6fa..35ce7f893fd4 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -22,8 +22,7 @@ def build_and_create_debug_adaptor(self):
 def set_source_breakpoints(self, source_path, lines, condition=None,
hitCondition=None):
 '''Sets source breakpoints and returns an array of strings containing
-   the breakpoint location IDs ("1.1", "1.2") for each breakpoint
-   that was set.
+   the breakpoint IDs ("1", "2") for each breakpoint that was set.
 '''
 response = self.vscode.request_setBreakpoints(
 source_path, lines, condition=condition, hitCondition=hitCondition)
@@ -32,17 +31,14 @@ def set_source_breakpoints(self, source_path, lines, 
condition=None,
 breakpoints = response['body']['breakpoints']
 breakpoint_ids = []
 for breakpoint in breakpoints:
-response_id = breakpoint['id']
-bp_id = response_id >> 32
-bp_loc_id = response_id & 0x
-breakpoint_ids.append('%i.%i' % (bp_id, bp_loc_id))
+breakpoint_ids.append('%i' % (breakpoint['id']))
 return breakpoint_ids
 
 def set_function_breakpoints(self, functions, condition=None,
  hitCondition=None):
 '''Sets breakpoints by function name given an array of function names
-   and returns an array of strings containing the breakpoint location
-   IDs ("1.1", "1.2") for each breakpoint that was set.
+   and returns an array of strings containing the breakpoint IDs
+   ("1", "2") for each breakpoint that was set.
 '''
 response = self.vscode.request_setFunctionBreakpoints(
 functions, condition=condition, hitCondition=hitCondition)
@@ -51,18 +47,15 @@ def set_function_breakpoints(self, functions, 
condition=None,
 breakpoints = response['body']['breakpoints']
 breakpoint_ids = []
 for breakpoint in breakpoints:
-response_id = breakpoint['id']
-bp_id = response_id >> 32
-bp_loc_id = response_id & 0x
-breakpoint_ids.append('%i.%i' % (bp_id, bp_loc_id))
+breakpoint_ids.append('%i' % (breakpoint['id']))
 return breakpoint_ids
 
 def verify_breakpoint_hit(self, breakpoint_ids):
 '''Wait for the process we are debugging to stop, and verify we hit
any breakpoint location in the "breakpoint_ids" array.
-   "breakpoint_ids" should be a list of breakpoint location ID strings
-   (["1.1", "2.1"]). The return value from
-   self.set_source_breakpoints() can be passed to this function'''
+   "breakpoint_ids" should be a list of breakpoint ID strings
+   (["1", "2"]). The return value fro

[Lldb-commits] [PATCH] D73665: Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9cb227f561f4: Stop emitting a breakpoint for each location 
in a breakpoint when responding to… (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73665

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/breakpoint-events/Makefile
  
lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
  lldb/test/API/tools/lldb-vscode/breakpoint-events/foo.cpp
  lldb/test/API/tools/lldb-vscode/breakpoint-events/foo.h
  lldb/test/API/tools/lldb-vscode/breakpoint-events/main.cpp
  lldb/tools/lldb-vscode/BreakpointBase.cpp
  lldb/tools/lldb-vscode/BreakpointBase.h
  lldb/tools/lldb-vscode/ExceptionBreakpoint.cpp
  lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
  lldb/tools/lldb-vscode/JSONUtils.cpp
  lldb/tools/lldb-vscode/JSONUtils.h
  lldb/tools/lldb-vscode/LLDBUtils.cpp
  lldb/tools/lldb-vscode/LLDBUtils.h
  lldb/tools/lldb-vscode/SourceBreakpoint.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -379,27 +379,20 @@
 if (event_mask & lldb::SBTarget::eBroadcastBitBreakpointChanged) {
   auto event_type =
   lldb::SBBreakpoint::GetBreakpointEventTypeFromEvent(event);
-  const auto num_locs =
-  lldb::SBBreakpoint::GetNumBreakpointLocationsFromEvent(event);
   auto bp = lldb::SBBreakpoint::GetBreakpointFromEvent(event);
-  bool added = event_type & lldb::eBreakpointEventTypeLocationsAdded;
-  bool removed =
-  event_type & lldb::eBreakpointEventTypeLocationsRemoved;
-  if (added || removed) {
-for (size_t i = 0; i < num_locs; ++i) {
-  auto bp_loc =
-  lldb::SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(
-  event, i);
-  auto bp_event = CreateEventObject("breakpoint");
-  llvm::json::Object body;
-  body.try_emplace("breakpoint", CreateBreakpoint(bp_loc));
-  if (added)
-body.try_emplace("reason", "new");
-  else
-body.try_emplace("reason", "removed");
-  bp_event.try_emplace("body", std::move(body));
-  g_vsc.SendJSON(llvm::json::Value(std::move(bp_event)));
-}
+  // If the breakpoint was originated from the IDE, it will have the
+  // BreakpointBase::GetBreakpointLabel() label attached. Regardless
+  // of wether the locations were added or removed, the breakpoint
+  // ins't going away, so we the reason is always "changed".
+  if ((event_type & lldb::eBreakpointEventTypeLocationsAdded ||
+   event_type & lldb::eBreakpointEventTypeLocationsRemoved) &&
+  bp.MatchesName(BreakpointBase::GetBreakpointLabel())) {
+auto bp_event = CreateEventObject("breakpoint");
+llvm::json::Object body;
+body.try_emplace("breakpoint", CreateBreakpoint(bp));
+body.try_emplace("reason", "changed");
+bp_event.try_emplace("body", std::move(body));
+g_vsc.SendJSON(llvm::json::Value(std::move(bp_event)));
   }
 }
   } else if (event.BroadcasterMatchesRef(g_vsc.broadcaster)) {
Index: lldb/tools/lldb-vscode/SourceBreakpoint.cpp
===
--- lldb/tools/lldb-vscode/SourceBreakpoint.cpp
+++ lldb/tools/lldb-vscode/SourceBreakpoint.cpp
@@ -17,6 +17,9 @@
 
 void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
   bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line);
+  // See comments in BreakpointBase::GetBreakpointLabel() for details of why
+  // we add a label to our breakpoints.
+  bp.AddName(GetBreakpointLabel());
   if (!condition.empty())
 SetCondition();
   if (!hitCondition.empty())
Index: lldb/tools/lldb-vscode/LLDBUtils.h
===
--- lldb/tools/lldb-vscode/LLDBUtils.h
+++ lldb/tools/lldb-vscode/LLDBUtils.h
@@ -106,46 +106,6 @@
 /// The LLDB frame index ID.
 uint32_t GetLLDBFrameID(uint64_t dap_frame_id);
 
-/// Given a LLDB breakpoint, make a breakpoint ID that is unique to a
-/// specific breakpoint and breakpoint location.
-///
-/// VSCode requires a Breakpoint "id" to be unique, so we use the
-/// breakpoint ID in the lower BREAKPOINT_ID_SHIFT bits and the
-/// breakpoint location ID in the upper BREAKPOINT_ID_SHIFT bits.
-///
-/// \param[in] bp_loc
-/// The LLDB break point location.
-//

[Lldb-commits] [lldb] 21d09cc - [lldb-vscode] Ensure that target matches the executable file

2020-02-13 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-13T19:34:01+03:00
New Revision: 21d09ccf268dc071d452b0207a3dd91228a51da3

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

LOG: [lldb-vscode] Ensure that target matches the executable file

This commit fixes an issue with lldb-vscode failing to run programs that
use different architecture/platform than the "empty" in the target.
Original implementation was creating a default target without specifying
the target architecture, platform or program, and then would set
executable file through SBLaunchInfo, assuming that this would update
architecture and platform accordingly. However this wasn't really
happening, and architecture and platform would remain at whatever values
were in the "empty" target. The simple solution is to create target
already for a desired architecture and platform.

Function request_attach is updated in a similar fashion.

This commit also adds new JSON properties to "launch" and "attach"
packets to allow user to override desired platform and architecture.
This might be especially important for cases where information in ELF is
not enough to derive those values correctly.

New code has a behavior similar to LLDB MI [1], where typically IDE would
specify target file with -file-exec-and-symbols, and then only do -exec-run
command that would launch the process. In lldb-vscode those two actions are
merged into one request_launch function. Similarly in the interpreter
session, user would first do "file" command, then "process launch"

Differential Revision: https://reviews.llvm.org/D70847
Signed-off-by: Anton Kolesov 

Added: 


Modified: 
lldb/tools/lldb-vscode/VSCode.cpp
lldb/tools/lldb-vscode/VSCode.h
lldb/tools/lldb-vscode/lldb-vscode.cpp
lldb/tools/lldb-vscode/package.json

Removed: 




diff  --git a/lldb/tools/lldb-vscode/VSCode.cpp 
b/lldb/tools/lldb-vscode/VSCode.cpp
index 2f85627da4b5..ba9542a63fca 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -303,4 +303,52 @@ void VSCode::RunExitCommands() {
   RunLLDBCommands("Running exitCommands:", exit_commands);
 }
 
+lldb::SBTarget VSCode::CreateTargetFromArguments(
+const llvm::json::Object &arguments,
+lldb::SBError &error) {
+  // Grab the name of the program we need to debug and create a target using
+  // the given program as an argument. Executable file can be a source of 
target
+  // architecture and platform, if they 
diff er from the host. Setting exe path
+  // in launch info is useless because Target.Launch() will not change
+  // architecture and platform, therefore they should be known at the target
+  // creation. We also use target triple and platform from the launch
+  // configuration, if given, since in some cases ELF file doesn't contain
+  // enough information to determine correct arch and platform (or ELF can be
+  // omitted at all), so it is good to leave the user an apportunity to specify
+  // those. Any of those three can be left empty.
+  llvm::StringRef target_triple = GetString(arguments, "targetTriple");
+  llvm::StringRef platform_name = GetString(arguments, "platformName");
+  llvm::StringRef program = GetString(arguments, "program");
+  auto target = this->debugger.CreateTarget(
+program.data(),
+target_triple.data(),
+platform_name.data(),
+true, // Add dependent modules.
+error
+  );
+
+  if (error.Fail()) {
+// Update message if there was an error.
+error.SetErrorStringWithFormat(
+"Could not create a target for a program '%s': %s.",
+program.data(), error.GetCString());
+  }
+
+  return target;
+}
+
+void VSCode::SetTarget(const lldb::SBTarget target) {
+  this->target = target;
+
+  if (target.IsValid()) {
+// Configure breakpoint event listeners for the target.
+lldb::SBListener listener = this->debugger.GetListener();
+listener.StartListeningForEvents(
+this->target.GetBroadcaster(),
+lldb::SBTarget::eBroadcastBitBreakpointChanged);
+listener.StartListeningForEvents(this->broadcaster,
+ eBroadcastBitStopEventThread);
+  }
+}
+
 } // namespace lldb_vscode

diff  --git a/lldb/tools/lldb-vscode/VSCode.h b/lldb/tools/lldb-vscode/VSCode.h
index be8b22806a4d..5733073fcfbf 100644
--- a/lldb/tools/lldb-vscode/VSCode.h
+++ b/lldb/tools/lldb-vscode/VSCode.h
@@ -63,6 +63,8 @@ typedef llvm::DenseMap 
SourceBreakpointMap;
 typedef llvm::StringMap FunctionBreakpointMap;
 enum class OutputType { Console, Stdout, Stderr, Telemetry };
 
+enum VSCodeBroadcasterBits { eBroadcastBitStopEventThread = 1u << 0 };
+
 struct VSCode {
   InputStream input;
   OutputStream output;
@@ -132,6 +134,24 @@ struct VSCode {
   void RunPreRunCommands();
   void RunStopCommands();
   void RunExi

[Lldb-commits] [PATCH] D70847: [lldb-vscode] Ensure that target matches the executable file

2020-02-13 Thread Tatyana Krasnukha via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21d09ccf268d: [lldb-vscode] Ensure that target matches the 
executable file (authored by tatyana-krasnukha).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70847

Files:
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json

Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -122,6 +122,14 @@
 "type": "string",
 "description": "Specify a working directory to set the debug adaptor to so relative object files can be located."
 			},
+			"targetTriple": {
+"type": "string",
+"description": "Triplet of the target architecture to override value derived from the program file."
+			},
+			"platformName": {
+"type": "string",
+"description": "Name of the execution platform to override value derived from the program file."
+			},
 			"initCommands": {
 	"type": "array",
 	"description": "Initialization commands executed upon debugger startup.",
@@ -175,6 +183,14 @@
 "type": "string",
 "description": "Specify a working directory to set the debug adaptor to so relative object files can be located."
 			},
+			"targetTriple": {
+"type": "string",
+"description": "Triplet of the target architecture to override value derived from the program file."
+			},
+			"platformName": {
+"type": "string",
+"description": "Name of the execution platform to override value derived from the program file."
+			},
 			"attachCommands": {
 "type": "array",
 "description": "Custom commands that are executed instead of attaching to a process ID or to a process by name. These commands may optionally create a new target and must perform an attach. A valid process must exist after these commands complete or the \"attach\" will fail.",
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -69,8 +69,6 @@
 
 enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
 
-enum VSCodeBroadcasterBits { eBroadcastBitStopEventThread = 1u << 0 };
-
 SOCKET AcceptConnection(int portno) {
   // Accept a socket connection from any host on "portno".
   SOCKET newsockfd = -1;
@@ -505,25 +503,13 @@
   // Run any initialize LLDB commands the user specified in the launch.json
   g_vsc.RunInitCommands();
 
-  // Grab the name of the program we need to debug and set it as the first
-  // argument that will be passed to the program we will debug.
-  const auto program = GetString(arguments, "program");
-  if (!program.empty()) {
-lldb::SBFileSpec program_fspec(program.data(), true /*resolve_path*/);
-
-g_vsc.launch_info.SetExecutableFile(program_fspec,
-false /*add_as_first_arg*/);
-const char *target_triple = nullptr;
-const char *uuid_cstr = nullptr;
-// Stand alone debug info file if different from executable
-const char *symfile = nullptr;
-g_vsc.target.AddModule(program.data(), target_triple, uuid_cstr, symfile);
-if (error.Fail()) {
-  response["success"] = llvm::json::Value(false);
-  EmplaceSafeString(response, "message", std::string(error.GetCString()));
-  g_vsc.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+  lldb::SBError status;
+  g_vsc.SetTarget(g_vsc.CreateTargetFromArguments(*arguments, status));
+  if (status.Fail()) {
+response["success"] = llvm::json::Value(false);
+EmplaceSafeString(response, "message", status.GetCString());
+g_vsc.SendJSON(llvm::json::Value(std::move(response)));
+return;
   }
 
   const bool detatchOnError = GetBoolean(arguments, "detachOnError", false);
@@ -536,7 +522,8 @@
 char attach_info[256];
 auto attach_info_len =
 snprintf(attach_info, sizeof(attach_info),
- "Waiting to attach to \"%s\"...", program.data());
+ "Waiting to attach to \"%s\"...",
+ g_vsc.target.GetExecutable().GetFilename());
 g_vsc.SendOutput(OutputType::Console, llvm::StringRef(attach_info,
   attach_info_len));
   }
@@ -1210,13 +1197,6 @@
 g_vsc.debugger.SetErrorFileHandle(out, false);
   }
 
-  g_vsc.target = g_vsc.debugger.CreateTarget(nullptr);
-  lldb::SBListener listener = g_vsc.debugger.GetListener();
-  listener.StartListeningForEvents(
-  g_vsc.target.GetBroadcaster(),
-  lldb::SBTarget::eBroadcastBitBreakpointChanged);
-  listener.StartListeningForEven

[Lldb-commits] [PATCH] D74377: [lldb-vscode] fix logging

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

you might want to abandon this in favor of my patch: 
https://reviews.llvm.org/D74566


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74377



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


[Lldb-commits] [PATCH] D74566: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, 
wallace.
Herald added a project: LLDB.
clayborg added a comment.

Here is an example of where these files end up after running tests:

  $ cd lldb-test-build.noindex/
  $ find . -name vscode.txt
  
./tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.test_breakpoint_events/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_shellExpandArguments_enabled/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_shellExpandArguments_disabled/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_stopOnEntry/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_commands/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_cwd/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_args/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_disableSTDIO/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_debuggerRoot/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_environment/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_extra_launch_commands/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_sourcePath/vscode.txt
  ./tools/lldb-vscode/step/TestVSCode_step.test_step/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.test_set_and_clear/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.test_set_and_clear/vscode.txt
  ./tools/lldb-vscode/attach/TestVSCode_attach.test_by_pid/vscode.txt
  ./tools/lldb-vscode/attach/TestVSCode_attach.test_by_name/vscode.txt
  
./tools/lldb-vscode/variables/TestVSCode_variables.test_scopes_variables_setVariable_evaluate/vscode.txt
  
./tools/lldb-vscode/stackTrace/TestVSCode_stackTrace.test_stackTrace/vscode.txt


This patch fixes logging to log incoming packets which was removed during a 
refactor.

We also enable logging to a "vscode.txt" file for each lldb-vscode test by 
creating the log file in the build artifacts directory for each test. This 
allows users to see the packets for their tests if needed and the log file is 
in a directory that will be removed after tests have been run.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74566

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/VSCode.cpp


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -129,6 +129,12 @@
   if (!input.read_full(log.get(), length, json_str))
 return json_str;
 
+  if (log) {
+*log << "--> " << std::endl
+ << "Content-Length: " << length << "\r\n\r\n"
+ << json_str << std::endl;
+  }
+
   return json_str;
 }
 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -847,13 +847,17 @@
 
 
 class DebugAdaptor(DebugCommunication):
-def __init__(self, executable=None, port=None, init_commands=[]):
+def __init__(self, executable=None, port=None, init_commands=[], 
log_file=None):
 self.process = None
 if executable is not None:
+adaptor_env = os.environ.copy()
+if log_file:
+adaptor_env['LLDBVSCODE_LOG'] = log_file
 self.process = subprocess.Popen([executable],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
+stderr=subprocess.PIPE,
+env=adaptor_env)
 DebugCommunication.__init__(self, self.process.stdout,
 self.process.stdin, init_commands)
 elif port is not None:
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -12,8 +12,10 @@
 '''Create the Visual Studio Code debug adaptor'''
 self.assertTrue(os.path.exists(self.lldbVSCodeExec),
 'lldb-vscode 

[Lldb-commits] [PATCH] D74566: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Here is an example of where these files end up after running tests:

  $ cd lldb-test-build.noindex/
  $ find . -name vscode.txt
  
./tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.test_breakpoint_events/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_shellExpandArguments_enabled/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_shellExpandArguments_disabled/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_stopOnEntry/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_commands/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_cwd/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_args/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_disableSTDIO/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_debuggerRoot/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_environment/vscode.txt
  
./tools/lldb-vscode/launch/TestVSCode_launch.test_extra_launch_commands/vscode.txt
  ./tools/lldb-vscode/launch/TestVSCode_launch.test_sourcePath/vscode.txt
  ./tools/lldb-vscode/step/TestVSCode_step.test_step/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.test_set_and_clear/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.test_functionality/vscode.txt
  
./tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.test_set_and_clear/vscode.txt
  ./tools/lldb-vscode/attach/TestVSCode_attach.test_by_pid/vscode.txt
  ./tools/lldb-vscode/attach/TestVSCode_attach.test_by_name/vscode.txt
  
./tools/lldb-vscode/variables/TestVSCode_variables.test_scopes_variables_setVariable_evaluate/vscode.txt
  
./tools/lldb-vscode/stackTrace/TestVSCode_stackTrace.test_stackTrace/vscode.txt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74566



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


[Lldb-commits] [PATCH] D73067: [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D73067#1873779 , @labath wrote:

> This looks like a bad upload -- based on some earlier version of this patch 
> and not master..


Yup, you're right, forgot to squash the commits.


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

https://reviews.llvm.org/D73067



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


[Lldb-commits] [PATCH] D73067: [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 244455.
JDevlieghere added a comment.

Squash commits into single diff


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

https://reviews.llvm.org/D73067

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
  lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
  lldb/source/Plugins/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
  lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
  lldb/source/Plugins/Language/ObjC/CMakeLists.txt
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
  
lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
  lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Plugins.def.in
  lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
  lldb/tools/lldb-test/CMakeLists.txt
  lldb/tools/lldb-test/SystemInitializerTest.cpp
  lldb/unittests/Disassembler/CMakeLists.txt
  lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
  lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Index: lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
===
--- lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
+++ lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
@@ -5,7 +5,7 @@
 lldbSymbol
 lldbTarget
 lldbPluginUnwindAssemblyInstEmulation
-lldbPluginDisassemblerLLVM
+lldbPluginDisassemblerLLVMC
 lldbPluginInstructionPPC64
 lldbPluginProcessUtility
   LINK_COMPONENTS
Index: lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
===
--- lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
+++ lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
@@ -5,7 +5,7 @@
 lldbSymbol
 lldbTarget
 lldbPluginUnwindAssemblyInstEmulation
-lldbPluginDisassemblerLLVM
+lldbPluginDisassemblerLLVMC
 lldbPluginInstructionARM64
 lldbPluginProcessUtility
   LINK_COMPONENTS
Index: lldb/unittests/Disassembler/CMakeLists.txt
===
--- lldb/unittests/Disassembler/CMakeLists.txt
+++ lldb/unittests/Disassembler/CMakeLists.txt
@@ -6,7 +6,7 @@
   lldbCore
   lldbSymbol
   lldbTarget
-  lldbPluginDisassemblerLLVM
+  lldbPluginDisassemblerLLVMC
   lldbPluginProcessUtility
 LINK_COMPONENTS
   Support
Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -17,88 +17,9 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64)
-LLDB_PLUGIN_DECLARE(ABISysV_arm64)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
-LLDB_PLUGIN_DECLARE(ABISysV_mips)
-LLDB_PLUGIN_DECLARE(ABISysV_mips64)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc64)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_x86_64)
-LLDB_PLUGIN_DECLARE(ABIWindows_x86_64)
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
-LLDB_PLUGIN_DECLARE(ObjectFileELF)
-LLDB_PLUGIN_DECLARE(ObjectFileMachO)
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
-LLDB_PLUGIN_DECLARE(ObjectFileWasm)
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
-LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
-LLDB_PLUGIN_DECLARE(PlatformFreeBSD)
-LLDB_PLUGIN_DECLARE(PlatformLinux)
-LLDB_PLUGIN_DECLARE(PlatformNetBSD)
-LLDB_PLUGIN_DECLARE(PlatformOpenBSD)
-LLDB_PLUGIN_DECLARE(PlatformWindows)
-LLDB

[Lldb-commits] [lldb] cecc185 - Add REQUIRES: x86 so this won't be run if x86 is not available.

2020-02-13 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2020-02-13T11:17:27-06:00
New Revision: cecc185166c03945f1c06f8d3e1993720f3d3c1a

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

LOG: Add REQUIRES: x86 so this won't be run if x86 is not available.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s

Removed: 




diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s 
b/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
index 96e4abe110e6..1448993672a1 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
@@ -1,3 +1,5 @@
+# REQUIRES: x86
+
 # RUN: llvm-mc -filetype=obj -o %t -triple x86_64-pc-linux %s
 # RUN: %lldb %t -o "target variable reset" -b | FileCheck %s
 



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


[Lldb-commits] [lldb] c84a0bd - Fix buildbots by disabling this new test until I can fix it.

2020-02-13 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2020-02-13T09:32:19-08:00
New Revision: c84a0bd9adb3ad699cd6bd4bf865d8b1ea76f2b0

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

LOG: Fix buildbots by disabling this new test until I can fix it.

This tests works on Darwin. I will need to check windows and linux.

Added: 


Modified: 

lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
index e519075923d3..e99297c35e32 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
@@ -17,6 +17,7 @@ class 
TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfWindows
+@skipUnlessDarwin
 def test_breakpoint_events(self):
 '''
 This test sets a breakpoint in a shared library and runs and stops



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


[Lldb-commits] [PATCH] D73665: Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Disabled the new breakpoint event test unless being run on Darwin to keep the 
buidbots happy until I can figure out what is going wrong:

commit c84a0bd9adb3ad699cd6bd4bf865d8b1ea76f2b0 
 (HEAD -> 
master, origin/master, origin/HEAD)
Author: Greg Clayton 
Date:   Thu Feb 13 09:32:19 2020 -0800

  Fix buildbots by disabling this new test until I can fix it.
  
  This tests works on Darwin. I will need to check windows and linux.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73665



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


[Lldb-commits] [PATCH] D74566: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

Cool


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74566



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


[Lldb-commits] [lldb] 7202d1c - Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2020-02-13T09:58:30-08:00
New Revision: 7202d1c2f6c83e989979bb76a61cbe1d0c859420

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

LOG: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

Summary:
This patch fixes logging to log incoming packets which was removed during a 
refactor.

We also enable logging to a "vscode.txt" file for each lldb-vscode test by 
creating the log file in the build artifacts directory for each test. This 
allows users to see the packets for their tests if needed and the log file is 
in a directory that will be removed after tests have been run.

Reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, wallace

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/tools/lldb-vscode/VSCode.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index 35ce7f893fd4..1eb23ce56212 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -12,8 +12,10 @@ def create_debug_adaptor(self):
 '''Create the Visual Studio Code debug adaptor'''
 self.assertTrue(os.path.exists(self.lldbVSCodeExec),
 'lldb-vscode must exist')
+log_file_path = self.getBuildArtifact('vscode.txt')
 self.vscode = vscode.DebugAdaptor(
-executable=self.lldbVSCodeExec, init_commands=self.setUpCommands())
+executable=self.lldbVSCodeExec, init_commands=self.setUpCommands(),
+log_file=log_file_path)
 
 def build_and_create_debug_adaptor(self):
 self.build()
@@ -133,7 +135,7 @@ def get_dict_value(self, d, key_path):
 key, key_path, d))
 return value
 
-def get_stackFrames_and_totalFramesCount(self, threadId=None, 
startFrame=None, 
+def get_stackFrames_and_totalFramesCount(self, threadId=None, 
startFrame=None,
 levels=None, dump=False):
 response = self.vscode.request_stackTrace(threadId=threadId,
   startFrame=startFrame,

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index cdb3dc115769..3cdf1ee90ccb 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -847,13 +847,17 @@ def terminate(self):
 
 
 class DebugAdaptor(DebugCommunication):
-def __init__(self, executable=None, port=None, init_commands=[]):
+def __init__(self, executable=None, port=None, init_commands=[], 
log_file=None):
 self.process = None
 if executable is not None:
+adaptor_env = os.environ.copy()
+if log_file:
+adaptor_env['LLDBVSCODE_LOG'] = log_file
 self.process = subprocess.Popen([executable],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
+stderr=subprocess.PIPE,
+env=adaptor_env)
 DebugCommunication.__init__(self, self.process.stdout,
 self.process.stdin, init_commands)
 elif port is not None:

diff  --git a/lldb/tools/lldb-vscode/VSCode.cpp 
b/lldb/tools/lldb-vscode/VSCode.cpp
index ba9542a63fca..8112f4c8d0d9 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -129,6 +129,12 @@ std::string VSCode::ReadJSON() {
   if (!input.read_full(log.get(), length, json_str))
 return json_str;
 
+  if (log) {
+*log << "--> " << std::endl
+ << "Content-Length: " << length << "\r\n\r\n"
+ << json_str << std::endl;
+  }
+
   return json_str;
 }
 



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


[Lldb-commits] [PATCH] D74478: [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

2020-02-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The only hesitation I have about this is if we are still printing this noise in 
demangled names, then the name of the type you see for a variable will be 
different from what you see when a method of that type ends up in a backtrace.  
That might be confusing.  OTOH, the correct solution to that problem, IMO, is 
to remove the noise from backtraces, not keep it in the types...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74478



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


[Lldb-commits] [PATCH] D74566: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread Greg Clayton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7202d1c2f6c8: Fix lldb-vscode logging and enable logging for 
all lldb-vscode tests. (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74566

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/VSCode.cpp


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -129,6 +129,12 @@
   if (!input.read_full(log.get(), length, json_str))
 return json_str;
 
+  if (log) {
+*log << "--> " << std::endl
+ << "Content-Length: " << length << "\r\n\r\n"
+ << json_str << std::endl;
+  }
+
   return json_str;
 }
 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -847,13 +847,17 @@
 
 
 class DebugAdaptor(DebugCommunication):
-def __init__(self, executable=None, port=None, init_commands=[]):
+def __init__(self, executable=None, port=None, init_commands=[], 
log_file=None):
 self.process = None
 if executable is not None:
+adaptor_env = os.environ.copy()
+if log_file:
+adaptor_env['LLDBVSCODE_LOG'] = log_file
 self.process = subprocess.Popen([executable],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
+stderr=subprocess.PIPE,
+env=adaptor_env)
 DebugCommunication.__init__(self, self.process.stdout,
 self.process.stdin, init_commands)
 elif port is not None:
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -12,8 +12,10 @@
 '''Create the Visual Studio Code debug adaptor'''
 self.assertTrue(os.path.exists(self.lldbVSCodeExec),
 'lldb-vscode must exist')
+log_file_path = self.getBuildArtifact('vscode.txt')
 self.vscode = vscode.DebugAdaptor(
-executable=self.lldbVSCodeExec, init_commands=self.setUpCommands())
+executable=self.lldbVSCodeExec, init_commands=self.setUpCommands(),
+log_file=log_file_path)
 
 def build_and_create_debug_adaptor(self):
 self.build()
@@ -133,7 +135,7 @@
 key, key_path, d))
 return value
 
-def get_stackFrames_and_totalFramesCount(self, threadId=None, 
startFrame=None, 
+def get_stackFrames_and_totalFramesCount(self, threadId=None, 
startFrame=None,
 levels=None, dump=False):
 response = self.vscode.request_stackTrace(threadId=threadId,
   startFrame=startFrame,


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -129,6 +129,12 @@
   if (!input.read_full(log.get(), length, json_str))
 return json_str;
 
+  if (log) {
+*log << "--> " << std::endl
+ << "Content-Length: " << length << "\r\n\r\n"
+ << json_str << std::endl;
+  }
+
   return json_str;
 }
 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -847,13 +847,17 @@
 
 
 class DebugAdaptor(DebugCommunication):
-def __init__(self, executable=None, port=None, init_commands=[]):
+def __init__(self, executable=None, port=None, init_commands=[], log_file=None):
 self.process = None
 if executable is not None:
+adaptor_env = os.environ.copy()
+if log_file:
+adaptor_env['LLDBVSCODE_LOG'] = log_file
 self.process = subprocess.Popen([executable],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
-stderr=su

[Lldb-commits] [PATCH] D74556: [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

2020-02-13 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.

LGTM


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74556



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


[Lldb-commits] [PATCH] D74252: Fix+re-enable Assert StackFrame Recognizer on Linux

2020-02-13 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/source/Target/AssertFrameRecognizer.cpp:152
+ConstString func_name = sym_ctx.GetFunctionName();
+if (func_name == ConstString(function_name) ||
+alternate_function_name.empty() ||

JDevlieghere wrote:
> teemperor wrote:
> > JDevlieghere wrote:
> > > I believe someone added an overload for comparing ConstStrings with 
> > > StringRefs. We shouldn't have to pay the price of creating one here just 
> > > for comparison. Same below.
> > I really don't want a == overload for StringRef in `ConstString`. The 
> > *only* reason for using ConstString is using less memory for duplicate 
> > strings and being fast to compare against other ConstStrings. So if we add 
> > an overload for comparing against StringRef then code like this will look 
> > really innocent even though it essentially goes against the idea of 
> > ConstString. Either both string lists are using ConstString or neither does 
> > (which I would prefer). But having a list of normal strings and comparing 
> > it against ConstStrings usually means that the design is kinda flawed. Then 
> > we have both normal string comparisons but also the whole overhead of 
> > ConstString.
> > 
> > Looking at this patch we already construct at one point a ConstString from 
> > the function name at one point, so that might as well be a ConstString in 
> > the first place. If we had an implicit comparison than the conversion here 
> > would look really innocent and no one would notice.
> Hmm, you're totally right, I must be confusing this with something else then. 
> The *only* reason for using ConstString is using less memory for duplicate 
> strings and being fast to compare against other ConstStrings.

Just for completeness, a huge use-case for ConstString in LLDB are as keys in 
DenseMaps and sorted vectors. This avoids redundantly string them in multiple 
StringMaps.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74252



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


[Lldb-commits] [PATCH] D74566: Fix lldb-vscode logging and enable logging for all lldb-vscode tests.

2020-02-13 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.



Comment at: lldb/tools/lldb-vscode/VSCode.cpp:136
+ << json_str << std::endl;
+  }
+

I had this chunk in a local patch, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74566



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


[Lldb-commits] [PATCH] D74556: [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

LGTM




Comment at: lldb/include/lldb/Breakpoint/Breakpoint.h:573
+  // target - primarily from the dummy target to prime new targets.
+  static lldb::BreakpointSP CopyFromBreakpoint(Target& new_target,
+  const Breakpoint &bp_to_copy_from);

nit: How about renaming this to `Breakpoint::CopyToTarget` instead? That seems 
a bit more explanatory than `Breakpoint:: CopyFromBreakpoint`. 


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74556



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


[Lldb-commits] [PATCH] D74551: [lldb/dotest] Remove the "exclusive test subdir" concept

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

Neat, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74551



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


[Lldb-commits] [PATCH] D74557: [lldb] Make BreakpointResolver hold weak_ptr instead of raw pointer to breakpoint

2020-02-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I wonder if it wouldn't be better to assert in GetBreakpoint.  Except when you 
are making the resolver, you should never have a breakpoint resolver without a 
valid breakpoint.  And there's no point in calling GetBreakpoint when you know 
you haven't set it yet.  You assert after most of the calls to GetBreakpoint, 
but not all.  Of the ones you don't, I think most of them should be.

Were there any places you found where it was legit to ask for the Breakpoint 
for a resolver and not have one?

Other than that LGTM.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74557



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


[Lldb-commits] [PATCH] D74558: [lldb] Make shared_from_this-related code safer

2020-02-13 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.

LGTM

Targets and Breakpoints should only ever be managed by SP in lldb, so enforcing 
that seems like a good cleanup.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74558



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


[Lldb-commits] [PATCH] D74478: [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

2020-02-13 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

If we still see the info using `-R` then I am happy but Jim's concerns are 
valid, they won't match the bracktrace.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74478



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


[Lldb-commits] [PATCH] D74243: [lldb] Introduce "RegInfoBasedABI"

2020-02-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Either this change or D74475   broke the 
windows bot and I suspect it's not D74475 :

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/13719


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74243



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


[Lldb-commits] [PATCH] D74475: [lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

2020-02-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Either this change or D74243  broke the 
windows bot and I do suspect D74243  but have 
not confirmed it yet:

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/13719


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74475



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


[Lldb-commits] [PATCH] D74551: [lldb/dotest] Remove the "exclusive test subdir" concept

2020-02-13 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision.
vsk added a comment.

Thanks. 'exclusive_test_dir' used to be set in dotest.py, but now no longer is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74551



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


[Lldb-commits] [lldb] 1287977 - Document third option to python synthetic type summary

2020-02-13 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-13T13:04:51-08:00
New Revision: 1287977b9edd86a4983542b50a082dd0996ae67e

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

LOG: Document third option to python synthetic type summary
callback unconditionally; it was added to lldb five years
ago and we don't need to qualify its availability.

Added: 


Modified: 
lldb/docs/use/variable.rst

Removed: 




diff  --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst
index 4e3f25eb6a4a..7915abf92d65 100644
--- a/lldb/docs/use/variable.rst
+++ b/lldb/docs/use/variable.rst
@@ -651,7 +651,7 @@ class, as shown in this example:
 
(lldb) type summary add -P Rectangle
Enter your Python command(s). Type 'DONE' to end.
-   def function (valobj,internal_dict):
+   def function (valobj,internal_dict,options):
   height_val = valobj.GetChildMemberWithName('height')
   width_val = valobj.GetChildMemberWithName('width')
   height = height_val.GetValueAsUnsigned(0)
@@ -698,6 +698,12 @@ that (yet) via this method call, and you must use 
``GetChildAtIndex()``
 querying it for the array items one by one. Also, handling custom formats is
 something you have to deal with on your own.
 
+``options`` Python summary formatters can optionally define this
+third argument, which is an object of type ``lldb.SBTypeSummaryOptions``,
+allowing for a few customizations of the result. The decision to
+adopt or not this third argument - and the meaning of options thereof
+- is up to the individual formatter's writer.
+
 Other than interactively typing a Python script there are two other ways for
 you to input a Python script as a summary:
 
@@ -716,14 +722,6 @@ you to input a Python script as a summary:
   LLDB will emit a warning if it is unable to find the function you passed, but
   will still register the binding.
 
-Starting in SVN r222593, Python summary formatters can optionally define a
-third argument: options
-
-This is an object of type ``lldb.SBTypeSummaryOptions`` that can be passed into
-the formatter, allowing for a few customizations of the result. The decision to
-adopt or not this third argument - and the meaning of options thereof - is
-within the individual formatters' writer.
-
 Regular Expression Typenames
 
 



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


[Lldb-commits] [lldb] 14d6863 - Small reformat to avoid tripping up possible formatting.

2020-02-13 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-13T13:06:44-08:00
New Revision: 14d686309a1ac9cc41522b00da7a751db592ef6e

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

LOG: Small reformat to avoid tripping up possible formatting.

Added: 


Modified: 
lldb/docs/use/variable.rst

Removed: 




diff  --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst
index 7915abf92d65..5b1fef7b06c3 100644
--- a/lldb/docs/use/variable.rst
+++ b/lldb/docs/use/variable.rst
@@ -701,8 +701,8 @@ something you have to deal with on your own.
 ``options`` Python summary formatters can optionally define this
 third argument, which is an object of type ``lldb.SBTypeSummaryOptions``,
 allowing for a few customizations of the result. The decision to
-adopt or not this third argument - and the meaning of options thereof
-- is up to the individual formatter's writer.
+adopt or not this third argument - and the meaning of options 
+thereof - is up to the individual formatter's writer.
 
 Other than interactively typing a Python script there are two other ways for
 you to input a Python script as a summary:



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


[Lldb-commits] [PATCH] D74579: Creating environment variable test for lldbd

2020-02-13 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74579

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1402,10 +1402,11 @@
   // if arguments has launchWithDebuggerEnvironment
   // then append current environment to g_vsc.launch_info
   if (launchWithDebuggerEnvironment) {
+  // if (true) {
 char** env_var_pointer = environ;
 std::vector vscode_env_variables;
-for (char* c = *env_var_pointer; c; c=*++env_var_pointer){
-  vscode_env_variables.push_back(c);
+for (char* env_variable = *env_var_pointer; env_variable; env_variable=*++env_var_pointer){
+  vscode_env_variables.push_back(env_variable);
 }
 envs.insert(std::end(envs), std::begin(vscode_env_variables), std::end(vscode_env_variables));
   } 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -562,7 +562,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None, launchCommands=None):
+   debuggerRoot=None, launchCommands=None, inheritEnvironment=False):
 args_dict = {
 'program': program
 }
@@ -597,6 +597,8 @@
 args_dict['debuggerRoot'] = debuggerRoot
 if launchCommands:
 args_dict['launchCommands'] = launchCommands
+if inheritEnvironment:
+args_dict['inheritEnvironment'] = inheritEnvironment
 command_dict = {
 'command': 'launch',
 'type': 'request',
@@ -891,6 +893,7 @@
   stopCommands=options.stopCmds,
   exitCommands=options.exitCmds)
 else:
+print('Options.Envs: ', options.envs)
 response = dbg.request_launch(options.program,
   args=args,
   env=options.envs,
@@ -929,6 +932,7 @@
 
 
 def main():
+print("Hello This Is Main")
 parser = optparse.OptionParser(
 description=('A testing framework for the Visual Studio Code Debug '
  'Adaptor protocol'))
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -265,7 +265,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None,sourcePath= None,
-   debuggerRoot=None, launchCommands=None):
+   debuggerRoot=None, launchCommands=None, inheritEnvironment=False):
 '''Sending launch request to vscode
 '''
 
@@ -296,7 +296,9 @@
 exitCommands=exitCommands,
 sourcePath=sourcePath,
 debuggerRoot=debuggerRoot,
-launchCommands=launchCommands)
+launchCommands=launchCommands,
+inheritEnvironment=inheritEnvironment
+)
 if not (response and response['success']):
 self.assertTrue(response['success'],
 'launch failed (%s)' % (response['message']))
@@ -306,14 +308,13 @@
  disableSTDIO=False, shellExpandArguments=False,
  trace=False, initCommands=None, preRunCommands=None,
  stopCommands=None, exitCommands=None,
- sourcePath=None, debuggerRoot=None):
+ sourcePath=None, debuggerRoot=None, inheritEnvironment=False):
 '''Build the default Makefile target, create the VSCode debug adaptor,
and launch

[Lldb-commits] [PATCH] D74579: Creating environment variable test for lldbd

2020-02-13 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 244531.
diazhector98 added a comment.

Creating env tes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74579

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1402,10 +1402,11 @@
   // if arguments has launchWithDebuggerEnvironment
   // then append current environment to g_vsc.launch_info
   if (launchWithDebuggerEnvironment) {
+  // if (true) {
 char** env_var_pointer = environ;
 std::vector vscode_env_variables;
-for (char* c = *env_var_pointer; c; c=*++env_var_pointer){
-  vscode_env_variables.push_back(c);
+for (char* env_variable = *env_var_pointer; env_variable; env_variable=*++env_var_pointer){
+  vscode_env_variables.push_back(env_variable);
 }
 envs.insert(std::end(envs), std::begin(vscode_env_variables), std::end(vscode_env_variables));
   } 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -562,7 +562,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None, launchCommands=None):
+   debuggerRoot=None, launchCommands=None, inheritEnvironment=False):
 args_dict = {
 'program': program
 }
@@ -597,6 +597,8 @@
 args_dict['debuggerRoot'] = debuggerRoot
 if launchCommands:
 args_dict['launchCommands'] = launchCommands
+if inheritEnvironment:
+args_dict['inheritEnvironment'] = inheritEnvironment
 command_dict = {
 'command': 'launch',
 'type': 'request',
@@ -891,6 +893,7 @@
   stopCommands=options.stopCmds,
   exitCommands=options.exitCmds)
 else:
+print('Options.Envs: ', options.envs)
 response = dbg.request_launch(options.program,
   args=args,
   env=options.envs,
@@ -929,6 +932,7 @@
 
 
 def main():
+print("Hello This Is Main")
 parser = optparse.OptionParser(
 description=('A testing framework for the Visual Studio Code Debug '
  'Adaptor protocol'))
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -265,7 +265,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None,sourcePath= None,
-   debuggerRoot=None, launchCommands=None):
+   debuggerRoot=None, launchCommands=None, inheritEnvironment=False):
 '''Sending launch request to vscode
 '''
 
@@ -296,7 +296,9 @@
 exitCommands=exitCommands,
 sourcePath=sourcePath,
 debuggerRoot=debuggerRoot,
-launchCommands=launchCommands)
+launchCommands=launchCommands,
+inheritEnvironment=inheritEnvironment
+)
 if not (response and response['success']):
 self.assertTrue(response['success'],
 'launch failed (%s)' % (response['message']))
@@ -306,14 +308,13 @@
  disableSTDIO=False, shellExpandArguments=False,
  trace=False, initCommands=None, preRunCommands=None,
  stopCommands=None, exitCommands=None,
- sourcePath=None, debuggerRoot=None):
+ sourcePath=None, debuggerRoot=None, inheritEnvironment=False):
 '''Build the default Makefile targ

[Lldb-commits] [PATCH] D73921: Assert that a subprogram should have a name when parsing DWARF

2020-02-13 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik abandoned this revision.
shafik added a comment.

I am going to abandon this change b/c the consensus seems to be that we want a 
different solution and I don't know how much work would require ATM but I may 
revisit another time,

I will note that we do currently have a lot of these and they have in the past 
be very helpful solving problems but clearly the bar is higher now for new ones.


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

https://reviews.llvm.org/D73921



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


[Lldb-commits] [lldb] 4570f2c - Add a test for debugserver handling threads suspended from within a program.

2020-02-13 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2020-02-13T15:48:38-08:00
New Revision: 4570f2c7cf35388d8b3ab9cc5cdcad4971e31cf2

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

LOG: Add a test for debugserver handling threads suspended from within a 
program.

Mach allows you to suspend and resume other threads within a program, so
debugserver has to be careful not to interfere with this when it goes to supend 
and
resume threads while stepping over breakpoints and calling functions.  Even
trickier, if you call a function on a suspended thread, it has to resume the
thread to get the expression to run, and then suspend it properly when done.

This all works already, but there wasn't a test for it.  Adding that here.

This same test could be written for a unix that supports 
pthread_{suspend,resume}_np, but
macOS doesn't support these calls, only the mach version.  It doesn't look like
a lot of Linux'es support this (AIX does apparently...)  And IIUC Windows allows
you to suspend and resume other threads, but the code for that would look pretty
different than this main.c.  So for simplicity's sake I wrote this test for 
Darwin-only.

Added: 
lldb/test/API/macosx/thread_suspend/Makefile
lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
lldb/test/API/macosx/thread_suspend/main.c

Modified: 


Removed: 




diff  --git a/lldb/test/API/macosx/thread_suspend/Makefile 
b/lldb/test/API/macosx/thread_suspend/Makefile
new file mode 100644
index ..695335e068c0
--- /dev/null
+++ b/lldb/test/API/macosx/thread_suspend/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py 
b/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
new file mode 100644
index ..301b80058d3d
--- /dev/null
+++ b/lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py
@@ -0,0 +1,108 @@
+"""
+Make sure that if threads are suspended outside of lldb, debugserver
+won't make them run, even if we call an expression on the thread.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+class TestSuspendedThreadHandling(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@skipUnlessDarwin
+def test_suspended_threads(self):
+"""Test that debugserver doesn't disturb the suspend count of a thread
+   that has been suspended from within a program, when navigating 
breakpoints
+   on other threads, or calling functions both on the suspended thread 
and
+   on other threads."""
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.c")
+self.suspended_thread_test()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Set up your test case here. If your test doesn't need any set up then
+# remove this method from your TestCase class.
+
+def try_an_expression(self, thread, correct_value, test_bp):
+frame = thread.frames[0]
+
+value = frame.EvaluateExpression('function_to_call()')
+self.assertTrue(value.GetError().Success(), "Successfully called the 
function")
+self.assertEqual(value.GetValueAsSigned(), correct_value, "Got 
expected value for expression")
+
+# Again, make sure we didn't let the suspend thread breakpoint run:
+self.assertEqual(test_bp.GetHitCount(), 0, "First expression allowed 
the suspend thread to run")
+
+
+def make_bkpt(self, pattern):
+bp = self.target.BreakpointCreateBySourceRegex(pattern, 
self.main_source_file)
+self.assertEqual(bp.GetNumLocations(), 1, "Locations for %s"%(pattern))
+return bp
+
+def suspended_thread_test(self):
+(self.target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+   "Stop here to get things going", 
self.main_source_file)
+
+# Make in the running thread, so the we will have to stop a number of 
times
+# while handling breakpoints.  The first couple of times we hit it we 
will
+# run expressions as well.  Make sure we don't let the suspended 
thread run
+# during those operations.
+rt_bp = self.make_bkpt("Break here to show we can handle breakpoints")
+
+# Make a breakpoint that we will hit when the running thread exits:
+rt_exit_bp = self.make_bkpt("Break here after thread_join")
+
+# Make a breakpoint in the suspended thread.  We should not hit this 
till we
+# resume it after joining the running thread.
+st_bp =

[Lldb-commits] [PATCH] D74398: [lldb-server] jThreadsInfo returns stack memory

2020-02-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

To be honest, I'm thinking of stealing your idea of sending the $fp - $sp 
memory region for frame 0 in debugserver, at least for the currently selected 
thread.  I might add a check that it's not a huge amount of bytes in case 
there's a giant buffer or something that we may not need to fetch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74398



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


[Lldb-commits] [PATCH] D74579: [don't review]Creating environment variable test for lldbd

2020-02-13 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 244547.
diazhector98 added a comment.

Squashing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74579

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json

Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -84,6 +84,11 @@
 "description": "Additional environment variables.",
 "default": []
 			},
+			"inheritEnvironment": {
+"type": "boolean",
+"description": "Inherit the VSCode Environment Variables",
+"default": false
+			},
 			"stopOnEntry": {
 "type": "boolean",
 "description": "Automatically stop after launch.",
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -49,6 +49,11 @@
 #include "LLDBUtils.h"
 #include "VSCode.h"
 
+#include  // std::this_thread::sleep_for
+#include  // std::chrono::seconds
+
+extern char **environ;
+
 #if defined(_WIN32)
 #ifndef PATH_MAX
 #define PATH_MAX MAX_PATH
@@ -1340,6 +1345,7 @@
   auto launchCommands = GetStrings(arguments, "launchCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
   const auto debuggerRoot = GetString(arguments, "debuggerRoot");
+  bool launchWithDebuggerEnvironment = GetBoolean(arguments, "inheritEnvironment", false);
 
   // This is a hack for loading DWARF in .o files on Mac where the .o files
   // in the debug map of the main executable have relative paths which require
@@ -1387,13 +1393,26 @@
   // Extract any extra arguments and append them to our program arguments for
   // when we launch
   auto args = GetStrings(arguments, "args");
-  if (!args.empty())
+  if (!args.empty()) 
 g_vsc.launch_info.SetArguments(MakeArgv(args).data(), true);
 
   // Pass any environment variables along that the user specified.
   auto envs = GetStrings(arguments, "env");
-  if (!envs.empty())
+
+  // if arguments has launchWithDebuggerEnvironment
+  // then append current environment to g_vsc.launch_info
+  if (launchWithDebuggerEnvironment) {
+  // if (true) {
+char** env_var_pointer = environ;
+std::vector vscode_env_variables;
+for (char* env_variable = *env_var_pointer; env_variable; env_variable=*++env_var_pointer){
+  vscode_env_variables.push_back(env_variable);
+}
+envs.insert(std::end(envs), std::begin(vscode_env_variables), std::end(vscode_env_variables));
+  } 
+  if (!envs.empty()) {
 g_vsc.launch_info.SetEnvironmentEntries(MakeArgv(envs).data(), true);
+  }
 
   auto flags = g_vsc.launch_info.GetLaunchFlags();
 
@@ -2228,6 +2247,8 @@
 //   }]
 // }
 void request_stepIn(const llvm::json::Object &request) {
+
+  return;
   llvm::json::Object response;
   FillResponse(request, response);
   auto arguments = request.getObject("arguments");
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -562,7 +562,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None, launchCommands=None):
+   debuggerRoot=None, launchCommands=None, inheritEnvironment=False):
 args_dict = {
 'program': program
 }
@@ -597,6 +597,8 @@
 args_dict['debuggerRoot'] = debuggerRoot
 if launchCommands:
 args_dict['launchCommands'] = launchCommands
+if inheritEnvironment:
+args_dict['inheritEnvironment'] = inheritEnvironment
 command_dict = {
 'command': 'launch',
 'type': 'request',
@@ -891,6 +893,7 @@
   stopCommands=options.stopCmds,
   exitCommands=options.exitCmds)
 else:
+print('Options.Envs: ', options.envs)
 

[Lldb-commits] [PATCH] D74579: [don't review]Creating environment variable test for lldbd

2020-02-13 Thread walter erquinigo via Phabricator via lldb-commits
wallace requested changes to this revision.
wallace added inline comments.
This revision now requires changes to proceed.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py:26
 @skipIfWindows
-@skipIfDarwin # Skip this test for now until we can figure out why tings 
aren't working on build bots
+#@skipIfDarwin # Skip this test for now until we can figure out why tings 
aren't working on build bots
 def test_completions(self):

don't forget to remove the #



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py:19-24
+def verify_completions(self, actual_list, expected_list, 
not_expected_list=[]):
+for expected_item in expected_list:
+self.assertTrue(expected_item in actual_list)
+
+for not_expected_item in not_expected_list:
+self.assertFalse(not_expected_item in actual_list)

remove this



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py:38-43
+found = False
+for line in lines:
+if line.startswith('PATH='):
+found = True
+self.assertTrue(path_env_variable == line, "PATH environment 
variable not the same")
+self.assertTrue(found, 'PATH environment variable not found')

you can write different tests:
- inheritEnvironment = false -> no PATH
- inheritEnvironment = true
 --  send an additional env in the config -> it should override the inherited
 -- PATH should be correct 



Comment at: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py:906
   stopCommands=options.stopCmds,
   exitCommands=options.exitCmds)
 

inheritEnv should be passed here



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1400-1412
   auto envs = GetStrings(arguments, "env");
-  if (!envs.empty())
+
+  // if arguments has launchWithDebuggerEnvironment
+  // then append current environment to g_vsc.launch_info
+  if (launchWithDebuggerEnvironment) {
+  // if (true) {
+char** env_var_pointer = environ;

the env sent by the user in the launch.json config should have more priority 
than the inherited environment. For example, if env = ["X=A"] and the inherited 
env is ["X=Z", "Y=V"], then the resulting environment should be ["X=A", "Y=V"].
You should also write a test for that



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1405
+  if (launchWithDebuggerEnvironment) {
+  // if (true) {
+char** env_var_pointer = environ;

remove this



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:2250-2251
 void request_stepIn(const llvm::json::Object &request) {
+
+  return;
   llvm::json::Object response;

lol



Comment at: lldb/tools/lldb-vscode/package.json:89
+   "type": 
"boolean",
+   "description": 
"Inherit the VSCode Environment Variables",
+   "default": false

Inherit the debugger environment when launching a process. Only works for 
binaries launched directly by LLDB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74579



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


[Lldb-commits] [PATCH] D74585: Don't prefix error message from process launch with "process launch failed:" boilerplate in Target::Launch

2020-02-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added reviewers: jingham, clayborg, labath.
jasonmolenda added a project: LLDB.
Herald added a subscriber: krytarowski.

I wanted to put this up as a phab to collect any reactions instead of just 
landing it, I think it's not controversial but I could be wrong.  Right now, 
Target::Launch() will prepend any error message with "process launch failed: ". 
 This is a problem with a driver program using the SB API to launch a process 
on a remote system -- the wording "process launch failed:" makes some sense for 
the lldb command line driver, but the UI driving lldb may have a different way 
of describing the operation to the user -- for instance pressing the Run button 
in an UI.  When we get back a meaningful error message about why the launch 
failed, prepending boilerplate like this makes it harder for a user to spot the 
error message.

It's a little annoying to test - on a native run, at least on macOS, our 
process launching doesn't go through Target::Process, 
CommandObjectProcessLaunch and SBTarget::Launch go through NativeProcessDarwin, 
there is no change in the error messaging in this case.  I looked over 
PlatformLinux and PlatformNetBSD, they both seem to prefix their own "process 
launch failed: " strings; PlatformWindows overwrites the error message.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74585

Files:
  lldb/source/Target/Target.cpp


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2957,11 +2957,6 @@
   }
 }
 m_process_sp->RestoreProcessEvents();
-  } else {
-Status error2;
-error2.SetErrorStringWithFormat("process launch failed: %s",
-error.AsCString());
-error = error2;
   }
   return error;
 }


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2957,11 +2957,6 @@
   }
 }
 m_process_sp->RestoreProcessEvents();
-  } else {
-Status error2;
-error2.SetErrorStringWithFormat("process launch failed: %s",
-error.AsCString());
-error = error2;
   }
   return error;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f10e2df - [lldb/Plugins] Have one initializer per ABI plugin

2020-02-13 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-13T21:49:38-08:00
New Revision: f10e2df7bc19a3f05038387d77addd16ab058e06

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

LOG: [lldb/Plugins] Have one initializer per ABI plugin

After the recent change that grouped some of the ABI plugins together,
those plugins ended up with multiple initializers per plugin. This is
incompatible with my proposed approach of generating the initializers
dynamically, which is why I've grouped them together in a new entry
point.

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

Added: 
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
lldb/source/Plugins/ABI/ARM/ABIARM.cpp
lldb/source/Plugins/ABI/ARM/ABIARM.h
lldb/source/Plugins/ABI/Mips/ABIMips.cpp
lldb/source/Plugins/ABI/Mips/ABIMips.h
lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.cpp
lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.h
lldb/source/Plugins/ABI/X86/ABIX86.cpp
lldb/source/Plugins/ABI/X86/ABIX86.h

Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
lldb/source/Plugins/ABI/ARM/CMakeLists.txt
lldb/source/Plugins/ABI/Mips/CMakeLists.txt
lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
lldb/source/Plugins/ABI/X86/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 888a7579f84d..7e2d80fceec8 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,29 +24,22 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64)
-LLDB_PLUGIN_DECLARE(ABISysV_arm64)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
-LLDB_PLUGIN_DECLARE(ABISysV_mips)
-LLDB_PLUGIN_DECLARE(ABISysV_mips64)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc64)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_x86_64)
-LLDB_PLUGIN_DECLARE(ABIWindows_x86_64)
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
-LLDB_PLUGIN_DECLARE(ObjectFileELF)
-LLDB_PLUGIN_DECLARE(ObjectFileMachO)
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
-LLDB_PLUGIN_DECLARE(ObjectFileWasm)
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
-LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
+LLDB_PLUGIN_DECLARE(ABIAArch64);
+LLDB_PLUGIN_DECLARE(ABIARM);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABIMips);
+LLDB_PLUGIN_DECLARE(ABIPowerPC);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIX86);
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad);
+LLDB_PLUGIN_DECLARE(ObjectFileELF);
+LLDB_PLUGIN_DECLARE(ObjectFileMachO);
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF);
+LLDB_PLUGIN_DECLARE(ObjectFileWasm);
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive);
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO);
+LLDB_PLUGIN_DECLARE(ScriptInterpreterNone);
 #if LLDB_ENABLE_PYTHON
 LLDB_PLUGIN_DECLARE(OperatingSystemPython)
 LLDB_PLUGIN_DECLARE(ScriptInterpreterPython)
@@ -120,26 +113,14 @@ SystemInitializerFull::SystemInitializerFull() {}
 
 SystemInitializerFull::~SystemInitializerFull() {}
 
-#define LLDB_PROCESS_AArch64(op)   
\
-  op(ABIMacOSX_arm64); 
\
-  op(ABISysV_arm64);
-#define LLDB_PROCESS_ARM(op)   
\
-  op(ABIMacOSX_arm);   
\
-  op(ABISysV_arm);
+#define LLDB_PROCESS_AArch64(op) op(ABIAArch64);
+#define LLDB_PROCESS_ARM(op) op(ABIARM);
 #define LLDB_PROCESS_ARC(op) op(ABISysV_arc);
 #define LLDB_PROCESS_Hexagon(op) op(ABISysV_hexagon);
-#define LLDB_PROCESS_Mips(op)  
\
-  op(ABISysV_mips);
\
-  op(ABISysV_mips64);
-#define LLDB_PROCESS_PowerPC(op)   
\
-  op(ABISysV_ppc); 
\
-  op(ABISysV_ppc64);
+#define LLDB_PROCESS_Mips(op) op(ABIMips);
+#define LLDB_PROCESS_PowerPC(op) op(ABIPowerPC);
 #define LLDB_PROCESS_SystemZ(op) op(ABISysV_s390x);
-#define LLDB_PROCESS_X86(op)   
\
-  op(ABIMacOSX_i386);  
\
-  op(

[Lldb-commits] [PATCH] D74451: [lldb/Plugins] Have one initializer per ABI plugin

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf10e2df7bc19: [lldb/Plugins] Have one initializer per ABI 
plugin (authored by JDevlieghere).
Herald added subscribers: jrtc27, aheejin.

Changed prior to commit:
  https://reviews.llvm.org/D74451?vs=244205&id=244570#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74451

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
  lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
  lldb/source/Plugins/ABI/ARM/ABIARM.cpp
  lldb/source/Plugins/ABI/ARM/ABIARM.h
  lldb/source/Plugins/ABI/ARM/CMakeLists.txt
  lldb/source/Plugins/ABI/Mips/ABIMips.cpp
  lldb/source/Plugins/ABI/Mips/ABIMips.h
  lldb/source/Plugins/ABI/Mips/CMakeLists.txt
  lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.cpp
  lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.h
  lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
  lldb/source/Plugins/ABI/X86/ABIX86.cpp
  lldb/source/Plugins/ABI/X86/ABIX86.h
  lldb/source/Plugins/ABI/X86/CMakeLists.txt
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -17,21 +17,14 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64)
-LLDB_PLUGIN_DECLARE(ABISysV_arm64)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arm)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
-LLDB_PLUGIN_DECLARE(ABISysV_mips)
-LLDB_PLUGIN_DECLARE(ABISysV_mips64)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc)
-LLDB_PLUGIN_DECLARE(ABISysV_ppc64)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
-LLDB_PLUGIN_DECLARE(ABIMacOSX_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_i386)
-LLDB_PLUGIN_DECLARE(ABISysV_x86_64)
-LLDB_PLUGIN_DECLARE(ABIWindows_x86_64)
+LLDB_PLUGIN_DECLARE(ABIAArch64);
+LLDB_PLUGIN_DECLARE(ABIARM);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABIMips);
+LLDB_PLUGIN_DECLARE(ABIPowerPC);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIX86);
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
 LLDB_PLUGIN_DECLARE(ObjectFileMachO)
@@ -106,25 +99,13 @@
 
 SystemInitializerTest::~SystemInitializerTest() {}
 
-#define LLDB_PROCESS_AArch64(op)   \
-  op(ABIMacOSX_arm64); \
-  op(ABISysV_arm64);
-#define LLDB_PROCESS_ARM(op)   \
-  op(ABIMacOSX_arm);   \
-  op(ABISysV_arm);
+#define LLDB_PROCESS_AArch64(op) op(ABIAArch64);
+#define LLDB_PROCESS_ARM(op) op(ABIARM);
 #define LLDB_PROCESS_Hexagon(op) op(ABISysV_hexagon);
-#define LLDB_PROCESS_Mips(op)  \
-  op(ABISysV_mips);\
-  op(ABISysV_mips64);
-#define LLDB_PROCESS_PowerPC(op)   \
-  op(ABISysV_ppc); \
-  op(ABISysV_ppc64);
+#define LLDB_PROCESS_Mips(op) op(ABIMips);
+#define LLDB_PROCESS_PowerPC(op) op(ABIPowerPC);
 #define LLDB_PROCESS_SystemZ(op) op(ABISysV_s390x);
-#define LLDB_PROCESS_X86(op)   \
-  op(ABIMacOSX_i386);  \
-  op(ABISysV_i386);\
-  op(ABISysV_x86_64);  \
-  op(ABIWindows_x86_64);
+#define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)
 #define LLDB_PROCESS_ARC(op)
Index: lldb/source/Plugins/ABI/X86/CMakeLists.txt
===
--- lldb/source/Plugins/ABI/X86/CMakeLists.txt
+++ lldb/source/Plugins/ABI/X86/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIX86 PLUGIN
+  ABIX86.cpp
   ABIMacOSX_i386.cpp
   ABISysV_i386.cpp
   ABISysV_x86_64.cpp
Index: lldb/source/Plugins/ABI/X86/ABIX86.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/X86/ABIX86.h
@@ -0,0 +1,17 @@
+//===-- X86.h ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

[Lldb-commits] [lldb] 16bf892 - [lldb/Test] Partially revert assertTrue change

2020-02-13 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-13T21:55:48-08:00
New Revision: 16bf89267e5ac01d2b512ce784f23640a82de821

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

LOG: [lldb/Test] Partially revert assertTrue change

This reverts b3a0c4d7dcfa252be17ef5f5b63ffaaa83e01a2b for
TestBreakpointHitCount.py because it's now timing out on the Windows
bot. I'm not sure this is the cause, but the substitution doesn't look
correct anyway...

Added: 


Modified: 

lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
index 9f8ac82e7f54..0254bf02366d 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
@@ -41,7 +41,7 @@ def test_breakpoint_one_shot(self):
 "There should be a thread stopped due to breakpoint")
 
 frame0 = thread.GetFrameAtIndex(0)
-self.assertEquals(frame0.GetFunctionName(), "a(int)" or 
frame0.GetFunctionName() == "int a(int)");
+self.assertTrue(frame0.GetFunctionName() == "a(int)" or 
frame0.GetFunctionName() == "int a(int)");
 
 process.Continue()
 self.assertEqual(process.GetState(), lldb.eStateExited)



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


[Lldb-commits] [PATCH] D74475: [lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D74475#1874860 , @stella.stamenova 
wrote:

> Either this change or D74243  broke the 
> windows bot and I do suspect D74243  but 
> have not confirmed it yet:
>
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/13719


I've partially reverted this change (just for for `TestBreakpointHitCount.py` 
which is the one timing out on the Windows bot) in 
16bf89267e5ac01d2b512ce784f23640a82de821 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74475



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


[Lldb-commits] [PATCH] D74475: [lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

2020-02-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Yup, looks like that was it, the bot is green again: 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/13740


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74475



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


Re: [Lldb-commits] [PATCH] D74475: [lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

2020-02-13 Thread Raphael “Teemperor” Isemann via lldb-commits
Thanks, I thought I fixed that before committing (that was the one change that 
Pavel missed IIRC).

> On 14. Feb 2020, at 07:53, Jonas Devlieghere via Phabricator 
>  wrote:
> 
> JDevlieghere added a comment.
> 
> Yup, looks like that was it, the bot is green again: 
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/13740
> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D74475/new/
> 
> https://reviews.llvm.org/D74475
> 
> 
> 

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


[Lldb-commits] [lldb] 65e843c - [lldb] Add a test for launch failure and its error message

2020-02-13 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-14T08:43:03+01:00
New Revision: 65e843c9e0b91d5ac156130f61b378bad2e8e2fd

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

LOG: [lldb] Add a test for launch failure and its error message

Added: 


Modified: 
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
index 8f0ed9a4933d..238a4559d6fb 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -50,6 +50,30 @@ def vAttach(self, pid):
 target.AttachToProcessWithID(lldb.SBListener(), 47, error)
 self.assertEquals(error_msg, error.GetCString())
 
+def test_launch_fail(self):
+class MyResponder(MockGDBServerResponder):
+# Pretend we don't have any process during the initial queries.
+def qC(self):
+return "E42"
+
+def qfThreadInfo(self):
+return "OK" # No threads.
+
+# Then, when we are asked to attach, error out.
+def A(self, packet):
+return "E47"
+
+self.server.responder = MyResponder()
+
+target = self.createTarget("a.yaml")
+process = self.connect(target)
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), process, 
[lldb.eStateConnected])
+
+error = lldb.SBError()
+target.Launch(lldb.SBListener(), None, None, None, None, None,
+None, 0, True, error)
+self.assertEquals("process launch failed: 'A' packet returned an 
error: 71", error.GetCString())
+
 def test_read_registers_using_g_packets(self):
 """Test reading registers using 'g' packets (default behavior)"""
 self.dbg.HandleCommand(

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py 
b/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
index 392aeba5bd68..486485c8e28d 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
@@ -106,6 +106,8 @@ def respond(self, packet):
 return self.cont()
 if packet.startswith("vCont;c"):
 return self.vCont(packet)
+if packet[0] == "A":
+return self.A(packet)
 if packet[0] == "g":
 return self.readRegisters()
 if packet[0] == "G":
@@ -201,6 +203,9 @@ def cont(self):
 def vCont(self, packet):
 raise self.UnexpectedPacketException()
 
+def A(self, packet):
+return ""
+
 def readRegisters(self):
 return "" * self.registerCount
 



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


[Lldb-commits] [PATCH] D74585: Don't prefix error message from process launch with "process launch failed:" boilerplate in Target::Launch

2020-02-13 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I think this is fine.

I added a "gdb client" test for an attach failure error message a while back, 
so I was curious if the same thing can be done for launches -- it can and 
65e843c9  
has the result. I think that patch shows that we really should remove the 
prefix, since the equivalent "attach" error does not have any additional 
prefixes.

PS: Don't forget to update the new test before committing this. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74585



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