Re: [Lldb-commits] [PATCH] debugserver: Disable four-char-constants and format-pedantic warnings

2016-10-18 Thread Pavel Labath via lldb-commits
Hi,

Thanks for the patch. Could you submit the patch through phabricator
 and add Greg Clayton as a reviewer. That
said, my preference would be to actually fix those warnings instead of
silencing them.

pl

On 17 October 2016 at 08:24, Justin Bogner via lldb-commits
 wrote:
> Today I checked out lldb to check that r284364 wouldn't cause any
> trouble, but there were a few warnings that fired when I tried to build
> it, breaking my -Werror build.
>
> This disables four character literal warnings (so that 'FDSC' in
> debugserver.cpp is allowed) and pedantic formatting warnings, so that
> printf-like functions can pass typed pointers to "%p" in format strings.
>
> Okay to commit?
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25714: [Test Suite] Allow overriding codesign identity

2016-10-18 Thread Pavel Labath via lldb-commits
labath added inline comments.



Comment at: packages/Python/lldbsuite/test/dotest.py:484
 
+os.environ['LLDB_CODESIGN_IDENTITY'] = args.codesign_identity
+

The function is not really consistent in this aspect, but if you don't really 
need this to be in the environment, maybe exporting it as a variable in 
`lldbtest_config` would be cleaner (see args.channels above for an example)?


https://reviews.llvm.org/D25714



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


[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Pavel Labath via lldb-commits
labath added subscribers: krytarowski, emaste, sylvestre.ledru.
labath added a comment.

@sylvestre.ledru : I believe this will fix the LINK_LLVM_DYLIB issue you were 
encountering. Let me know if you're still having problems after this.
@emaste @krytarowski : This has potential to break linking on *BSD. I'll keep 
an eye on the bots and respond accordingly.


https://reviews.llvm.org/D25680



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


[Lldb-commits] [lldb] r284466 - [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Oct 18 05:26:57 2016
New Revision: 284466

URL: http://llvm.org/viewvc/llvm-project?rev=284466&view=rev
Log:
[cmake] Make dependencies of lldb libraries private, take 2

Summary:
The dependencies of our libraries (only liblldb, really) we marked as public, 
which caused all
their dependencies to be repeated when linking any executables to them. This is 
a problem because
then all the .a files could end up being linked twice, once to liblldb and once
again to to the executable linking against liblldb (lldb, lldb-mi). As it turns 
out,
our build actually depends on this behavior:
- on windows, lldb does not have getopt, so it pulls it from inside liblldb, 
even
  though getopt is not a part of the exported interface of liblldb (maybe some 
of
  the bsd variants have this problem as well)
- lldb-mi uses llvm, which again is not exported by liblldb

This change does not actually fix these problems (that is going to be a hard
one), but it does make them explicit by moving this magic from add_lldb_library
to the places the executable targets are defined. That way, I can link the
additional .a files only on targets that really need it, and the other targets
can build cleanly and make sure we don't regress further. It also fixes the
LLVM_LINK_LLVM_DYLIB build on linux.

Reviewers: zturner, beanz

Subscribers: ki.stfu, lldb-commits, mgorny

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

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/tools/argdumper/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=284466&r1=284465&r2=284466&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Oct 18 05:26:57 2016
@@ -4,7 +4,7 @@ function(lldb_link_common_libs name targ
   endif()
 
   if(${targetkind} MATCHES "SHARED")
-set(LINK_KEYWORD PUBLIC)
+set(LINK_KEYWORD PRIVATE)
   endif()
 
   if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
@@ -56,19 +56,20 @@ macro(add_lldb_library name)
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-llvm_add_library(${name} ${libkind} DISABLE_LLVM_LINK_LLVM_DYLIB ${srcs})
-
-lldb_link_common_libs(${name} "${libkind}")
-
 if (PARAM_SHARED)
   if (LLDB_LINKER_SUPPORTS_GROUPS)
-target_link_libraries(${name} PUBLIC
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+-Wl,--start-group ${LLDB_USED_LIBS} 
-Wl,--end-group
+-Wl,--start-group ${CLANG_USED_LIBS} 
-Wl,--end-group
+  )
   else()
-target_link_libraries(${name} PUBLIC ${CLANG_USED_LIBS})
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+${LLDB_USED_LIBS} ${CLANG_USED_LIBS}
+  )
   endif()
+else()
+  llvm_add_library(${name} ${libking} ${srcs})
 endif()
-llvm_config(${name} ${LLVM_LINK_COMPONENTS} 
${LLVM_PRIVATE_LINK_COMPONENTS})
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
   if (PARAM_SHARED)
@@ -101,7 +102,7 @@ endmacro(add_lldb_library)
 
 macro(add_lldb_executable name)
   cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK" "" "" ${ARGN})
-  add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB 
${ARG_UNPARSED_ARGUMENTS})
+  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES
 FOLDER "lldb executables")
 

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt?rev=284466&r1=284465&r2=284466&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt Tue Oct 18 05:26:57 
2016
@@ -1,4 +1,4 @@
-set(LLVM_PRIVATE_LINK_COMPONENTS
+set(LLVM_LINK_COMPONENTS
 DebugInfoPDB)
 
 add_lldb_library(lldbPluginSymbolFilePDB

Modified: lldb/trunk/tools/argdumper/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/argdumper/CMakeLists.txt?rev=284466&r1=284465&r2=284466&view=diff
==
--- lldb/trunk/tools/argdumper/CMakeLists.txt (original)
+++ lldb/trunk/tools/argdumper/CMakeLists.txt Tue Oct 18 05:26:57 2016
@@ -1,8 +1,16 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb-argdumper INCLUDE_IN_FRAMEWORK
   argdumper.cpp
   )
 
-targ

[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284466: [cmake] Make dependencies of lldb libraries private, 
take 2 (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D25680?vs=74854&id=74967#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25680

Files:
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
  lldb/trunk/tools/argdumper/CMakeLists.txt
  lldb/trunk/tools/driver/CMakeLists.txt
  lldb/trunk/tools/lldb-mi/CMakeLists.txt

Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -4,7 +4,7 @@
   endif()
 
   if(${targetkind} MATCHES "SHARED")
-set(LINK_KEYWORD PUBLIC)
+set(LINK_KEYWORD PRIVATE)
   endif()
 
   if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
@@ -56,19 +56,20 @@
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-llvm_add_library(${name} ${libkind} DISABLE_LLVM_LINK_LLVM_DYLIB ${srcs})
-
-lldb_link_common_libs(${name} "${libkind}")
-
 if (PARAM_SHARED)
   if (LLDB_LINKER_SUPPORTS_GROUPS)
-target_link_libraries(${name} PUBLIC
--Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group
+-Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group
+  )
   else()
-target_link_libraries(${name} PUBLIC ${CLANG_USED_LIBS})
+llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
+${LLDB_USED_LIBS} ${CLANG_USED_LIBS}
+  )
   endif()
+else()
+  llvm_add_library(${name} ${libking} ${srcs})
 endif()
-llvm_config(${name} ${LLVM_LINK_COMPONENTS} ${LLVM_PRIVATE_LINK_COMPONENTS})
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
   if (PARAM_SHARED)
@@ -101,7 +102,7 @@
 
 macro(add_lldb_executable name)
   cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK" "" "" ${ARGN})
-  add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARG_UNPARSED_ARGUMENTS})
+  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES
 FOLDER "lldb executables")
 
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_PRIVATE_LINK_COMPONENTS
+set(LLVM_LINK_COMPONENTS
 DebugInfoPDB)
 
 add_lldb_library(lldbPluginSymbolFilePDB
Index: lldb/trunk/tools/driver/CMakeLists.txt
===
--- lldb/trunk/tools/driver/CMakeLists.txt
+++ lldb/trunk/tools/driver/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb
   Driver.cpp
   Platform.cpp
@@ -18,9 +20,14 @@
 endif()
 
 target_link_libraries(lldb liblldb)
-# TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb ${LLDB_USED_LIBS})
-#llvm_config(lldb ${LLVM_LINK_COMPONENTS})
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  # Windows does not have getopt support, so it relies on the one provided by
+  # liblldb. However, getopt is not a part of the liblldb interfact, so we have
+  # to link against the constituent libraries manually. Note that this is
+  # extremely scary as it introduces ODR violations, and it should go away as
+  # soon as possible.
+  target_link_libraries(lldb ${LLDB_USED_LIBS})
+endif()
 
 set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION})
 
Index: lldb/trunk/tools/argdumper/CMakeLists.txt
===
--- lldb/trunk/tools/argdumper/CMakeLists.txt
+++ lldb/trunk/tools/argdumper/CMakeLists.txt
@@ -1,8 +1,16 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_executable(lldb-argdumper INCLUDE_IN_FRAMEWORK
   argdumper.cpp
   )
 
-target_link_libraries(lldb-argdumper liblldb)
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+else()
+  target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS})
+endif()
+llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS})
+
 
 install(TARGETS lldb-argdumper
   RUNTIME DESTINATION bin)
Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
__

[Lldb-commits] [lldb] r284469 - Fixup r284466 - try to unbreak NetBSD

2016-10-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Oct 18 05:46:45 2016
New Revision: 284469

URL: http://llvm.org/viewvc/llvm-project?rev=284469&view=rev
Log:
Fixup r284466 - try to unbreak NetBSD

NetBSD does not have getopt as well - we need to apply the workaround there too.
FreeBSD seems to be fine though.

Modified:
lldb/trunk/tools/driver/CMakeLists.txt

Modified: lldb/trunk/tools/driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/CMakeLists.txt?rev=284469&r1=284468&r2=284469&view=diff
==
--- lldb/trunk/tools/driver/CMakeLists.txt (original)
+++ lldb/trunk/tools/driver/CMakeLists.txt Tue Oct 18 05:46:45 2016
@@ -20,9 +20,10 @@ if ( LLDB_CAN_USE_DEBUGSERVER )
 endif()
 
 target_link_libraries(lldb liblldb)
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-  # Windows does not have getopt support, so it relies on the one provided by
-  # liblldb. However, getopt is not a part of the liblldb interfact, so we have
+if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR
+(CMAKE_SYSTEM_NAME MATCHES "NetBSD" ))
+  # These targets do not have getopt support, so they rely on the one provided 
by
+  # liblldb. However, getopt is not a part of the liblldb interface, so we have
   # to link against the constituent libraries manually. Note that this is
   # extremely scary as it introduces ODR violations, and it should go away as
   # soon as possible.


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


[Lldb-commits] [PATCH] D25668: [cmake] Respect LLVM_CMAKE_PATH in stand-alone builds for GetSVN.cmake

2016-10-18 Thread Michał Górny via lldb-commits
mgorny planned changes to this revision.
mgorny added a comment.

`LLVM_CMAKE_PATH` posted as https://reviews.llvm.org/D25724.


https://reviews.llvm.org/D25668



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


[Lldb-commits] [PATCH] D25677: Minidump plugin: redesign the x86_64 register context

2016-10-18 Thread Dimitar Vlahovski via lldb-commits
dvlahovski updated this revision to Diff 74987.
dvlahovski added a comment.

Merge if's checking the same context flag


https://reviews.llvm.org/D25677

Files:
  source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
  source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h

Index: source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
===
--- source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
+++ source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
@@ -21,81 +21,145 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/Support/Endian.h"
 
 // C includes
 // C++ includes
 
 namespace lldb_private {
 
 namespace minidump {
 
-// The content of the Minidump register context is as follows:
-// (for reference see breakpad's source or WinNT.h)
-// Register parameter home addresses: (p1_home .. p6_home)
-// - uint64_t p1_home
-// - uint64_t p2_home
-// - uint64_t p3_home
-// - uint64_t p4_home
-// - uint64_t p5_home
-// - uint64_t p6_home
-//
-// - uint32_t context_flags - field that determines the layout of the structure
-// and which parts of it are populated
-// - uint32_t mx_csr
-//
-// - uint16_t cs - included if MinidumpContext_x86_64_Flags::Control
-//
-// - uint16_t ds - included if MinidumpContext_x86_64_Flags::Segments
-// - uint16_t es - included if MinidumpContext_x86_64_Flags::Segments
-// - uint16_t fs - included if MinidumpContext_x86_64_Flags::Segments
-// - uint16_t gs - included if MinidumpContext_x86_64_Flags::Segments
-//
-// - uint16_t ss - included if MinidumpContext_x86_64_Flags::Control
-// - uint32_t rflags - included if MinidumpContext_x86_64_Flags::Control
-//
-// Debug registers: (included if MinidumpContext_x86_64_Flags::DebugRegisters)
-// - uint64_t dr0
-// - uint64_t dr1
-// - uint64_t dr2
-// - uint64_t dr3
-// - uint64_t dr6
-// - uint64_t dr7
-//
-// The next 4 registers are included if MinidumpContext_x86_64_Flags::Integer
-// - uint64_t rax
-// - uint64_t rcx
-// - uint64_t rdx
-// - uint64_t rbx
-//
-// - uint64_t rsp - included if MinidumpContext_x86_64_Flags::Control
-//
-// The next 11 registers are included if MinidumpContext_x86_64_Flags::Integer
-// - uint64_t rbp
-// - uint64_t rsi
-// - uint64_t rdi
-// - uint64_t r8
-// - uint64_t r9
-// - uint64_t r10
-// - uint64_t r11
-// - uint64_t r12
-// - uint64_t r13
-// - uint64_t r14
-// - uint64_t r15
-//
-// - uint64_t rip - included if MinidumpContext_x86_64_Flags::Control
-//
-// TODO: add floating point registers here
-
 // This function receives an ArrayRef pointing to the bytes of the Minidump
 // register context and returns a DataBuffer that's ordered by the offsets
 // specified in the RegisterInfoInterface argument
 // This way we can reuse the already existing register contexts
 lldb::DataBufferSP
 ConvertMinidumpContextToRegIface(llvm::ArrayRef source_data,
  RegisterInfoInterface *target_reg_interface);
 
+struct uint128_struct {
+  llvm::support::ulittle64_t high;
+  llvm::support::ulittle64_t low;
+};
+
+// Reference: see breakpad/crashpad source or WinNT.h
+struct MinidumpXMMSaveArea32AMD64 {
+  llvm::support::ulittle16_t control_word;
+  llvm::support::ulittle16_t status_word;
+  uint8_t tag_word;
+  uint8_t reserved1;
+  llvm::support::ulittle16_t error_opcode;
+  llvm::support::ulittle32_t error_offset;
+  llvm::support::ulittle16_t error_selector;
+  llvm::support::ulittle16_t reserved2;
+  llvm::support::ulittle32_t data_offset;
+  llvm::support::ulittle16_t data_selector;
+  llvm::support::ulittle16_t reserved3;
+  llvm::support::ulittle32_t mx_csr;
+  llvm::support::ulittle32_t mx_csr_mask;
+  uint128_struct float_registers[8];
+  uint128_struct xmm_registers[16];
+  uint8_t reserved4[96];
+};
+
+struct MinidumpContext_x86_64 {
+  // Register parameter home addresses.
+  llvm::support::ulittle64_t p1_home;
+  llvm::support::ulittle64_t p2_home;
+  llvm::support::ulittle64_t p3_home;
+  llvm::support::ulittle64_t p4_home;
+  llvm::support::ulittle64_t p5_home;
+  llvm::support::ulittle64_t p6_home;
+
+  // The context_flags field determines and which parts
+  // of the structure are populated (have valid values)
+  llvm::support::ulittle32_t context_flags;
+  llvm::support::ulittle32_t mx_csr;
+
+  // The next register is included with
+  // MinidumpContext_x86_64_Flags::Control
+  llvm::support::ulittle16_t cs;
+
+  // The next 4 registers are included with
+  // MinidumpContext_x86_64_Flags::Segments
+  llvm::support::ulittle16_t ds;
+  llvm::support::ulittle16_t es;
+  llvm::support::ulittle16_t fs;
+  llvm::support::ulittle16_t gs;
+
+  // The next 2 registers are included with
+  // MinidumpContext_x86_64_Flags::Control
+  llvm::support::ulittle16_t ss;
+  llvm::support::ulittle32_t eflags;
+
+  // The next 6 registers are included with
+  // MinidumpContext_x86_64_Flags::DebugRegisters
+  llvm::support

[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-18 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, granata.enrico.
tberghammer added a subscriber: lldb-commits.

Improve the libstdc++ smart pointer formatters

  

- Display the strong/weak count in the summary
- Display the pointed object as a synthetic member
- Create synthetic children for weak/strong count


https://reviews.llvm.org/D25726

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
  source/Plugins/Language/CPlusPlus/LibStdcpp.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
===
--- source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -76,6 +76,20 @@
   bool MightHaveChildren() override;
 
   size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+  bool GetSummary(Stream &stream, const TypeSummaryOptions &options);
+
+ private:
+  ValueObjectSP m_ptr_obj;
+  ValueObjectSP m_obj_obj;
+  ValueObjectSP m_use_obj;
+  ValueObjectSP m_weak_obj;
+
+  uint8_t m_ptr_size = 0;
+  lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid;
+
+  bool IsEmpty();
+  bool IsValid();
 };
 
 } // end of anonymous namespace
@@ -355,35 +369,126 @@
 LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
 lldb::ValueObjectSP valobj_sp)
 : SyntheticChildrenFrontEnd(*valobj_sp) {
-  if (valobj_sp)
-Update();
+  Update();
 }
 
-size_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() { return 1; }
+bool LibStdcppSharedPtrSyntheticFrontEnd::Update() {
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp) return false;
 
-lldb::ValueObjectSP
-LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
-  ValueObjectSP valobj_sp = m_backend.GetSP();
-  if (!valobj_sp)
-return lldb::ValueObjectSP();
+  ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
+  if (!valobj_sp) return false;
 
-  if (idx == 0)
-return valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
-  else
-return lldb::ValueObjectSP();
-}
+  TargetSP target_sp(valobj_sp->GetTargetSP());
+  if (!target_sp) return false;
 
-bool LibStdcppSharedPtrSyntheticFrontEnd::Update() { return false; }
+  m_byte_order = target_sp->GetArchitecture().GetByteOrder();
+  m_ptr_size = target_sp->GetArchitecture().GetAddressByteSize();
+
+  m_ptr_obj = valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
+
+  m_use_obj = valobj_sp->GetChildAtNamePath({ConstString("_M_refcount"),
+ ConstString("_M_pi"),
+ ConstString("_M_use_count")});
+
+  m_weak_obj = valobj_sp->GetChildAtNamePath({ConstString("_M_refcount"),
+  ConstString("_M_pi"),
+  ConstString("_M_weak_count")});
+
+  if (m_use_obj && m_weak_obj && m_use_obj->GetValueAsUnsigned(0) > 0) {
+bool success = false;
+uint64_t count = m_weak_obj->GetValueAsUnsigned(0, &success) - 1;
+if (success) {
+  auto data = std::make_shared(&count, sizeof(count));
+  m_weak_obj = CreateValueObjectFromData(
+  "weak_count", DataExtractor(data, m_byte_order, m_ptr_size),
+  m_weak_obj->GetExecutionContextRef(), m_weak_obj->GetCompilerType());
+}
+  }
+
+  if (m_ptr_obj && !IsEmpty()) {
+Error error;
+m_obj_obj = m_ptr_obj->Dereference(error);
+if (error.Success()) {
+  m_obj_obj->SetName(ConstString("object"));
+}
+  }
+
+  return false;
+}
 
 bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() { return true; }
 
+lldb::ValueObjectSP LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(
+size_t idx) {
+  if (idx == 0) return m_obj_obj;
+  if (idx == 1) return m_ptr_obj;
+  if (idx == 2) return m_use_obj;
+  if (idx == 3) return m_weak_obj;
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
+  if (IsEmpty()) return 0;
+  return 1;
+}
+
 size_t LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(
 const ConstString &name) {
-  if (name == ConstString("_M_ptr"))
-return 0;
+  if (name == ConstString("obj") || name == ConstString("object")) return 0;
+  if (name == ConstString("ptr") || name == ConstString("pointer") ||
+  name == ConstString("_M_ptr"))
+return 1;
+  if (name == ConstString("cnt") || name == ConstString("count") ||
+  name == ConstString("use_count") || name == ConstString("strong") ||
+  name == ConstString("_M_use_count"))
+return 2;
+  if (name == ConstString("weak") || name == ConstString("weak_count") ||
+  name == ConstString("_M_weak_count"))
+return 3;
   return UINT32_MAX;
 }
 
+bool LibStdcppSharedPtrSyntheticFrontEnd::GetSummary(
+Stream &stream, const TypeSummaryOptions &options) {
+  if 

[Lldb-commits] [lldb] r284484 - xfail TestMiSyntax.py's test_lldbmi_output_grammar on macOS

2016-10-18 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Tue Oct 18 10:15:24 2016
New Revision: 284484

URL: http://llvm.org/viewvc/llvm-project?rev=284484&view=rev
Log:
xfail TestMiSyntax.py's test_lldbmi_output_grammar on macOS

Needs to be investigated.  This is failing locally and on the
Xcode CI.

rdar://28805064

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=284484&r1=284483&r2=284484&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
Tue Oct 18 10:15:24 2016
@@ -88,6 +88,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M
 
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@expectedFailureAll(oslist=["macosx"], bugnumber="rdar://28805064")
 def test_lldbmi_output_grammar(self):
 """Test that 'lldb-mi --interpreter' uses standard output syntax."""
 


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


[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-18 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 75025.
tberghammer added a comment.
Herald added subscribers: mgorny, beanz.

Move the code to a new cpp file


https://reviews.llvm.org/D25726

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
  source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
@@ -0,0 +1,192 @@
+//===-- LibStdcppSmartPointer.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+  explicit LibStdcppSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+  bool GetSummary(Stream &stream, const TypeSummaryOptions &options);
+
+ private:
+  ValueObjectSP m_ptr_obj;
+  ValueObjectSP m_obj_obj;
+  ValueObjectSP m_use_obj;
+  ValueObjectSP m_weak_obj;
+
+  uint8_t m_ptr_size = 0;
+  lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid;
+
+  bool IsEmpty();
+  bool IsValid();
+};
+
+} // end of anonymous namespace
+
+LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppSharedPtrSyntheticFrontEnd::Update() {
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp) return false;
+
+  ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
+  if (!valobj_sp) return false;
+
+  TargetSP target_sp(valobj_sp->GetTargetSP());
+  if (!target_sp) return false;
+
+  m_byte_order = target_sp->GetArchitecture().GetByteOrder();
+  m_ptr_size = target_sp->GetArchitecture().GetAddressByteSize();
+
+  m_ptr_obj = valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
+
+  m_use_obj = valobj_sp->GetChildAtNamePath({ConstString("_M_refcount"),
+ ConstString("_M_pi"),
+ ConstString("_M_use_count")});
+
+  m_weak_obj = valobj_sp->GetChildAtNamePath({ConstString("_M_refcount"),
+  ConstString("_M_pi"),
+  ConstString("_M_weak_count")});
+
+  if (m_use_obj && m_weak_obj && m_use_obj->GetValueAsUnsigned(0) > 0) {
+bool success = false;
+uint64_t count = m_weak_obj->GetValueAsUnsigned(0, &success) - 1;
+if (success) {
+  auto data = std::make_shared(&count, sizeof(count));
+  m_weak_obj = CreateValueObjectFromData(
+  "weak_count", DataExtractor(data, m_byte_order, m_ptr_size),
+  m_weak_obj->GetExecutionContextRef(), m_weak_obj->GetCompilerType());
+}
+  }
+
+  if (m_ptr_obj && !IsEmpty()) {
+Error error;
+m_obj_obj = m_ptr_obj->Dereference(error);
+if (error.Success()) {
+  m_obj_obj->SetName(ConstString("object"));
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(
+size_t idx) {
+  if (idx == 0) return m_obj_obj;
+  if (idx == 1) return m_ptr_obj;
+  if (idx == 2) return m_use_obj;
+  if (idx == 3) return m_weak_obj;
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
+  if (IsEmpty()) return 0;
+  return 1;
+}
+
+size_t LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(
+const ConstString &name) {
+  if (name == ConstString("obj") || name == ConstString("object")) return 0;
+  if (name == ConstString("ptr") || name == ConstString("pointer") ||
+  name == ConstString("_M_ptr"))
+return 1;
+  if (name == ConstString("cnt") || name == ConstString("count") ||
+  name == ConstString("use_count") || name == ConstString(

[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-18 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko added a comment.

Please run Clang-format over new code.




Comment at: source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp:12
+
+#include 
+#include 

STL headers should be after application's headers.



Comment at: source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp:28
+class LibStdcppSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+  explicit LibStdcppSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);

No space before access specifiers. Same below.


https://reviews.llvm.org/D25726



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


[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-18 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, granata.enrico.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: mgorny, beanz.

Add data formatter for libstdc++ tuple


https://reviews.llvm.org/D25733

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
@@ -0,0 +1,110 @@
+//===-- LibStdcppTuple.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppTupleSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+  explicit LibStdcppTupleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+ private:
+  std::vector m_members;
+};
+
+} // end of anonymous namespace
+
+LibStdcppTupleSyntheticFrontEnd::LibStdcppTupleSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::Update() {
+  m_members.clear();
+
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp) return false;
+
+  ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
+  if (!valobj_sp) return false;
+
+  ValueObjectSP next_child_sp = valobj_sp;
+  while (next_child_sp != nullptr) {
+ValueObjectSP current_child = next_child_sp;
+next_child_sp = nullptr;
+
+size_t child_count = current_child->GetNumChildren();
+for (size_t i = 0; i < child_count; ++i) {
+  ValueObjectSP child_sp = current_child->GetChildAtIndex(i, true);
+  llvm::StringRef name_str = child_sp->GetName().GetStringRef();
+  if (name_str.startswith("std::_Tuple_impl<")) {
+next_child_sp = child_sp;
+  } else if (name_str.startswith("std::_Head_base<")) {
+ValueObjectSP value_sp =
+child_sp->GetChildMemberWithName(ConstString("_M_head_impl"), true);
+if (value_sp) {
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", m_members.size());
+  value_sp->SetName(ConstString(name.GetData()));
+
+  m_members.push_back(value_sp);
+}
+  }
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(
+size_t idx) {
+  if (idx < m_members.size()) return m_members[idx];
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::CalculateNumChildren() {
+  return m_members.size();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::GetIndexOfChildWithName(
+const ConstString &name) {
+  return ExtractIndexFromString(name.GetCString());
+}
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator(
+CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  return (valobj_sp ? new LibStdcppTupleSyntheticFrontEnd(valobj_sp) : nullptr);
+}
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -803,16 +803,31 @@
 
   AddCXXSynthetic(
   cpp_category_sp,
+  lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator,
+  "std::unique_ptr synthetic children",
+  ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
   lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator,
   "std::shared_ptr synthetic 

[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-18 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, granata.enrico.
tberghammer added a subscriber: lldb-commits.

Add data formatter for libstdc++ unique_ptr


https://reviews.llvm.org/D25734

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
  source/Plugins/Language/CPlusPlus/LibStdcpp.h
  source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -0,0 +1,148 @@
+//===-- LibStdcpp.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+  explicit LibStdcppUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+  bool GetSummary(Stream &stream, const TypeSummaryOptions &options);
+
+ private:
+  ValueObjectSP m_ptr_obj;
+  ValueObjectSP m_obj_obj;
+  ValueObjectSP m_del_obj;
+};
+
+} // end of anonymous namespace
+
+LibStdcppUniquePtrSyntheticFrontEnd::LibStdcppUniquePtrSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp) return false;
+
+  ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
+  if (!valobj_sp) return false;
+
+  ValueObjectSP tuple_sp =
+  valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+  if (!tuple_sp) return false;
+
+  std::unique_ptr tuple_frontend(
+  LibStdcppTupleSyntheticFrontEndCreator(nullptr, tuple_sp));
+
+  m_ptr_obj = tuple_frontend->GetChildAtIndex(0);
+  if (m_ptr_obj)
+m_ptr_obj->SetName(ConstString("pointer"));
+
+  m_del_obj = tuple_frontend->GetChildAtIndex(1);
+  if (m_del_obj)
+m_del_obj->SetName(ConstString("deleter"));
+
+  if (m_ptr_obj) {
+Error error;
+m_obj_obj = m_ptr_obj->Dereference(error);
+if (error.Success()) {
+  m_obj_obj->SetName(ConstString("object"));
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(
+size_t idx) {
+  if (idx == 0) return m_obj_obj;
+  if (idx == 1) return m_del_obj;
+  if (idx == 2) return m_ptr_obj;
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
+  if (m_del_obj) return 2;
+  if (m_ptr_obj && m_ptr_obj->GetValueAsUnsigned(0) != 0) return 1;
+  return 0;
+}
+
+size_t LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(
+const ConstString &name) {
+  if (name == ConstString("obj") || name == ConstString("object")) return 0;
+  if (name == ConstString("del") || name == ConstString("deleter")) return 1;
+  if (name == ConstString("ptr") || name == ConstString("pointer")) return 2;
+  return UINT32_MAX;
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
+Stream &stream, const TypeSummaryOptions &options) {
+  if (!m_ptr_obj) return false;
+
+  if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
+stream.Printf("nullptr");
+  } else {
+Error error;
+bool print_pointee = false;
+if (m_obj_obj) {
+  if (m_obj_obj->DumpPrintableRepresentation(
+  stream, ValueObject::eValueObjectRepresentationStyleSummary,
+  lldb::eFormatInvalid,
+  ValueObject::ePrintableRepresentationSpecialCasesDisable,
+  false)) {
+print_pointee = true;
+  }
+}
+if (!print_pointee)
+  stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
+  }
+  return true;
+}
+
+SyntheticChildrenFro

[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-18 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

In https://reviews.llvm.org/D25726#573127, @Eugene.Zelenko wrote:

> Please run Clang-format over new code.


I run it before upload but it mush have picked up some strange config. Will run 
it again before submit. Thanks for noticing it.


https://reviews.llvm.org/D25726



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


[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-18 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko added a comment.

There are same problems with formatting as in https://reviews.llvm.org/D25726. 
Also test case main() has wrong indentation.


https://reviews.llvm.org/D25734



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


[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-18 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko added a comment.

There are same problems with formatting as in https://reviews.llvm.org/D25726. 
Also test case main() has wrong indentation.


https://reviews.llvm.org/D25733



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


[Lldb-commits] [PATCH] D25714: [Test Suite] Allow overriding codesign identity

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz updated this revision to Diff 75057.
beanz added a comment.

Updating to use lldbtest_config.


https://reviews.llvm.org/D25714

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  packages/Python/lldbsuite/test/lldbtest.py
  test/CMakeLists.txt


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -79,6 +79,10 @@
   endif()
 endif()
 
+if(LLDB_CODESIGN_IDENTITY)
+  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity 
"${LLDB_CODESIGN_IDENTITY}")
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1543,8 +1543,8 @@
 
 def signBinary(self, binary_path):
 if sys.platform.startswith("darwin"):
-codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
-binary_path)
+codesign_cmd = "codesign --force --sign \"%s\" %s" % (
+lldbtest_config.codesign_identity, binary_path)
 call(codesign_cmd, shell=True)
 
 def findBuiltClang(self):
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -151,6 +151,11 @@
 dest='log_success',
 action='store_true',
 help="Leave logs/traces even for successful test runs (useful for 
creating reference log files during debugging.)")
+group.add_argument(
+'--codesign-identity',
+metavar='Codesigning identity',
+default='lldb_codesign',
+help='The codesigning identity to use')
 
 # Configuration options
 group = parser.add_argument_group('Remote platform options')
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -481,6 +481,8 @@
 # Shut off multiprocessing mode when test directories are specified.
 configuration.no_multiprocess_test_runner = True
 
+lldbtest_config.codesign_identity = args.codesign_identity
+
 #print("testdirs:", testdirs)
 
 


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -79,6 +79,10 @@
   endif()
 endif()
 
+if(LLDB_CODESIGN_IDENTITY)
+  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1543,8 +1543,8 @@
 
 def signBinary(self, binary_path):
 if sys.platform.startswith("darwin"):
-codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
-binary_path)
+codesign_cmd = "codesign --force --sign \"%s\" %s" % (
+lldbtest_config.codesign_identity, binary_path)
 call(codesign_cmd, shell=True)
 
 def findBuiltClang(self):
Index: packages/Python/lldbsuite/test/dotest_args.py
===
--- packages/Python/lldbsuite/test/dotest_args.py
+++ packages/Python/lldbsuite/test/dotest_args.py
@@ -151,6 +151,11 @@
 dest='log_success',
 action='store_true',
 help="Leave logs/traces even for successful test runs (useful for creating reference log files during debugging.)")
+group.add_argument(
+'--codesign-identity',
+metavar='Codesigning identity',
+default='lldb_codesign',
+help='The codesigning identity to use')
 
 # Configuration options
 group = parser.add_argument_group('Remote platform options')
Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -481,6 +481,8 @@
 # Shut off multiprocessing mode when test directories are specified.
 configuration.no_multiprocess_test_runner = True
 
+lldbtest_config.codesign_identity = args.codesign_identity
+
 #print("testdirs:", testdirs)
 
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb

[Lldb-commits] [PATCH] D25745: [CMake] Rename lldb-launcher to darwin-debug

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added reviewers: tfiala, zturner.
beanz added a subscriber: lldb-commits.
Herald added a subscriber: mgorny.

This tool is only built on Darwin, and the name darwin-debug matches the Xcode 
project. We should have this in sync unless there is a good reason not to.


https://reviews.llvm.org/D25745

Files:
  tools/darwin-debug/CMakeLists.txt


Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,6 +1,6 @@
-add_lldb_executable(lldb-launcher INCLUDE_IN_FRAMEWORK
+add_lldb_executable(darwin-debug INCLUDE_IN_FRAMEWORK
   darwin-debug.cpp
   )
 
-install(TARGETS lldb-launcher
+install(TARGETS darwin-debug
   RUNTIME DESTINATION bin)


Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,6 +1,6 @@
-add_lldb_executable(lldb-launcher INCLUDE_IN_FRAMEWORK
+add_lldb_executable(darwin-debug INCLUDE_IN_FRAMEWORK
   darwin-debug.cpp
   )
 
-install(TARGETS lldb-launcher
+install(TARGETS darwin-debug
   RUNTIME DESTINATION bin)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25680: [cmake] Make dependencies of lldb libraries private, take 2

2016-10-18 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Looks fine, thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D25680



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


[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added a reviewer: tfiala.
beanz added a subscriber: lldb-commits.

If a user has their shell set to a non-POSIX conferment shell the 
TestTerminal.py tests fail because the shell blurb constructed here may not 
work in their shell.

In my specific case fish-shell (The Friendly Interactive Shell - 
http://fishshell.com) does not support $?, it instead uses $status (because it 
is friendly).

This patch removes the assumption of your default shell by running the 
constructed bash command via "/bin/bash -c ...". This should be safer for users 
mutating their shell environment.


https://reviews.llvm.org/D25750

Files:
  source/Host/macosx/Host.mm


Index: source/Host/macosx/Host.mm
===
--- source/Host/macosx/Host.mm
+++ source/Host/macosx/Host.mm
@@ -354,11 +354,11 @@
 
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
 "   activate\n"
-"  do script \"%s\"\n"
+"  do script \"/bin/bash -c '%s';exit\"\n"
 "end tell\n";
 
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
repeat with the_window in (get windows)\n\
repeat with the_tab in tabs of the_window\n\


Index: source/Host/macosx/Host.mm
===
--- source/Host/macosx/Host.mm
+++ source/Host/macosx/Host.mm
@@ -354,11 +354,11 @@
 
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
 "   activate\n"
-"	do script \"%s\"\n"
+"	do script \"/bin/bash -c '%s';exit\"\n"
 "end tell\n";
 
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
 	repeat with the_window in (get windows)\n\
 		repeat with the_tab in tabs of the_window\n\
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25751: [CMake] Don't include LLDB_TEST_COMPILER in cached variable

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added reviewers: tfiala, zturner, labath.
beanz added a subscriber: lldb-commits.
Herald added a subscriber: mgorny.

CMake has no builtin mechanism for cache invalidation. As a general convention 
you want to not expand user-specified variables in other cached variables 
because they will not get updated when the user changes their specified value.

This patch moves the "-C" option for dotest.py into the LLDB_TEST_COMMON_ARGS 
and out of the CMake cache. In order to prevent issues with out-of-date cache 
files on builders I've added code to scrub "-C ${LLDB_TEST_COMPILER}" out of 
the CMake caches, by Force writing the variable. This code can be removed in a 
few days once the change has trickled through CI systems.


https://reviews.llvm.org/D25751

Files:
  test/CMakeLists.txt


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -43,10 +43,15 @@
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  
Determines whether tests are compiled with -m32 or -m64")
 
+# Scrub LLDB_TEST_COMPILER out of the CMake caches
+# TODO: remove the replace lines and the FORCE parameter in a few days once the
+# change has made its way through bots to clean up their CMake caches.
+string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New 
"${LLDB_TEST_USER_ARGS}")
+
 # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to 
pass to the script
 set(LLDB_TEST_USER_ARGS
-  -C ${LLDB_TEST_COMPILER}
-  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'")
+  "${LLDB_TEST_USER_ARGS_New}"
+  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
 
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
@@ -56,6 +61,7 @@
   -S nm
   -u CXXFLAGS
   -u CFLAGS
+  -C ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -43,10 +43,15 @@
 	${LLDB_DEFAULT_TEST_ARCH}
 	CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  Determines whether tests are compiled with -m32 or -m64")
 
+# Scrub LLDB_TEST_COMPILER out of the CMake caches
+# TODO: remove the replace lines and the FORCE parameter in a few days once the
+# change has made its way through bots to clean up their CMake caches.
+string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New "${LLDB_TEST_USER_ARGS}")
+
 # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
 set(LLDB_TEST_USER_ARGS
-  -C ${LLDB_TEST_COMPILER}
-  CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
+  "${LLDB_TEST_USER_ARGS_New}"
+  CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
 
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
@@ -56,6 +61,7 @@
   -S nm
   -u CXXFLAGS
   -u CFLAGS
+  -C ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added reviewers: tfiala, zturner, labath.
beanz added a subscriber: lldb-commits.

When building the LLDB test programs, if your CC is clang it actually isn't 
safe to make CXX a string replace of "clang -> clang++". This falls down on 
unix configurations if your compiler is clang-${version}.

A safer approach is to use the "--driver-mode=g++" option to tell clang to act 
like clang++.


https://reviews.llvm.org/D25753

Files:
  packages/Python/lldbsuite/test/make/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-   $(subst clang,clang++,$(1)), \
-   $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1))
+cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
+$(subst icc,icpc,$(1)), \
+$(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+  $(subst gcc,g++,$(1)), \
+  $(subst cc,c++,$(1)
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+CXXFLAGS += --driver-mode=g++
+endif
+
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
-  $(subst icc,icpc,$(1)), \
-  $(if $(findstring llvm-gcc,$(1)), \
-   $(subst llvm-gcc,llvm-g++,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,g++,$(1)), \
-$(subst cc,c++,$(1))
+cxx_linker_notdir = $(if $(findstring icc,$(1)), \
+  $(subst icc,icpc,$(1)), \
+  $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,g++,$(1)), \
+$(subst cc,c++,$(1)
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
@@ -354,6 +354,7 @@
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
+LDFLAGS += --driver-mode=g++
 endif
 
 #--
@@ -377,6 +378,7 @@
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+  LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -395,6 +397,7 @@
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-   $(subst clang,clang++,$(1)), \
-   $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(su

[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

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

Yep, looks right.  We shouldn't be assuming the shell.


https://reviews.llvm.org/D25750



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


[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

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

LGTM.


https://reviews.llvm.org/D25753



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


[Lldb-commits] [PATCH] D25745: [CMake] Rename lldb-launcher to darwin-debug

2016-10-18 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a subscriber: labath.
tfiala added a comment.
This revision is now accepted and ready to land.

This seems fine, but @labath might want to weigh in if Android tools have a 
hard-baked assumption anywhere on lldb-launcher.


https://reviews.llvm.org/D25745



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


[Lldb-commits] [PATCH] D25714: [Test Suite] Allow overriding codesign identity

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

LGTM.


https://reviews.llvm.org/D25714



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


[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Joerg Sonnenberger via lldb-commits
joerg added a comment.

Hard-coding `/bin/bash` is not an improvement in my opinion. There are quite a 
few systems where this is plainly breaking things.


https://reviews.llvm.org/D25750



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


[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Joerg Sonnenberger via lldb-commits
joerg added a comment.

OK, this is OSX specific, but I still think that hardcoding bash is a bad idea. 
Does it need anything not in `/bin/sh`?


https://reviews.llvm.org/D25750



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


Re: [Lldb-commits] [PATCH] debugserver: Disable four-char-constants and format-pedantic warnings

2016-10-18 Thread Justin Bogner via lldb-commits
Pavel Labath  writes:
> Thanks for the patch. Could you submit the patch through phabricator
>  and add Greg Clayton as a reviewer.

Maybe later. I don't have time to fight with phabricator today.

> That said, my preference would be to actually fix those warnings
> instead of silencing them.

If you think that's best, but do note that neither of these warnings is
flagging much of a problem:

- The four-character-literal warning is flagging implementation defined
  behaviour four spelling a 32 bit hex constant in ascii instead of
  something like 0x46445343. This is a portability vs readability thing,
  and pretty minor.

- The format-pedantic is warning about passing typed pointers to a %p
  format specifier. The "fix" is to cast these arguments to `void *`,
  which IMO hurts readability for no gain. I'm pretty sure this warning
  only exists to preserve portability to some hypothetical ABI whose
  calling convention depends on the type of the pointer.

> pl
>
> On 17 October 2016 at 08:24, Justin Bogner via lldb-commits
>  wrote:
>> Today I checked out lldb to check that r284364 wouldn't cause any
>> trouble, but there were a few warnings that fired when I tried to build
>> it, breaking my -Werror build.
>>
>> This disables four character literal warnings (so that 'FDSC' in
>> debugserver.cpp is allowed) and pedantic formatting warnings, so that
>> printf-like functions can pass typed pointers to "%p" in format strings.
>>
>> Okay to commit?
>>
>>
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Todd Fiala via lldb-commits
Actually that's a good point. We can default to bash but add a setting to 
override. The issue we have to solve is that the current approach fails with 
non-POSIX shells.

-Todd

> On Oct 18, 2016, at 4:09 PM, Joerg Sonnenberger  wrote:
> 
> joerg added a comment.
> 
> OK, this is OSX specific, but I still think that hardcoding bash is a bad 
> idea. Does it need anything not in `/bin/sh`?
> 
> 
> https://reviews.llvm.org/D25750
> 
> 
> 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-18 Thread Dmitry Mikulin via lldb-commits
dmikulin created this revision.
dmikulin added a subscriber: lldb-commits.
dmikulin set the repository for this revision to rL LLVM.
dmikulin added a project: LLDB.
Herald added subscribers: emaste, rengolin, aemerson.

Implementation of software single step for FreeBSD on ARM.
The code is largely based on the Linux implementation of the same functionality.

I ran lldb test on an rpi2 board running FreeBSD 11.RC3. With the change the 
pass rate improves from the current 174
tests to 419. I used amd64 as a reference architecture where 517 tests pass on 
FreeBSD.

This is my first attempt to submit a patch for lldb, so I may need some 
guidance to work through the process.
How do reviewers get assigned for code reviews?


Repository:
  rL LLVM

https://reviews.llvm.org/D25756

Files:
  source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Index: source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -1141,11 +1141,17 @@
 
   case SI_KERNEL:
   case TRAP_BRKPT:
-if (log)
-  log->Printf(
-  "ProcessMonitor::%s() received breakpoint event, tid = %" PRIu64,
-  __FUNCTION__, tid);
-message = ProcessMessage::Break(tid);
+if (monitor->m_process->IsSoftwareStepBreakpoint(tid)) {
+  if (log)
+	log->Printf ("ProcessMonitor::%s() received sw single step breakpoint "
+		 "event, tid = %" PRIu64, __FUNCTION__, tid);
+  message = ProcessMessage::Trace(tid);
+} else {
+  if (log)
+	log->Printf ("ProcessMonitor::%s() received breakpoint event, tid = %"
+		 PRIu64, __FUNCTION__, tid);
+  message = ProcessMessage::Break(tid);
+}
 break;
   }
 
Index: source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
===
--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
+++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
@@ -171,7 +171,27 @@
   virtual FreeBSDThread *CreateNewFreeBSDThread(lldb_private::Process &process,
 lldb::tid_t tid);
 
-protected:
+  static bool
+  SingleStepBreakpointHit(void *baton,
+			  lldb_private::StoppointCallbackContext *context,
+			  lldb::user_id_t break_id,
+			  lldb::user_id_t break_loc_id);
+
+  void SetupSoftwareSingleStepping(lldb::tid_t tid);
+
+  lldb_private::Error
+  SetSoftwareSingleStepBreakpoint (lldb::tid_t tid, lldb::addr_t addr);
+
+  bool IsSoftwareStepBreakpoint(lldb::tid_t tid);
+
+  bool SupportHardwareSingleStepping() const;
+
+  typedef std::vector tid_collection;
+  tid_collection &GetStepTids() { return m_step_tids; }
+
+ protected:
+  static const size_t MAX_TRAP_OPCODE_SIZE = 8;
+
   /// Target byte order.
   lldb::ByteOrder m_byte_order;
 
@@ -207,10 +227,10 @@
 
   friend class FreeBSDThread;
 
-  typedef std::vector tid_collection;
   tid_collection m_suspend_tids;
   tid_collection m_run_tids;
   tid_collection m_step_tids;
+  std::map m_threads_stepping_with_breakpoint;
 
   int m_resume_signo;
 };
Index: source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -13,6 +13,7 @@
 
 // C++ Includes
 #include 
+#include 
 
 // Other libraries and framework includes
 #include "lldb/Core/PluginManager.h"
@@ -122,6 +123,7 @@
 
   std::lock_guard guard(m_thread_list.GetMutex());
   bool do_step = false;
+  bool software_single_step = !SupportHardwareSingleStepping();
 
   for (tid_collection::const_iterator t_pos = m_run_tids.begin(),
   t_end = m_run_tids.end();
@@ -133,6 +135,8 @@
t_pos != t_end; ++t_pos) {
 m_monitor->ThreadSuspend(*t_pos, false);
 do_step = true;
+if (software_single_step)
+  SetupSoftwareSingleStepping(*t_pos);
   }
   for (tid_collection::const_iterator t_pos = m_suspend_tids.begin(),
   t_end = m_suspend_tids.end();
@@ -145,7 +149,7 @@
   if (log)
 log->Printf("process %" PRIu64 " resuming (%s)", GetID(),
 do_step ? "step" : "continue");
-  if (do_step)
+  if (do_step && !software_single_step)
 m_monitor->SingleStep(GetID(), m_resume_signo);
   else
 m_monitor->Resume(GetID(), m_resume_signo);
@@ -913,3 +917,200 @@
   "no platform or not the host - how did we get here with ProcessFreeBSD?");
   return DataBufferSP();
 }
+
+struct EmulatorBaton {
+  ProcessFreeBSD *m_process;
+  RegisterContext *m_reg_context;
+
+  // eRegisterKindDWARF -> RegsiterValue
+  std::unordered_map m_register_values;
+
+  EmulatorBaton(ProcessFreeBSD *process, RegisterContext *reg_context)
+  

[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-18 Thread Dmitry Mikulin via lldb-commits
dmikulin updated this revision to Diff 75090.
dmikulin added a comment.

Fixed indentation.


Repository:
  rL LLVM

https://reviews.llvm.org/D25756

Files:
  source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Index: source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -1141,11 +1141,17 @@
 
   case SI_KERNEL:
   case TRAP_BRKPT:
-if (log)
-  log->Printf(
-  "ProcessMonitor::%s() received breakpoint event, tid = %" PRIu64,
-  __FUNCTION__, tid);
-message = ProcessMessage::Break(tid);
+if (monitor->m_process->IsSoftwareStepBreakpoint(tid)) {
+  if (log)
+log->Printf ("ProcessMonitor::%s() received sw single step breakpoint "
+ "event, tid = %" PRIu64, __FUNCTION__, tid);
+  message = ProcessMessage::Trace(tid);
+} else {
+  if (log)
+log->Printf ("ProcessMonitor::%s() received breakpoint event, tid = %"
+ PRIu64, __FUNCTION__, tid);
+  message = ProcessMessage::Break(tid);
+}
 break;
   }
 
Index: source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
===
--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
+++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
@@ -171,7 +171,27 @@
   virtual FreeBSDThread *CreateNewFreeBSDThread(lldb_private::Process &process,
 lldb::tid_t tid);
 
-protected:
+  static bool
+  SingleStepBreakpointHit(void *baton,
+			  lldb_private::StoppointCallbackContext *context,
+			  lldb::user_id_t break_id,
+			  lldb::user_id_t break_loc_id);
+
+  void SetupSoftwareSingleStepping(lldb::tid_t tid);
+
+  lldb_private::Error
+  SetSoftwareSingleStepBreakpoint (lldb::tid_t tid, lldb::addr_t addr);
+
+  bool IsSoftwareStepBreakpoint(lldb::tid_t tid);
+
+  bool SupportHardwareSingleStepping() const;
+
+  typedef std::vector tid_collection;
+  tid_collection &GetStepTids() { return m_step_tids; }
+
+ protected:
+  static const size_t MAX_TRAP_OPCODE_SIZE = 8;
+
   /// Target byte order.
   lldb::ByteOrder m_byte_order;
 
@@ -207,10 +227,10 @@
 
   friend class FreeBSDThread;
 
-  typedef std::vector tid_collection;
   tid_collection m_suspend_tids;
   tid_collection m_run_tids;
   tid_collection m_step_tids;
+  std::map m_threads_stepping_with_breakpoint;
 
   int m_resume_signo;
 };
Index: source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -13,6 +13,7 @@
 
 // C++ Includes
 #include 
+#include 
 
 // Other libraries and framework includes
 #include "lldb/Core/PluginManager.h"
@@ -122,6 +123,7 @@
 
   std::lock_guard guard(m_thread_list.GetMutex());
   bool do_step = false;
+  bool software_single_step = !SupportHardwareSingleStepping();
 
   for (tid_collection::const_iterator t_pos = m_run_tids.begin(),
   t_end = m_run_tids.end();
@@ -133,6 +135,8 @@
t_pos != t_end; ++t_pos) {
 m_monitor->ThreadSuspend(*t_pos, false);
 do_step = true;
+if (software_single_step)
+  SetupSoftwareSingleStepping(*t_pos);
   }
   for (tid_collection::const_iterator t_pos = m_suspend_tids.begin(),
   t_end = m_suspend_tids.end();
@@ -145,7 +149,7 @@
   if (log)
 log->Printf("process %" PRIu64 " resuming (%s)", GetID(),
 do_step ? "step" : "continue");
-  if (do_step)
+  if (do_step && !software_single_step)
 m_monitor->SingleStep(GetID(), m_resume_signo);
   else
 m_monitor->Resume(GetID(), m_resume_signo);
@@ -913,3 +917,200 @@
   "no platform or not the host - how did we get here with ProcessFreeBSD?");
   return DataBufferSP();
 }
+
+struct EmulatorBaton {
+  ProcessFreeBSD *m_process;
+  RegisterContext *m_reg_context;
+
+  // eRegisterKindDWARF -> RegsiterValue
+  std::unordered_map m_register_values;
+
+  EmulatorBaton(ProcessFreeBSD *process, RegisterContext *reg_context)
+  : m_process(process), m_reg_context(reg_context) {}
+};
+
+static size_t ReadMemoryCallback(EmulateInstruction *instruction, void *baton,
+ const EmulateInstruction::Context &context,
+ lldb::addr_t addr, void *dst, size_t length) {
+  EmulatorBaton *emulator_baton = static_cast(baton);
+
+  Error error;
+  size_t bytes_read =
+  emulator_baton->m_process->DoReadMemory(addr, dst, length, error);
+  if (!error.Success())
+bytes_read = 0;
+  return bytes_read;
+}
+
+static bool ReadRegisterCallback(EmulateInstruction *

Re: [Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Jim Ingham via lldb-commits
I am pretty sure /bin/sh is supposed to be a posix shell.  We could probably 
use that as well if we felt that there might be an OS X without /bin/bash.  

But we aren't using any but the most basic properties of the shell along this 
code path.  It isn't being done for shell expansion or anything like that,  So 
there isn't much point in making it overridable.

Jim

> On Oct 18, 2016, at 4:26 PM, Todd Fiala via lldb-commits 
>  wrote:
> 
> Actually that's a good point. We can default to bash but add a setting to 
> override. The issue we have to solve is that the current approach fails with 
> non-POSIX shells.
> 
> -Todd
> 
>> On Oct 18, 2016, at 4:09 PM, Joerg Sonnenberger  wrote:
>> 
>> joerg added a comment.
>> 
>> OK, this is OSX specific, but I still think that hardcoding bash is a bad 
>> idea. Does it need anything not in `/bin/sh`?
>> 
>> 
>> https://reviews.llvm.org/D25750
>> 
>> 
>> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Zachary Turner via lldb-commits
I don't think you need to go out of your way to account for this, but
Microsoft recently shipped bash on Windows in a full ubuntu environment. I
can't check right this second, but I don't think it has sh, only bash. What
about a fallback? Try bash, if you can't find it try sh. Thoughts?
On Tue, Oct 18, 2016 at 4:39 PM Jim Ingham via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> I am pretty sure /bin/sh is supposed to be a posix shell.  We could
> probably use that as well if we felt that there might be an OS X without
> /bin/bash.
>
> But we aren't using any but the most basic properties of the shell along
> this code path.  It isn't being done for shell expansion or anything like
> that,  So there isn't much point in making it overridable.
>
> Jim
>
> > On Oct 18, 2016, at 4:26 PM, Todd Fiala via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >
> > Actually that's a good point. We can default to bash but add a setting
> to override. The issue we have to solve is that the current approach fails
> with non-POSIX shells.
> >
> > -Todd
> >
> >> On Oct 18, 2016, at 4:09 PM, Joerg Sonnenberger 
> wrote:
> >>
> >> joerg added a comment.
> >>
> >> OK, this is OSX specific, but I still think that hardcoding bash is a
> bad idea. Does it need anything not in `/bin/sh`?
> >>
> >>
> >> https://reviews.llvm.org/D25750
> >>
> >>
> >>
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Jim Ingham via lldb-commits
This piece of code is OS X only, it's cons'ing up an AppleScript to run the 
process in a new Terminal.app window.  So unless Windows has implemented an 
AppleScript drivable Terminal.app behind our backs we don't need to work this 
problem that hard...

Jim

> On Oct 18, 2016, at 4:43 PM, Zachary Turner  wrote:
> 
> I don't think you need to go out of your way to account for this, but 
> Microsoft recently shipped bash on Windows in a full ubuntu environment. I 
> can't check right this second, but I don't think it has sh, only bash. What 
> about a fallback? Try bash, if you can't find it try sh. Thoughts?
> On Tue, Oct 18, 2016 at 4:39 PM Jim Ingham via lldb-commits 
>  wrote:
> I am pretty sure /bin/sh is supposed to be a posix shell.  We could probably 
> use that as well if we felt that there might be an OS X without /bin/bash.
> 
> But we aren't using any but the most basic properties of the shell along this 
> code path.  It isn't being done for shell expansion or anything like that,  
> So there isn't much point in making it overridable.
> 
> Jim
> 
> > On Oct 18, 2016, at 4:26 PM, Todd Fiala via lldb-commits 
> >  wrote:
> >
> > Actually that's a good point. We can default to bash but add a setting to 
> > override. The issue we have to solve is that the current approach fails 
> > with non-POSIX shells.
> >
> > -Todd
> >
> >> On Oct 18, 2016, at 4:09 PM, Joerg Sonnenberger  wrote:
> >>
> >> joerg added a comment.
> >>
> >> OK, this is OSX specific, but I still think that hardcoding bash is a bad 
> >> idea. Does it need anything not in `/bin/sh`?
> >>
> >>
> >> https://reviews.llvm.org/D25750
> >>
> >>
> >>
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Zachary Turner via lldb-commits
Ahh nvm then, I'm on mobile so couldn't see the patch, missed that this was
Apple only
On Tue, Oct 18, 2016 at 4:49 PM Jim Ingham  wrote:

> This piece of code is OS X only, it's cons'ing up an AppleScript to run
> the process in a new Terminal.app window.  So unless Windows has
> implemented an AppleScript drivable Terminal.app behind our backs we don't
> need to work this problem that hard...
>
> Jim
>
> > On Oct 18, 2016, at 4:43 PM, Zachary Turner  wrote:
> >
> > I don't think you need to go out of your way to account for this, but
> Microsoft recently shipped bash on Windows in a full ubuntu environment. I
> can't check right this second, but I don't think it has sh, only bash. What
> about a fallback? Try bash, if you can't find it try sh. Thoughts?
> > On Tue, Oct 18, 2016 at 4:39 PM Jim Ingham via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> > I am pretty sure /bin/sh is supposed to be a posix shell.  We could
> probably use that as well if we felt that there might be an OS X without
> /bin/bash.
> >
> > But we aren't using any but the most basic properties of the shell along
> this code path.  It isn't being done for shell expansion or anything like
> that,  So there isn't much point in making it overridable.
> >
> > Jim
> >
> > > On Oct 18, 2016, at 4:26 PM, Todd Fiala via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> > >
> > > Actually that's a good point. We can default to bash but add a setting
> to override. The issue we have to solve is that the current approach fails
> with non-POSIX shells.
> > >
> > > -Todd
> > >
> > >> On Oct 18, 2016, at 4:09 PM, Joerg Sonnenberger 
> wrote:
> > >>
> > >> joerg added a comment.
> > >>
> > >> OK, this is OSX specific, but I still think that hardcoding bash is a
> bad idea. Does it need anything not in `/bin/sh`?
> > >>
> > >>
> > >> https://reviews.llvm.org/D25750
> > >>
> > >>
> > >>
> > > ___
> > > lldb-commits mailing list
> > > lldb-commits@lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r284550 - Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 18:53:24 2016
New Revision: 284550

URL: http://llvm.org/viewvc/llvm-project?rev=284550&view=rev
Log:
Use clang --driver-mode instead of guessing c++ compiler path

Summary:
When building the LLDB test programs, if your CC is clang it actually isn't 
safe to make CXX a string replace of "clang -> clang++". This falls down on 
unix configurations if your compiler is clang-${version}.

A safer approach is to use the "--driver-mode=g++" option to tell clang to act 
like clang++.

Reviewers: tfiala, zturner, labath

Subscribers: lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=284550&r1=284549&r2=284550&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Oct 18 
18:53:24 2016
@@ -242,27 +242,27 @@ ifneq "$(DYLIB_NAME)" ""
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-   $(subst clang,clang++,$(1)), \
-   $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1))
+cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
+$(subst icc,icpc,$(1)), \
+$(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+  $(subst gcc,g++,$(1)), \
+  $(subst cc,c++,$(1)
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+CXXFLAGS += --driver-mode=g++
+endif
+
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
-  $(subst icc,icpc,$(1)), \
-  $(if $(findstring llvm-gcc,$(1)), \
-   $(subst llvm-gcc,llvm-g++,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,g++,$(1)), \
-$(subst cc,c++,$(1))
+cxx_linker_notdir = $(if $(findstring icc,$(1)), \
+  $(subst icc,icpc,$(1)), \
+  $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,g++,$(1)), \
+$(subst cc,c++,$(1)
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
@@ -354,6 +354,7 @@ ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
+LDFLAGS += --driver-mode=g++
 endif
 
 #--
@@ -377,6 +378,7 @@ endif
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+  LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -395,6 +397,7 @@ ifneq "$(strip $(OBJCXX_SOURCES))" ""
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


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


[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284550: Use clang --driver-mode instead of guessing c++ 
compiler path (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D25753?vs=75078&id=75095#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25753

Files:
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-   $(subst clang,clang++,$(1)), \
-   $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1))
+cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
+$(subst icc,icpc,$(1)), \
+$(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+  $(subst gcc,g++,$(1)), \
+  $(subst cc,c++,$(1)
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+CXXFLAGS += --driver-mode=g++
+endif
+
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
-  $(subst icc,icpc,$(1)), \
-  $(if $(findstring llvm-gcc,$(1)), \
-   $(subst llvm-gcc,llvm-g++,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,g++,$(1)), \
-$(subst cc,c++,$(1))
+cxx_linker_notdir = $(if $(findstring icc,$(1)), \
+  $(subst icc,icpc,$(1)), \
+  $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,g++,$(1)), \
+$(subst cc,c++,$(1)
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
@@ -354,6 +354,7 @@
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
+LDFLAGS += --driver-mode=g++
 endif
 
 #--
@@ -377,6 +378,7 @@
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+  LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -395,6 +397,7 @@
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-   $(subst clang,clang++,$(1)), \
-   $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1))
+cxx_compiler_notdir = $(if $(find

[Lldb-commits] [lldb] r284551 - [CMake] Don't include LLDB_TEST_COMPILER in cached variable

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 18:54:28 2016
New Revision: 284551

URL: http://llvm.org/viewvc/llvm-project?rev=284551&view=rev
Log:
[CMake] Don't include LLDB_TEST_COMPILER in cached variable

Summary:
CMake has no builtin mechanism for cache invalidation. As a general convention 
you want to not expand user-specified variables in other cached variables 
because they will not get updated when the user changes their specified value.

This patch moves the "-C" option for dotest.py into the LLDB_TEST_COMMON_ARGS 
and out of the CMake cache. In order to prevent issues with out-of-date cache 
files on builders I've added code to scrub "-C ${LLDB_TEST_COMPILER}" out of 
the CMake caches, by Force writing the variable. This code can be removed in a 
few days once the change has trickled through CI systems.

Reviewers: tfiala, labath, zturner

Subscribers: lldb-commits, mgorny

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

Modified:
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=284551&r1=284550&r2=284551&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue Oct 18 18:54:28 2016
@@ -43,10 +43,15 @@ set(LLDB_TEST_ARCH
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  
Determines whether tests are compiled with -m32 or -m64")
 
+# Scrub LLDB_TEST_COMPILER out of the CMake caches
+# TODO: remove the replace lines and the FORCE parameter in a few days once the
+# change has made its way through bots to clean up their CMake caches.
+string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New 
"${LLDB_TEST_USER_ARGS}")
+
 # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to 
pass to the script
 set(LLDB_TEST_USER_ARGS
-  -C ${LLDB_TEST_COMPILER}
-  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'")
+  "${LLDB_TEST_USER_ARGS_New}"
+  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
 
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
@@ -56,6 +61,7 @@ set(LLDB_TEST_COMMON_ARGS
   -S nm
   -u CXXFLAGS
   -u CFLAGS
+  -C ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )


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


[Lldb-commits] [PATCH] D25751: [CMake] Don't include LLDB_TEST_COMPILER in cached variable

2016-10-18 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284551: [CMake] Don't include LLDB_TEST_COMPILER in cached 
variable (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D25751?vs=75073&id=75097#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25751

Files:
  lldb/trunk/test/CMakeLists.txt


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -43,10 +43,15 @@
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  
Determines whether tests are compiled with -m32 or -m64")
 
+# Scrub LLDB_TEST_COMPILER out of the CMake caches
+# TODO: remove the replace lines and the FORCE parameter in a few days once the
+# change has made its way through bots to clean up their CMake caches.
+string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New 
"${LLDB_TEST_USER_ARGS}")
+
 # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to 
pass to the script
 set(LLDB_TEST_USER_ARGS
-  -C ${LLDB_TEST_COMPILER}
-  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'")
+  "${LLDB_TEST_USER_ARGS_New}"
+  CACHE STRING "Specify additional arguments to pass to test runner. For 
example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
 
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
@@ -56,6 +61,7 @@
   -S nm
   -u CXXFLAGS
   -u CFLAGS
+  -C ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -43,10 +43,15 @@
 	${LLDB_DEFAULT_TEST_ARCH}
 	CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  Determines whether tests are compiled with -m32 or -m64")
 
+# Scrub LLDB_TEST_COMPILER out of the CMake caches
+# TODO: remove the replace lines and the FORCE parameter in a few days once the
+# change has made its way through bots to clean up their CMake caches.
+string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New "${LLDB_TEST_USER_ARGS}")
+
 # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
 set(LLDB_TEST_USER_ARGS
-  -C ${LLDB_TEST_COMPILER}
-  CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
+  "${LLDB_TEST_USER_ARGS_New}"
+  CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
 
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
@@ -56,6 +61,7 @@
   -S nm
   -u CXXFLAGS
   -u CFLAGS
+  -C ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r284552 - When invoking Terminal, don't assume the default shell

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 18:55:34 2016
New Revision: 284552

URL: http://llvm.org/viewvc/llvm-project?rev=284552&view=rev
Log:
When invoking Terminal, don't assume the default shell

Summary:
If a user has their shell set to a non-POSIX conferment shell the 
TestTerminal.py tests fail because the shell blurb constructed here may not 
work in their shell.

In my specific case fish-shell (The Friendly Interactive Shell - 
http://fishshell.com) does not support $?, it instead uses $status (because it 
is friendly).

This patch removes the assumption of your default shell by running the 
constructed bash command via "/bin/bash -c ...". This should be safer for users 
mutating their shell environment.

Reviewers: tfiala

Subscribers: joerg, lldb-commits

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

Modified:
lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=284552&r1=284551&r2=284552&view=diff
==
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Tue Oct 18 18:55:34 2016
@@ -354,11 +354,11 @@ static bool WaitForProcessToSIGSTOP(cons
 
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
 "   activate\n"
-"  do script \"%s\"\n"
+"  do script \"/bin/bash -c '%s';exit\"\n"
 "end tell\n";
 
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
repeat with the_window in (get windows)\n\
repeat with the_tab in tabs of the_window\n\


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


[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284552: When invoking Terminal, don't assume the default 
shell (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D25750?vs=75069&id=75098#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25750

Files:
  lldb/trunk/source/Host/macosx/Host.mm


Index: lldb/trunk/source/Host/macosx/Host.mm
===
--- lldb/trunk/source/Host/macosx/Host.mm
+++ lldb/trunk/source/Host/macosx/Host.mm
@@ -354,11 +354,11 @@
 
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
 "   activate\n"
-"  do script \"%s\"\n"
+"  do script \"/bin/bash -c '%s';exit\"\n"
 "end tell\n";
 
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
repeat with the_window in (get windows)\n\
repeat with the_tab in tabs of the_window\n\


Index: lldb/trunk/source/Host/macosx/Host.mm
===
--- lldb/trunk/source/Host/macosx/Host.mm
+++ lldb/trunk/source/Host/macosx/Host.mm
@@ -354,11 +354,11 @@
 
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
 "   activate\n"
-"	do script \"%s\"\n"
+"	do script \"/bin/bash -c '%s';exit\"\n"
 "end tell\n";
 
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
 	repeat with the_window in (get windows)\n\
 		repeat with the_tab in tabs of the_window\n\
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz added a comment.

@joerg, it is OS X exclusive, and bash is the system default shell, so I think 
that makes sense.


Repository:
  rL LLVM

https://reviews.llvm.org/D25750



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


[Lldb-commits] [lldb] r284555 - Fixing the linux bots I broke in r284550

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 19:13:56 2016
New Revision: 284555

URL: http://llvm.org/viewvc/llvm-project?rev=284555&view=rev
Log:
Fixing the linux bots I broke in r284550

Need to gate cxx linker adding driver-mode flag based on the linker being clang.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=284555&r1=284554&r2=284555&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Oct 18 
19:13:56 2016
@@ -354,7 +354,9 @@ ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
-LDFLAGS += --driver-mode=g++
+ifeq ($(findstring clang, $(cxx_linker)), clang)
+  LDFLAGS += --driver-mode=g++
+endif
 endif
 
 #--
@@ -378,7 +380,9 @@ endif
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
-  LDFLAGS += --driver-mode=g++
+  ifeq ($(findstring clang, $(cxx_linker)), clang)
+LDFLAGS += --driver-mode=g++
+  endif
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -397,7 +401,9 @@ ifneq "$(strip $(OBJCXX_SOURCES))" ""
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
-  LDFLAGS += --driver-mode=g++
+  ifeq ($(findstring clang, $(cxx_linker)), clang)
+LDFLAGS += --driver-mode=g++
+  endif
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


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


[Lldb-commits] [lldb] r284564 - Trying to fix a few more missing LDFLAGS.

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 21:31:31 2016
New Revision: 284564

URL: http://llvm.org/viewvc/llvm-project?rev=284564&view=rev
Log:
Trying to fix a few more missing LDFLAGS.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=284564&r1=284563&r2=284564&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Oct 18 
21:31:31 2016
@@ -423,6 +423,9 @@ ifneq "$(strip $(ARCHIVE_CXX_SOURCES))"
ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  ifeq ($(findstring clang, $(cxx_linker)), clang)
+LDFLAGS += --driver-mode=g++
+  endif
 endif
 
 #--
@@ -440,6 +443,9 @@ ifneq "$(strip $(ARCHIVE_OBJCXX_SOURCES)
ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  ifeq ($(findstring clang, $(cxx_linker)), clang)
+LDFLAGS += --driver-mode=g++
+  endif
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


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


[Lldb-commits] [lldb] r284565 - Revert back to the state before r284550

2016-10-18 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Oct 18 21:44:20 2016
New Revision: 284565

URL: http://llvm.org/viewvc/llvm-project?rev=284565&view=rev
Log:
Revert back to the state before r284550

This patch is causing a lot of issues on bots that I didn't see in local 
testing. I'm going to have to work on this. Reverting for now while I sort it 
out.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=284565&r1=284564&r2=284565&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Oct 18 
21:44:20 2016
@@ -242,27 +242,27 @@ ifneq "$(DYLIB_NAME)" ""
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1)
+cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
+   $(subst clang,clang++,$(1)), \
+   $(if $(findstring icc,$(1)), \
+$(subst icc,icpc,$(1)), \
+$(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+  $(subst gcc,g++,$(1)), \
+  $(subst cc,c++,$(1))
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
-ifeq ($(findstring clang, $(cxx_compiler)), clang)
-CXXFLAGS += --driver-mode=g++
-endif
-
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring icc,$(1)), \
-  $(subst icc,icpc,$(1)), \
-  $(if $(findstring llvm-gcc,$(1)), \
-   $(subst llvm-gcc,llvm-g++,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,g++,$(1)), \
-$(subst cc,c++,$(1)
+cxx_linker_notdir = $(if $(findstring clang,$(1)), \
+ $(subst clang,clang++,$(1)), \
+ $(if $(findstring icc,$(1)), \
+  $(subst icc,icpc,$(1)), \
+  $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,g++,$(1)), \
+$(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
@@ -354,9 +354,6 @@ ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
-ifeq ($(findstring clang, $(cxx_linker)), clang)
-  LDFLAGS += --driver-mode=g++
-endif
 endif
 
 #--
@@ -380,9 +377,6 @@ endif
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
-  ifeq ($(findstring clang, $(cxx_linker)), clang)
-LDFLAGS += --driver-mode=g++
-  endif
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -401,9 +395,6 @@ ifneq "$(strip $(OBJCXX_SOURCES))" ""
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
-  ifeq ($(findstring clang, $(cxx_linker)), clang)
-LDFLAGS += --driver-mode=g++
-  endif
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif
@@ -423,9 +414,6 @@ ifneq "$(strip $(ARCHIVE_CXX_SOURCES))"
ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
-  ifeq ($(findstring clang, $(cxx_linker)), clang)
-LDFLAGS += --driver-mode=g++
-  endif
 endif
 
 #--
@@ -443,9 +431,6 @@ ifneq "$(strip $(ARCHIVE_OBJCXX_SOURCES)
ARCHIVE_OBJECTS +=$(strip $(

[Lldb-commits] [PATCH] D25057: Fix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints

2016-10-18 Thread Muhammad Omair Javaid via lldb-commits
omjavaid updated this revision to Diff 75103.
omjavaid added a comment.

Sorry I was on Holiday so couldnt get back to this earlier.

I ll get back to your comments about GDB packet sequence in a separate thread 
after collecting further information.

I have made the suggested corrections in above patch.


https://reviews.llvm.org/D25057

Files:
  
packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile
  
packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
  
packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -538,42 +538,33 @@
   control_value |= ((1 << size) - 1) << 5;
   control_value |= (2 << 1) | 1;
 
-  // Iterate over stored watchpoints
-  // Find a free wp_index or update reference count if duplicate.
+  // Iterate over stored watchpoints and find a free wp_index
   wp_index = LLDB_INVALID_INDEX32;
   for (uint32_t i = 0; i < m_max_hwp_supported; i++) {
 if ((m_hwp_regs[i].control & 1) == 0) {
   wp_index = i; // Mark last free slot
-} else if (m_hwp_regs[i].address == addr &&
-   m_hwp_regs[i].control == control_value) {
-  wp_index = i; // Mark duplicate index
-  break;// Stop searching here
+} else if (m_hwp_regs[i].address == addr) {
+  return LLDB_INVALID_INDEX32; // We do not support duplicate watchpoints.
 }
   }
 
   if (wp_index == LLDB_INVALID_INDEX32)
 return LLDB_INVALID_INDEX32;
 
-  // Add new or update existing watchpoint
-  if ((m_hwp_regs[wp_index].control & 1) == 0) {
-// Update watchpoint in local cache
-m_hwp_regs[wp_index].real_addr = real_addr;
-m_hwp_regs[wp_index].address = addr;
-m_hwp_regs[wp_index].control = control_value;
-m_hwp_regs[wp_index].refcount = 1;
+  // Update watchpoint in local cache
+  m_hwp_regs[wp_index].real_addr = real_addr;
+  m_hwp_regs[wp_index].address = addr;
+  m_hwp_regs[wp_index].control = control_value;
 
-// PTRACE call to set corresponding watchpoint register.
-error = WriteHardwareDebugRegs(eDREGTypeWATCH);
+  // PTRACE call to set corresponding watchpoint register.
+  error = WriteHardwareDebugRegs(eDREGTypeWATCH);
 
-if (error.Fail()) {
-  m_hwp_regs[wp_index].address = 0;
-  m_hwp_regs[wp_index].control &= ~1;
-  m_hwp_regs[wp_index].refcount = 0;
+  if (error.Fail()) {
+m_hwp_regs[wp_index].address = 0;
+m_hwp_regs[wp_index].control &= ~1;
 
-  return LLDB_INVALID_INDEX32;
-}
-  } else
-m_hwp_regs[wp_index].refcount++;
+return LLDB_INVALID_INDEX32;
+  }
 
   return wp_index;
 }
@@ -596,36 +587,25 @@
   if (wp_index >= m_max_hwp_supported)
 return false;
 
-  // Update reference count if multiple references.
-  if (m_hwp_regs[wp_index].refcount > 1) {
-m_hwp_regs[wp_index].refcount--;
-return true;
-  } else if (m_hwp_regs[wp_index].refcount == 1) {
-// Create a backup we can revert to in case of failure.
-lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
-uint32_t tempControl = m_hwp_regs[wp_index].control;
-uint32_t tempRefCount = m_hwp_regs[wp_index].refcount;
-
-// Update watchpoint in local cache
-m_hwp_regs[wp_index].control &= ~1;
-m_hwp_regs[wp_index].address = 0;
-m_hwp_regs[wp_index].refcount = 0;
-
-// Ptrace call to update hardware debug registers
-error = WriteHardwareDebugRegs(eDREGTypeWATCH);
-
-if (error.Fail()) {
-  m_hwp_regs[wp_index].control = tempControl;
-  m_hwp_regs[wp_index].address = tempAddr;
-  m_hwp_regs[wp_index].refcount = tempRefCount;
-
-  return false;
-}
+  // Create a backup we can revert to in case of failure.
+  lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
+  uint32_t tempControl = m_hwp_regs[wp_index].control;
+
+  // Update watchpoint in local cache
+  m_hwp_regs[wp_index].control &= ~1;
+  m_hwp_regs[wp_index].address = 0;
+
+  // Ptrace call to update hardware debug registers
+  error = WriteHardwareDebugRegs(eDREGTypeWATCH);
+
+  if (error.Fail()) {
+m_hwp_regs[wp_index].control = tempControl;
+m_hwp_regs[wp_index].address = tempAddr;
 
-return true;
+return false;
   }
 
-  return false;
+  return true;
 }
 
 Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() {
@@ -650,20 +630,17 @@
   // Create a backup we can revert to in case of failure.
   tempAddr = m_hwp_regs[i].address;
   tempControl = m_hwp_regs[i].control;
-  tempRefCount = m_hwp_regs[i].refcount;
 
   // Clear watchpoints in local c

Re: [Lldb-commits] [PATCH] D25681: [PseudoTerminal] Fix PseudoTerminal MSVC release crash

2016-10-18 Thread Carlo Kok via lldb-commits
fwiw this looks good to me, a much better fix than I had. but it'z 
zturner who objected to my approach.


On 2016-10-17 17:51, Rudy Pons via lldb-commits wrote:

Ilod created this revision.
Ilod added reviewers: zturner, carlokok.
Ilod added a subscriber: lldb-commits.

Since r278177, the Posix functions in PseudoTerminal::OpenFirstAvailableMaster 
on windows are now inlined LLVM_UNREACHABLE instead of return 0.
This causes __assume(0) to be inlined in OpenFirstAvailableMaster, allowing the 
optimizer to change code because this function should never be executed. In 
particular, on Visual 2015 Update 3 Win32 Release builds, the optimizer skips 
the if (error_str) test, causing a crash if error_str is nullptr.
The added #if !defined(LLDB_DISABLE_POSIX) restore the previous behaviour 
(which was doing nothing and returning true, as every function was returning 0, 
and prevent crashes.
The crash was 100% when launching a test x86 executable (built with clang, 
linked with lld-link) in lldb.
I don't know if there is another fix in progress (not calling the function on 
Win32?), but it seems to be called from several places, so it may be simpler to 
fix it in PseudoTerminal.


https://reviews.llvm.org/D25681

Files:
  source/Utility/PseudoTerminal.cpp


Index: source/Utility/PseudoTerminal.cpp
===
--- source/Utility/PseudoTerminal.cpp
+++ source/Utility/PseudoTerminal.cpp
@@ -88,6 +88,7 @@
   if (error_str)
 error_str[0] = '\0';

+#if !defined(LLDB_DISABLE_POSIX)
   // Open the master side of a pseudo terminal
   m_master_fd = ::posix_openpt(oflag);
   if (m_master_fd < 0) {
@@ -111,6 +112,7 @@
 CloseMasterFileDescriptor();
 return false;
   }
+#endif

   return true;
 }




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



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