[Lldb-commits] [PATCH] D27134: Remove ConnectionMachPort

2016-11-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288117: Remove ConnectionMachPort (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D27134?vs=79310&id=79518#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27134

Files:
  lldb/trunk/include/lldb/Core/ConnectionMachPort.h
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/source/Core/CMakeLists.txt
  lldb/trunk/source/Core/ConnectionMachPort.cpp

Index: lldb/trunk/source/Core/CMakeLists.txt
===
--- lldb/trunk/source/Core/CMakeLists.txt
+++ lldb/trunk/source/Core/CMakeLists.txt
@@ -9,7 +9,6 @@
   Broadcaster.cpp
   Communication.cpp
   Connection.cpp
-  ConnectionMachPort.cpp
   ConnectionSharedMemory.cpp
   ConstString.cpp
   DataBufferHeap.cpp
Index: lldb/trunk/source/Core/ConnectionMachPort.cpp
===
--- lldb/trunk/source/Core/ConnectionMachPort.cpp
+++ lldb/trunk/source/Core/ConnectionMachPort.cpp
@@ -1,259 +0,0 @@
-//===-- ConnectionMachPort.cpp *- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-#if defined(__APPLE__)
-
-#include "lldb/Core/ConnectionMachPort.h"
-
-// C Includes
-#include 
-#include 
-
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Communication.h"
-#include "lldb/Core/Log.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-struct MessageType {
-  mach_msg_header_t head;
-  ConnectionMachPort::PayloadType payload;
-};
-
-ConnectionMachPort::ConnectionMachPort()
-: Connection(), m_task(mach_task_self()), m_port(MACH_PORT_TYPE_NONE) {}
-
-ConnectionMachPort::~ConnectionMachPort() { Disconnect(NULL); }
-
-bool ConnectionMachPort::IsConnected() const {
-  return m_port != MACH_PORT_TYPE_NONE;
-}
-
-ConnectionStatus ConnectionMachPort::Connect(const char *s, Error *error_ptr) {
-  if (IsConnected()) {
-if (error_ptr)
-  error_ptr->SetErrorString("already connected");
-return eConnectionStatusError;
-  }
-
-  if (s == NULL || s[0] == '\0') {
-if (error_ptr)
-  error_ptr->SetErrorString("empty connect URL");
-return eConnectionStatusError;
-  }
-
-  ConnectionStatus status = eConnectionStatusError;
-
-  if (0 == strncmp(s, "bootstrap-checkin://", strlen("bootstrap-checkin://"))) {
-s += strlen("bootstrap-checkin://");
-
-if (*s) {
-  status = BootstrapCheckIn(s, error_ptr);
-} else {
-  if (error_ptr)
-error_ptr->SetErrorString("bootstrap port name is empty");
-}
-  } else if (0 ==
- strncmp(s, "bootstrap-lookup://", strlen("bootstrap-lookup://"))) {
-s += strlen("bootstrap-lookup://");
-if (*s) {
-  status = BootstrapLookup(s, error_ptr);
-} else {
-  if (error_ptr)
-error_ptr->SetErrorString("bootstrap port name is empty");
-}
-  } else {
-if (error_ptr)
-  error_ptr->SetErrorStringWithFormat("unsupported connection URL: '%s'",
-  s);
-  }
-
-  if (status == eConnectionStatusSuccess) {
-if (error_ptr)
-  error_ptr->Clear();
-m_uri.assign(s);
-  } else {
-Disconnect(NULL);
-  }
-
-  return status;
-}
-
-ConnectionStatus ConnectionMachPort::BootstrapCheckIn(const char *port,
-  Error *error_ptr) {
-  mach_port_t bootstrap_port = MACH_PORT_TYPE_NONE;
-
-  /* Getting bootstrap server port */
-  kern_return_t kret =
-  task_get_bootstrap_port(mach_task_self(), &bootstrap_port);
-  if (kret == KERN_SUCCESS) {
-name_t port_name;
-int len = snprintf(port_name, sizeof(port_name), "%s", port);
-if (static_cast(len) < sizeof(port_name)) {
-  kret = ::bootstrap_check_in(bootstrap_port, port_name, &m_port);
-} else {
-  Disconnect(NULL);
-  if (error_ptr)
-error_ptr->SetErrorString("bootstrap is too long");
-  return eConnectionStatusError;
-}
-  }
-
-  if (kret != KERN_SUCCESS) {
-Disconnect(NULL);
-if (error_ptr)
-  error_ptr->SetError(kret, eErrorTypeMachKernel);
-return eConnectionStatusError;
-  }
-  return eConnectionStatusSuccess;
-}
-
-lldb::ConnectionStatus ConnectionMachPort::BootstrapLookup(const char *port,
-   Error *error_ptr) {
-  name_t port_name;
-
-  if (port && port[0]) {
-if (static_cast(::snprintf(port_name, sizeof(port_name), "%s",
-   port)) >= sizeof(port_name)) {
-  if (error_ptr)
-error_ptr->SetErrorString("port netname is too long");
-  return eConnectionStatusError;
-}
-  } else {
-if (error_ptr)
-  erro

[Lldb-commits] [lldb] r288117 - Remove ConnectionMachPort

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 03:23:05 2016
New Revision: 288117

URL: http://llvm.org/viewvc/llvm-project?rev=288117&view=rev
Log:
Remove ConnectionMachPort

Summary:
This class is unused, and since the StringRef refactor, it does not even
implement the Connection interface.

Reviewers: clayborg, jingham

Subscribers: mgorny, lldb-commits

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

Removed:
lldb/trunk/include/lldb/Core/ConnectionMachPort.h
lldb/trunk/source/Core/ConnectionMachPort.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/CMakeLists.txt

Removed: lldb/trunk/include/lldb/Core/ConnectionMachPort.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionMachPort.h?rev=288116&view=auto
==
--- lldb/trunk/include/lldb/Core/ConnectionMachPort.h (original)
+++ lldb/trunk/include/lldb/Core/ConnectionMachPort.h (removed)
@@ -1,79 +0,0 @@
-//===-- ConnectionMachPort.h *- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-#if defined(__APPLE__)
-
-#ifndef liblldb_ConnectionMachPort_h_
-#define liblldb_ConnectionMachPort_h_
-
-// C Includes
-#include 
-#include 
-
-// C++ Includes
-#include 
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Connection.h"
-
-class ConnectionMachPort : public lldb_private::Connection {
-public:
-  ConnectionMachPort();
-
-  virtual ~ConnectionMachPort();
-
-  virtual bool IsConnected() const;
-
-  virtual lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec,
-lldb_private::Error 
*error_ptr);
-
-  virtual lldb::ConnectionStatus Connect(const char *s,
- lldb_private::Error *error_ptr);
-
-  virtual lldb::ConnectionStatus Disconnect(lldb_private::Error *error_ptr);
-
-  virtual size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
-  lldb::ConnectionStatus &status,
-  lldb_private::Error *error_ptr);
-
-  virtual size_t Write(const void *src, size_t src_len,
-   lldb::ConnectionStatus &status,
-   lldb_private::Error *error_ptr);
-
-  virtual std::string GetURI();
-
-  lldb::ConnectionStatus BootstrapCheckIn(const char *port_name,
-  lldb_private::Error *error_ptr);
-
-  lldb::ConnectionStatus BootstrapLookup(const char *port_name,
- lldb_private::Error *error_ptr);
-
-  struct PayloadType {
-uint32_t command;
-uint32_t data_length;
-uint8_t data[32];
-  };
-
-  kern_return_t Send(const PayloadType &payload);
-
-  kern_return_t Receive(PayloadType &payload);
-
-protected:
-  mach_port_t m_task;
-  mach_port_t m_port;
-
-private:
-  std::string m_uri;
-
-  DISALLOW_COPY_AND_ASSIGN(ConnectionMachPort);
-};
-
-#endif // liblldb_ConnectionMachPort_h_
-
-#endif // #if defined(__APPLE__)

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=288117&r1=288116&r2=288117&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 29 03:23:05 2016
@@ -332,7 +332,6 @@
266E82971B8CE3AC008FCA06 /* DWARFDIE.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 266E82961B8CE3AC008FCA06 /* DWARFDIE.cpp */; };
266E829D1B8E542C008FCA06 /* DWARFAttribute.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 266E829C1B8E542C008FCA06 /* DWARFAttribute.cpp 
*/; };
2670F8121862B44A006B332C /* libncurses.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2670F8111862B44A006B332C /* libncurses.dylib */; 
};
-   2671A0D013482601003A87BB /* ConnectionMachPort.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2671A0CF13482601003A87BB /* 
ConnectionMachPort.cpp */; };
26744EF11338317700EF765A /* GDBRemoteCommunicationClient.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26744EED1338317700EF765A /* 
GDBRemoteCommunicationClient.cpp */; };
26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26744EEF1338317700EF765A /* 
GDBRemoteCommunicationServer.cpp */; };
26780C611867C33D00234593 /* libncurses.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2670F8111862B44A006B332C /* libncurses.dylib */; 
};
@@ -1838,8 +1837,6 @@
266F5CBB12FC846200DFCE33 /* Config.h */ = {isa = 
PBXFile

[Lldb-commits] [lldb] r288118 - Fix a typo.

2016-11-29 Thread Hafiz Abid Qadeer via lldb-commits
Author: abidh
Date: Tue Nov 29 03:31:57 2016
New Revision: 288118

URL: http://llvm.org/viewvc/llvm-project?rev=288118&view=rev
Log:
Fix a typo.


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

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp?rev=288118&r1=288117&r2=288118&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp 
Tue Nov 29 03:31:57 2016
@@ -22,7 +22,7 @@
 #include "UnwindLLDB.h"
 
 #if defined(_WIN64)
-#include "x86/RegisterContextWindows_x64.h"
+#include "x64/RegisterContextWindows_x64.h"
 #else
 #include "x86/RegisterContextWindows_x86.h"
 #endif


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


[Lldb-commits] [lldb] r288122 - Remove ConnectionSharedMemory

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 03:42:35 2016
New Revision: 288122

URL: http://llvm.org/viewvc/llvm-project?rev=288122&view=rev
Log:
Remove ConnectionSharedMemory

This class is unused.

Removed:
lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h
lldb/trunk/source/Core/ConnectionSharedMemory.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/CMakeLists.txt

Removed: lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h?rev=288121&view=auto
==
--- lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h (original)
+++ lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h (removed)
@@ -1,61 +0,0 @@
-//===-- ConnectionSharedMemory.h *- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef liblldb_ConnectionSharedMemory_h_
-#define liblldb_ConnectionSharedMemory_h_
-
-// C Includes
-// C++ Includes
-#include 
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Connection.h"
-#include "lldb/Core/DataBufferMemoryMap.h"
-
-namespace lldb_private {
-
-class ConnectionSharedMemory : public Connection {
-public:
-  ConnectionSharedMemory();
-
-  ~ConnectionSharedMemory() override;
-
-  bool IsConnected() const override;
-
-  virtual lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec,
-Error *error_ptr);
-
-  lldb::ConnectionStatus Connect(llvm::StringRef s, Error *error_ptr) override;
-
-  lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
-
-  size_t Read(void *dst, size_t dst_len, const Timeout &timeout,
-  lldb::ConnectionStatus &status, Error *error_ptr) override;
-
-  size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
-   Error *error_ptr) override;
-
-  std::string GetURI() override;
-
-  lldb::ConnectionStatus Open(bool create, const char *name, size_t size,
-  Error *error_ptr);
-
-protected:
-  std::string m_name;
-  int m_fd; // One buffer that contains all we need
-  DataBufferMemoryMap m_mmap;
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(ConnectionSharedMemory);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ConnectionSharedMemory_h_

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=288122&r1=288121&r2=288122&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 29 03:42:35 2016
@@ -215,7 +215,6 @@
2657AFB71B86910100958979 /* CompilerDeclContext.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2657AFB61B86910100958979 /* 
CompilerDeclContext.cpp */; };
2660AAB914622483003A9694 /* LLDBWrapPython.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp 
*/; settings = {COMPILER_FLAGS = "-Dregister="; }; };
26651A18133BF9E0005B64B7 /* Opcode.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26651A17133BF9DF005B64B7 /* Opcode.cpp */; };
-   266603CA1345B5A8004DA8B6 /* ConnectionSharedMemory.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 266603C91345B5A8004DA8B6 /* 
ConnectionSharedMemory.cpp */; };
2666ADC61B3CB675001FAFD3 /* DynamicLoaderHexagonDYLD.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2666ADC11B3CB675001FAFD3 /* 
DynamicLoaderHexagonDYLD.cpp */; };
2666ADC81B3CB675001FAFD3 /* HexagonDYLDRendezvous.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2666ADC31B3CB675001FAFD3 /* 
HexagonDYLDRendezvous.cpp */; };
2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 26BC7C2510F1B3BC00F91463 /* lldb-defines.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -1665,8 +1664,6 @@
26651A15133BF9CC005B64B7 /* Opcode.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Opcode.h; path = include/lldb/Core/Opcode.h; sourceTree = ""; };
26651A17133BF9DF005B64B7 /* Opcode.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = Opcode.cpp; path = source/Core/Opcode.cpp; sourceTree = ""; };
2665CD0D15080846002C8FAE /* Makefile */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = 
Makefile; sourceTree = ""; };
-   266603C91345B5A8004DA8B6 /

[Lldb-commits] [PATCH] D26975: Specify the dependencies of lldb-server manually

2016-11-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Any thoughts on this?


https://reviews.llvm.org/D26975



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


Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-29 Thread Pavel Labath via lldb-commits
On 28 November 2016 at 18:06, Jim Ingham  wrote:
> backtick parsing is currently incorrect, because it parses the backtick
> before doing arg parsing, which means it does the substitutions for “raw”
> commands:
>
> (lldb) expr char *$foo = "some `1 + 2` string"
> (lldb) expr $foo
> (char *) $foo = 0x00010032f100 "some 3 string"
>
> That’s unexpected, and since part of the point of expr is that you can
> freely cut and paste from a source view into the expr command, it is not
> desirable.
Agreed, although I do not think this requirement conflicts with the
requirements above (btw, I like the raw mode very much)

>
> The most straightforward way to fix this is to make backtick parsing happen
> as a part of argument parsing - so you would know you were in a raw command
> and not intervene in the input.
>
> I actually think the full bash quoting rules are overly complex for lldb.
> Greg was having fun emulating the bash syntax but that seems an
> unnecessarily complex model for lldb’s command line.  But that may be water
> under the bridge at this point.

I'll have to take some of the blame for that. One of my first changes
on this project was fixing quote processing. :) I think it was a
strict improvement, as back then we get very inconsistent quoting and
unquoting rules, which produced very strange results in more
complicated cases (e.g. prefixing a command with "lldb --" is able to
run it in a debugger in almost all cases, before it broke down as soon
as arguments contained quotes). I chose to model it after posix
shells, as the rules very already quite similar to that, and I thought
(and still do) that sticking known rules is better than trying to
invent new ones.

I hope I'll find more time to go back to that soon and finish the
remaining bugs we have mentioned here.

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


Re: [Lldb-commits] [PATCH] D26975: Specify the dependencies of lldb-server manually

2016-11-29 Thread Zachary Turner via lldb-commits
Lgtm, and as we start untangling the mess of dependencies in liblldb id
like for us to take the same approach there too (as llvm does)
On Tue, Nov 29, 2016 at 3:08 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added a comment.
>
> Any thoughts on this?
>
>
> https://reviews.llvm.org/D26975
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-11-29 Thread Luke Drummond via Phabricator via lldb-commits
ldrumm added a subscriber: lldb-commits.
ldrumm updated this revision to Diff 79578.
ldrumm added a comment.

Addressed some unwanted whitespace changes as suggested by @bryant; use 
`os.dir.curdir` as instead of `.`


https://reviews.llvm.org/D26757

Files:
  CMakeLists.txt
  scripts/CMakeLists.txt
  scripts/Python/prepare_binding_Python.py

Index: scripts/Python/prepare_binding_Python.py
===
--- scripts/Python/prepare_binding_Python.py
+++ scripts/Python/prepare_binding_Python.py
@@ -196,34 +196,37 @@
 temp_dep_file_path = dependency_file + ".tmp"
 
 # Build the SWIG args list
-command = [
-options.swig_executable,
-"-c++",
-"-shadow",
-"-python",
-"-threads",
-"-I\"%s\"" % os.path.normcase(
-os.path.join(options.src_root, "include")),
-"-I\"%s\"" % os.path.normcase("./."),
-"-D__STDC_LIMIT_MACROS",
-"-D__STDC_CONSTANT_MACROS"]
-if options.target_platform == "Darwin":
-command.append("-D__APPLE__")
-if options.generate_dependency_file:
-command.append("-MMD -MF \"%s\"" % temp_dep_file_path)
-command.extend([
-"-outdir", "\"%s\"" % config_build_dir,
-"-o", "\"%s\"" % settings.output_file,
-"\"%s\"" % settings.input_file
-])
-logging.info("running swig with: %s", command)
+is_darwin = options.target_platform == "Darwin"
+gen_deps = options.generate_dependency_file
+darwin_extras = ["-D__APPLE__"] if is_darwin else []
+deps_args = ["-MMD", "-MF", temp_dep_file_path] if gen_deps else []
+command = ([
+options.swig_executable,
+"-c++",
+"-shadow",
+"-python",
+"-threads",
+"-I" + os.path.normpath(os.path.join(options.src_root, "include")),
+"-I" + os.path.curdir,
+"-D__STDC_LIMIT_MACROS",
+"-D__STDC_CONSTANT_MACROS"
+]
++ darwin_extras
++ deps_args
++ [
+"-outdir", config_build_dir,
+"-o", settings.output_file,
+settings.input_file
+]
+)
+logging.info("running swig with: %r", command)
 
 # Execute swig
 process = subprocess.Popen(
-' '.join(command),
+command,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
-shell=True)
+)
 # Wait for SWIG process to terminate
 swig_stdout, swig_stderr = process.communicate()
 return_code = process.returncode
@@ -265,15 +268,14 @@
 the command line arguments to pass to it.
 """
 command = [sys.executable] + script_and_args
-command_line = " ".join(command)
-process = subprocess.Popen(command, shell=False)
+process = subprocess.Popen(command)
 script_stdout, script_stderr = process.communicate()
 return_code = process.returncode
 if return_code != 0:
-logging.error("failed to run '%s': %s", command_line, script_stderr)
+logging.error("failed to run %r: %r", command, script_stderr)
 sys.exit(return_code)
 else:
-logging.info("ran script '%s'", command_line)
+logging.info("ran script %r'", command)
 if script_stdout is not None:
 logging.info("output: %s", script_stdout)
 
Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -35,12 +35,13 @@
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/prepare_binding_Python.py
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/modify-python-lldb.py
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py
-  ${framework_arg}
-  "--srcRoot=${LLDB_SOURCE_DIR}"
-  "--targetDir=${LLDB_PYTHON_TARGET_DIR}"
-  "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}"
-  "--prefix=${CMAKE_BINARY_DIR}"
-  "--swigExecutable=${SWIG_EXECUTABLE}"
+  ${framework_arg}
+  --srcRoot=${LLDB_SOURCE_DIR}
+  --targetDir=${LLDB_PYTHON_TARGET_DIR}
+  --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}
+  --prefix=${CMAKE_BINARY_DIR}
+  --swigExecutable=${SWIG_EXECUTABLE}
+  VERBATIM
   COMMENT "Python script building LLDB Python wrapper")
 set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -39,15 +39,19 @@
 add_subdirectory(lit)
 
 if (NOT LLDB_DISABLE_PYTHON)
-# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
-add_custom_target( finish_swig ALL
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
-"--srcRoot=${LLDB_SOURCE_DIR}"
-"

[Lldb-commits] [PATCH] D26975: Specify the dependencies of lldb-server manually

2016-11-29 Thread Todd Fiala via Phabricator via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

I think this is a great approach.  LGTM!


https://reviews.llvm.org/D26975



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


[Lldb-commits] [lldb] r288159 - Specify the dependencies of lldb-server manually

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 10:40:57 2016
New Revision: 288159

URL: http://llvm.org/viewvc/llvm-project?rev=288159&view=rev
Log:
Specify the dependencies of lldb-server manually

Summary:
This basically just inlines the LLDBDependencies.cmake file into lldb-server
CMakeLists.txt. The reason is that most of these dependencies are not actually
necessary for lldb-server (some of them can't be removed because of
cross-dependencies, but most of the plugins can). I intend to start cleaning
these up in follow-up commits, but I want to do this first, so the subsequent
ones can be easily reverted if they don't build in some configurations.

When I cleaned these up locally, I was able to get a 30%--50% improvement in
lldb-server size.

Reviewers: zturner, beanz, tfiala

Subscribers: danalbert, srhines, lldb-commits, mgorny

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

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288159&r1=288158&r2=288159&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Nov 29 10:40:57 2016
@@ -23,7 +23,215 @@ endif ()
 
 include_directories(../../source)
 
-include(../../cmake/LLDBDependencies.cmake)
+
+set( LLDB_USED_LIBS
+  lldbBase
+  lldbBreakpoint
+  lldbCommands
+  lldbDataFormatters
+  lldbHost
+  lldbCore
+  lldbExpression
+  lldbInitialization
+  lldbInterpreter
+  lldbSymbol
+  lldbTarget
+  lldbUtility
+
+  # Plugins
+  lldbPluginDisassemblerLLVM
+  lldbPluginSymbolFileDWARF
+  lldbPluginSymbolFilePDB
+  lldbPluginSymbolFileSymtab
+  lldbPluginDynamicLoaderStatic
+  lldbPluginDynamicLoaderPosixDYLD
+  lldbPluginDynamicLoaderHexagonDYLD
+  lldbPluginDynamicLoaderWindowsDYLD
+
+  lldbPluginCPlusPlusLanguage
+  lldbPluginGoLanguage
+  lldbPluginJavaLanguage
+  lldbPluginObjCLanguage
+  lldbPluginObjCPlusPlusLanguage
+  lldbPluginOCamlLanguage
+
+  lldbPluginObjectFileELF
+  lldbPluginObjectFileJIT
+  lldbPluginSymbolVendorELF
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginProcessGDBRemote
+  lldbPluginProcessUtility
+  lldbPluginPlatformAndroid
+  lldbPluginPlatformGDB
+  lldbPluginPlatformFreeBSD
+  lldbPluginPlatformKalimba
+  lldbPluginPlatformLinux
+  lldbPluginPlatformNetBSD
+  lldbPluginPlatformPOSIX
+  lldbPluginPlatformWindows
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginPlatformMacOSX
+  lldbPluginStructuredDataDarwinLog
+  lldbPluginDynamicLoaderMacOSXDYLD
+  lldbPluginUnwindAssemblyInstEmulation
+  lldbPluginUnwindAssemblyX86
+  lldbPluginAppleObjCRuntime
+  lldbPluginRenderScriptRuntime
+  lldbPluginLanguageRuntimeGo
+  lldbPluginLanguageRuntimeJava
+  lldbPluginCXXItaniumABI
+  lldbPluginABIMacOSX_arm
+  lldbPluginABIMacOSX_arm64
+  lldbPluginABIMacOSX_i386
+  lldbPluginABISysV_arm
+  lldbPluginABISysV_arm64
+  lldbPluginABISysV_i386
+  lldbPluginABISysV_x86_64
+  lldbPluginABISysV_hexagon
+  lldbPluginABISysV_ppc
+  lldbPluginABISysV_ppc64
+  lldbPluginABISysV_mips
+  lldbPluginABISysV_mips64
+  lldbPluginABISysV_s390x
+  lldbPluginInstructionARM
+  lldbPluginInstructionARM64
+  lldbPluginInstructionMIPS
+  lldbPluginInstructionMIPS64
+  lldbPluginObjectFilePECOFF
+  lldbPluginOSGo
+  lldbPluginOSPython
+  lldbPluginMemoryHistoryASan
+  lldbPluginInstrumentationRuntimeAddressSanitizer
+  lldbPluginInstrumentationRuntimeThreadSanitizer
+  lldbPluginSystemRuntimeMacOSX
+  lldbPluginProcessElfCore
+  lldbPluginProcessMinidump
+  lldbPluginJITLoaderGDB
+  lldbPluginExpressionParserClang
+  lldbPluginExpressionParserGo
+  )
+
+# Windows-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessWindows
+lldbPluginProcessWindowsCommon
+Ws2_32
+Rpcrt4
+)
+endif ()
+
+# Linux-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessLinux
+lldbPluginProcessPOSIX
+   )
+endif ()
+
+# FreeBSD-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessFreeBSD
+lldbPluginProcessPOSIX
+)
+endif ()
+
+# NetBSD-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessPOSIX
+)
+endif ()
+
+# Darwin-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginDynamicLoaderDarwinKernel
+lldbPluginObjectFileMachO
+lldbPluginProcessMachCore
+lldbPluginProcessMacOSXKernel
+lldbPluginSymbolVendorMacOSX
+)
+endif()
+
+set( CLANG_USED_LIBS
+  clangAnalysis
+  clangAST
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangEdit
+  clangFrontend
+  clangLex
+  clangParse
+  clangRewrite
+  clangRe

[Lldb-commits] [PATCH] D26975: Specify the dependencies of lldb-server manually

2016-11-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288159: Specify the dependencies of lldb-server manually 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D26975?vs=78880&id=79584#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26975

Files:
  lldb/trunk/tools/lldb-server/CMakeLists.txt

Index: lldb/trunk/tools/lldb-server/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-server/CMakeLists.txt
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt
@@ -23,7 +23,215 @@
 
 include_directories(../../source)
 
-include(../../cmake/LLDBDependencies.cmake)
+
+set( LLDB_USED_LIBS
+  lldbBase
+  lldbBreakpoint
+  lldbCommands
+  lldbDataFormatters
+  lldbHost
+  lldbCore
+  lldbExpression
+  lldbInitialization
+  lldbInterpreter
+  lldbSymbol
+  lldbTarget
+  lldbUtility
+
+  # Plugins
+  lldbPluginDisassemblerLLVM
+  lldbPluginSymbolFileDWARF
+  lldbPluginSymbolFilePDB
+  lldbPluginSymbolFileSymtab
+  lldbPluginDynamicLoaderStatic
+  lldbPluginDynamicLoaderPosixDYLD
+  lldbPluginDynamicLoaderHexagonDYLD
+  lldbPluginDynamicLoaderWindowsDYLD
+
+  lldbPluginCPlusPlusLanguage
+  lldbPluginGoLanguage
+  lldbPluginJavaLanguage
+  lldbPluginObjCLanguage
+  lldbPluginObjCPlusPlusLanguage
+  lldbPluginOCamlLanguage
+
+  lldbPluginObjectFileELF
+  lldbPluginObjectFileJIT
+  lldbPluginSymbolVendorELF
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginProcessGDBRemote
+  lldbPluginProcessUtility
+  lldbPluginPlatformAndroid
+  lldbPluginPlatformGDB
+  lldbPluginPlatformFreeBSD
+  lldbPluginPlatformKalimba
+  lldbPluginPlatformLinux
+  lldbPluginPlatformNetBSD
+  lldbPluginPlatformPOSIX
+  lldbPluginPlatformWindows
+  lldbPluginObjectContainerMachOArchive
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginPlatformMacOSX
+  lldbPluginStructuredDataDarwinLog
+  lldbPluginDynamicLoaderMacOSXDYLD
+  lldbPluginUnwindAssemblyInstEmulation
+  lldbPluginUnwindAssemblyX86
+  lldbPluginAppleObjCRuntime
+  lldbPluginRenderScriptRuntime
+  lldbPluginLanguageRuntimeGo
+  lldbPluginLanguageRuntimeJava
+  lldbPluginCXXItaniumABI
+  lldbPluginABIMacOSX_arm
+  lldbPluginABIMacOSX_arm64
+  lldbPluginABIMacOSX_i386
+  lldbPluginABISysV_arm
+  lldbPluginABISysV_arm64
+  lldbPluginABISysV_i386
+  lldbPluginABISysV_x86_64
+  lldbPluginABISysV_hexagon
+  lldbPluginABISysV_ppc
+  lldbPluginABISysV_ppc64
+  lldbPluginABISysV_mips
+  lldbPluginABISysV_mips64
+  lldbPluginABISysV_s390x
+  lldbPluginInstructionARM
+  lldbPluginInstructionARM64
+  lldbPluginInstructionMIPS
+  lldbPluginInstructionMIPS64
+  lldbPluginObjectFilePECOFF
+  lldbPluginOSGo
+  lldbPluginOSPython
+  lldbPluginMemoryHistoryASan
+  lldbPluginInstrumentationRuntimeAddressSanitizer
+  lldbPluginInstrumentationRuntimeThreadSanitizer
+  lldbPluginSystemRuntimeMacOSX
+  lldbPluginProcessElfCore
+  lldbPluginProcessMinidump
+  lldbPluginJITLoaderGDB
+  lldbPluginExpressionParserClang
+  lldbPluginExpressionParserGo
+  )
+
+# Windows-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessWindows
+lldbPluginProcessWindowsCommon
+Ws2_32
+Rpcrt4
+)
+endif ()
+
+# Linux-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessLinux
+lldbPluginProcessPOSIX
+   )
+endif ()
+
+# FreeBSD-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessFreeBSD
+lldbPluginProcessPOSIX
+)
+endif ()
+
+# NetBSD-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginProcessPOSIX
+)
+endif ()
+
+# Darwin-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+  list(APPEND LLDB_USED_LIBS
+lldbPluginDynamicLoaderDarwinKernel
+lldbPluginObjectFileMachO
+lldbPluginProcessMachCore
+lldbPluginProcessMacOSXKernel
+lldbPluginSymbolVendorMacOSX
+)
+endif()
+
+set( CLANG_USED_LIBS
+  clangAnalysis
+  clangAST
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangEdit
+  clangFrontend
+  clangLex
+  clangParse
+  clangRewrite
+  clangRewriteFrontend
+  clangSema
+  clangSerialization
+  )
+
+set(LLDB_SYSTEM_LIBS)
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT __ANDROID_NDK__)
+  if (NOT LLDB_DISABLE_LIBEDIT)
+list(APPEND LLDB_SYSTEM_LIBS edit)
+  endif()
+  if (NOT LLDB_DISABLE_CURSES)
+list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
+if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+  list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
+endif()
+  endif()
+endif()
+
+if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
+list(APPEND LLDB_SYSTEM_LIBS atomic)
+endif()
+
+# On FreeBSD/NetBSD backtrace() is provided by libexecinfo, not libc.
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+  list(APPEND LLDB_SYSTEM_LIBS execinfo)
+endif()
+
+if (NOT L

[Lldb-commits] [PATCH] D27017: Support more report types in AddressSanitizerRuntime.cpp

2016-11-29 Thread Filipe Cabecinhas via Phabricator via lldb-commits
filcab added a comment.

I'd mostly use Anna's suggestions. Kuba: Can you remove the "detected" from the 
messages and refresh the patch, just so we can have one last look? Otherwise, 
if you think it's good enough, commit with these changes and we can do 
post-commit review.




Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:198
   if (description == "heap-use-after-free") {
 return "Use of deallocated memory detected";
   } else if (description == "heap-buffer-overflow") {

zaks.anna wrote:
> Kuba would like to drop all of these "detected" that do not add anything and 
> are just used as filler words in all of the description messages. This will 
> make some of them into non-complete sentences, but keeping them short is more 
> user friendly and gets the point across just fine.
Agree.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:220
+  } else if (description == "stack-overflow") {
+return "Stack overflow detected (recursion too deep)";
+  } else if (description == "null-deref") {

zaks.anna wrote:
> filcab wrote:
> > kubabrecka wrote:
> > > filcab wrote:
> > > > Not necessarily recursion. There's also stack variables. I'd omit the 
> > > > stuff in parenthesis.
> > > Multiple times have I seen that people read "stack overflow" as "stack 
> > > **buffer** overflow" and they spend a lot of time trying to find what 
> > > buffer was actually overflown...  I'd like to somehow point that out.  
> > > Ideas?
> > Maybe instead of "recursion too deep" have "stack space exhausted" or 
> > something like that?
> > I've seen stack overflow errors on as few as 10 (maybe even fewer) stack 
> > frames (with big objects). ASan is also more likely to make this a problem. 
> > I think seeing "recursion too deep" but having only a dozen frames is 
> > probably confusing.
> > Not that "stack space exhausted" is much better, but I think it's less 
> > likely to be misleading.
> > 
> > And yes, please ask native speakers too, as I'm not one either. :-)
> > 
> We could just say "Stack space exhausted" with no parentheses.
Yes.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:222
+  } else if (description == "null-deref") {
+return "Null pointer dereference detected";
+  } else if (description == "wild-jump") {

zaks.anna wrote:
> Drop "detected" or "Dereference of null pointer".
> 
I'd go for the second option.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:224
+  } else if (description == "wild-jump") {
+return "Wild pointer jump detected";
+  } else if (description == "wild-addr-write") {

zaks.anna wrote:
> filcab wrote:
> > Nit: "Wild jump" is probably better than "wild pointer jump", no?
> How about "Jump to a wild address". "Wild jump" sounds like a term, but I am 
> not familiar with  it.
"Jump to non-executable address" (basically, it's either non-readable (or 
unmapped) or non-executable. But I don't think we need to have those 
distinctions in this error message)? If not, I'm fine with Anna's suggestion 
too.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:226
+  } else if (description == "wild-addr-write") {
+return "Write to a wild pointer detected";
+  } else if (description == "wild-addr-read") {

zaks.anna wrote:
> filcab wrote:
> > Nit: I'd probably use "Write through wild pointer ..." (same for the others)
> "Write through", "Access through" but "Read from" (as per the English speaker 
> on our team :)).
Heh. Right.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:234
+  } else if (description == "double-free") {
+return "Attempt to deallocate a freed object detected";
+  } else if (description == "new-delete-type-mismatch") {

zaks.anna wrote:
> filcab wrote:
> > Nit: Phrasing seems off. I think "Double free detected" is easier to read 
> > and more explicit.
> Double free is a bit of a jargon, I think it's better to be explicit:
> "Deallocation of freed memory"
Good.



Comment at: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp:236
+  } else if (description == "new-delete-type-mismatch") {
+return "Deallocation of a wrong size detected";
+  } else if (description == "bad-free") {

zaks.anna wrote:
> filcab wrote:
> > Nit: Maybe "Deallocation size mismatch detected"? The user isn't 
> > deallocating a "size".
> Is this always about "new" and "delete"? If so, we could try to be more 
> explicit about it "The size of deleted object does not match the size at 
> allocation"
> 
> "Deallocation size different than allocation size

[Lldb-commits] [lldb] r288164 - Remove dynamic loader, platform and ABI plugins from lldb-server dependencies

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 11:06:26 2016
New Revision: 288164

URL: http://llvm.org/viewvc/llvm-project?rev=288164&view=rev
Log:
Remove dynamic loader, platform and ABI plugins from lldb-server dependencies

These packages are not used on the server.

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288164&r1=288163&r2=288164&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Nov 29 11:06:26 2016
@@ -43,10 +43,6 @@ set( LLDB_USED_LIBS
   lldbPluginSymbolFileDWARF
   lldbPluginSymbolFilePDB
   lldbPluginSymbolFileSymtab
-  lldbPluginDynamicLoaderStatic
-  lldbPluginDynamicLoaderPosixDYLD
-  lldbPluginDynamicLoaderHexagonDYLD
-  lldbPluginDynamicLoaderWindowsDYLD
 
   lldbPluginCPlusPlusLanguage
   lldbPluginGoLanguage
@@ -62,19 +58,9 @@ set( LLDB_USED_LIBS
   lldbPluginObjectContainerMachOArchive
   lldbPluginProcessGDBRemote
   lldbPluginProcessUtility
-  lldbPluginPlatformAndroid
-  lldbPluginPlatformGDB
-  lldbPluginPlatformFreeBSD
-  lldbPluginPlatformKalimba
-  lldbPluginPlatformLinux
-  lldbPluginPlatformNetBSD
-  lldbPluginPlatformPOSIX
-  lldbPluginPlatformWindows
   lldbPluginObjectContainerMachOArchive
   lldbPluginObjectContainerBSDArchive
-  lldbPluginPlatformMacOSX
   lldbPluginStructuredDataDarwinLog
-  lldbPluginDynamicLoaderMacOSXDYLD
   lldbPluginUnwindAssemblyInstEmulation
   lldbPluginUnwindAssemblyX86
   lldbPluginAppleObjCRuntime
@@ -82,19 +68,6 @@ set( LLDB_USED_LIBS
   lldbPluginLanguageRuntimeGo
   lldbPluginLanguageRuntimeJava
   lldbPluginCXXItaniumABI
-  lldbPluginABIMacOSX_arm
-  lldbPluginABIMacOSX_arm64
-  lldbPluginABIMacOSX_i386
-  lldbPluginABISysV_arm
-  lldbPluginABISysV_arm64
-  lldbPluginABISysV_i386
-  lldbPluginABISysV_x86_64
-  lldbPluginABISysV_hexagon
-  lldbPluginABISysV_ppc
-  lldbPluginABISysV_ppc64
-  lldbPluginABISysV_mips
-  lldbPluginABISysV_mips64
-  lldbPluginABISysV_s390x
   lldbPluginInstructionARM
   lldbPluginInstructionARM64
   lldbPluginInstructionMIPS


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


[Lldb-commits] [lldb] r288166 - Remove assorted other plugins which are not needed by lldb-server

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 11:21:18 2016
New Revision: 288166

URL: http://llvm.org/viewvc/llvm-project?rev=288166&view=rev
Log:
Remove assorted other plugins which are not needed by lldb-server

language runtime, structured data, sanitizers, process plugins.

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288166&r1=288165&r2=288166&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Nov 29 11:21:18 2016
@@ -60,28 +60,14 @@ set( LLDB_USED_LIBS
   lldbPluginProcessUtility
   lldbPluginObjectContainerMachOArchive
   lldbPluginObjectContainerBSDArchive
-  lldbPluginStructuredDataDarwinLog
   lldbPluginUnwindAssemblyInstEmulation
   lldbPluginUnwindAssemblyX86
-  lldbPluginAppleObjCRuntime
-  lldbPluginRenderScriptRuntime
-  lldbPluginLanguageRuntimeGo
-  lldbPluginLanguageRuntimeJava
   lldbPluginCXXItaniumABI
   lldbPluginInstructionARM
   lldbPluginInstructionARM64
   lldbPluginInstructionMIPS
   lldbPluginInstructionMIPS64
   lldbPluginObjectFilePECOFF
-  lldbPluginOSGo
-  lldbPluginOSPython
-  lldbPluginMemoryHistoryASan
-  lldbPluginInstrumentationRuntimeAddressSanitizer
-  lldbPluginInstrumentationRuntimeThreadSanitizer
-  lldbPluginSystemRuntimeMacOSX
-  lldbPluginProcessElfCore
-  lldbPluginProcessMinidump
-  lldbPluginJITLoaderGDB
   lldbPluginExpressionParserClang
   lldbPluginExpressionParserGo
   )


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


[Lldb-commits] [lldb] r288169 - Remove some OS-specific plugins from lldb-server dependencies

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 11:45:25 2016
New Revision: 288169

URL: http://llvm.org/viewvc/llvm-project?rev=288169&view=rev
Log:
Remove some OS-specific plugins from lldb-server dependencies

I don't believe the code in those plugins could be in any way useful for
lldb-server, but I can't be sure if this will break some transitive 
dependencies.
Builtbots should be able to tell us that.

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288169&r1=288168&r2=288169&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Nov 29 11:45:25 2016
@@ -72,16 +72,6 @@ set( LLDB_USED_LIBS
   lldbPluginExpressionParserGo
   )
 
-# Windows-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessWindows
-lldbPluginProcessWindowsCommon
-Ws2_32
-Rpcrt4
-)
-endif ()
-
 # Linux-only libraries
 if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
   list(APPEND LLDB_USED_LIBS
@@ -90,29 +80,10 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
)
 endif ()
 
-# FreeBSD-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessFreeBSD
-lldbPluginProcessPOSIX
-)
-endif ()
-
-# NetBSD-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
-  list(APPEND LLDB_USED_LIBS
-lldbPluginProcessPOSIX
-)
-endif ()
-
 # Darwin-only libraries
 if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
   list(APPEND LLDB_USED_LIBS
-lldbPluginDynamicLoaderDarwinKernel
 lldbPluginObjectFileMachO
-lldbPluginProcessMachCore
-lldbPluginProcessMacOSXKernel
-lldbPluginSymbolVendorMacOSX
 )
 endif()
 


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


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-11-29 Thread Enrico Granata via Phabricator via lldb-commits
granata.enrico resigned from this revision.
granata.enrico removed a reviewer: granata.enrico.
granata.enrico added a comment.

I am not an Apple employee working on LLDB anymore


https://reviews.llvm.org/D26757



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


[Lldb-commits] [PATCH] D13617: Fix ref-counting of Python objects

2016-11-29 Thread Enrico Granata via Phabricator via lldb-commits
granata.enrico resigned from this revision.
granata.enrico removed a reviewer: granata.enrico.
granata.enrico added a comment.

I am not an Apple employee working on LLDB anymore


https://reviews.llvm.org/D13617



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


[Lldb-commits] [PATCH] D19092: Fix Android build after r266267

2016-11-29 Thread Enrico Granata via Phabricator via lldb-commits
granata.enrico resigned from this revision.
granata.enrico removed a reviewer: granata.enrico.
granata.enrico added a comment.

I am not an Apple employee working on LLDB anymore


https://reviews.llvm.org/D19092



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


[Lldb-commits] [PATCH] D19086: [clang-analyzer] fix warnings emitted on lldb code base

2016-11-29 Thread Enrico Granata via Phabricator via lldb-commits
granata.enrico resigned from this revision.
granata.enrico removed a reviewer: granata.enrico.
granata.enrico added a comment.

I am not an Apple employee working on LLDB anymore


https://reviews.llvm.org/D19086



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


[Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions

2016-11-29 Thread Ewan Crawford via Phabricator via lldb-commits
EwanCrawford abandoned this revision.
EwanCrawford added a subscriber: ldrumm.
EwanCrawford added a comment.

Abandoning this patch since it's out of date, and @ldrumm has an alternative 
fix he's about to post


Repository:
  rL LLVM

https://reviews.llvm.org/D17957



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


[Lldb-commits] [lldb] r288181 - Add back some of the previous lldb-server dependencies

2016-11-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 29 12:38:09 2016
New Revision: 288181

URL: http://llvm.org/viewvc/llvm-project?rev=288181&view=rev
Log:
Add back some of the previous lldb-server dependencies

It seems a debug build of lldb-server will not complete without these, as the
linker is not able to strip out code that aggressively. Add those back until I
can figure out how to break the dependency chains.

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288181&r1=288180&r2=288181&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Nov 29 12:38:09 2016
@@ -43,6 +43,7 @@ set( LLDB_USED_LIBS
   lldbPluginSymbolFileDWARF
   lldbPluginSymbolFilePDB
   lldbPluginSymbolFileSymtab
+  lldbPluginDynamicLoaderPosixDYLD
 
   lldbPluginCPlusPlusLanguage
   lldbPluginGoLanguage
@@ -54,20 +55,24 @@ set( LLDB_USED_LIBS
   lldbPluginObjectFileELF
   lldbPluginObjectFileJIT
   lldbPluginSymbolVendorELF
+  lldbPluginPlatformPOSIX
   lldbPluginObjectContainerBSDArchive
   lldbPluginObjectContainerMachOArchive
   lldbPluginProcessGDBRemote
   lldbPluginProcessUtility
   lldbPluginObjectContainerMachOArchive
   lldbPluginObjectContainerBSDArchive
+  lldbPluginPlatformMacOSX
   lldbPluginUnwindAssemblyInstEmulation
   lldbPluginUnwindAssemblyX86
+  lldbPluginAppleObjCRuntime
   lldbPluginCXXItaniumABI
   lldbPluginInstructionARM
   lldbPluginInstructionARM64
   lldbPluginInstructionMIPS
   lldbPluginInstructionMIPS64
   lldbPluginObjectFilePECOFF
+  lldbPluginProcessElfCore
   lldbPluginExpressionParserClang
   lldbPluginExpressionParserGo
   )


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


Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-29 Thread Jim Ingham via lldb-commits

> On Nov 29, 2016, at 7:53 AM, Pavel Labath  wrote:
> 
> On 28 November 2016 at 18:06, Jim Ingham  wrote:
>> backtick parsing is currently incorrect, because it parses the backtick
>> before doing arg parsing, which means it does the substitutions for “raw”
>> commands:
>> 
>> (lldb) expr char *$foo = "some `1 + 2` string"
>> (lldb) expr $foo
>> (char *) $foo = 0x00010032f100 "some 3 string"
>> 
>> That’s unexpected, and since part of the point of expr is that you can
>> freely cut and paste from a source view into the expr command, it is not
>> desirable.
> Agreed, although I do not think this requirement conflicts with the
> requirements above (btw, I like the raw mode very much)

Raw mode is useful for something like expr, where you know you want to ingest 
text from the user directly, but IMHO it should be used very sparingly, since 
it offloads the responsibility for understanding the structure of the command 
from lldb to the individual command, which in turn adds cognitive load for the 
user.  The way expr works as a raw commands w.r.t. options, however, makes them 
for the most part look of a piece with the parsed commands, with some added 
text at the end.  That's a pretty clear model.  The settings commands, which 
are also raw, is more inchoate, and has some surprising and some "you can't get 
there from here" corners as a result.

> 
>> 
>> The most straightforward way to fix this is to make backtick parsing happen
>> as a part of argument parsing - so you would know you were in a raw command
>> and not intervene in the input.
>> 
>> I actually think the full bash quoting rules are overly complex for lldb.
>> Greg was having fun emulating the bash syntax but that seems an
>> unnecessarily complex model for lldb’s command line.  But that may be water
>> under the bridge at this point.
> 
> I'll have to take some of the blame for that. One of my first changes
> on this project was fixing quote processing. :) I think it was a
> strict improvement, as back then we get very inconsistent quoting and
> unquoting rules, which produced very strange results in more
> complicated cases (e.g. prefixing a command with "lldb --" is able to
> run it in a debugger in almost all cases, before it broke down as soon
> as arguments contained quotes). I chose to model it after posix
> shells, as the rules very already quite similar to that, and I thought
> (and still do) that sticking known rules is better than trying to
> invent new ones.

Yes.  I was advocating for a less DWIM set of rules, quotes delimit arguments, 
conjoining quoted words is not allowed and you are required to backslash any 
internal quotes.  That is a simple model - kinda of what most programming 
languages do.  It is sometimes annoying - but in the cases where that matters, 
mostly expr, the annoying bits aren't parts that the command interpreter has to 
parse, and raw commands are appropriate there.

The bash rules where "aaa""sss" -> "aaasss" are really useful when you're 
composing command elements with:

`somecommand``someothercommand` 

where you have no idea whether the result of the `somecommand` will be quoted 
or not.  But we don't allow that so we didn't need that level of complexity.

Some of the inconsistency you saw is probably because Caroline and I started 
out thinking of it in this more straightforward way, but then we added a bunch 
of cool but not necessary complexity.

> 
> I hope I'll find more time to go back to that soon and finish the
> remaining bugs we have mentioned here.
> 

Cool, thanks!

Jim


> pl

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


[Lldb-commits] [PATCH] D27017: Support more report types in AddressSanitizerRuntime.cpp

2016-11-29 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubabrecka added reviewers: filcab, zaks.anna, dcoughlin.
kubabrecka removed rL LLVM as the repository for this revision.
kubabrecka updated this revision to Diff 79611.
kubabrecka added a comment.

Updating the patch.


https://reviews.llvm.org/D27017

Files:
  
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp


Index: 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
===
--- 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ 
source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -26,6 +26,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "llvm/ADT/StringSwitch.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -194,32 +196,45 @@
 ->GetValueForKey("description")
 ->GetAsString()
 ->GetValue();
-  if (description == "heap-use-after-free") {
-return "Use of deallocated memory detected";
-  } else if (description == "heap-buffer-overflow") {
-return "Heap buffer overflow detected";
-  } else if (description == "stack-buffer-underflow") {
-return "Stack buffer underflow detected";
-  } else if (description == "initialization-order-fiasco") {
-return "Initialization order problem detected";
-  } else if (description == "stack-buffer-overflow") {
-return "Stack buffer overflow detected";
-  } else if (description == "stack-use-after-return") {
-return "Use of returned stack memory detected";
-  } else if (description == "use-after-poison") {
-return "Use of poisoned memory detected";
-  } else if (description == "container-overflow") {
-return "Container overflow detected";
-  } else if (description == "stack-use-after-scope") {
-return "Use of out-of-scope stack memory detected";
-  } else if (description == "global-buffer-overflow") {
-return "Global buffer overflow detected";
-  } else if (description == "unknown-crash") {
-return "Invalid memory access detected";
-  }
-
-  // for unknown report codes just show the code
-  return description;
+  return llvm::StringSwitch(description)
+  .Case("heap-use-after-free", "Use of deallocated memory")
+  .Case("heap-buffer-overflow", "Heap buffer overflow")
+  .Case("stack-buffer-underflow", "Stack buffer underflow")
+  .Case("initialization-order-fiasco", "Initialization order problem")
+  .Case("stack-buffer-overflow", "Stack buffer overflow")
+  .Case("stack-use-after-return", "Use of returned stack memory")
+  .Case("use-after-poison", "Use of poisoned memory")
+  .Case("container-overflow", "Container overflow")
+  .Case("stack-use-after-scope", "Use of out-of-scope stack memory")
+  .Case("global-buffer-overflow", "Global buffer overflow")
+  .Case("unknown-crash", "Invalid memory access")
+  .Case("stack-overflow", "Stack space exhausted")
+  .Case("null-deref", "Dereference of null pointer")
+  .Case("wild-jump", "Jump to non-executable address")
+  .Case("wild-addr-write", "Write through wild pointer")
+  .Case("wild-addr-read", "Read from wild pointer")
+  .Case("wild-addr", "Access through wild pointer")
+  .Case("signal", "Deadly signal")
+  .Case("double-free", "Deallocation of freed memory")
+  .Case("new-delete-type-mismatch",
+"Deallocation size different from allocation size")
+  .Case("bad-free", "Deallocation of non-allocated memory")
+  .Case("alloc-dealloc-mismatch",
+"Mismatch between allocation and deallocation APIs")
+  .Case("bad-malloc_usable_size", "Invalid argument to malloc_usable_size")
+  .Case("bad-__sanitizer_get_allocated_size",
+"Invalid argument to __sanitizer_get_allocated_size")
+  .Case("param-overlap",
+"Call to function disallowing overlapping memory ranges")
+  .Case("negative-size-param", "Negative size used when accessing memory")
+  .Case("bad-__sanitizer_annotate_contiguous_container",
+"Invalid argument to __sanitizer_annotate_contiguous_container")
+  .Case("odr-violation", "Symbol defined in multiple translation units")
+  .Case(
+  "invalid-pointer-pair",
+  "Comparison or arithmetic on pointers from different memory regions")
+  // for unknown report codes just show the code
+  .Default("AddressSanitizer detected: " + description);
 }
 
 bool AddressSanitizerRuntime::NotifyBreakpointHit(


Index: source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
===
--- source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -26,6 +26,8 @@
 #inclu

[Lldb-commits] [PATCH] D27017: Support more report types in AddressSanitizerRuntime.cpp

2016-11-29 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubabrecka added a comment.

In https://reviews.llvm.org/D27017#604265, @clayborg wrote:

> Looks fine. One question though: do we always have a shared library that 
> contains the ASAN runtime? If so, then we can actually put the array of short 
> to long description into the ASAN dylib and then we read this array as a 
> global variable. This would allow you to add as many descriptions as you want 
> directly in your ASAN code and have LLDB detect all of the new strings. Or, 
> if there is a function you can call with the short description that returns 
> the long description, then we can still have the ASAN code contain all of the 
> strings.


We do have the dylib with the runtime any time this code is run.  However, I 
don't think these should live in the ASan runtime, because they should be 
considered as more high-level user-visible strings.  The ASan runtime itself 
produces detailed technical reports that don't use the wording used here.  For 
example, the console report will just say "Invalid pointer pair" assuming the 
user knows what that means.  When using LLDB (and/or Xcode) we should provide 
less technical descriptions.

Anyway, I think this asks for a longer discussion.  Are you okay with leaving 
these strings here for now?


https://reviews.llvm.org/D27017



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


[Lldb-commits] [PATCH] D27222: Remove an x86-ism from RegisterInfoInterface

2016-11-29 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, dvlahovski.
labath added a subscriber: lldb-commits.

While adding FPR support to x86 elf core files 
(https://reviews.llvm.org/D26300), we ended up adding a
very x86-specific function to the general RegisterInfoInterface class, which I
didn't catch in review. This removes that function. The only reason we needed
it was to find the offset of the FXSAVE area. This is the same as the offset of
the first register within that area, so we might as well use that.


https://reviews.llvm.org/D27222

Files:
  source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
  source/Plugins/Process/Utility/RegisterContextLinux_i386.h
  source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
  source/Plugins/Process/Utility/RegisterInfoInterface.h


Index: source/Plugins/Process/Utility/RegisterInfoInterface.h
===
--- source/Plugins/Process/Utility/RegisterInfoInterface.h
+++ source/Plugins/Process/Utility/RegisterInfoInterface.h
@@ -29,8 +29,6 @@
 
   virtual size_t GetGPRSize() const = 0;
 
-  virtual size_t GetFXSAVEOffset() const { return 0; }
-
   virtual const lldb_private::RegisterInfo *GetRegisterInfo() const = 0;
 
   // Returns the number of registers including the user registers and the
Index: source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
===
--- source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
+++ source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
@@ -415,7 +415,7 @@
 }
 
 size_t RegisterContextPOSIX_x86::GetFXSAVEOffset() {
-  return m_register_info_ap->GetFXSAVEOffset();
+  return GetRegisterInfo()[m_reg_info.first_fpr].byte_offset;
 }
 
 const RegisterInfo *RegisterContextPOSIX_x86::GetRegisterInfo() {
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
===
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
@@ -18,8 +18,6 @@
 
   size_t GetGPRSize() const override;
 
-  size_t GetFXSAVEOffset() const override;
-
   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
 
   uint32_t GetRegisterCount() const override;
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
@@ -179,11 +179,6 @@
 
 size_t RegisterContextLinux_x86_64::GetGPRSize() const { return sizeof(GPR); }
 
-size_t RegisterContextLinux_x86_64::GetFXSAVEOffset() const {
-  return (LLVM_EXTENSION offsetof(UserArea, fpr) +
-  LLVM_EXTENSION offsetof(FPR, xstate));
-}
-
 const std::vector *
 RegisterContextLinux_x86_64::GetDynamicRegisterInfoP() const {
   return &d_register_infos;
Index: source/Plugins/Process/Utility/RegisterContextLinux_i386.h
===
--- source/Plugins/Process/Utility/RegisterContextLinux_i386.h
+++ source/Plugins/Process/Utility/RegisterContextLinux_i386.h
@@ -18,8 +18,6 @@
 
   size_t GetGPRSize() const override;
 
-  size_t GetFXSAVEOffset() const override;
-
   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
 
   uint32_t GetRegisterCount() const override;
Index: source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
+++ source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
@@ -111,10 +111,6 @@
 
 size_t RegisterContextLinux_i386::GetGPRSize() const { return sizeof(GPR); }
 
-size_t RegisterContextLinux_i386::GetFXSAVEOffset() const {
-  return (LLVM_EXTENSION offsetof(UserArea, i387));
-}
-
 const RegisterInfo *RegisterContextLinux_i386::GetRegisterInfo() const {
   switch (m_target_arch.GetMachine()) {
   case llvm::Triple::x86:


Index: source/Plugins/Process/Utility/RegisterInfoInterface.h
===
--- source/Plugins/Process/Utility/RegisterInfoInterface.h
+++ source/Plugins/Process/Utility/RegisterInfoInterface.h
@@ -29,8 +29,6 @@
 
   virtual size_t GetGPRSize() const = 0;
 
-  virtual size_t GetFXSAVEOffset() const { return 0; }
-
   virtual const lldb_private::RegisterInfo *GetRegisterInfo() const = 0;
 
   // Returns the number of registers including the user registers and the
Index: source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
===
--- source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
+++ source/Plugins

[Lldb-commits] [PATCH] D27223: Expression evaluation for overloaded C functions (redux)

2016-11-29 Thread Luke Drummond via Phabricator via lldb-commits
ldrumm created this revision.
ldrumm added reviewers: spyffe, clayborg.
ldrumm added a subscriber: LLDB.
Herald added a subscriber: aemerson.

This is a redux of Ewan's patch  , refactored 
to properly substitute primitive  types using a hook in the itanium demangler, 
and updated after the previous patch went stale

The new `SubsPrimitiveParmItanium` function takes a symbol name and replacement 
primitive type parameter as before but parses it using the FastDemangler, which 
has been modified to be able to notify clients of parse events (primitive types 
at this point).

Additionally, we now use a `set` of `ConstStrings` instead of a `vector` so 
that we try and resolve the same invalid candidate multiple times.

I'd particularly welcome feedback on whether there is a better way of doing the 
hook from the demangler. In the present implementation, the time tradeoff is a 
single `nullptr` check in the hot path, which was the least invasive change of 
a few I prototyped.


https://reviews.llvm.org/D27223

Files:
  include/lldb/Core/FastDemangle.h
  
packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/Makefile
  
packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/TestCallOverloadedCFunction.py
  
packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/main.c
  source/Core/FastDemangle.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h

Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -12,6 +12,7 @@
 
 // C Includes
 // C++ Includes
+#include 
 #include 
 
 // Other libraries and framework includes
@@ -93,7 +94,6 @@
   }
 
   std::unique_ptr GetTypeScavenger() override;
-  
   lldb::TypeCategoryImplSP GetFormatters() override;
 
   HardcodedFormatters::HardcodedSummaryFinder GetHardcodedSummaries() override;
@@ -142,6 +142,12 @@
   static uint32_t FindEquivalentNames(ConstString type_name,
   std::vector &equivalents);
 
+  // Given a mangled function name, calculates some alternative manglings since
+  // the compiler mangling may not line up with the symbol we are expecting
+  static uint32_t
+  FindAlternateFunctionManglings(const ConstString mangled,
+ std::set &candidates);
+
   //--
   // PluginInterface protocol
   //--
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -10,17 +10,22 @@
 #include "CPlusPlusLanguage.h"
 
 // C Includes
-// C++ Includes
 #include 
 #include 
+
+// C++ Includes
 #include 
+#include 
 #include 
+#include 
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
 
 // Project includes
 #include "lldb/Core/ConstString.h"
+#include "lldb/Core/FastDemangle.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/UniqueCStringMap.h"
@@ -440,6 +445,112 @@
   return count;
 }
 
+/// Given a mangled function `mangled`, replace all the primitive function type
+/// arguments of `mangled` with type `replace`.
+static ConstString SubsPrimitiveParmItanium(const char *mangled,
+const char *search,
+const char *replace) {
+  Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
+  assert(mangled && search && replace);
+
+  const size_t search_len = ::strlen(search);
+  const size_t replace_len = ::strlen(replace);
+  const size_t mangled_len = ::strlen(mangled);
+  const size_t max_len =
+  mangled_len + llvm::StringRef(mangled).count(search) * replace_len + 1;
+
+  // Make a temporary buffer to fix up the mangled parameter types
+  // and copy the original there
+  std::unique_ptr output_buf(new char[max_len]);
+  ::memset(output_buf.get(), '\0', max_len);
+  ::strncpy(output_buf.get(), mangled, max_len - 1);
+
+  size_t avail_sz = max_len - 1;
+  ptrdiff_t replaced_offset = 0;
+
+  auto swap_parms_hook = [&](const char *s) {
+if (!s || !*s)
+  return;
+
+// Check whether we've found a substitutee
+if (::strncmp(s, search, search_len) == 0) {
+  // account for the case where a replacement is of a different length
+  // to the original
+  replaced_offset += replace_len - search_len;
+
+  ptrdiff_t replace_idx 

[Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions

2016-11-29 Thread Luke Drummond via Phabricator via lldb-commits
ldrumm added a comment.

New candidate is here 


Repository:
  rL LLVM

https://reviews.llvm.org/D17957



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


[Lldb-commits] [PATCH] D27223: Expression evaluation for overloaded C functions (redux)

2016-11-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:449
+/// Given a mangled function `mangled`, replace all the primitive function type
+/// arguments of `mangled` with type `replace`.
+static ConstString SubsPrimitiveParmItanium(const char *mangled,

Don't you mean `search` instead of `mangled` above?



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:450-452
+static ConstString SubsPrimitiveParmItanium(const char *mangled,
+const char *search,
+const char *replace) {

Use llvm::StringRef instead of "const char *" and then use the llvm::StringRef 
functions instead of libc functions for string searching.



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:456-458
+  const size_t search_len = ::strlen(search);
+  const size_t replace_len = ::strlen(replace);
+  const size_t mangled_len = ::strlen(mangled);

Remove since using llvm::StringRef will have lengths already.



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:460
+  const size_t max_len =
+  mangled_len + llvm::StringRef(mangled).count(search) * replace_len + 1;
+

remove llvm::StringRef temp as no longer needed since "mangled" will be a 
llvm::StringRef already.



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:464
+  // and copy the original there
+  std::unique_ptr output_buf(new char[max_len]);
+  ::memset(output_buf.get(), '\0', max_len);

Why not use a std::string?



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:465-466
+  std::unique_ptr output_buf(new char[max_len]);
+  ::memset(output_buf.get(), '\0', max_len);
+  ::strncpy(output_buf.get(), mangled, max_len - 1);
+

Remove both lines above if you use a std::string. Also, why zero it first and 
then copy the string over it?



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:471
+
+  auto swap_parms_hook = [&](const char *s) {
+if (!s || !*s)

Does this only get called with parameters? Or does it get called for everything?



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:476
+// Check whether we've found a substitutee
+if (::strncmp(s, search, search_len) == 0) {
+  // account for the case where a replacement is of a different length

Use starts_with StringRef function.

You also need to verify that there is a word boundary at the end of this. If 
you are searching for "F", and replacing it with "E" and you get "Foo, Bar) 
const" in `s` then this will match you will change it to "Eoo, Bar) const" 
right? So you need to check `s[search.size]` and make sure it is a non 
identifier character. Unless this function only gets called with identifier 
boundaries. From my quick look at the FastDemangle changes, it seems that this 
will get called with the entire remaining part of the string.



Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:481-486
+  ptrdiff_t replace_idx = (s - mangled) + replaced_offset;
+  for (size_t i = 0; avail_sz && replace[i]; ++i, ++s) {
+output_buf[replace_idx++] = replace[i];
+avail_sz--;
+  }
+

If you use a std::string just call .erase() and .insert()


https://reviews.llvm.org/D27223



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


[Lldb-commits] [PATCH] D27222: Remove an x86-ism from RegisterInfoInterface

2016-11-29 Thread Dimitar Vlahovski via Phabricator via lldb-commits
dvlahovski accepted this revision.
dvlahovski added a comment.

LGTM


https://reviews.llvm.org/D27222



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


[Lldb-commits] [PATCH] D27223: Expression evaluation for overloaded C functions (redux)

2016-11-29 Thread Alexander Shaposhnikov via Phabricator via lldb-commits
alexshap added inline comments.



Comment at: include/lldb/Core/FastDemangle.h:22
+char *
+FastDemangle(const char *mangled_name, size_t mangled_name_length,
+ std::function primitive_type_hook = nullptr);

some thoughts: 
(also i assume i might be mistaken / missing smth) 
in ./source/Core/Mangled.cpp at least 3 demanglers are used:
FastDemangle, itaniumDemangle, abi::__cxa_demangle .
Adding primitive_type_hook to FastDemangle makes  the interface 
more complicated & inconsistent (although yes, it's not particularly consistent 
right now). 



Comment at: 
packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/main.c:17
+return 0; // break here
+}

does this patch work when the functions come from a shared library ? 
(i mean if we have libFoo.so which contains the implementations of 
get_arg_type(float), get_arg_type(int), and then in lldb we want to call "p 
get_arg_type(0.12f)")


https://reviews.llvm.org/D27223



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