theia icon indicating copy to clipboard operation
theia copied to clipboard

Integrate Memory Inspector in Theia repository

Open colin-grant-work opened this issue 3 years ago • 5 comments

What it does

This PR transfers the Memory Inspector functionality from the Theia CPP Extensions to the Theia repository. Relative to the current state of that repository, this PR makes some minor changes necessary to operate with [email protected] and transfers some functionality that is not fully determined by the Debug Adapter Protocol into the MemoryProviderService, where it can be more easily adjusted for adapters with specific known properties.

How to test

  1. With the CDT-GDB adapter, the instructions from this PR still apply
  2. To demonstrate the functionality with another debug adapter: (less convenient than GDB, because it supports fewer reference options)
  3. Create and open a new Rust project or use this one
  4. In your workspace, make sure that the preference lldb.rpcServer is set to null to work around #11392
  5. Install Rust Analyzer and CodeLLDB
  6. (If using the example project linked above) open main.rs and put a breakpoint on line 12.
  7. Use the code lenses provided by Rust Analyzer to start a debug session from the testson lines 16-25.
  8. When you hit the breakpoint, the terminal in which the program is running will have printed two addresses.
  9. Open the memory inspector from the right panel and input one of the addresses into the address selector and hit Go. The memory location should load, and it should match the data of the struct whose address you entered.

Review checklist

Reminder for reviewers

colin-grant-work avatar Jul 07 '22 21:07 colin-grant-work

Just out of interest: Did you consider moving this to CDT.cloud instead of the Theia main repo?

JonasHelming avatar Jul 08 '22 18:07 JonasHelming

@JonasHelming, I've made this PR for two reasons: I believe that having the code in this repo will make it easier to ensure its compatibility with latest Theia, and I believe that it's advantageous with respect to the features requested in #10841. What would be the benefit of placing it in CDT.cloud?

colin-grant-work avatar Jul 12 '22 21:07 colin-grant-work

Basically to keep the core Theia project as slim as possible. Most components would benefit from beeing moved to the core project/repo in terms of ensuring compatibility. Are the people maintaining this component the same team that are core Theia developers? Again: I am not opposed to move this to Theia core, I just wanted to raise the question as we had a tendency to try to keep the core repo as small as possible.

One example that you could aim at when hosting it at CDT.cloud would be to ensure compatibility for community releases only. Again, up to you!

JonasHelming avatar Jul 13 '22 08:07 JonasHelming

Thinking about this again: the memory inspector is not necessarily bound to C/C++, correct? This would be an argument in favor to keep it in Theia.

JonasHelming avatar Jul 19 '22 07:07 JonasHelming

@JonasHelming, exactly. I've been waiting till I could get it working on at least one non-C(++) debug adapter before trying to move it here, and I was finally able to get it working for Rust. :-)

colin-grant-work avatar Jul 19 '22 14:07 colin-grant-work

@colin-grant-work Is this ready for a re-review?

JonasHelming avatar Aug 17 '22 12:08 JonasHelming

@vince-fugnitto @colin-grant-work: Thanks again for the great work! Is there any chance this PR can make it in the upcoming release? If there is any way I can help out, please let me know.

martin-fleck-at avatar Aug 23 '22 08:08 martin-fleck-at

@martin-fleck-at, I'll devote some time to this today to address the outstanding comments.

colin-grant-work avatar Aug 23 '22 13:08 colin-grant-work

@vince-fugnitto, @martin-fleck-at, I've addressed most of y'all's comments - since there's some interest in getting this into the release, would you mind taking another look?

colin-grant-work avatar Aug 23 '22 21:08 colin-grant-work

@martin-fleck-at, I've pushed commits that I hope should address your concerns and requests.

colin-grant-work avatar Aug 24 '22 15:08 colin-grant-work

@vince-fugnitto Do you want to have another look at it or do you think we can merge this?

martin-fleck-at avatar Aug 25 '22 07:08 martin-fleck-at