Re: [Lldb-commits] [PATCH] D20274: Add preliminary bits for Plugins/Process/NetBSD

2016-05-26 Thread Kamil Rytarowski via lldb-commits
krytarowski abandoned this revision.
krytarowski added a comment.

It no longer builds due to mutex refactoring. Remove as it will need to be 
redone for remote debugging.


Repository:
  rL LLVM

http://reviews.llvm.org/D20274



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


Re: [Lldb-commits] [PATCH] D20673: [cmake] Remove the LLDB versions of the exception-controlling variables

2016-05-26 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270863: [cmake] Remove the LLDB versions of the 
exception-controlling variables (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D20673?vs=58587=58630#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20673

Files:
  lldb/trunk/cmake/modules/LLDBConfig.cmake

Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -338,28 +338,6 @@
   list(APPEND system_libs ${CMAKE_DL_LIBS})
 endif()
 
-if(LLDB_REQUIRES_EH)
-  set(LLDB_REQUIRES_RTTI ON)
-else()
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-exceptions")
-  elseif(MSVC)
-add_definitions( -D_HAS_EXCEPTIONS=0 )
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /EHs-c-")
-  endif()
-endif()
-
-# Disable RTTI by default
-if(NOT LLDB_REQUIRES_RTTI)
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-rtti")
-  elseif(MSVC)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /GR-")
-  endif()
-endif()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
-
 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
 # Check for syscall used by lldb-server on linux.
 # If these are not found, it will fall back to ptrace (slow) for memory 
reads.


Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -338,28 +338,6 @@
   list(APPEND system_libs ${CMAKE_DL_LIBS})
 endif()
 
-if(LLDB_REQUIRES_EH)
-  set(LLDB_REQUIRES_RTTI ON)
-else()
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-exceptions")
-  elseif(MSVC)
-add_definitions( -D_HAS_EXCEPTIONS=0 )
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /EHs-c-")
-  endif()
-endif()
-
-# Disable RTTI by default
-if(NOT LLDB_REQUIRES_RTTI)
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-rtti")
-  elseif(MSVC)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /GR-")
-  endif()
-endif()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
-
 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
 # Check for syscall used by lldb-server on linux.
 # If these are not found, it will fall back to ptrace (slow) for memory reads.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r270863 - [cmake] Remove the LLDB versions of the exception-controlling variables

2016-05-26 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu May 26 11:11:04 2016
New Revision: 270863

URL: http://llvm.org/viewvc/llvm-project?rev=270863=rev
Log:
[cmake] Remove the LLDB versions of the exception-controlling variables

Summary:
One can still use the LLVM variables to control this: LLVM_ENABLE_EH, 
LLVM_ENABLE_RTTI. It's not
clear to me why one would want to control these at lldb level and it's 
generally not even a good
idea to compile parts of the same binary with different values of these flags.

Reviewers: zturner, tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D20673

Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=270863=270862=270863=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu May 26 11:11:04 2016
@@ -338,28 +338,6 @@ if (HAVE_LIBDL)
   list(APPEND system_libs ${CMAKE_DL_LIBS})
 endif()
 
-if(LLDB_REQUIRES_EH)
-  set(LLDB_REQUIRES_RTTI ON)
-else()
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-exceptions")
-  elseif(MSVC)
-add_definitions( -D_HAS_EXCEPTIONS=0 )
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /EHs-c-")
-  endif()
-endif()
-
-# Disable RTTI by default
-if(NOT LLDB_REQUIRES_RTTI)
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-rtti")
-  elseif(MSVC)
-set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /GR-")
-  endif()
-endif()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
-
 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
 # Check for syscall used by lldb-server on linux.
 # If these are not found, it will fall back to ptrace (slow) for memory 
reads.


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


Re: [Lldb-commits] [PATCH] D20673: [cmake] Remove the LLDB versions of the exception-controlling variables

2016-05-26 Thread Zachary Turner via lldb-commits
Don't think this is needed anymore, lgtm
On Thu, May 26, 2016 at 8:59 AM Todd Fiala  wrote:

> tfiala added a comment.
>
> In http://reviews.llvm.org/D20673#440967, @labath wrote:
>
> > In http://reviews.llvm.org/D20673#440660, @labath wrote:
> >
> > > Enabling this should not make any difference in the common case, as
> llvm already adds one set of exception-disabling flags if you don't specify
> the flag I mentioned (llvm/cmake/modules/AddLLVM.cmake).
> >
> >
> > (And by "Enabling" I mean "Removing" :P )
>
>
> ;-)
>
>
> http://reviews.llvm.org/D20673
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D20671: [cmake] Add a big warning about a libstdc++ issue

2016-05-26 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

looks good



Comment at: cmake/modules/LLDBConfig.cmake:432
@@ +431,3 @@
+message(WARNING
+"You appear to be using linking to libstdc++ version lesser than 
4.9 without "
+"exceptions enabled. These versions of the library have an issue, 
which causes "

(nit): "be using linking to libstdc++"


http://reviews.llvm.org/D20671



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


Re: [Lldb-commits] [PATCH] D19998: Add a "-gmodules" category to the test suite.

2016-05-26 Thread Todd Fiala via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270848: Add "-gmodules" support to the test suite. (authored 
by tfiala).

Changed prior to commit:
  http://reviews.llvm.org/D19998?vs=58459=58605#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19998

Files:
  lldb/trunk/packages/Python/lldbsuite/support/gmodules.py
  lldb/trunk/packages/Python/lldbsuite/test/decorators.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
  lldb/trunk/packages/Python/lldbsuite/test/test_categories.py

Index: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -143,6 +143,17 @@
 # True signifies that we can handle building dwo.
 return True
 
+def buildGModules(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+"""Build the binaries with dwarf debug info."""
+commands = []
+if clean:
+commands.append([getMake(), "clean", getCmdLine(dictionary)])
+commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+
+lldbtest.system(commands, sender=sender)
+# True signifies that we can handle building with gmodules.
+return True
+
 def cleanup(sender=None, dictionary=None):
 """Perform a platform-specific cleanup after the test."""
 #import traceback
Index: lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
+++ lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
@@ -11,16 +11,19 @@
 # Third-party modules
 
 # LLDB modules
+from lldbsuite.support import gmodules
+
 
 debug_info_categories = [
-'dwarf', 'dwo', 'dsym'
+'dwarf', 'dwo', 'dsym', 'gmodules'
 ]
 
 all_categories = {
 'dataformatters': 'Tests related to the type command and the data formatters subsystem',
 'dwarf' : 'Tests that can be run with DWARF debug information',
 'dwo'   : 'Tests that can be run with DWO debug information',
 'dsym'  : 'Tests that can be run with DSYM debug information',
+'gmodules'  : 'Tests that can be run with -gmodules debug information',
 'expression': 'Tests related to the expression parser',
 'objc'  : 'Tests related to the Objective-C programming language support',
 'pyapi' : 'Tests related to the Python API',
@@ -42,12 +45,27 @@
 candidate = item
 return candidate
 
-def is_supported_on_platform(category, platform):
+
+def is_supported_on_platform(category, platform, compiler_paths):
 if category == "dwo":
 # -gsplit-dwarf is not implemented by clang on Windows.
 return platform in ["linux", "freebsd"]
 elif category == "dsym":
 return platform in ["darwin", "macosx", "ios"]
+elif category == "gmodules":
+# First, check to see if the platform can even support gmodules.
+if platform not in ["linux", "freebsd", "darwin", "macosx", "ios"]:
+return False
+# If all compilers specified support gmodules, we'll enable it.
+for compiler_path in compiler_paths:
+if not gmodules.is_compiler_clang_with_gmodules(compiler_path):
+# Ideally in a multi-compiler scenario during a single test run, this would
+# allow gmodules on compilers that support it and not on ones that don't.
+# However, I didn't see an easy way for all the callers of this to know
+# the compiler being used for a test invocation.  As we tend to run with
+# a single compiler per test run, this shouldn't be a major issue.
+return False
+return True
 return True
 
 def validate(categories, exact_match):
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ 

[Lldb-commits] [lldb] r270848 - Add "-gmodules" support to the test suite.

2016-05-26 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Thu May 26 08:57:03 2016
New Revision: 270848

URL: http://llvm.org/viewvc/llvm-project?rev=270848=rev
Log:
Add "-gmodules" support to the test suite.

This change adds the capability of building test inferiors
with the -gmodules flag to enable module debug info support.
Windows is excluded per @zturner.

Reviewers: granata.enrico, aprantl, zturner, labath

Subscribers: zturner, labath, lldb-commits

Differential Revision: http://reviews.llvm.org/D19998

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

lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py

lldb/trunk/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
lldb/trunk/packages/Python/lldbsuite/test/test_categories.py

Added: lldb/trunk/packages/Python/lldbsuite/support/gmodules.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/support/gmodules.py?rev=270848=auto
==
--- lldb/trunk/packages/Python/lldbsuite/support/gmodules.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/support/gmodules.py Thu May 26 
08:57:03 2016
@@ -0,0 +1,30 @@
+from __future__ import absolute_import
+from __future__ import print_function
+
+# System modules
+import os
+import re
+
+
+GMODULES_SUPPORT_MAP = {}
+GMODULES_HELP_REGEX = re.compile(r"\s-gmodules\s")
+
+
+def is_compiler_clang_with_gmodules(compiler_path):
+# Before computing the result, check if we already have it cached.
+if compiler_path in GMODULES_SUPPORT_MAP:
+return GMODULES_SUPPORT_MAP[compiler_path]
+
+def _gmodules_supported_internal():
+compiler = os.path.basename(compiler_path)
+if "clang" not in compiler:
+return False
+else:
+# Check the compiler help for the -gmodules option.
+clang_help = os.popen("%s --help" % compiler_path).read()
+return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not 
None
+
+GMODULES_SUPPORT_MAP[compiler_path] = _gmodules_supported_internal()
+return GMODULES_SUPPORT_MAP[compiler_path]
+
+

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=270848=270847=270848=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu May 26 08:57:03 
2016
@@ -522,15 +522,3 @@ def skipUnlessThreadSanitizer(func):
 return "Compiler cannot compile with -fsanitize=thread"
 return None
 return skipTestIfFn(is_compiler_clang_with_thread_sanitizer)(func)
-
-def skipUnlessClangModules():
-"""Decorate the item to skip test unless Clang -gmodules flag is 
supported."""
-def is_compiler_clang_with_gmodules(self):
-compiler_path = self.getCompiler()
-compiler = os.path.basename(compiler_path)
-if compiler != "clang":
-return "Test requires clang as compiler"
-clang_help = os.popen("%s --help" % (compiler_path)).read()
-match = re.match(".* -gmodules ", clang_help, re.DOTALL)
-return "Clang version doesn't support -gmodules flag" if not match 
else None
-return skipTestIfFn(is_compiler_clang_with_gmodules)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py?rev=270848=270847=270848=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
 Thu May 26 08:57:03 2016
@@ -52,6 +52,7 @@ class TopLevelExpressionsTestCase(TestBa
 @add_test_categories(['pyapi'])
 @expectedFailureAndroid(api_levels=[21, 22], bugnumber="llvm.org/pr27787")
 @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], 

Re: [Lldb-commits] [PATCH] D20673: [cmake] Remove the LLDB versions of the exception-controlling variables

2016-05-26 Thread Pavel Labath via lldb-commits
labath added a comment.

Zachary, Todd, you added these in http://reviews.llvm.org/D3929. I know it's a 
long time, but do you recall what was the original motivation for that?

In light of the issue in http://reviews.llvm.org/D20671, I've experimenting 
with compiling lldb with exceptions enabled, and this code here is interfering 
with the standard llvm logic for enabling them (LLVM_ENABLE_EH). Enabling this 
should not make any difference in the common case, as llvm already adds one set 
of exception-disabling flags if you don't specify the flag I mentioned 
(llvm/cmake/modules/AddLLVM.cmake).

So, unless we know of a concrete use case where this is needed, I think we 
should remove it.


http://reviews.llvm.org/D20673



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


Re: [Lldb-commits] [PATCH] D20671: [cmake] Add a big warning about a libstdc++ issue

2016-05-26 Thread Pavel Labath via lldb-commits
labath added a comment.

I am adding everyone I think could be susceptible to this problem. It would be 
a good idea to check if you are still using libstdc++4.8 or older.


http://reviews.llvm.org/D20671



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


Re: [Lldb-commits] [PATCH] D20567: Avoid using stdio in TestVirtual

2016-05-26 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270831: Avoid using stdio in TestVirtual (authored by 
labath).

Changed prior to commit:
  http://reviews.llvm.org/D20567?vs=58418=58579#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20567

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
@@ -84,17 +84,20 @@
 C *c_as_C = new C();
 A *c_as_A = c_as_C;
 
-printf ("a_as_A->a() = '%s'\n", a_as_A->a());
-printf ("a_as_A->b() = '%s'\n", a_as_A->b());
-printf ("a_as_A->c() = '%s'\n", a_as_A->c());
-printf ("b_as_A->a() = '%s'\n", b_as_A->a());
-printf ("b_as_A->b() = '%s'\n", b_as_A->b());
-printf ("b_as_A->c() = '%s'\n", b_as_A->c());
-printf ("b_as_B->aa() = '%s'\n", b_as_B->aa());
-printf ("c_as_A->a() = '%s'\n", c_as_A->a());
-printf ("c_as_A->b() = '%s'\n", c_as_A->b());
-printf ("c_as_A->c() = '%s'\n", c_as_A->c());
-printf ("c_as_C->aa() = '%s'\n", c_as_C->aa());
+char golden[4096];
+char *p = golden;
+char *end = p + sizeof golden;
+p += snprintf(p, end-p, "a_as_A->a() = '%s'\n", a_as_A->a());
+p += snprintf(p, end-p, "a_as_A->b() = '%s'\n", a_as_A->b());
+p += snprintf(p, end-p, "a_as_A->c() = '%s'\n", a_as_A->c());
+p += snprintf(p, end-p, "b_as_A->a() = '%s'\n", b_as_A->a());
+p += snprintf(p, end-p, "b_as_A->b() = '%s'\n", b_as_A->b());
+p += snprintf(p, end-p, "b_as_A->c() = '%s'\n", b_as_A->c());
+p += snprintf(p, end-p, "b_as_B->aa() = '%s'\n", b_as_B->aa());
+p += snprintf(p, end-p, "c_as_A->a() = '%s'\n", c_as_A->a());
+p += snprintf(p, end-p, "c_as_A->b() = '%s'\n", c_as_A->b());
+p += snprintf(p, end-p, "c_as_A->c() = '%s'\n", c_as_A->c());
+p += snprintf(p, end-p, "c_as_C->aa() = '%s'\n", c_as_C->aa());
 puts("");// Set first breakpoint here.
 // then evaluate:
 // expression a_as_A->a()
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
@@ -22,9 +22,6 @@
 # printf() stmts (see main.cpp).
 pattern = re.compile("^([^=]*) = '([^=]*)'$")
 
-# Assert message.
-PRINTF_OUTPUT_GROKKED = "The printf output from compiled code is parsed 
correctly"
-
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
@@ -58,11 +55,13 @@
 thread = lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint)
 self.assertTrue(thread.IsValid(), "There should be a thread stopped 
due to breakpoint condition")
 
-# First, capture the golden output from the program itself from the
-# series of printf statements.
-stdout = process.GetSTDOUT(1024)
-
-self.assertIsNotNone(stdout, "Encountered an error reading the 
process's output")
+# First, capture the golden output from the program itself.
+golden = thread.GetFrameAtIndex(0).FindVariable("golden")
+self.assertTrue(golden.IsValid(), "Encountered an error reading the 
process's golden variable")
+error = lldb.SBError()
+golden_str = 
process.ReadCStringFromMemory(golden.AddressOf().GetValueAsUnsigned(), 4096, 
error);
+self.assertTrue(error.Success())
+self.assertTrue("c_as_C" in golden_str)
 
 # This golden list contains a list of "my_expr = 'value' pairs 
extracted
 # from the golden output.
@@ -72,7 +71,7 @@
 #
 # my_expr = 'value'
 #
-for line in stdout.split(os.linesep):
+for line in golden_str.split(os.linesep):
 match = self.pattern.search(line)
 if match:
 my_expr, val = match.group(1), match.group(2)


Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
@@ -84,17 +84,20 @@
 C *c_as_C = new C();
 A *c_as_A = c_as_C;
 
-printf ("a_as_A->a() = '%s'\n", a_as_A->a());
-printf ("a_as_A->b() = '%s'\n", a_as_A->b());
-printf ("a_as_A->c() = '%s'\n", a_as_A->c());
-printf ("b_as_A->a() = '%s'\n", b_as_A->a());
-printf ("b_as_A->b() = '%s'\n", b_as_A->b());
-printf ("b_as_A->c() = '%s'\n", b_as_A->c());
-printf ("b_as_B->aa() = '%s'\n", b_as_B->aa());

[Lldb-commits] [lldb] r270831 - Avoid using stdio in TestVirtual

2016-05-26 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu May 26 03:38:02 2016
New Revision: 270831

URL: http://llvm.org/viewvc/llvm-project?rev=270831=rev
Log:
Avoid using stdio in TestVirtual

Summary:
using stdio in tests does not work on windows, and it is not completely 
reliable on linux.
Avoid using stdio in this test, as it is not necessary for this purpose.

Reviewers: clayborg

Subscribers: lldb-commits, zturner

Differential Revision: http://reviews.llvm.org/D20567

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py?rev=270831=270830=270831=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py 
Thu May 26 03:38:02 2016
@@ -22,9 +22,6 @@ class CppVirtualMadness(TestBase):
 # printf() stmts (see main.cpp).
 pattern = re.compile("^([^=]*) = '([^=]*)'$")
 
-# Assert message.
-PRINTF_OUTPUT_GROKKED = "The printf output from compiled code is parsed 
correctly"
-
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
@@ -58,11 +55,13 @@ class CppVirtualMadness(TestBase):
 thread = lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint)
 self.assertTrue(thread.IsValid(), "There should be a thread stopped 
due to breakpoint condition")
 
-# First, capture the golden output from the program itself from the
-# series of printf statements.
-stdout = process.GetSTDOUT(1024)
-
-self.assertIsNotNone(stdout, "Encountered an error reading the 
process's output")
+# First, capture the golden output from the program itself.
+golden = thread.GetFrameAtIndex(0).FindVariable("golden")
+self.assertTrue(golden.IsValid(), "Encountered an error reading the 
process's golden variable")
+error = lldb.SBError()
+golden_str = 
process.ReadCStringFromMemory(golden.AddressOf().GetValueAsUnsigned(), 4096, 
error);
+self.assertTrue(error.Success())
+self.assertTrue("c_as_C" in golden_str)
 
 # This golden list contains a list of "my_expr = 'value' pairs 
extracted
 # from the golden output.
@@ -72,7 +71,7 @@ class CppVirtualMadness(TestBase):
 #
 # my_expr = 'value'
 #
-for line in stdout.split(os.linesep):
+for line in golden_str.split(os.linesep):
 match = self.pattern.search(line)
 if match:
 my_expr, val = match.group(1), match.group(2)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp?rev=270831=270830=270831=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp Thu May 
26 03:38:02 2016
@@ -84,17 +84,20 @@ int main (int argc, char const *argv[],
 C *c_as_C = new C();
 A *c_as_A = c_as_C;
 
-printf ("a_as_A->a() = '%s'\n", a_as_A->a());
-printf ("a_as_A->b() = '%s'\n", a_as_A->b());
-printf ("a_as_A->c() = '%s'\n", a_as_A->c());
-printf ("b_as_A->a() = '%s'\n", b_as_A->a());
-printf ("b_as_A->b() = '%s'\n", b_as_A->b());
-printf ("b_as_A->c() = '%s'\n", b_as_A->c());
-printf ("b_as_B->aa() = '%s'\n", b_as_B->aa());
-printf ("c_as_A->a() = '%s'\n", c_as_A->a());
-printf ("c_as_A->b() = '%s'\n", c_as_A->b());
-printf ("c_as_A->c() = '%s'\n", c_as_A->c());
-printf ("c_as_C->aa() = '%s'\n", c_as_C->aa());
+char golden[4096];
+char *p = golden;
+char *end = p + sizeof golden;
+p += snprintf(p, end-p, "a_as_A->a() = '%s'\n", a_as_A->a());
+p += snprintf(p, end-p, "a_as_A->b() = '%s'\n", a_as_A->b());
+p += snprintf(p, end-p, "a_as_A->c() = '%s'\n", a_as_A->c());
+p += snprintf(p, end-p, "b_as_A->a() = '%s'\n", b_as_A->a());
+p += snprintf(p, end-p, "b_as_A->b() = '%s'\n", b_as_A->b());
+p += snprintf(p, end-p, "b_as_A->c() = '%s'\n", b_as_A->c());
+p += snprintf(p, end-p, "b_as_B->aa() = '%s'\n", b_as_B->aa());
+p += snprintf(p, end-p, "c_as_A->a() = '%s'\n", c_as_A->a());
+p += snprintf(p, end-p, "c_as_A->b() = '%s'\n", c_as_A->b());
+p += snprintf(p, end-p, "c_as_A->c() = '%s'\n", c_as_A->c());
+p += snprintf(p, end-p, "c_as_C->aa() = '%s'\n", c_as_C->aa());
 puts("");// Set first breakpoint here.
 // then evaluate:
 // expression a_as_A->a()



Re: [Lldb-commits] [PATCH] D20623: [cmake] Add ability to customize (and skip) debugserver codesign

2016-05-26 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270832: [cmake] Add ability to customize (and skip) 
debugserver codesign (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D20623?vs=58424=58580#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20623

Files:
  lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt

Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -59,29 +59,31 @@
 
 target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})
 
-# Sign the debugserver binary
-set (CODESIGN_IDENTITY lldb_codesign)
-execute_process(
-  COMMAND xcrun -f codesign_allocate
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-  OUTPUT_VARIABLE CODESIGN_ALLOCATE
-  )
-# Older cmake versions don't support "-E env".
-if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2)
-  add_custom_command(TARGET debugserver
-POST_BUILD
-# Note: --entitlements option removed, as it causes errors when debugging.
-# was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign 
--entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist 
--force --sign ${CODESIGN_IDENTITY} debugserver
-COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign 
${CODESIGN_IDENTITY} debugserver
-WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-  )
-else()
-  add_custom_command(TARGET debugserver
-POST_BUILD
-# Note: --entitlements option removed (see comment above).
-COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} 
codesign --force --sign ${CODESIGN_IDENTITY} debugserver
-WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-  )
+set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
+  CACHE STRING "Identity used for code signing. Set to empty string to skip 
the signing step.")
+if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
+  execute_process(
+COMMAND xcrun -f codesign_allocate
+OUTPUT_STRIP_TRAILING_WHITESPACE
+OUTPUT_VARIABLE CODESIGN_ALLOCATE
+)
+  # Older cmake versions don't support "-E env".
+  if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2)
+add_custom_command(TARGET debugserver
+  POST_BUILD
+  # Note: --entitlements option removed, as it causes errors when 
debugging.
+  # was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign 
--entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist 
--force --sign ${LLDB_CODESIGN_IDENTITY} debugserver
+  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign 
${LLDB_CODESIGN_IDENTITY} debugserver
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+)
+  else()
+add_custom_command(TARGET debugserver
+  POST_BUILD
+  # Note: --entitlements option removed (see comment above).
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} 
codesign --force --sign ${LLDB_CODESIGN_IDENTITY} debugserver
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+)
+  endif()
 endif()
 
 install(TARGETS debugserver


Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -59,29 +59,31 @@
 
 target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})
 
-# Sign the debugserver binary
-set (CODESIGN_IDENTITY lldb_codesign)
-execute_process(
-  COMMAND xcrun -f codesign_allocate
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-  OUTPUT_VARIABLE CODESIGN_ALLOCATE
-  )
-# Older cmake versions don't support "-E env".
-if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2)
-  add_custom_command(TARGET debugserver
-POST_BUILD
-# Note: --entitlements option removed, as it causes errors when debugging.
-# was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
-COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
-WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-  )
-else()
-  add_custom_command(TARGET debugserver
-POST_BUILD
-# Note: --entitlements option removed (see comment above).
-COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
-WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-  )
+set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
+  CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.")
+if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
+  execute_process(
+COMMAND xcrun -f codesign_allocate
+OUTPUT_STRIP_TRAILING_WHITESPACE
+OUTPUT_VARIABLE