Commit Graph

15 Commits

Author SHA1 Message Date
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
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
Dave Lee 30ef2ae716 Fix PEP issues 2018-04-02 10:35:05 -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