Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shire Debugger #183

Closed
phodal opened this issue Jan 5, 2025 · 0 comments
Closed

Shire Debugger #183

phodal opened this issue Jan 5, 2025 · 0 comments

Comments

@phodal
Copy link
Owner

phodal commented Jan 5, 2025

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Refs

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001525719-Custom-language-debugger

Hi, it should be possible to implement it the same way kotlin, scala and other jvm based languages debuggers work. I would start with:

  • create your own breakpoint type, extend JavaLineBreakpointType
  • create and register JavaBreakpointHandlerFactory for your breakpoint type
  • create and register your own PositionManager to be able to map jdi Locations to your sources and back
  • to start java debug session copy the code from/around com.intellij.debugger.impl.GenericDebuggerRunner#attachVirtualMachine
    as a reference see:

https://github.com/JetBrains/kotlin/blob/ba6da7c40a6cc502508faf6e04fa105b96bc7777/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpointType.java

https://github.com/JetBrains/kotlin/blob/37411c823df28b43a83b4b517e9aee77f312550f/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt

phodal added a commit that referenced this issue Jan 5, 2025
…183

Introduce ResolvableVariableSnapshot to store variable change flow during compilation. Includes a manager class for handling snapshots.
phodal added a commit that referenced this issue Jan 6, 2025
- Rename `createSnapshot` to `createOrUpdate` to better reflect its behavior of updating existing snapshots.
- Remove `timestamp` parameter from `replayTo` as it was unused.
- Make `variables` mutable in `ShireFileSnapshot` to allow updates.
- Add `updateVariable` method to handle variable updates.
- Introduce `RecordFunction` and `ExecutionContext` for better variable tracking.
- Improve `recordValue` to include function context.
phodal added a commit that referenced this issue Jan 6, 2025
#183

Add `allCode`, `executedCode`, and `metadata` fields to `TimeTravelSnapshot` to track code execution and snapshot metadata. Introduce `SnapshotMetadata` data class for storing creation time, version, and file information.
phodal added a commit that referenced this issue Jan 6, 2025
Set a default value for `metadata` in `ShireTimeTravel` using `Clock.System.now()` and a version string. This simplifies initialization and ensures consistent metadata when not explicitly provided.
phodal added a commit that referenced this issue Jan 6, 2025
- Introduce `VariableSnapshotRecorder` to track variable changes during execution.
- Add snapshot recording in `CompositeVariableResolver`, `UserCustomVariableResolver`, and `ShireVariableTemplateCompiler`.
- Simplify `TimeTravelService` and rename `createOrUpdate` to `createSnapshot`.
- Replace `RecordFunction` with `ExecuteFunction` for clarity.
phodal added a commit that referenced this issue Jan 6, 2025
- Move `ContextVariable` to core module and extend `Variable` interface.
- Add companion object with `from` method to `ConditionPsiVariable` and `ContextVariable`.
- Rename `ShireVariablePanel` to `ShireVariableViewPanel` and update its table model to include descriptions.
- Update imports and references to reflect the new structure.
phodal added a commit that referenced this issue Jan 6, 2025
…#183

Adds a new method `all()` to the `PsiContextVariable` companion object, allowing retrieval of all entries as a list. Also includes an import for `Variable` in `ShireVariableViewPanel.kt`.
phodal added a commit that referenced this issue Jan 6, 2025
…183

- Removed ConditionPsiVariable references and commented out related code.
- Added `all()` method to aggregate all variable types into a single list.
- Updated `ShireVariableViewPanel` to handle variable updates more efficiently.
phodal added a commit that referenced this issue Jan 6, 2025
…iableResolver #183

- Removed VariableSnapshotRecorder instance and related snapshot recording logic from CompositeVariableResolver.
- Cleaned up unused code and comments in ShireTimeTravel.kt.
phodal added a commit that referenced this issue Jan 6, 2025
…#183

- Introduced `ShireSnapshotViewPanel` for displaying variable snapshots.
- Refactored `UserCustomVariableSnapshot` and `VariableSnapshotRecorder` to simplify variable tracking.
- Updated `ShireVariableViewPanel` to integrate the new snapshot view.
- Removed unused `TimeTravelService` and related time-travel functionality.
- Improved action handling in `ShireFileEditorWithPreview` with DumbService checks.
phodal added a commit that referenced this issue Jan 6, 2025
- Extract timestamp formatting logic into a separate method in `ShireSnapshotViewPanel`.
- Remove redundant `project != null` check in `ShireFileEditorWithPreview` action updates.
phodal added a commit that referenced this issue Jan 6, 2025
- Clear snapshot record before resolving variables
- Remove redundant `record` parameter from `PatternActionProcessor`
- Adjust column widths in `ShireSnapshotViewPanel`
- Replace `smartReadAction` with `runReadAction` in `ShirePreviewEditor`
phodal added a commit that referenced this issue Jan 6, 2025


- Rename `rerenderShire` to `updateDisplayedContent` for clarity.
- Replace `runReadAction` with `smartReadAction` for better concurrency handling.
- Simplify coroutine usage and improve thread management in `updateDisplayedContent`.
phodal added a commit that referenced this issue Jan 6, 2025
- Reduce height of ShireVariableViewPanel scroll pane from 200 to 160.
- Update ShireSnapshotViewPanel title label styling with brighter font color, background, and adjusted border.
- Remove commented-out code in ShirePreviewEditor.
phodal added a commit that referenced this issue Jan 7, 2025
#183

- Relocate debugger snapshot-related classes to a new `snapshot` package.
- Update imports and references to reflect the new package structure.
phodal added a commit that referenced this issue Jan 7, 2025
- Introduce ShireDebugRunner for debug execution.
- Add ShireLineBreakpointType for breakpoint management.
- Implement ShireDebuggerEditorsProvider for expression evaluation.
- Add ShireStackFrame for stack frame representation.
- Introduce ShireDebugSettings for debugger configuration.
- Add ShirePositionManagerFactory for position management.
- Register
phodal added a commit that referenced this issue Jan 7, 2025
- Update `canRun` in `ShireDebugRunner` and `ShireProgramRunner` to check for `DefaultDebugExecutor` and `DefaultRunExecutor` respectively.
- Add `isDumbAware` and `isEditableInDumbMode` to `ShireConfigurationType` for better IDE integration.
phodal added a commit that referenced this issue Jan 7, 2025
…ovements #183

- Add breakpoint handlers and properties for Shire debugger.
- Improve debugger UI with execution console and stack frame presentation.
- Refactor position manager and stack frame logic for better debugging support.
phodal added a commit that referenced this issue Jan 7, 2025
- Add `ShireDebugTabLayouter` to handle console content layout in debugger.
- Implement `XDebugSessionListener` in `ShireDebugProcess` to handle session events.
- Refactor variable names for clarity and consistency.
phodal added a commit that referenced this issue Jan 8, 2025
- Add `frontMatterOffset` function to calculate the text offset of the front matter header.
- Update debugger UI text from "some title" to "Variables" and rename execution stack ID to "Custom variables".
phodal added a commit that referenced this issue Jan 8, 2025
…183

- Added `VariableSnapshotRecorder` to track and display variable snapshots.
- Updated `ShireStackFrame` to show variable values in the debugger UI.
- Improved `ShireDebugProcess` with proper start/stop handling and breakpoint management.
- Refactored `ShireSuspendContext` and `ExecutionStack` to include project context.
phodal added a commit that referenced this issue Jan 8, 2025
Moved ShireDebugProcess and related classes from ShireDebugRunner.kt to a new file ShireDebugProcess.kt for better code organization and maintainability. Removed unused imports and cleaned up the code structure.
phodal added a commit that referenced this issue Jan 8, 2025
- Simplify `ShireDebugProcess` by moving console creation logic to `ShireRunConfigurationProfileState`.
- Remove redundant code and improve readability in `ShireDebugProcess`.
- Add missing `runToPosition` implementation in `ShireDebugProcess`.
- Make `ShireRunConfigurationProfileState` non-open and initialize console properties directly.
- Add `getContextElement` method to `ShireDebuggerEditorsProvider` for better debugging context handling.
phodal added a commit that referenced this issue Jan 8, 2025
- Refactor ShireDebugProcess to simplify initialization and add breakpoint handlers.
- Enhance ShireStackFrame to display compiled variables from ShireRunnerContext.
- Update ShireRunner to make sampleEditor parameter optional.
phodal added a commit that referenced this issue Jan 8, 2025
Remove redundant variable display logic and streamline the presentation of builtin variables.
Refactor `computeChildren` to use `XValueChildrenList` for better organization and clarity.
phodal added a commit that referenced this issue Jan 8, 2025
…#183

Add support for displaying custom variables in the debugger stack frame. Introduced `UserCustomVariableSnapshot` and `VariableSnapshotRecorder` to manage and display variable operations. Updated `ShireStackFrame` to handle custom variable presentation and added logic to reverse stack frames for proper ordering.
phodal added a commit that referenced this issue Jan 8, 2025
- Remove unused `XDebugSessionListener` import and redundant `ProcessListener` implementation.
- Pass `console` to `ShireDebugTabLayouter` for better context.
- Rename `customVariable` to `snapshot` for clarity in `ShireStackFrame`.
- Add `snapshot` parameter to `ShireDebugValue` for enhanced debugging context.
- Implement `execute` calls for step operations in `ShireDebugProcess`.
phodal added a commit that referenced this issue Jan 8, 2025


- Consolidate imports using wildcard for cleaner code.
- Move process listener setup to `start()` method for better initialization flow.
- Ensure process termination is handled correctly in `ShireRunConfigurationProfileState`.
phodal added a commit that referenced this issue Jan 8, 2025
Deleted the unused ShireDebugSettings.kt file to clean up the codebase.
phodal added a commit that referenced this issue Jan 9, 2025


- Move breakpoint-related classes to `ShireBreakpoint.kt`.
- Move suspend context logic to `ShireSuspendContext.kt`.
- Rename `ExecutionStack` to `ShireExecutionStack` for consistency.
- Minor text case fixes in `ShireStackFrame`.
phodal added a commit that referenced this issue Jan 9, 2025
@phodal phodal closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant