[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: zturner.
JDevlieghere added a project: LLDB.
Herald added subscribers: jfb, mgorny.

Alternative to https://reviews.llvm.org/D54682.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54692

Files:
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,106 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+
+def version: F<"version">,
+  HelpText<"Prints out the current version number of the LLDB debugger.">;
+def: Flag<["-"], "v">, Alias, HelpText<"Alias for --version">;
+
+def help: F<"help">,
+  HelpText<"Prints out the usage information for the LLDB debugger.">;
+def: Flag<["-"], "h">, Alias, HelpText<"Alias for --help">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">;
+def: Flag<["-"], "P">, Alias, HelpText<"Alias for --python-path">;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">;
+def: Flag<["-"], "b">, Alias, HelpText<"Alias for --batch">;
+
+def core: F<"core">,
+  HelpText<"Tells the debugger to use the full path to  as the core file.">;
+def: Flag<["-"], "c">, Alias, HelpText<"Alias for --core">;
+
+def editor: F<"editor">,
+  HelpText<"Tells the debugger to open source files using the host's \"external editor\" mechanism.">;
+def: Flag<["-"], "e">, Alias, HelpText<"Alias for --editor">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">;
+def: Flag<["-"], "x">, Alias, HelpText<"Alias for --no-lldbinit">;
+
+def no_use_colors: F<"no-use-colors">,
+  HelpText<"Do not use colors.">;
+def: Flag<["-"], "X">, Alias, HelpText<"Alias for --no-use-color">;
+
+def file: Separate<["--", "-"], "file">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the file  as the program to be debugged.">;
+def: Separate<["-"], "f">, Alias, HelpText<"Alias for --file">;
+
+def arch: Separate<["--", "-"], "arch">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified architecture when starting and running the program.">;
+def: Separate<["-"], "a">, Alias, HelpText<"Alias for --arch">;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">;
+def: Separate<["-"], "l">, Alias, HelpText<"Alias for --script-language">;
+
+def debug: F<"debug">,
+  HelpText<"Tells the debugger to print out extra information for debugging itself.">;
+def: Flag<["-"], "d">, Alias, HelpText<"Alias for --debug">;
+
+def reproducer: Separate<["--", "-"], "reproducer">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the fullpath to  as a reproducer.">;
+def: Separate<["-"], "z">, Alias, HelpText<"Alias for --reproducer">;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">;
+def: Flag<["-"], "Q">, Alias, HelpText<"Alias for --source-quietly">;
+
+def attach_name: Separate<["--", "-"], "attach-name">, MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">;
+def: Separate<["-"], "n">, Alias, HelpText<"Alias for --attach-name">;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">;
+def: Flag<["-"], "w">, Alias, HelpText<"Alias for --wait-for">;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">, MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">;
+def: Separate<["-"], "p">, Alias, HelpText<"Alias for --attach-pid">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">;
+def: Separate<["-"], "r">, Alias, HelpText<"Alias for --repl">;
+
+def repl_language: Separate<["--", "-"], "repl-language">, MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">;
+def: Separate<["-"], "R">, Alias, HelpText<"Alias for --repl-language">;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">, MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">;
+def: Separate<["-"], "K">, Alias, HelpText<"Alias for --source-on-crash">;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">, MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">;
+def: Separate<["-"], "k">, Alias, HelpText<"Alias for --one-line-on-crash">;
+
+def source: Separate<["--", "-"], "source">, MetaVarName<"">,
+  HelpText<"

[Lldb-commits] [PATCH] D54682: [Driver] Extract option parsing and option processing.

2018-11-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In https://reviews.llvm.org/D54682#1302448, @zturner wrote:

> Lib option definitely does, as its entire purpose is to be powerful and
>  flexible enough to mimic arbitrary command line tools.


I created https://reviews.llvm.org/D54692 to show what the driver would look 
like using libOption. Personally I think the code looks better but the help is 
more messy, especially with the aliases. It's more consistent with LLVM though, 
which has to count for something.

The only thing that I found missing was support for the "end of options" marker 
(`--`). I ended up implementing a simple work-around, but it seems like the lib 
could benefit from supporting that. I'll have a look when I have some spare 
time.

> cl::opt is a little less powerful but it still preserves order among
>  multiple options with the same flag, just not multiple options with
>  different flags.
> 
> I don’t have a strong opinion that this particular change should be gated
>  on that, it’s just nice when we can reuse llvm logic. Sometimes it fixes
>  latent bugs, sometimes it enables new functionality that wasn’t possible
>  before, etc. up to you if you wanna give it a shot

I'm always a strong proponent of reusing llvm logic.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54682



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


[Lldb-commits] [lldb] r347188 - Remove unused variable. NFC.

2018-11-19 Thread Benjamin Kramer via lldb-commits
Author: d0k
Date: Mon Nov 19 02:59:12 2018
New Revision: 347188

URL: http://llvm.org/viewvc/llvm-project?rev=347188&view=rev
Log:
Remove unused variable. NFC.

Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=347188&r1=347187&r2=347188&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Mon Nov 19 02:59:12 2018
@@ -770,7 +770,6 @@ typedef union {
 } TaggedDoubleBits;
 
 static uint64_t decodeExponent(uint64_t exp) {
-  int64_t exp7 = exp;
   // Tagged exponent field is 7-bit signed. Sign-extend the value to 64 bits
   // before performing arithmetic.
   return llvm::SignExtend64<7>(exp) + TAGGED_DATE_EXPONENT_BIAS;


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


[Lldb-commits] [PATCH] D54682: [Driver] Extract option parsing and option processing.

2018-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

If by //"it would cause errors to no longer appear in the same order as 
specified by the user, but in an arbitrary order specified by the driver 
implementation"//, you mean that now for a command line like:

  $ new/lldb -S /tmp/sadg --file /tmp/qwr

I get

  error: file specified in --file (-f) option doesn't exist: '/tmp/qwr'

instead of

  error: file specified in --source (-s) option doesn't exist: '/tmp/sadg'

then that's something I really don't care about.

I have to agree that the new --help output is less readable than the old one, 
but that's a price I would be willing to pay for getting rid of getopt. And 
this can be easily improved in the future, either by rolling our own --help 
output (as we do now anyway), or by improving the central libOption help 
printer (thereby improving `clang --help` output as well, which I also find 
lacking in readability).

So yes, I'm in favour of the libOption approach, or at least cleaning this up 
by "sacrificing" the error message order.

(I also have to point out that for libOption to work, someone will have to dive 
into the xcode project to get the tablegen rules in there.)


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54682



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


[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: include/lldb/Utility/Reproducer.h:59-64
+  void InitializeFileInfo(llvm::StringRef name,
+  llvm::ArrayRef files) {
+m_info.name = name;
+for (auto file : files)
+  m_info.files.push_back(file);
+  }

Could this be replaced by additional arguments to the constructor (avoiding 
two-stage initialization)?



Comment at: include/lldb/Utility/Reproducer.h:99
+  template  T *Get() {
+auto it = m_providers.find(T::NAME);
+if (it == m_providers.end())

Is the value of the `NAME` used anywhere? If not, you could just have each 
class define a `char` variable (like `llvm::ErrorInfo` subclasses do) and then 
use its address as a key, making everything faster.

(Even if name is useful (for printing to the user or whatever), it might be 
worth to switch to using the char-address for lookup and then just have 
`getName` method for other things.)



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:304
+ProcessGDBRemoteProvider *provider =
+g->GetOrCreate();
 // Set the history stream to the stream owned by the provider.

could `GetOrCreate` keep returning a reference (to avoid spurious `guaranteed 
to be not null` comments)?



Comment at: source/Utility/Reproducer.cpp:131-133
+  assert(m_providers.empty() &&
+ "Changing the root directory after providers have "
+ "been registered would invalidate the index.");

Given these limitations, would it be possible to set the root once in the 
constructor and keep it immutable since then?



Comment at: unittests/Utility/ReproducerTest.cpp:44-46
+auto error = reproducer.SetReplay(FileSpec("/bogus/path"));
+EXPECT_TRUE(static_cast(error));
+llvm::consumeError(std::move(error));

Shorter and with better error messages:
`EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), 
llvm::Succeeded());`



Comment at: unittests/Utility/ReproducerTest.cpp:79-81
+auto error = reproducer.SetCapture(FileSpec("/bogus/path"));
+EXPECT_TRUE(static_cast(error));
+llvm::consumeError(std::move(error));

`EXPECT_THAT_ERROR(..., llvm::Failed());`


https://reviews.llvm.org/D54616



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


[Lldb-commits] [PATCH] D54617: [wip][Reproducers] Add file provider

2018-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D54617#1302376, @JDevlieghere wrote:

> In https://reviews.llvm.org/D54617#1302366, @labath wrote:
>
> > I am confused by differing scopes of various objects that are interacting 
> > here. It seems you are implementing capture/replay as something that can be 
> > flicked on/off at any point during a debug session (`Debugger` lifetime). 
> > However, you are modifying global state (the filesystem singleton, at 
> > least), which is shared by all debug sessions. If multiple debug sessions 
> > try to enable capture/replay (or even access the filesystem concurrently, 
> > as none of this is synchronized in any way), things will break horribly. 
> > This seems like a bad starting point in implementing a feature, as I don't 
> > see any way to fix incrementally in the future.
>
>
> Maybe I should've added a comment (I didn't want to litter the code with 
> design goals) but the goal of the commands is not really to enable/disable 
> the reproducer feature. I'm currently abusing the commands to do that, but 
> the long term goal is that you can enable/disable part of the reproducer. For 
> example, you could say only capture GDB packets or capture only files. It 
> makes testing a lot easier if you can isolate a single source of information. 
> Since there's currently only GDB packets I didn't split it up (yet).
>
> Also I piggy-backed off this to enable/disable the feature as a whole because 
> I needed to go through the debugger. See my reply below on why and how 
> that'll be fixed by the next patch :-)


Ok, that makes sense, thanks for the explanation. I guess that means that 
filesystem capturing (due to it being global) will then be one of the things 
that cannot be enabled/disabled at runtime ?




Comment at: source/Host/common/FileSystem.cpp:71-74
+  llvm::ErrorOr> buffer =
+  m_fs->getBufferForFile(mapping);
+  if (!buffer)
+return;

Do you want to propagate this error up the stack?



Comment at: source/Utility/FileCollector.cpp:31-32
+  // default.
+  for (auto &C : path)
+upper_dest.push_back(toUpper(C));
+  if (sys::fs::real_path(upper_dest, real_dest) && path.equals(real_dest))

`upper_dest = path.upper();` ?



Comment at: source/Utility/FileCollector.cpp:82-87
+  // Remove redundant leading "./" pieces and consecutive separators.
+  absolute_src = sys::path::remove_leading_dotslash(absolute_src);
+
+  // Canonicalize the source path by removing "..", "." components.
+  SmallString<256> virtual_path = absolute_src;
+  sys::path::remove_dots(virtual_path, /*remove_dot_dot=*/true);

Is there anything which `remove_leading_dotslash` does, which wouldn't be done 
by the latter `remove_dots` call?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54617



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


Re: [Lldb-commits] [lldb] r347125 - Just don't even attempt to invoke sed on Windows.

2018-11-19 Thread Pavel Labath via lldb-commits

On 17/11/2018 02:27, Adrian Prantl via lldb-commits wrote:

Author: adrian
Date: Fri Nov 16 17:27:47 2018
New Revision: 347125

URL: http://llvm.org/viewvc/llvm-project?rev=347125&view=rev
Log:
Just don't even attempt to invoke sed on Windows.

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=347125&r1=347124&r2=347125&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Fri Nov 16 
17:27:47 2018
@@ -253,7 +253,12 @@ ifeq "$(MAKE_DWO)" "YES"
  endif
  
  # Use a shared module cache when building in the default test build directory.

+ifeq "$(OS)" "Windows_NT"
+CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
+else
+# FIXME: Get sed to work on Windows here.
  CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed 
's/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/')
+endif
  
  ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" ""

  CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache


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



Could we just have dotest pass the correct value for the module cache 
(or the root build dir, which would make the computation of the module 
cache dir trivial)?


This way you wouldn't even have to depend on the "default" build 
directory name.

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


[Lldb-commits] [PATCH] D54680: Don't use lldb -O in lit tests

2018-11-19 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347213: Don't use -O in lit tests. (authored by 
zturner, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54680?vs=174549&id=174609#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54680

Files:
  lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
  lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
  lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
  lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
  lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
  lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
  lldb/trunk/lit/ExecControl/StopHook/stop-hook.test


Index: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
===
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
@@ -1,19 +1,7 @@
 # RUN: %cxx %p/Inputs/stop-hook-threads.cpp -g -o %t
-# RUN: %lldb -b -s %s -O 'target create %t' \
-# RUN: -O 'break set -f stop-hook-threads.cpp -p "Break here to test that 
the stop-hook"' \
-# RUN: -O run \
-# RUN: -O 'target stop-hook add' \
-# RUN:-O "frame variable --show-globals g_val" \
-# RUN:-O "thread list" \
-# RUN:-O continue \
-# RUN:-O DONE \
+# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
-# RUN: %lldb -b -s %s \
-# RUN: -O 'target create %t' \
-# RUN: -O 'break set -f stop-hook-threads.cpp -p "Break here to test that 
the stop-hook"' \
-# RUN: -O run \
-# RUN: -O 'target stop-hook add -x 2 -o "frame variable thread_index"' \
-# RUN: -O 'target stop-hook add -o continue' \
+# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FILTER %s
 
 thread list
Index: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
===
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
@@ -0,0 +1,3 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34
+expr ptr
+DONE
\ No newline at end of file
Index: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
===
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
@@ -0,0 +1 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34 -o "expr ptr"
\ No newline at end of file
Index: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
===
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
@@ -0,0 +1 @@
+target stop-hook add -n b -o "expr ptr"
Index: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
===
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
@@ -0,0 +1,4 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add -x 2 -o "frame variable thread_index"
+target stop-hook add -o continue
Index: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
===
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
@@ -0,0 +1,7 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add
+frame variable --show-globals g_val
+thread list
+continue
+DONE
Index: lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
===
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
@@ -1,11 +1,11 @@
 # RUN: %cc %p/Inputs/stop-hook.c -g -o %t
 # Test setting stop-hook per-function
-# RUN: %lldb -b -s %s -O 'target create %t' -O 'target stop-hook add -n b -o 
"expr ptr"' \
+# RUN: %lldb -b -s %p/Inputs/stop-hook-1.lldbinit -s %s -f %t \
 # RUN:  | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FUNC %s
 # Test setting stop-hook per-line range
-# RUN: %lldb -b -s %s -O 'target create %t' -O 'target stop-hook add -f 
stop-hook.c -l 30 -e 34 -o "expr ptr"'  | FileCheck %s
+# RUN: %lldb -b -s %p/Inputs/stop-hook-2.l

[Lldb-commits] [lldb] r347213 - Don't use -O in lit tests.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 07:06:10 2018
New Revision: 347213

URL: http://llvm.org/viewvc/llvm-project?rev=347213&view=rev
Log:
Don't use -O in lit tests.

Because of different shell quoting rules, and the fact that LLDB
commands often contain spaces, -O is not portable for writing command
lines. Instead, we should use explicit lldbinit files.

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

Added:
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
Modified:
lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
lldb/trunk/lit/ExecControl/StopHook/stop-hook.test

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1 @@
+target stop-hook add -n b -o "expr ptr"

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34 -o "expr ptr"
\ No newline at end of file

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit (added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit Mon Nov 19 
07:06:10 2018
@@ -0,0 +1,3 @@
+target stop-hook add -f stop-hook.c -l 30 -e 34
+expr ptr
+DONE
\ No newline at end of file

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit 
(added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit Mon 
Nov 19 07:06:10 2018
@@ -0,0 +1,7 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add
+frame variable --show-globals g_val
+thread list
+continue
+DONE

Added: lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit?rev=347213&view=auto
==
--- lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit 
(added)
+++ lldb/trunk/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit Mon 
Nov 19 07:06:10 2018
@@ -0,0 +1,4 @@
+break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
+run
+target stop-hook add -x 2 -o "frame variable thread_index"
+target stop-hook add -o continue

Modified: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test?rev=347213&r1=347212&r2=347213&view=diff
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test (original)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test Mon Nov 19 
07:06:10 2018
@@ -1,19 +1,7 @@
 # RUN: %cxx %p/Inputs/stop-hook-threads.cpp -g -o %t
-# RUN: %lldb -b -s %s -O 'target create %t' \
-# RUN: -O 'break set -f stop-hook-threads.cpp -p "Break here to test that 
the stop-hook"' \
-# RUN: -O run \
-# RUN: -O 'target stop-hook add' \
-# RUN:-O "frame variable --show-globals g_val" \
-# RUN:-O "thread list" \
-# RUN:-O continue \
-# RUN:-O DONE \
+# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
-# RUN: %lldb -b -s %s \
-# RUN: -O 'target create %t' \
-# RUN: -O 'break set -f stop-h

[Lldb-commits] [PATCH] D54567: Fix LLDB's lit files

2018-11-19 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC347216: Fix some issues with LLDB's lit configuration 
files. (authored by zturner, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54567?vs=174473&id=174610#toc

Repository:
  rC Clang

https://reviews.llvm.org/D54567

Files:
  test/lit.cfg.py


Index: test/lit.cfg.py
===
--- test/lit.cfg.py
+++ test/lit.cfg.py
@@ -43,6 +43,10 @@
 
 llvm_config.use_clang()
 
+config.substitutions.append(
+('%src_include_dir', config.clang_src_dir + '/include'))
+
+
 # Propagate path to symbolizer for ASan/MSan.
 llvm_config.with_system_environment(
 ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])


Index: test/lit.cfg.py
===
--- test/lit.cfg.py
+++ test/lit.cfg.py
@@ -43,6 +43,10 @@
 
 llvm_config.use_clang()
 
+config.substitutions.append(
+('%src_include_dir', config.clang_src_dir + '/include'))
+
+
 # Propagate path to symbolizer for ASan/MSan.
 llvm_config.with_system_environment(
 ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347216 - Fix some issues with LLDB's lit configuration files.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 07:12:34 2018
New Revision: 347216

URL: http://llvm.org/viewvc/llvm-project?rev=347216&view=rev
Log:
Fix some issues with LLDB's lit configuration files.

Recently I tried to port LLDB's lit configuration files over to use a
on the surface, but broke some cases that weren't broken before and also
exposed some additional problems with the old approach that we were just
getting lucky with.

When we set up a lit environment, the goal is to make it as hermetic as
possible. We should not be relying on PATH and enabling the use of
arbitrary shell commands. Instead, only whitelisted commands should be
allowed. These are, generally speaking, the lit builtins such as echo,
cd, etc, as well as anything for which substitutions have been
explicitly set up for. These substitutions should map to the build
output directory, but in some cases it's useful to be able to override
this (for example to point to an installed tools directory).

This is, of course, how it's supposed to work. What was actually
happening is that we were bringing in PATH and LD_LIBRARY_PATH and then
just running the given run line as a shell command. This led to problems
such as finding the wrong version of clang-cl on PATH since it wasn't
even a substitution, and flakiness / non-determinism since the
environment the tests were running in would change per-machine. On the
other hand, it also made other things possible. For example, we had some
tests that were explicitly running cl.exe and link.exe instead of
clang-cl and lld-link and the only reason it worked at all is because it
was finding them on PATH. Unfortunately we can't entirely get rid of
these tests, because they support a few things in debug info that
clang-cl and lld-link don't (notably, the LF_UDT_MOD_SRC_LINE record
which makes some of the tests fail.

The high level changes introduced in this patch are:

1. Removal of functionality - The lit test suite no longer respects
   LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. This means there is no
   more support for gcc, but nobody was using this anyway (note: The
   functionality is still there for the dotest suite, just not the lit test
   suite). There is no longer a single substitution %cxx and %cc which maps
   to , you now explicitly specify the compiler with a
   substitution like %clang or %clangxx or %clang_cl. We can revisit this
   in the future when someone needs gcc.

2. Introduction of the LLDB_LIT_TOOLS_DIR directory. This does in spirit
   what LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER used to do, but now
   more friendly. If this is not specified, all tools are expected to be
   the just-built tools. If it is specified, the tools which are not
   themselves being tested but are being used to construct and run checks
   (e.g. clang, FileCheck, llvm-mc, etc) will be searched for in this
   directory first, then the build output directory.

3. Changes to core llvm lit files. The use_lld() and use_clang()
   functions were introduced long ago in anticipation of using them in
   lldb, but since they were never actually used anywhere but their
   respective problems, there were some issues to be resolved regarding
   generality and ability to use them outside their project.

4. Changes to .test files - These are all just replacing things like
   clang-cl with %clang_cl and %cxx with %clangxx, etc.

5. Changes to lit.cfg.py - Previously we would load up some system
   environment variables and then add some new things to them. Then do a
   bunch of work building out our own substitutions. First, we delete the
   system environment variable code, making the environment hermetic. Then,
   we refactor the substitution logic into two separate helper functions,
   one which sets up substitutions for the tools we want to test (which
   must come from the build output directory), and another which sets up
   substitutions for support tools (like compilers, etc).

6. New substitutions for MSVC -- Previously we relied on location of
   MSVC by bringing in the entire parent's PATH and letting
   subprocess.Popen just run the command line. Now we set up real
   substitutions that should have the same effect. We use PATH to find
   them, and then look for INCLUDE and LIB to construct a substitution
   command line with appropriate /I and /LIBPATH: arguments. The nice thing
   about this is that it opens the door to having separate %msvc-cl32 and
   %msvc-cl64 substitutions, rather than only requiring the user to run
   vcvars first. Because we can deduce the path to 32-bit libraries from
   64-bit library directories, and vice versa. Without these substitutions
   this would have been impossible.

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

Added:
lldb/trunk/lit/helper/
lldb/trunk/lit/helper/__init__.py
lldb/trunk/lit/helper/toolchain.py
Modified:
lldb/trunk/lit/Breakpoint/case-insensitive.test
lldb/trunk/lit/Breakpoint/case-sensitive.test
lldb/trunk/lit/ExecContro

[Lldb-commits] [lldb] r347223 - Remove non-ASCII characters at the beginning of file.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 08:41:31 2018
New Revision: 347223

URL: http://llvm.org/viewvc/llvm-project?rev=347223&view=rev
Log:
Remove non-ASCII characters at the beginning of file.

It's not clear how these ended up in the file, but this fixes it.

Modified:
lldb/trunk/lit/helper/toolchain.py

Modified: lldb/trunk/lit/helper/toolchain.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/toolchain.py?rev=347223&r1=347222&r2=347223&view=diff
==
--- lldb/trunk/lit/helper/toolchain.py (original)
+++ lldb/trunk/lit/helper/toolchain.py Mon Nov 19 08:41:31 2018
@@ -1,4 +1,4 @@
-import os
+import os
 import platform
 import subprocess
 import sys


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


[Lldb-commits] [lldb] r347224 - [lit] On Windows, don't error if MSVC is not in PATH.

2018-11-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov 19 08:47:06 2018
New Revision: 347224

URL: http://llvm.org/viewvc/llvm-project?rev=347224&view=rev
Log:
[lit] On Windows, don't error if MSVC is not in PATH.

We had some logic backwards, and as a result if MSVC was not found
in PATH we would throw a string concatenation exception.

Modified:
lldb/trunk/lit/helper/toolchain.py

Modified: lldb/trunk/lit/helper/toolchain.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/toolchain.py?rev=347224&r1=347223&r2=347224&view=diff
==
--- lldb/trunk/lit/helper/toolchain.py (original)
+++ lldb/trunk/lit/helper/toolchain.py Mon Nov 19 08:47:06 2018
@@ -42,12 +42,14 @@ def _use_msvc_substitutions(config):
 # If running from a Visual Studio Command prompt (e.g. vcvars), this will
 # detect the include and lib paths, and find cl.exe and link.exe and create
 # substitutions for each of them that explicitly specify /I and /L paths
-cl = '"' + lit.util.which('cl') + '"'
-link = '"' + lit.util.which('link') + '"'
+cl = lit.util.which('cl')
+link = lit.util.which('link')
 
 if not cl or not link:
 return
 
+cl = '"' + cl + '"'
+link = '"' + link + '"'
 includes = os.getenv('INCLUDE', '').split(';')
 libs = os.getenv('LIB', '').split(';')
 


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


[Lldb-commits] [PATCH] D54709: [lldbsuite] Invoke sed on Windows to determine the cache dir for clang

2018-11-19 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova created this revision.
stella.stamenova added reviewers: aprantl, zturner.
Herald added subscribers: lldb-commits, teemperor.

In order to invoke sed on Windows, we need to quote the command correctly. 
Since we already have commands which do that, move the definitions at the 
beginning of the file and then re-use them for each command.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54709

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
@@ -60,6 +60,22 @@
 	SHELL = $(WINDIR)\system32\cmd.exe
 endif
 
+#--
+# If the OS is Windows use double-quotes in commands
+#
+# For other operating systems, single-quotes work fine, but on Windows
+# we strictly required double-quotes
+#--
+ifeq "$(HOST_OS)" "Windows_NT"
+	JOIN_CMD = &
+	QUOTE = "
+	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
+else
+	JOIN_CMD = ;
+	QUOTE = '
+	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
+endif
+
 #--
 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
 # from the triple alone
@@ -74,8 +90,8 @@
 	TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
 	ifeq "$(TRIPLE_VENDOR)" "apple"
 		ifeq "$(TRIPLE_OS)" "ios"
-		CODESIGN := codesign
-		ifeq "$(SDKROOT)" ""
+			CODESIGN := codesign
+			ifeq "$(SDKROOT)" ""
 # Set SDKROOT if it wasn't set
 ifneq (,$(findstring arm,$(ARCH)))
 	SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path)
@@ -253,12 +269,7 @@
 endif
 
 # Use a shared module cache when building in the default test build directory.
-ifeq "$(OS)" "Windows_NT"
-CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
-else
-# FIXME: Get sed to work on Windows here.
-CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed 's/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/')
-endif
+CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed $(QUOTE)s/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/$(QUOTE))
 
 ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" ""
 CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
@@ -343,7 +354,7 @@
 endif
 
 ifdef PIE
-LDFLAGS += -pie
+	LDFLAGS += -pie
 endif
 
 #--
@@ -408,17 +419,17 @@
 endif
 
 ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
-DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
-CXX = $(call cxx_compiler,$(CC))
-LD = $(call cxx_linker,$(CC))
+	DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
+	CXX = $(call cxx_compiler,$(CC))
+	LD = $(call cxx_linker,$(CC))
 endif
 
 #--
 # Check if we have a precompiled header
 #--
 ifneq "$(strip $(PCH_CXX_SOURCE))" ""
-PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
-PCHFLAGS = -include $(PCH_CXX_SOURCE)
+	PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
+	PCHFLAGS = -include $(PCH_CXX_SOURCE)
 endif
 
 #--
@@ -500,21 +511,21 @@
 ifneq "$(filter g++,$(CXX))" ""
 	CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3)
 	ifeq "$(CXXVERSION)" "4.6"
-# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
-# instead. FIXME: remove once GCC version is upgraded.
+		# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
+		# instead. FIXME: remove once GCC version is upgraded.
 		override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
 	endif
 endif
 endif
 
 ifeq ($(findstring clang, $(CXX)), clang)
-  CXXFLAGS += --driver-mode=g++
+	CXXFLAGS += --driver-mode=g++
 endif
 
 ifneq "$(CXX)" ""
-  ifeq ($(findstring clang, $(LD)), clang)
-LDFLAGS += --driver-mode=g++
-  endif
+	ifeq ($(findstring clang, $(LD)), clang)
+		LDFLAGS += --driver-mode=g++
+	endif
 endif
 
 #--
@@ -628,16 +639,6 @@
 # the compiler -MM option. The -M option will list all system headers,
 # and the -MM option will list all non-system dependencies.
 #--
-ifeq "$(HOST_OS)" "Windows_NT"
-	JOIN_CMD = &
-	QUOTE = "
-	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
-else
-	JOIN_CMD = ;
-	QUOTE = '
-	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
-endif
-
 %.d: %.c
 	@rm -f $@ $(JOIN_CMD) \
 	$(CC) -M $(CFLAGS) $< > $@.tmp && \
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/l

[Lldb-commits] [lldb] r347243 - [lldbsuite] Invoke sed on Windows to determine the cache dir for clang

2018-11-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Mon Nov 19 10:41:33 2018
New Revision: 347243

URL: http://llvm.org/viewvc/llvm-project?rev=347243&view=rev
Log:
[lldbsuite] Invoke sed on Windows to determine the cache dir for clang

Summary: In order to invoke sed on Windows, we need to quote the command 
correctly. Since we already have commands which do that, move the definitions 
at the beginning of the file and then re-use them for each command.

Reviewers: aprantl, zturner

Subscribers: teemperor, lldb-commits

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

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=347243&r1=347242&r2=347243&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Mon Nov 19 
10:41:33 2018
@@ -61,6 +61,22 @@ ifeq "$(OS)" "Windows_NT"
 endif
 
 #--
+# If the OS is Windows use double-quotes in commands
+#
+# For other operating systems, single-quotes work fine, but on Windows
+# we strictly required double-quotes
+#--
+ifeq "$(HOST_OS)" "Windows_NT"
+   JOIN_CMD = &
+   QUOTE = "
+   FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
+else
+   JOIN_CMD = ;
+   QUOTE = '
+   FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
+endif
+
+#--
 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
 # from the triple alone
 #--
@@ -74,8 +90,8 @@ ifneq "$(TRIPLE)" ""
TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
ifeq "$(TRIPLE_VENDOR)" "apple"
ifeq "$(TRIPLE_OS)" "ios"
-   CODESIGN := codesign
-   ifeq "$(SDKROOT)" ""
+   CODESIGN := codesign
+   ifeq "$(SDKROOT)" ""
# Set SDKROOT if it wasn't set
ifneq (,$(findstring arm,$(ARCH)))
SDKROOT = $(shell xcrun --sdk iphoneos 
--show-sdk-path)
@@ -253,12 +269,7 @@ ifeq "$(MAKE_DWO)" "YES"
 endif
 
 # Use a shared module cache when building in the default test build directory.
-ifeq "$(OS)" "Windows_NT"
-CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
-else
-# FIXME: Get sed to work on Windows here.
-CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed 
's/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/')
-endif
+CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed 
$(QUOTE)s/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/$(QUOTE))
 
 ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" ""
 CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
@@ -343,7 +354,7 @@ ifneq "$(OS)" "Darwin"
 endif
 
 ifdef PIE
-LDFLAGS += -pie
+   LDFLAGS += -pie
 endif
 
 #--
@@ -408,17 +419,17 @@ ifneq "$(strip $(DYLIB_OBJC_SOURCES))" "
 endif
 
 ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
-DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
-CXX = $(call cxx_compiler,$(CC))
-LD = $(call cxx_linker,$(CC))
+   DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
+   CXX = $(call cxx_compiler,$(CC))
+   LD = $(call cxx_linker,$(CC))
 endif
 
 #--
 # Check if we have a precompiled header
 #--
 ifneq "$(strip $(PCH_CXX_SOURCE))" ""
-PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
-PCHFLAGS = -include $(PCH_CXX_SOURCE)
+   PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
+   PCHFLAGS = -include $(PCH_CXX_SOURCE)
 endif
 
 #--
@@ -500,21 +511,21 @@ ifneq "$(strip $(CXX_SOURCES) $(OBJCXX_S
 ifneq "$(filter g++,$(CXX))" ""
CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3)
ifeq "$(CXXVERSION)" "4.6"
-# GCC 4.6 cannot handle -std=c++11, so replace it with 
-std=c++0x
-# instead. FIXME: remove once GCC version is upgraded.
+   # GCC 4.6 cannot handle -std=c++11, so replace it with 
-std=c++0x
+   # instead. FIXME: remove once GCC version is upgraded.
override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
endif
 endif
 endif
 
 ifeq ($(findstring clang, $(CXX)), clang)
-  CXXFLAGS += --driver-mode=g++
+   CXXFLAGS += --driver-mode=g++
 

[Lldb-commits] [PATCH] D54709: [lldbsuite] Invoke sed on Windows to determine the cache dir for clang

2018-11-19 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347243: [lldbsuite] Invoke sed on Windows to determine the 
cache dir for clang (authored by stella.stamenova, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54709?vs=174630&id=174649#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54709

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
@@ -61,6 +61,22 @@
 endif
 
 #--
+# If the OS is Windows use double-quotes in commands
+#
+# For other operating systems, single-quotes work fine, but on Windows
+# we strictly required double-quotes
+#--
+ifeq "$(HOST_OS)" "Windows_NT"
+	JOIN_CMD = &
+	QUOTE = "
+	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
+else
+	JOIN_CMD = ;
+	QUOTE = '
+	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
+endif
+
+#--
 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
 # from the triple alone
 #--
@@ -74,8 +90,8 @@
 	TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
 	ifeq "$(TRIPLE_VENDOR)" "apple"
 		ifeq "$(TRIPLE_OS)" "ios"
-		CODESIGN := codesign
-		ifeq "$(SDKROOT)" ""
+			CODESIGN := codesign
+			ifeq "$(SDKROOT)" ""
 # Set SDKROOT if it wasn't set
 ifneq (,$(findstring arm,$(ARCH)))
 	SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path)
@@ -253,12 +269,7 @@
 endif
 
 # Use a shared module cache when building in the default test build directory.
-ifeq "$(OS)" "Windows_NT"
-CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
-else
-# FIXME: Get sed to work on Windows here.
-CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed 's/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/')
-endif
+CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed $(QUOTE)s/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/$(QUOTE))
 
 ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" ""
 CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache
@@ -343,7 +354,7 @@
 endif
 
 ifdef PIE
-LDFLAGS += -pie
+	LDFLAGS += -pie
 endif
 
 #--
@@ -408,17 +419,17 @@
 endif
 
 ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
-DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
-CXX = $(call cxx_compiler,$(CC))
-LD = $(call cxx_linker,$(CC))
+	DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
+	CXX = $(call cxx_compiler,$(CC))
+	LD = $(call cxx_linker,$(CC))
 endif
 
 #--
 # Check if we have a precompiled header
 #--
 ifneq "$(strip $(PCH_CXX_SOURCE))" ""
-PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
-PCHFLAGS = -include $(PCH_CXX_SOURCE)
+	PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
+	PCHFLAGS = -include $(PCH_CXX_SOURCE)
 endif
 
 #--
@@ -500,21 +511,21 @@
 ifneq "$(filter g++,$(CXX))" ""
 	CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3)
 	ifeq "$(CXXVERSION)" "4.6"
-# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
-# instead. FIXME: remove once GCC version is upgraded.
+		# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
+		# instead. FIXME: remove once GCC version is upgraded.
 		override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
 	endif
 endif
 endif
 
 ifeq ($(findstring clang, $(CXX)), clang)
-  CXXFLAGS += --driver-mode=g++
+	CXXFLAGS += --driver-mode=g++
 endif
 
 ifneq "$(CXX)" ""
-  ifeq ($(findstring clang, $(LD)), clang)
-LDFLAGS += --driver-mode=g++
-  endif
+	ifeq ($(findstring clang, $(LD)), clang)
+		LDFLAGS += --driver-mode=g++
+	endif
 endif
 
 #--
@@ -628,16 +639,6 @@
 # the compiler -MM option. The -M option will list all system headers,
 # and the -MM option will list all non-system dependencies.
 #--
-ifeq "$(HOST_OS)" "Windows_NT"
-	JOIN_CMD = &
-	QUOTE = "
-	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
-else
-	JOIN_CMD = ;
-	QUOTE = '
-	FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
-endif
-
 %.d: %.c
 	@rm -f $@ $(JOIN_CMD) \
 	$(CC) -M $(CFLAGS) $< > $@.tmp && \
__

[Lldb-commits] [lldb] r347254 - Fix clang test suite on Windows by reverting part of r347216

2018-11-19 Thread Reid Kleckner via lldb-commits
Author: rnk
Date: Mon Nov 19 11:36:28 2018
New Revision: 347254

URL: http://llvm.org/viewvc/llvm-project?rev=347254&view=rev
Log:
Fix clang test suite on Windows by reverting part of r347216

Otherwise, the clang analyzer tests fail on Windows when attempting to
unpickle AnalyzerTest objects in the worker processes. The pattern of,
add to path, import, remove from path, serialize, deserialize, doesn't
work. Once something gets added to the path, if we want to move it
across the wire for multiprocessing, we need to keep the module on
sys.path.

Modified:
lldb/trunk/lit/lit.cfg.py

Modified: lldb/trunk/lit/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg.py?rev=347254&r1=347253&r2=347254&view=diff
==
--- lldb/trunk/lit/lit.cfg.py (original)
+++ lldb/trunk/lit/lit.cfg.py Mon Nov 19 11:36:28 2018
@@ -11,6 +11,7 @@ from lit.llvm import llvm_config
 from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
+site.addsitedir(os.path.dirname(__file__))
 from helper import toolchain
 
 # name: The name of this test suite.


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


[Lldb-commits] [PATCH] D54731: [lit] Enable the use of custom user-defined lit commands

2018-11-19 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added reviewers: labath, stella.stamenova, davide, rnk, aprantl, friss.
Herald added a subscriber: delcypher.

Currently lit supports running shell commands through the use of the `RUN: ` 
prefix.  This patch allows individual test suites to install their own run 
handlers that can do things other than run shell commands.  `RUN` commands 
still work as they always do, just that now if a different kind of command 
appears it will be appropriately sequenced along with the run command.

The commands the user installs can execute arbitrary Python code.  As such, 
they can in theory write directly to stdout or stderr, but a well-behaved 
command should return its stdout and stderr from the function so that this can 
be reported to the user in a manner consistent with output from `RUN` lines.

The motivating use case for this is being able to provide a richer and more 
powerful syntax by which to compile test programs in LLDB tests.  Currently 
everything is based off of substitutions and explicitly shell commands, but 
this is problematic when you get into interesting compilation scenarios.

For example, one could imagine wanting to write a test that tested the behavior 
of the debugger with optimized code.  Each driver has different sets of flags 
that control the optimization behavior.

Another example is in cross-compilation scenarios.  Certain types of PDB tests 
don't need to run a process, so the tests can be run anywhere, but they need to 
be linked with special flags to avoid pulling in system libraries.

We can try to make substitutions for all of these cases, but it will quickly 
become unwieldy and you will end up with a command line like: `RUN: %cxx %debug 
%opt %norun`, and this still isn't as flexible as you'd like.

With this patch, we could (in theory) do the compilation directly from Python.  
Instead of a shell command like above, we could write something like:

  COMPILE: mode=debug \
   opt=none \
   link=no
   output=%t.o
   clean=yes
   source=%p/Inputs/foo.cpp

and let the function figure out how best to do this for each platform.  This is 
similar in spirit to how lldb's `dotest.py` already works with its platform 
specific builders, but the mechanism here is general enough that it can be used 
for anything a test suite wants, not just compiling.


https://reviews.llvm.org/D54731

Files:
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/ShCommands.py
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword-command.txt
  llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword_helper.py
  llvm/utils/lit/tests/Inputs/shtest-keyword-command/lit.cfg
  llvm/utils/lit/tests/shtest-keyword-command.py

Index: llvm/utils/lit/tests/shtest-keyword-command.py
===
--- /dev/null
+++ llvm/utils/lit/tests/shtest-keyword-command.py
@@ -0,0 +1,22 @@
+# Check the that keyword commands work as expected.
+#
+# RUN: %{lit} -j 1 -sav %{inputs}/shtest-keyword-command > %t.out
+# RUN: FileCheck --input-file %t.out %s
+#
+# END.
+
+# CHECK: $ MYCOMMAND: at line 1  Command1
+# CHECK: command output:
+# CHECK: STDOUT:   Command1
+# CHECK: command stderr:
+# CHECK: STDERR:   Command1
+# CHECK: $ MYCOMMAND: at line 2  Command2
+# CHECK: command output:
+# CHECK: STDOUT:   Command2
+# CHECK: command stderr:
+# CHECK: STDERR:   Command2
+# CHECK: $ MYCOMMAND: at line 3  Multi-lineCommand
+# CHECK: command output:
+# CHECK: STDOUT:   Multi-lineCommand
+# CHECK: command stderr:
+# CHECK: STDERR:   Multi-lineCommand
\ No newline at end of file
Index: llvm/utils/lit/tests/Inputs/shtest-keyword-command/lit.cfg
===
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/shtest-keyword-command/lit.cfg
@@ -0,0 +1,18 @@
+
+import os
+import site
+
+site.addsitedir(os.path.dirname(__file__))
+
+
+import lit.formats
+import keyword_helper
+
+config.name = 'shtest-keyword-command'
+config.suffixes = ['.txt']
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None
+config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
+
+lit_config.installKeywordCommand('MYCOMMAND:', keyword_helper.customCommand)
Index: llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword_helper.py
===
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword_helper.py
@@ -0,0 +1,3 @@
+
+def customCommand(line):
+  return ('STDOUT: ' + line, 'STDERR: ' + line)
Index: llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword-command.txt
===
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/shtest-keyword-command/keyword-command.txt
@@ -0,0 +1,4 @@
+MYCOMMAND: Comman

[Lldb-commits] [PATCH] D54731: [lit] Enable the use of custom user-defined lit commands

2018-11-19 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

LGTM as long as the tests are all still passing :)


https://reviews.llvm.org/D54731



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-19 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

Can you post a short snippet of old help and new help output?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54692



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


[Lldb-commits] [lldb] r347283 - Skip TestTargetCreateDeps

2018-11-19 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Nov 19 17:18:49 2018
New Revision: 347283

URL: http://llvm.org/viewvc/llvm-project?rev=347283&view=rev
Log:
Skip TestTargetCreateDeps

Skip this test because Windows deals differently with shared libraries.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py?rev=347283&r1=347282&r2=347283&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py
 Mon Nov 19 17:18:49 2018
@@ -10,7 +10,7 @@ from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
+@skipIfWindows # Windows deals differently with shared libs.
 class TargetDependentsTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)


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