1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/.gitignore
Matt Valentine-House f1ccfa0c2c [ci-skip][Feature #18910][lldb] Provide class framework for lldb commands
`lldb_cruby.py` manages lldb custom commands using functions. The file
is a large list of Python functions, and an init handler to map some of
the Python functions into the debugger, to enable execution of custom
logic during a debugging session.

Since LLDB 3.7 (September 2015) there has also been support for using
python classes rather than bare functions, as long as those classes
implement a specific interface.

This PR Introduces some more defined structure to the LLDB helper
functions by switching from the function based implementation to the
class based one, and providing an auto-loading mechanism by which new
functions can be loaded.

The intention behind this change is to make working with the LLDB
helpers easier, by reducing code duplication, providing a consistent
structure and a clearer API for developers.

The current function based approach has some advantages and
disadvantages

Advantages:

- Adding new code is easy.
- All the code is self contained and searchable.

Disadvantages:
- No visible organisation of the file contents. This means
  - Hard to tell which functions are utility functions and which are
    available to you in a debugging session
  - Lots of code duplication within lldb functions
- Large files quickly become intimidating to work with - for example,
  `lldb_disasm.py` was implemented as a seperate Python module because
  it was easier to start with a clean slate than add significant amounts
  of code to `lldb_cruby.py`

This PR attempts, to fix the disadvantages of the current approach and
maintain, or enhance, the benefits. The new structure of a command looks
like this;

 ```
 class TestCommand(RbBaseCommand):
    # program is the keyword the user will type in lldb to execute this command
    program = "test"

    # help_string will be displayed in lldb when the user uses the help functions
    help_string = "This is a test command to show how to implement lldb commands"

    # call is where our command logic will be implemented
    def call(self, debugger, command, exe_ctx, result):
        pass
  ```

If the command fulfils the following criteria it will then be
auto-loaded when an lldb session is started:

- The package file must exist inside the `commands` directory and the
  filename must end in `_command.py`
- The package must implement a class whose name ends in `Command`
- The class inherits from `RbBaseCommand` or at minimum a class that
  shares the same interface as `RbBaseCommand`  (at minimum this means
  defining `__init__` and `__call__`, and using `__call__` to call
  `call` which is defined in the subclasses).
- The class must have a class variable `package` that is a String. This
  is the name of the command you'll call in the `lldb` debugger.
2022-08-18 13:25:32 -04:00

241 lines
2.8 KiB
Text

*-*-*.def
*-*-*.exp
*-*-*.lib
*.a
*.bak
*.bc
*.bundle
*.dSYM
*.dmyh
*.dylib
*.elc
*.i
*.ii
*.inc
*.log
*.o
*.obj
*.old
*.orig
*.pch
*.pdb
*.rbinc
*.rej
*.s
*.sav
*.sl
*.so
*.swp
*.yarb
*~
.*.list
.*.time
.DS_Store
.bundle
.ccmalloc
.ext
.pc
.ppack
.svn
.time
.ruby-version
Makefile
cygruby*.def
extconf.h
y.output
y.tab.c
*.gcda
*.gcno
*.gcov
*.vscode
lcov*.info
# /
/*-fake.rb
/*.dll
/*.exe
/*.res
/*.pc
/*.rc
/*_prelude.c
/.downloaded-cache
/.top-enc.mk
/build*/
/COPYING.LIB
/ChangeLog
/Doxyfile
/GNUmakefile
/README.atheos
/README.fat-patch
/README.v6
/TAGS
/archive
/autom4te*.cache
/automake
/benchmark/benchmark-driver
/beos
/bmlog-*
/breakpoints.gdb
/config.cache
/config.h
/config.h.in
/config.status
/config.status.lineno
/configure
/coverage/simplecov
/coverage/simplecov-html
/coverage/doclie
/coverage/.last_run.json
/coverage/.resultset.json*
/coverage/assets
/coverage/index.html
/doc/capi
/enc.mk
/encdb.h
/exts.mk
/goruby
/id.[ch]
/largefile.h
/lcov-c-out
/lcov-rb-out
/lcov-out
/lex.c
/libruby*.*
/miniprelude.c
/miniruby
/newdate.rb
/newline.c
/newver.rb
/parse.c
/parse.h
/patches
/patches-master
/pitest.rb
/ppack
/prelude.c
/preview
/probes.dmyh
/probes.h
/rbconfig.rb
/rename2.h
/repack
/revision.h
/revision.tmp
/riscos
/rubicon
/ruby
/ruby-runner
/ruby-runner.h
/ruby-man.rd.gz
/rubyspec_temp
/run.gdb
/sizes.c
/static-ruby
/test.rb
/test-coverage.dat
/tmp
/transdb.h
/uncommon.mk
/verconf.h
/verconf.mk
/web
/yasmdata.rb
# /bin/
/bin/*.exe
/bin/*.dll
# /benchmark/
/benchmark/bm_require.data
/benchmark/bmx_*.rb
/benchmark/fasta.output.*
/benchmark/wc.input
/enc/*.def
/enc/*.exp
/enc/*.lib
/enc/jis/props.h
/enc/unicode/data
# /coroutine/
!/coroutine/**/*.s
# /enc/trans/
/enc/trans/*.c
/enc/trans/*.def
/enc/trans/*.exp
/enc/trans/*.lib
# /exe/
/exe/goruby
/exe/ruby
# /ext/
/ext/extinit.c
/ext/configure-ext.mk
/ext/*/exts.mk
# /ext/-test-/cxxanyargs
/ext/-test-/cxxanyargs/failure*.failed
# /ext/-test-/win32/dln/
/ext/-test-/win32/dln/dlntest.dll
/ext/-test-/win32/dln/dlntest.exp
/ext/-test-/win32/dln/dlntest.lib
# /ext/-test-/gems
/ext/-test-/gems
# /ext/etc/
/ext/etc/constdefs.h
# /ext/fiddle/
/ext/fiddle/libffi-*
# /ext/rbconfig/
/ext/rbconfig/sizeof/sizes.c
/ext/rbconfig/sizeof/limits.c
# /ext/ripper/
/ext/ripper/eventids1.c
/ext/ripper/.eventids2-check
/ext/ripper/eventids2table.c
/ext/ripper/ripper.*
/ext/ripper/ids1
/ext/ripper/ids2
# /ext/socket/
/ext/socket/constants.h
/ext/socket/constdefs.h
/ext/socket/constdefs.c
# /gems
/gems/*.gem
/gems/src
/gems/*-*
# /lib/
/lib/ruby/[1-9]*.*
/lib/ruby/vendor_ruby
# /misc/
/misc/**/__pycache__
# /spec/bundler
/.rspec_status
# /tool/
/tool/config.guess
/tool/config.sub
# /win32/
/win32/*.ico
# MJIT
/rb_mjit_header.h
/mjit_config.h
/include/ruby-*/*/rb_mjit_min_header-*.h
# /wasm/
/wasm/tests/*.wasm