Граф коммитов

401 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada b06b69e6dc
LLDB: Dump table structs in Hash [ci skip] 2023-10-31 22:40:34 +09:00
Nobuyoshi Nakada 526292d9fe
LLDB: Use `expression` to save the result into the history [ci skip] 2023-10-25 16:50:00 +09:00
yui-knk 7de6908a28 LLDB: Print actual node structure [ci skip] 2023-10-10 07:53:42 +09:00
Nobuyoshi Nakada ce717be188
Fix RBignum print [ci skip] 2023-09-30 02:09:29 +09:00
Nobuyoshi Nakada 9fa7ec9332
Fix RArray print [ci skip] 2023-09-30 02:09:29 +09:00
Nobuyoshi Nakada e825160257
Delete empty lines at EOF [ci skip] 2023-09-30 02:09:29 +09:00
Peter Zhu 27024004fa Fix string2cstr in lldb_cruby.py [ci skip] 2023-08-29 19:31:53 -04:00
Takashi Kokubun 5766fb7266 Fix gdb.py for C frames [ci skip] 2023-08-23 10:59:23 -07:00
Takashi Kokubun b35a222348 gdb.py: Support dumping a dummy frame [ci skip] 2023-08-03 09:55:37 -07:00
git 29fd05036b * remove trailing spaces. [ci skip] 2023-08-02 23:43:29 +00:00
Takashi Kokubun 192ed8e70f gdb.py: Add -a option to dump all frames [ci skip] 2023-08-02 16:43:12 -07:00
Takashi Kokubun 5f5cc22b5f gdb.py: Print Env based on EP instead of BP
because EP could be escaped.
2023-08-02 16:23:55 -07:00
Takashi Kokubun 8d9a25a6d7 misc/gdb.py: Allow overriding stack_size [ci skip] 2023-07-20 15:04:51 -07:00
Takashi Kokubun a7127745f1 Get rid of obsoleted __bp__ references 2023-07-20 11:55:31 -07:00
Jemma Issroff dadf17818c
Add ruby_globals to lldb for easier debugging (#8041) 2023-07-07 15:55:58 -04:00
Nobuyoshi Nakada dcdc2cbd8e
`RString::len` was moved at 7577c101ed
[ci skip]
2023-06-11 17:31:49 +09:00
Takashi Kokubun 2e14a65309 Add an example for rust-analyzer.cargo.unsetTest [ci skip] 2023-06-05 14:01:37 -07:00
Nobuyoshi Nakada e1d2dc4cfc
LLDB: Fix T_ARRAY inspect [ci skip] 2023-04-10 14:12:19 +09:00
Takashi Kokubun 3a238eff88 gdb: Fix a command example
It was actually harder to type `cfp + 1`. `cfp 1` also works and is more
useful.
2023-04-01 00:23:35 -07:00
Takashi Kokubun a3074c1256 gdb: Fix specval
Somehow my gdb stopped recognizing VM_BLOCK_HANDLER_NONE (macro) today.
Just changing it to a safer code.
2023-04-01 00:19:43 -07:00
Takashi Kokubun 1da77539da gdb: Don't dump params and locals for C frames 2023-04-01 00:19:27 -07:00
Takashi Kokubun a9b6b25de5 gdb: Visualize register positions on the left 2023-03-31 09:13:37 -07:00
Takashi Kokubun 185f39df79 gdb: Always show actual values in cfp 2023-03-31 03:20:40 -07:00
Takashi Kokubun 0f368bfb7b gdb: Show params and locals in cfp 2023-03-31 03:05:30 -07:00
Takashi Kokubun 98347c251a gdb: Dump env data in cfp command 2023-03-31 02:54:56 -07:00
Takashi Kokubun 9f426491ca Put misc/gdb.py [experimental]
This works like:

```
(gdb) cfp
CFP (count=3, addr=0x7ffff73fef50):
$1 = {pc = 0x555556bf7818, sp = 0x7ffff72ff078, iseq = 0x7ffff2603270, self = 140737344619296, ep = 0x7ffff72ff058, block_code = 0x0,
  __bp__ = 0x7ffff72ff060, jit_return = 0x555558c2b000}

Stack (size=3):
[0] FIXNUM: 1
[1] T_STRING: "" bytesize:0 (embed) encoding:1 coderange:7bit $2 = (struct RString *) 0x7ffff249ea80
[2] [PROMOTED] T_OBJECT: $3 = {flags = 21474844769, klass = 140737344040416}
$4 = {0x24, 0x24, 0x24}

(gdb) cfp + 1
CFP (count=3, addr=0x7ffff73fef90):
$5 = {pc = 0x5555567a78f8, sp = 0x7ffff72ff040, iseq = 0x7ffff26032d0, self = 140737344619296, ep = 0x7ffff72ff038, block_code = 0x0,
  __bp__ = 0x7ffff72ff040, jit_return = 0x555558c2b000}

Stack (size=0):
```
2023-03-31 00:20:40 -07:00
Matt Valentine-House dabeec8034 [ci skip] LLDB: Fix rp for arrays 2023-03-30 22:38:30 +01:00
Nobuyoshi Nakada 339295dd7c
Fix missing receiver [ci sip] 2023-03-31 01:16:44 +09:00
Matt Valentine-House 6eac424e5e [ci skip] Move rb_id2str into new LLDB format 2023-03-21 09:10:46 +00:00
git 2d97f87407 * remove trailing spaces. [ci skip] 2023-03-17 20:04:58 +00:00
Matt Valentine-House c7862c68eb [ci skip] Move rp helper to new LLDB format
For now, the old function still exists as `old_rp`, in order to debug
issues with this command.
2023-03-17 20:04:43 +00:00
Matt Valentine-House 220cdbeea5
[lldb] Add a print_flags command (#7358) 2023-02-22 14:26:28 -05:00
Matt Valentine-House dc715af53b Tell VSCode to debug test.rb by default [ci-skip] 2023-02-10 11:53:04 -05:00
Takashi Kokubun dff03149a0
Put example VSCode configs in misc/.vscode [ci skip]
They are needed very often but it's hard to remember. I thought it'd be
useful to just copy that to /.vscode and edit that.

Usage:
cp -r misc/.vscode .vscode

Don't symlink it because you'd edit it but not want to commit it.
2023-02-03 11:01:08 -08:00
Aaron Patterson 70173a72a2
Ivar copy needs to happen _before_ setting the shape
When we copy instance variables, it is possible for the GC to be kicked
off.  The GC looks at the shape to determine what slots to mark inside
the object.  If the shape is set too soon, the GC could think that there
are more instance variables on the object than there actually are at
that moment.
2022-11-01 15:38:44 -07:00
Jemma Issroff ad63b668e2
Revert "Revert "This commit implements the Object Shapes technique in CRuby.""
This reverts commit 9a6803c90b.
2022-10-11 08:40:56 -07:00
Aaron Patterson 9a6803c90b
Revert "This commit implements the Object Shapes technique in CRuby."
This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
2022-09-30 16:01:50 -07:00
Jemma Issroff d594a5a8bd
This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-28 08:26:21 -07:00
Aaron Patterson 06abfa5be6
Revert this until we can figure out WB issues or remove shapes from GC
Revert "* expand tabs. [ci skip]"

This reverts commit 830b5b5c35.

Revert "This commit implements the Object Shapes technique in CRuby."

This reverts commit 9ddfd2ca00.
2022-09-26 16:10:11 -07:00
Jemma Issroff 9ddfd2ca00 This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-26 09:21:30 -07:00
Kaíque Kandy Koga 4177f60eed Write interface instead of interfact 2022-08-19 22:18:36 +09:00
git 59da26789f * remove trailing spaces. [ci skip] 2022-08-19 02:25:54 +09:00
Matt Valentine-House 92603bbd69 [ci skip][Feature #18910][lldb] Dedup lldb_init
by moving it fully into RbBaseCommand
2022-08-18 13:25:32 -04:00
Matt Valentine-House b26aec9daa [ci-skip][Feature #18910][lldb] New directory structure
Push the newly refactored lldb files into a sub-directory so that we're
not cluttering up the misc directory
2022-08-18 13:25:32 -04:00
Matt Valentine-House a4ef2f1672 [ci-skip][Feature #18910][lldb] Port rclass_ext to new LLDB Framework 2022-08-18 13:25:32 -04:00
Matt Valentine-House 281bcc8e64 [ci-skip][Feature #18910][lldb] Port heap_page command to new LLDB framework 2022-08-18 13:25:32 -04:00
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
Matt Valentine-House 1df9b6c390 Get the insns_address_table from the vm_exec_core module table... 2022-07-14 08:25:37 -07:00
Aaron Patterson 4ccaf6285f
fix lldb scripts on older lldb python 2022-07-06 13:21:37 -07:00
Jemma Issroff 87a560a057 Add T_STRUCT to lldb inspect helper 2022-06-21 18:16:10 -07:00