Commit Graph

21 Commits

Author SHA1 Message Date
Emil Pedersen
3581efc2aa Fix LLDB Swift data formatters breaking Swift code debugging
Because the data formatter for the compiler internals was registering itself as
swift, it was hiding the default data formatters for swift code.

rdar://125114526
2024-03-27 10:03:40 -07:00
Egor Zhdan
4269c027ec [utils] Show the string value of swift::Identifier in LLDB
This adds a straightforward LLDB pretty printer for `swift::Identifier` which prints its string value.
2023-06-02 15:52:20 +01:00
Dave Lee
ab0eeb7427 [utils] Use --expand in Demangle::Node lldb type summary (#65897)
Without `--expand`, only the summary is shown, no child nodes. Adding `--expand` allows 
for printing the child nodes, to be printed too.

Follow up to https://github.com/apple/swift/pull/40568
2023-05-15 11:04:31 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Sergej Jaskiewicz
1ecb94798e [lldb] Add a formatter for swift::Demangle::Node 2022-01-14 12:49:20 +03:00
Michael Gottesman
d3e6ffdbad [lldb-toolbox] Add the ability to disassemble-to-file a specific function from a target without running the target.
The routine already supports dumping the assembly to file if we are at a
breakpoint using the current frame. This adds a -n option so one can without
running just dump the assembly to a file of a specific function in a binary.
2020-10-06 14:18:58 -05:00
tbkka
868425be8a More Python3 lint fixes (#32967)
* More Python3 lint fixes

Some of the issues addressed include:
* Don't use `l` as a variable name (confusable with `1` or `I`)
* `print` statement does not exist in Py3, use `print` function instead
* Implicit tuple deconstruction in function args is no longer supported,
  use explicit splat `*` at the call site instead
* `xrange` does not exist in Py3, use `range` instead

* Better name per review feedback
2020-07-19 21:44:13 -07:00
Michael Forster
35b06b6aa3 Fix the LLVM repo path in lldbToolBox.py
I guess this got broken in the monorepo migration.
2020-04-01 17:54:07 +02:00
Michael Gottesman
475917db88 Add a pretty printer for small mode SmallBitVectors.
Just something I cooked up really quickly b/c I needed it. If you want to use
this, lldb-with-tools will auto-import it, so I suggest that you use that.
2020-01-05 14:28:21 -08:00
Michael Gottesman
b99fb69cc2 [lldb-with-tools] Fix disassemble-asm-cfg. 2019-08-19 11:42:39 -07:00
swift-ci
38d56eed83 Merge pull request #15628 from kastiglione/lldb-sequence-command 2018-04-02 11:35:10 -07:00
Dave Lee
30ef2ae716 Fix PEP issues 2018-04-02 10:35:05 -07:00
Vedant Kumar
ca27e829ba Add a transform to help test lldb expression evaluation
The initial version of the debugger testing transform instruments
assignments in a way that allows the debugger to sanity-check its
expression evaluator.

Given an assignment expression of the form:

```
  a = b
```

The transform rewrites the relevant bits of the AST to look like this:

```
  { () -> () in
    a = b
    checkExpect("a", stringForPrintObject(a))
  }()
```

The purpose of the rewrite is to make it easier to exercise the
debugger's expression evaluator in new contexts. This can be automated
by having the debugger set a breakpoint on checkExpect, running `expr
$Varname`, and comparing the result to the expected value generated by
the runtime.

While the initial version of this testing transform only supports
instrumenting assignments, it should be simple to teach it to do more
interesting rewrites.

There's a driver script available in SWIFT_BIN_DIR/lldb-check-expect to
simplfiy the process of launching and testing instrumented programs.

rdar://36032055
2018-03-30 16:50:31 -07:00
Dave Lee
49def952ea Skip empty commands
Mostly likely case is when the last command has a semicolon:

    sequence p 1; p 2;

HandleCommand() fails when given an empty command.
2018-03-30 13:57:21 -07:00
Dave Lee
3c7c04fdc3 Explain the sequence examples 2018-03-30 12:53:33 -07:00
Dave Lee
e43de1c204 Fix mistake in header doc 2018-03-30 12:07:10 -07:00
Dave Lee
c16d0658ea Add sequence command to lldbToolBox 2018-03-30 11:38:24 -07:00
Michael Gottesman
37f34cc624 [lldb-with-tools] Rename create_swift_disassemble_viewcfg => disassemble_asm_cfg.
Now the python method matches the name used on the lldb command line.
2018-03-06 16:40:13 -08:00
Michael Gottesman
879808474b [lldb-with-tools] Add disassemble-to-file.
Sometimes it is really useful to be able to dump the disassembly from lldb into
a file so that one can work with the disassembly in an editor. The disassemble
command in lldb does not provide such facility today. So this lldb function in
the lldb toolbox provides such a facility.
2018-03-06 02:05:22 -08:00
Michael Gottesman
e1cc84d738 [lldb-tools] Add command disassemble-asm-cfg.
This works by dumping the disassembly of the current assembly frame into a
temporary file and then running:

  blockifyasm < tmpfile | viewcfg

without having to leave lldb.

I also fixed a small bug in the lldb-with-tools.in script where the input was
passed onto lldb as:

  lldb -O '...' -- $@

The -- should not have been there since sometimes one wants to /not/ use a --
argument form to lldb.
2018-02-22 12:56:11 -08:00
Michael Gottesman
8b96071803 [lldb-with-tools] Add a new utility script called lldb-with-tools.
This is a simple tool that starts lldb, but before it runs your commands, uses
the -O command to load lldbToolBox.py. This provide sthe llvm data formatters as
well as potential future lldb extensions that we write for swift itself.

A better name for this utility would be much appreciated, but I think for now
the name "lldb-with-tools" is at least self explanatory.
2018-02-19 07:02:15 -08:00