51 Commits

Author SHA1 Message Date
Michael Buch
b8264293a7 [lldb][test] TestChildDepthTruncation: don't force DWARF
Fixes test on Windows. Same reason as https://github.com/llvm/llvm-project/pull/149322
2025-07-17 22:36:25 +01:00
Michael Buch
1e7ec351c4
[lldb] Adjust default target.max-children-depth (#149282)
Deeply nested structs can be noisy, so Apple's LLDB fork sets the
default to `4`:
9c93adbb28/lldb/source/Target/TargetProperties.td (L134-L136)

Thought it would be useful to upstream this. Though happy to pick a
different default or keep it as-is.
2025-07-17 21:24:27 +01:00
David Spickett
4bf82aebc0
[lldb][test] Fix TestChildCountTruncation on Windows (#149322)
By not forcing the DWARF debug info format. When left as the default,
the tests pass.

Test added by https://github.com/llvm/llvm-project/pull/149088.
2025-07-17 16:06:03 +01:00
David Spickett
ba5f31cfaa [lldb][test] Disable TestChildCountTruncation on Windows
This fails because it tells clang to use DWARF which link.exe
then discards.

The test may not need DWARF, but I'm going to confirm that in
a follow up PR review.

Test added by https://github.com/llvm/llvm-project/pull/149088.
2025-07-17 14:30:50 +00:00
Michael Buch
4797a6c4e8 [lldb][test] TestChildCountTruncation.test: add missing command 2025-07-17 10:49:05 +01:00
Michael Buch
8c28f4920d
[lldb] Print children-count warning for dwim-print and expr (#149088)
When dumping variables, LLDB will print a one-time warning about
truncating children (when the children count exceeds the default
`target.max-children-count`). But we only do this for `frame variable`.
So if we use `dwim-print` or `expression`, the output gets truncated but
we don't print a warning. But because we store the fact that we
truncated some output on the `CommandInterpreter`, we fire the warning
next time we use `frame variable`. E.g.,:
```
(lldb) p arr
(int[1000]) {
  [0] = -5
  [1] = 0
  [2] = 0
  <-- snipped -->
  [253] = 0
  [254] = 0
  [255] = 0
  ...
}
(lldb) v someLocal
(int) someLocal = 10
*** Some of the displayed variables have more members than the debugger
will show by default. To show all of them, you can either use the
--show-all-children option to frame variable or raise the limit by
changing the target.max-children-count setting.
```

This patch prints the warning for `dwim-print` and `expression`.

I only added a test for the `target.max-children-count` for now because
it seems the `target.max-children-depth` warning is broken (I can't get
it to fire).
2025-07-16 21:47:13 +01:00
Michael Buch
8afab759d4
[lldb][Format] Fall back to old function.name-with-args if language frame format is emtpy (#148235)
There is currently no way to prevent `${function.name-with-args}` from
using the `plugin.cplusplus.display.function-name-format` setting. Even
if the setting is set to an empty string. As a way to disable formatting
by language plugin, this patch makes it so
`plugin.cplusplus.display.function-name-format` falls back to the old
way of printing `${function.name-with-args}`. Even if we didn't want to
add a fallback, making the setting an empty string shouldn't really
"succeed".
2025-07-12 22:41:21 +01:00
David Spickett
974ee967ad [lldb][test] Add more context for frame format test
This test is unsupported due to problems I assume with debug info,
but even if we solve that, the formatting elements aren't working
properly.

https://github.com/llvm/llvm-project/issues/143149
2025-06-06 14:42:12 +00:00
David Spickett
95b3fd6170 [lldb][test] Fix TestFrameFunctionInlined on Windows
This test was timing out on Linaro's Windows on Arm bot.

This was because it couldn't identify an inlined function to
break on, which let it run into an infinite loop, which exhausted
the stack, which would have taken forever to backtrace.

Full details here - https://github.com/llvm/llvm-project/issues/143104

I'm not sure PDB would help here but it does work with DWARF
as long as we use a linker that keeps it.

So I've changed the test to require Windows and lld, unless you're
not on Windows and then you can use any linker.

Also I had to regex some parts of the function name because
on Windows we get the return and parameter types too.
2025-06-06 10:38:49 +00:00
Michael Buch
5a918923f3
[lldb][Format] Add [inlined] marker to names of inlined frames (#142952)
This was removed in https://github.com/llvm/llvm-project/pull/135343 in
favour of making it a format variable, which we do here. This follows
the precedent of the `[opt]` and `[artificial]` markers.

Before:
```
 thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
 * frame #0: 0x000000010000037c a.out`inlined1() at inline.cpp:4:3
   frame #1: 0x000000010000037c a.out`regular() at inline.cpp:6:17
   frame #2: 0x00000001000003b8 a.out`inlined2() at inline.cpp:7:43
   frame #3: 0x00000001000003b4 a.out`main at inline.cpp:10:3
   frame #4: 0x0000000186345be4 dyld`start + 7040
```

After (note the `[inlined]` markers):
```
thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
* frame #0: 0x000000010000037c a.out`inlined1() at inline.cpp:4:3 [inlined]
  frame #1: 0x000000010000037c a.out`regular() at inline.cpp:6:17
  frame #2: 0x00000001000003b8 a.out`inlined2() at inline.cpp:7:43 [inlined]
  frame #3: 0x00000001000003b4 a.out`main at inline.cpp:10:3
  frame #4: 0x0000000186345be4 dyld`start + 7040
```

rdar://152642178
2025-06-05 17:41:37 +01:00
David Spickett
da8271e887 [lldb][test] Disable TestCxxFrameFormatRecursive on Linux
It was always expected to fail and now it sometimes times out instead.

See https://github.com/llvm/llvm-project/issues/142726.
2025-06-04 14:01:46 +00:00
Charles Zablit
b8997c07d9
[Demangling] Refactor Demangler range tracking (#140762)
This PR is a subset of the commits made in
https://github.com/swiftlang/llvm-project/pull/10710.

The most notable change is the addition of `PrefixRange` and
`SuffixRange` which are a catch-all to track anything after or before a
function's demangled name. In the case of Swift, this allows to add
support for name highlighting without having to track the range of the
scope and specifiers of a function (this will come in another PR).
2025-05-28 13:53:02 +01:00
Michael Buch
4560ff8740 [lldb][test] Skip TestFrameFormatFunctionSuffix.test on Windows
We skip/xfail the other FrameFormat tests on Windows already. The number
of different buildbot configurations out there targetting Windows makes
it hard to make this test portable. If we want to test this on Windows
we should probably just make a dedicated test for it.
2025-04-29 14:25:31 +01:00
Michael Buch
ebeae6402d Reland "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
This reverts commit da7099290cea7d11b83da01adda8afeb3bcd5362.

Same as the original PR. The failing test-case was resolved in https://github.com/llvm/llvm-project/pull/137763
2025-04-29 11:49:21 +01:00
Michael Buch
64b5bc876a
[lldb][Format] Add function.suffix frame-format variable (#137763)
This patch adds another frame-format variable (currently only
implemented in the CPlusPlus language plugin) that represents the
"suffix" of a function. The name is derived from the `DotSuffix` node of
LLVM's Itanium demangler.

For a function name such as `int foo() (.cold)`, the suffix would be
`(.cold)`.
2025-04-29 10:02:44 +01:00
Michael Buch
da7099290c
Revert "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
Reverts llvm/llvm-project#137408

This change broke `lldb/test/Shell/Unwind/split-machine-functions.test`.

The test binary has a symbol named `_Z3foov.cold` and the test expects
the backtrace to print the name of the cold part of the function like
this:

```
# SPLIT: frame #1: {{.*}}`foo() (.cold) +
```
but now it gets

```
frame #1: 0x000055555555514f split-machine-functions.test.tmp`foo() + 12
```
2025-04-29 07:13:04 +01:00
Michael Buch
cebf86eb1d
[lldb][Format] Make function name frame-format variables work without debug-info (#137408)
This patch makes the frame-format variables introduced in
https://github.com/llvm/llvm-project/pull/131836 also work when no
debug-info is available. Previously, we assumed `sc.function` was
available, but without debug-info we might only have `sc.symbol`. We
don't really need the `sc.function` apart from when formatting
arguments.

For the function arguments case I added a fallback that will just print
the arguments we get from the demangler (which is what LLDB does for
stacktraces with no debug-info anyway). Ideally we'd have a separate
`FormatEntity::Entry::Type::FunctionArguments` that will just print the
arguments from the demangler and have something like the following in
the `plugin.cplusplus.display.function-name-format`:
```
{ ${function.formatted-arguments} || ${function.arguments} }
```
I.e., when we can't format the arguments, print the ones from the
demangler. But we currently don't have the `||` operator in the
frame-format language yet.
2025-04-28 10:46:00 +01:00
Michael Buch
10f379e686 [lldb][test] TestFrameFormat: set breakpoints by name
Without this for some reason Linux PR CI was failing with:
```
 (lldb) settings set -f frame-format "custom-frame '${function.basename}'\n"
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:50'1                                          ?                                       possible intended match
            9: (lldb) break set -l 5 -f main.cpp
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           10: Breakpoint 1: no locations (pending).
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: WARNING: Unable to resolve breakpoint to any actual locations.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-04-27 21:43:27 +01:00
Michael Buch
d605a0d70e [lldb][test] FrameFormat tests: Specify filename when setting breakpoints
Try to work around following error on some of the Linux CI:
```
            8: (lldb) settings set -f frame-format "custom-frame '${function.basename}'\n"
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:50'1                                          ?                                       possible intended match
            9: (lldb) break set -l 5
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~
           10: error: No selected frame to use to find the default file.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: error: No file supplied and no default file available.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           12: (lldb) exit
check:50'0     ~~~~~~~~~~~~
```
2025-04-27 11:21:01 +01:00
Michael Buch
3f5dc586ef [lldb][test] XFAIL TestCxxFrameFormat.test for Windows target
Fails on Windows CI:
```
|            10: (lldb) break set -l 3
| check:30'0     ~~~~~~~~~~~~~~~~~~~~~~
|            11: error: No selected frame to use to find the default file.
| check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|            12: error: No file supplied and no default file available.
| check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|            13: (lldb) exit
```

This passes fine when compiling on Windows for Linux targets.
2025-04-26 18:40:53 +01:00
Michael Buch
28293ea023 [lldb][test] XFAIL FrameFormat tests on Windows again
These are failing for various reasons on CI, most likely due to us
requiring the Microsoft mangler. So XFAIL these.
2025-04-26 13:23:47 +01:00
Michael Buch
8a5bc9e340 [lldb][test] Un-XFAIL TestCxxFrameFormat.test for now
This was XPASSing on the linux-win remote CI jobs.
Since we're now compiling with DWARF (not PDB), lets see if these pass
on Windows again.
2025-04-26 13:04:23 +01:00
Michael Buch
7581aa1d8e [lldb][test] Make sure we compile FrameFormat tests with DWARF
These don't make sense for PDB on Windows
2025-04-26 11:28:32 +01:00
Michael Buch
e6f7e3418e [lldb][test] Fix/XFAIL FrameFormat tests on Windows
All of these were failing on Windows CI. Some are failing because
breakpoints on template functions can't be set by name. Others are
failing because of slight textual differences. Most are failing because
we can't track components of a mangled name from PDB, so XFAIL those.
2025-04-26 08:56:16 +01:00
Michael Buch
cc0bdb38ee [lldb][test] Skip Objective-C FrameFormat tests on Windows
This were failing on Windows CI with errors like:
```
22: (lldb) bt
23: * thread #1, stop reason = breakpoint 1.1
24:  frame #0: 0x00007ff7c5e41000 TestFrameFormatFunctionFormattedArgumentsObjC.test.tmp.objc.out`func at main.m:2
25:  frame #1: 0x00007ff7c5e4101c TestFrameFormatFunctionFormattedArgumentsObjC.test.tmp.objc.out`bar + 12 at main.m:3
26:  frame #2: 0x00007ff7c5e4103c TestFrameFormatFunctionFormattedArgumentsObjC.test.tmp.objc.out`main + 16 at main.m:5
27:  custom-frame '()'
     !~~~~~~~~~~~       error: no match expected
28:  custom-frame '(__formal=<unavailable>)'
```
2025-04-26 08:40:29 +01:00
Michael Buch
d555b9f9a0 [lldb][CPlusPlus] Add plugin.cplusplus.display.function-name-format setting (#131836)
Adds the new `plugin.cplusplus.display.function-name-format` setting and makes the `${function.name-with-args}` query it for formatting the function name.

One caveat is that the setting can't itself be set to `${function.name-with-args}` because that would cause infinite recursion and blow the stack. I added an XFAILed test-case for it and will address it in a follow-up patch.

https://github.com/llvm/llvm-project/pull/131836
2025-04-25 10:04:27 +01:00
Michael Buch
8b91b44a3b [lldb][Format] Introduce new frame-format variables for function parts (#131836)
Adds new frame-format variables and implements them in the CPlusPlusLanguage plugin.

We use the `DemangledNameInfo` type to retrieve the necessary part of the demangled name.

https://github.com/llvm/llvm-project/pull/131836
2025-04-25 10:04:27 +01:00
Michael Buch
1e153b782e
[lldb][Format] Display only the inlined frame name in backtraces if available (#135343)
When a frame is inlined, LLDB will display its name in backtraces as
follows:
```
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.3
  * frame #0: 0x0000000100000398 a.out`func() [inlined] baz(x=10) at inline.cpp:1:42
    frame #1: 0x0000000100000398 a.out`func() [inlined] bar() at inline.cpp:2:37
    frame #2: 0x0000000100000398 a.out`func() at inline.cpp:4:15
    frame #3: 0x00000001000003c0 a.out`main at inline.cpp:7:5
    frame #4: 0x000000026eb29ab8 dyld`start + 6812
```
The longer the names get the more confusing this gets because the first
function name that appears is the parent frame. My assumption (which may
need some more surveying) is that for the majority of cases we only care
about the actual frame name (not the parent). So this patch removes all
the special logic that prints the parent frame.

Another quirk of the current format is that the inlined frame name does
not abide by the `${function.name-XXX}` format variables. We always just
print the raw demangled name. With this patch, we would format the
inlined frame name according to the `frame-format` setting (see the
test-cases).

If we really want to have the `parentFrame [inlined] inlinedFrame`
format, we could expose it through a new `frame-format` variable (e..g.,
`${function.inlined-at-name}` and let the user decide where to place
things.
2025-04-13 23:21:52 +01:00
Vladislav Dzhidzhoev
32e90bbe57
[lldb][test] Support remote run of Shell tests (#95986)
1. This commit adds LLDB_TEST_PLATFORM_URL, LLDB_TEST_SYSROOT,
LLDB_TEST_PLATFORM_WORKING_DIR, LLDB_SHELL_TESTS_DISABLE_REMOTE cmake
flags to pass arguments for cross-compilation and remote running of both Shell&API tests.
2. To run Shell tests remotely, it adds 'platform select' and 'platform connect' commands to %lldb
substitution.
3. 'remote-linux' feature added to lit to disable tests failing with
remote execution.
4. A separate working directory is assigned to each test to avoid
conflicts during parallel test execution.
5. Remote Shell testing is run only when LLDB_TEST_SYSROOT is set for
building test sources. The recommended compiler for that is Clang.

---------

Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
2024-10-07 20:31:33 +02:00
Zequan Wu
f4ede08c61
[lldb][Format] Fix missing inlined function names in frame formatting. (#78494)
This fixes missing inlined function names when formatting frame and the
`Block` in `SymbolContext` is a lexical block (e.g.
`DW_TAG_lexical_block` in Dwarf).
2024-01-18 11:06:57 -05:00
walter erquinigo
bc0b569906 [LLDB] Fix tab size settings tests
They were reported in https://lab.llvm.org/buildbot/#/builders/68/builds/58956 and the fix is simple.
2023-08-28 17:55:15 -04:00
Jonas Devlieghere
76fb334302
[lldb] Remove TestExternalEditor.test
Remove TestExternalEditor.test as the code to open the transcript in an
external editor is conditional on lldb running in a graphical session.
As a result this test passes locally but not on the bots.
2023-05-01 21:25:14 -07:00
Jonas Devlieghere
b12b35ad4b
[lldb] Add debugger.external-editor setting
Add a new setting (debugger.external-editor) to specify an external
editor. The setting takes precedence over the existing
LLDB_EXTERNAL_EDITOR environment variable.

Differential revision: https://reviews.llvm.org/D149565
2023-05-01 14:11:11 -07:00
Dave Lee
d875838e8b [lldb][test] Replace use of p with expression in Shell tests (NFC)
In Shell tests, replace use of the `p` alias with the `expression` command.

To avoid conflating tests of the alias with tests of the expression command,
this patch canonicalizes to the use `expression`.

See also D141539 which made the same change to API tests.

Differential Revision: https://reviews.llvm.org/D146230
2023-03-17 10:29:24 -07:00
Ayush Sahay
0803241130 [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation
TestFrameFormatNameWithArgs.test is enabled only in case of native
compilation but is applicable in case of cross compilation too. So,
provision support for enabling it in case of both, native and cross
compilation.

Reviewed By: Michael137

Differential Revision: https://reviews.llvm.org/D140839
2023-02-01 23:05:28 +05:30
Michael Buch
c188910694 [lldb][Test] Make TestFrameFormatNameWithArgs.test more compatible across platforms
On Linux the `std::function` behaved differently to that on Darwin.

This patch removes usage of `std::function` in the test but attempts
to retain the test-coverage. We mainly want function types appearing
in the template argument and function argument lists.

Also add a `char const*` overload to one of the test functions to
cover the "format function argument using ValueObject formatter" code-path.

Differential Revision: https://reviews.llvm.org/D137272
2022-11-03 06:30:14 -07:00
Michael Buch
3e03873e36 [lldb][Test] Fix TestFrameFormatNameWithArgs.test on Windows/Linux
* Windows doesn't support setting these breakpoints by basename
* On Linux std::function arguments aren't formatted as such
2022-10-31 22:59:16 -07:00
Michael Buch
9dd413a1be [lldb][Test] Fix TestFrameFormatNameWithArgs.test on Linux
Be less strict about the `std::` namespace string. Depending
on platform it may contain an inline namespace, e.g., `__1`.
2022-10-31 14:35:37 +00:00
Michael Buch
031096d04d [lldb][CPlusPlus] Implement CPlusPlusLanguage::GetFunctionDisplayName
This patch implements the `GetFunctionDisplayName` API which gets
used by the frame-formatting code to decide how to print a
function name.

Currently this API trivially returns `false`, so we try to parse
the demangled function base-name by hand. We try find the closing
parenthesis by doing a forward scan through the demangled name. However,
for arguments that contain parenthesis (e.g., function pointers)
this would leave garbage in the frame function name.

By re-using the `CPlusPlusLanguage` parser for this we offload the
need to parse function names to a component that knows how to do this
already.

We leave the existing parsing code in `FormatEntity` since it's used
in cases where a language-plugin is not available (and is not
necessarily C++ specific).

**Example**

For following function:
```
int foo(std::function<int(void)> const& func) { return 1; }
```

Before patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() )> const&) at sample.cpp:11:49
```

After patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() ) at sample.cpp:11:49
```

**Testing**

* Added shell test
2022-10-31 12:25:19 +00:00
Greg Clayton
48207b2559 Fix "settings set -g" so it works again.
When we switched options over to use the Options.td file, a bug was introduced that caused the "-g" option for "settings set" to require a filename arguemnt. This patch fixes this issue and adds a test so this doesn't regress.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D116012
2021-12-28 11:03:09 -08:00
Lawrence D'Anna
531d877ee6 [lldb] Fix TestEchoCommands.test again
In 7f01f78593d6 [lldb] update TestEchoCommands -- I fixed this test,
but not on windows, becuase I used  some unix shell syntax that
doesn't work with cmd.exe.   Fixed it so it will work in both.
Test logic is the same.

This is a trivial fix, so bypassing review to get the build clean again
ASAP.
2021-11-04 01:24:25 -07:00
Lawrence D'Anna
7f01f78593 [lldb] update TestEchoCommands
Followup to https://reviews.llvm.org/D112988

Sorry, I broke this test.   The test was verifying the bad behavior
of --source-quietly that the previous change fixed -- namely that
it still echos the initial list of startup commands while
sourcing them.

Updated the test to verify that --source-quietly is quiet, rather than
loud.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D113047
2021-11-02 14:30:08 -07:00
Raphael Isemann
208e3f5d9b [lldb] Fix that symbols.clang-modules-cache-path is never initialized
LLDB is supposed to ask the Clang Driver what the default module cache path is
and then use that value as the default for the
`symbols.clang-modules-cache-path` setting. However, we use the property type
`String` to change `symbols.clang-modules-cache-path` even though the type of
that setting is `FileSpec`, so the setter will simply do nothing and return
`false`. We also don't check the return value of the setter, so this whole code
ends up not doing anything at all.

This changes the setter to use the correct property type and adds an assert that
we actually successfully set the default path. Also adds a test that checks that
the default value for this setting is never unset/empty path as this would
effectively disable the import-std-module feature from working by default.

Reviewed By: JDevlieghere, shafik

Differential Revision: https://reviews.llvm.org/D92772
2020-12-10 13:37:40 +01:00
Jonas Devlieghere
61d5b0e663 [lldb/Driver] Exit with a non-zero exit code in case of error in batch mode.
We have the option to stop running commands in batch mode when an error
occurs. When that happens we should exit the driver with a non-zero exit
code.

Differential revision: https://reviews.llvm.org/D78825
2020-05-05 11:01:44 -07:00
Jonas Devlieghere
841be9854c [lldb] Color the line marker
Highlight the color marker similar to what we do for the column marker.
The default color matches the color of the current PC marker (->) in the
default disassembly format.

Differential revision: https://reviews.llvm.org/D75070
2020-02-24 15:40:31 -08:00
Jonas Devlieghere
7f9f027c62 [lldb/Test] Update TestDisassemblyFormat for new format 2020-02-24 14:08:16 -08:00
Med Ismail Bennani
7eaae939b9 [FormatEntity] Add mangled function name support
Summary:
Add `function.mangled-name` key for FormatEntity to show the mangled
function names in backtraces.

rdar://54088244

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Subscribers: lldb-commits

Tags: #lldb

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2019-12-12 10:22:57 -08:00
Pavel Labath
9c73925226 [lldb/lit] Introduce %clang_host substitutions
Summary:
This patch addresses an ambiguity in how our existing tests invoke the
compiler. Roughly two thirds of our current "shell" tests invoke the
compiler to build the executables for the host. However, there is also
a significant number of tests which don't build a host binary (because
they don't need to run it) and instead they hardcode a certain target.

We also have code which adds a bunch of default arguments to the %clang
substitutions. However, most of these arguments only really make sense
for the host compilation. So far, this has worked mostly ok, because the
arguments we were adding were not conflicting with the target-hardcoding
tests (though they did provoke an occasional "argument unused" warning).

However, this started to break down when we wanted to use
target-hardcoding clang-cl tests (D69031) because clang-cl has a
substantially different command line, and it was getting very confused
by some of the arguments we were adding on non-windows hosts.

This patch avoid this problem by creating separate %clang(xx,_cl)_host
substutitions, which are specifically meant to be used for compiling
host binaries. All funny host-specific options are moved there. To
ensure that the regular %clang substitutions are not used for compiling
host binaries (skipping the extra arguments) I employ a little
hac^H^H^Htrick -- I add an invalid --target argument to the %clang
substitution, which means that one has to use an explicit --target in
order for the compilation to succeed.

Reviewers: JDevlieghere, aprantl, mstorsjo, espindola

Subscribers: emaste, arichardson, MaskRay, jfb, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D69619
2019-10-31 10:40:37 +01:00
Jonas Devlieghere
87aa9c9e4d Re-land "[test] Split LLDB tests into API, Shell & Unit"
The original patch got reverted because it broke `check-lldb` on a clean
build. This fixes that.

llvm-svn: 374201
2019-10-09 19:22:02 +00:00
Adrian Prantl
0115c10328 Revert [test] Split LLDB tests into API, Shell & Unit
as it appears to have broken check-lldb.

This reverts r374184 (git commit 22314179f0660c172514b397060fd8f34b586e82)

llvm-svn: 374187
2019-10-09 17:35:43 +00:00