Commit Graph

18 Commits

Author SHA1 Message Date
Jonas Devlieghere 9f75418e1a [Driver] Expand the executable path in the target create output
Resolve the path in the target create output. This is nice when passing
relative paths to the lldb command line driver.

  $ lldb ./binary
  (lldb) target create "./binary"
  Current executable set to '/absolute/path/to/binary' (x86_64).

This change only affects the target create output and does not change
the debugger's behavior. It doesn't resolve symbolic links so it won't
cause confusing when debugging something like clang++ that's symlinked
to clang.

Differential revision: https://reviews.llvm.org/D65611

llvm-svn: 368182
2019-08-07 16:21:40 +00:00
Adrian Prantl c8e8b274f1 Reapply "Fix a crash in option parsing."
with an additional read-out-of-bounds bugfix applied.

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

llvm-svn: 364260
2019-06-25 00:55:27 +00:00
Davide Italiano 0cdae2681a Revert "Fix a crash in option parsing."
This fails on the bots around 1/10 of the time.

llvm-svn: 363999
2019-06-20 23:44:37 +00:00
Adrian Prantl e6130a3090 Fix a crash in option parsing.
The call to getopt_long didn't handle the case where the *last* option
had an argument missing.

<rdar://problem/51231882>

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

llvm-svn: 363101
2019-06-11 21:14:02 +00:00
Michal Gorny f8fccb14de [lldb] [lit] Skip more tests when Python is unavailable
LocalLLDBInit.test requires Python module loading support.
CommandScriptImmediateOutput tests are specific to running scripts.
Disable all of them when Python support is disabled.

llvm-svn: 361115
2019-05-19 09:27:52 +00:00
Michal Gorny 6f356784be [lldb] [lit] Driver/TestConvenienceVariables.test requires Python
Differential Revision: https://reviews.llvm.org/D62096

llvm-svn: 361114
2019-05-19 06:05:31 +00:00
Jonas Devlieghere c0b48ab631 Propagate command interpreter errors from lldlbinit
This patch ensures that we propagate errors coming from the lldbinit
file trough the command/script interpreter. Before, if you did something
like command script import syntax_error.py, and the python file
contained a syntax error, lldb wouldn't tell you about it. This changes
with the current patch: errors are now propagated by default.

PS: Jim authored this change and I added testing.

Differential revision: https://reviews.llvm.org/D61579

llvm-svn: 360216
2019-05-08 01:23:47 +00:00
Jonas Devlieghere 7ffd963834 [Driver] Add command line option to allow loading local lldbinit file.
This patch adds a command line flag that allows lldb to load local
lldbinit files.

Differential revision: https://reviews.llvm.org/D61578

llvm-svn: 360172
2019-05-07 16:57:17 +00:00
Jonas Devlieghere 2edcad7b59 [Driver] Change the way we deal with local lldbinit files.
Currently we have special handling for local lldbinit files in the
driver. At the same time, we have an SB API named
`SourceInitFileInCurrentWorkingDirectory` that does the same thing.

This patch removes the special handling from the driver and uses the API
instead. In addition to the obvious advantages of having one canonical
way of doing things and removing code duplication, this change also
means that the code path is the same for global and local lldb init
files.

Differential revision: https://reviews.llvm.org/D61577

llvm-svn: 360077
2019-05-06 20:45:31 +00:00
Adrian Prantl 040f94cc7e Update the lldb driver to support the -O and -S options when passing --repl
At the moment when --repl is passed to lldb it silently ignores any
commands passed via the options below:

--one-line-before-file <command>
                     Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
--one-line <command>
                     Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
--source-before-file <file>
                     Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
--source <file>
                     Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
-O <value>           Alias for --one-line-before-file
-o <value>           Alias for --one-line
-S <value>           Alias for --source-before-file
-s <value>           Alias for --source

The -O and -S options are quite useful when writing tests for the REPL
though, e.g. to change settings prior to entering REPL mode. This
patch updates the driver to still respect the commands supplied via -O
and -S when passing --repl instead of silently ignoring them. As -s
and -o don't really make sense in REPL mode, commands supplied via
those options are still ignored, but the driver now emits a warning to
make that clear to the user.

Patch by Nathan Hawes!

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

llvm-svn: 356911
2019-03-25 15:38:18 +00:00
Davide Italiano 3eac27789d [testsuite] Add a comment explaining what this test does.
llvm-svn: 353896
2019-02-12 23:02:53 +00:00
Davide Italiano caade28362 [testsuite] Convert TestSingleQuote to lit.
Nothing crazy, this is pretty mechanical.

llvm-svn: 353894
2019-02-12 22:57:57 +00:00
Jonas Devlieghere b5c1d07920 [lit] Make TestConvenienceVariables a cpp file
The build.py script always runs the compiler in C++ mode, regardless of
the file extension. This results in mangled names presented to the
linker which in turn cannot find the printf symbol.

While we figure out how to solve this issue I've turned the source file
into a cpp file and added extern c. This should unbreak the bots.

llvm-svn: 349642
2018-12-19 17:10:21 +00:00
Stella Stamenova 9efcff5602 [lit] Rather than including stdio.h, forward-declare printf in TestConvenienceVariables.test
llvm-svn: 349573
2018-12-18 23:36:35 +00:00
Stella Stamenova f5b5325a10 [lit] Use the new build.py script in the lldb-mi tests
This allows the tests to pass on Windows as well

llvm-svn: 349562
2018-12-18 22:54:17 +00:00
Adrian Prantl 0bc587a128 Rewrite pexpect-based test in LIT/FileCheck.
pexecpt-based tests are flakey because they involve timeouts and this
test is eprfectly serializable.

llvm-svn: 348808
2018-12-10 22:57:47 +00:00
Jonas Devlieghere cef2af0f3c [driver] Fix --core/-c and add test
Because the optarg variable was shadowed we didn't notice we weren't
extracting the value from the option. This patch fixes that and renames
the variable to prevent this from happening in the future.

I also added two tests to check the error output for --core and --file
when the given value doesn't exist.

llvm-svn: 347821
2018-11-29 00:22:28 +00:00
Jonas Devlieghere 00eae5ea31 [Driver] Use libOption with tablegen.
This patch modifies the lldb driver to use libOption for option parsing.
It allows us to decouple option parsing from option processing which is
important when arguments affect initialization. This was previously not
possible because the debugger need to be initialized as some option
interpretation (like the scripting language etc) was handled by the
debugger, rather than in the driver.

Differential revision: https://reviews.llvm.org/D54692

llvm-svn: 347709
2018-11-27 21:00:32 +00:00