Skip to content

Commit

Permalink
Integrate Memory Inspector in Theia repository (#11394)
Browse files Browse the repository at this point in the history
Co-authored-by: colin-grant-work <[email protected]>
Co-authored-by: kenneth-marut-work <[email protected]>
Co-authored-by: Tomas Sisohore <[email protected]>
Co-authored-by: Paul Maréchal <[email protected]>
Co-authored-by: vince-fugnitto <[email protected]>
Co-authored-by: Simon Marchi <[email protected]>
Co-authored-by: Federico Bozzini <[email protected]>
Co-authored-by: Bohémond Couka <[email protected]>
Co-authored-by: Duc Nguyen <[email protected]>
Co-authored-by: Marc Dumais <[email protected]>
Co-authored-by: Rob Moran <[email protected]>
  • Loading branch information
11 people authored Aug 25, 2022
1 parent 6bd8e74 commit 9331b9b
Show file tree
Hide file tree
Showing 74 changed files with 6,605 additions and 41 deletions.
1 change: 1 addition & 0 deletions examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@theia/git": "1.28.0",
"@theia/keymaps": "1.28.0",
"@theia/markers": "1.28.0",
"@theia/memory-inspector": "1.28.0",
"@theia/messages": "1.28.0",
"@theia/metrics": "1.28.0",
"@theia/mini-browser": "1.28.0",
Expand Down
3 changes: 3 additions & 0 deletions examples/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
{
"path": "../../packages/markers"
},
{
"path": "../../packages/memory-inspector"
},
{
"path": "../../packages/messages"
},
Expand Down
1 change: 1 addition & 0 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@theia/git": "1.28.0",
"@theia/keymaps": "1.28.0",
"@theia/markers": "1.28.0",
"@theia/memory-inspector": "1.28.0",
"@theia/messages": "1.28.0",
"@theia/metrics": "1.28.0",
"@theia/mini-browser": "1.28.0",
Expand Down
3 changes: 3 additions & 0 deletions examples/electron/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
{
"path": "../../packages/markers"
},
{
"path": "../../packages/memory-inspector"
},
{
"path": "../../packages/messages"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/browser/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,17 @@ blockquote {
display: none !important;
}

.noselect {
.noselect,
.no-select {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
-o-user-select: none;
cursor: default;
}

:focus {
Expand Down Expand Up @@ -276,6 +279,7 @@ button.secondary[disabled], .theia-button.secondary[disabled] {
border: 1px solid var(--theia-dropdown-border);
background: var(--theia-dropdown-background);
outline: none;
cursor: pointer;
}

.theia-select option {
Expand Down
4 changes: 2 additions & 2 deletions packages/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"@theia/terminal": "1.28.0",
"@theia/variable-resolver": "1.28.0",
"@theia/workspace": "1.28.0",
"@vscode/debugprotocol": "^1.51.0",
"jsonc-parser": "^2.2.0",
"mkdirp": "^0.5.0",
"p-debounce": "^2.1.0",
"requestretry": "^7.0.0",
"tar": "^4.0.0",
"unzip-stream": "^0.3.0",
"vscode-debugprotocol": "^1.32.0"
"unzip-stream": "^0.3.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/breakpoint/breakpoint-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
import URI from '@theia/core/lib/common/uri';
import { Marker } from '@theia/markers/lib/common/marker';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';

export const BREAKPOINT_KIND = 'breakpoint';

Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/console/debug-console-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import * as React from '@theia/core/shared/react';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { SingleTextInputDialog } from '@theia/core/lib/browser';
import { ConsoleItem, CompositeConsoleItem } from '@theia/console/lib/browser/console-session';
import { DebugSession } from '../debug-session';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import throttle = require('@theia/core/shared/lodash.throttle');
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { ConsoleSession, ConsoleItem } from '@theia/console/lib/browser/console-session';
import { AnsiConsoleItem } from '@theia/console/lib/browser/ansi-console-item';
import { DebugSession } from '../debug-session';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/debug-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// *****************************************************************************

import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { DebugSessionConnection } from './debug-session-connection';

export const DebugContribution = Symbol('DebugContribution');
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/debug-session-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* eslint-disable @typescript-eslint/no-explicit-any */

import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { Event, Emitter, DisposableCollection, Disposable, MaybePromise } from '@theia/core';
import { OutputChannel } from '@theia/output/lib/browser/output-channel';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/debug-session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import * as React from '@theia/core/shared/react';
import { LabelProvider } from '@theia/core/lib/browser';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { Emitter, Event, DisposableCollection, Disposable, MessageClient, MessageType, Mutable, ContributionProvider } from '@theia/core/lib/common';
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
import { EditorManager } from '@theia/editor/lib/browser';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { createStringBuilder } from '@theia/monaco-editor-core/esm/vs/editor/com
import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { DebugSource } from '../model/debug-source';
import { DisassembledInstructionEntry, DisassemblyViewRendererReference, InstructionColumnTemplateData } from './disassembly-view-utilities';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { IDisposable, IEvent } from '@theia/monaco-editor-core';
import { BareFontInfo } from '@theia/monaco-editor-core/esm/vs/editor/common/config/fontInfo';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';

export interface DisassemblyViewRendererReference {
onDidChangeStackFrame: IEvent<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
import { BaseWidget, LabelProvider, Message, OpenerService, Widget } from '@theia/core/lib/browser';
import { ArrayUtils } from '@theia/core/lib/common/types';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { InstructionBreakpoint } from '../breakpoint/breakpoint-marker';
import { BreakpointManager } from '../breakpoint/breakpoint-manager';
import { DebugSessionManager } from '../debug-session-manager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as React from '@theia/core/shared/react';
import { createRoot, Root } from '@theia/core/shared/react-dom/client';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
import { Disposable, DisposableCollection, nls } from '@theia/core';
import URI from '@theia/core/lib/common/uri';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/editor/debug-editor-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { DebugEditor } from './debug-editor';
import { DebugHoverWidget, createDebugHoverWidgetContainer } from './debug-hover-widget';
import { DebugBreakpointWidget } from './debug-breakpoint-widget';
import { DebugExceptionWidget } from './debug-exception-widget';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { DebugInlineValueDecorator, INLINE_VALUE_DECORATION_KEY } from './debug-inline-value-decorator';

export const DebugEditorModelFactory = Symbol('DebugEditorModelFactory');
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/model/debug-breakpoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import * as React from '@theia/core/shared/react';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import URI from '@theia/core/lib/common/uri';
import { EditorManager } from '@theia/editor/lib/browser';
import { LabelProvider, DISABLED_CLASS } from '@theia/core/lib/browser';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import * as React from '@theia/core/shared/react';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { RecursivePartial } from '@theia/core';
import URI from '@theia/core/lib/common/uri';
import { Range } from '@theia/editor/lib/browser';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/model/debug-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { LabelProvider } from '@theia/core/lib/browser';
import { EditorManager, EditorOpenerOptions, EditorWidget } from '@theia/editor/lib/browser';
import URI from '@theia/core/lib/common/uri';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { DebugSession } from '../debug-session';
import { URI as Uri } from '@theia/core/shared/vscode-uri';
import { DEBUG_SCHEME, SCHEME_PATTERN } from '../../common/debug-uri-utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/model/debug-stack-frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import * as React from '@theia/core/shared/react';
import { WidgetOpenerOptions, DISABLED_CLASS } from '@theia/core/lib/browser';
import { EditorWidget, Range, Position } from '@theia/editor/lib/browser';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { TreeElement } from '@theia/core/lib/browser/source-tree';
import { DebugScope } from '../console/debug-console-items';
import { DebugSource } from './debug-source';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/model/debug-thread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as React from '@theia/core/shared/react';
import { CancellationTokenSource, Emitter, Event } from '@theia/core';
import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
import { TreeElement } from '@theia/core/lib/browser/source-tree';
import { DebugStackFrame } from './debug-stack-frame';
import { DebugSession } from '../debug-session';
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/browser/view/debug-watch-expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as React from '@theia/core/shared/react';
import { SingleTextInputDialog } from '@theia/core/lib/browser/dialogs';
import { ExpressionItem, DebugSessionProvider } from '../console/debug-console-items';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';

export class DebugWatchExpression extends ExpressionItem {

Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/common/debug-adapter-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
DebugAdapter,
DebugAdapterSession
} from './debug-model';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugProtocol } from '@vscode/debugprotocol';
import { DebugChannel } from './debug-service';

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/memory-inspector/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
'../../configs/build.eslintrc.json'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
}
};
71 changes: 71 additions & 0 deletions packages/memory-inspector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<div align='center'>

<br />

<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />

<h2>ECLIPSE THEIA - MEMORY-INSPECTOR EXTENSION</h2>

<hr />

</div>

## Description

This extension contributes a set of widgets for viewing memory in different ways.

## Requirements

This extension must be used in conjunction with a Debug Adapter that implements a `ReadMemoryRequest` handler or alternative custom request that returns memory data.
It has been tested against the [CDT-GDB Adapter](https://github.com/eclipse-cdt/cdt-gdb-adapter) used as the backend for the
[CDT-GDB VSCode](https://github.com/eclipse-cdt/cdt-gdb-vscode) plugin. This repository is configured to download that plugin as part of its build routine.
If you intend to use this extension with a different debug adapter, you may need to implement a custom
[`MemoryProvider`](./src/browser/memory-provider/memory-provider-service.ts) to handle any peculiarities of the requests and responses used by your adapter.

## Widgets

### Memory Widget

The basic [`MemoryWidget` class](./src/browser/memory-widget/memory-widget.ts) is a wrapper around two functional widgets, a `MemoryOptionsWidget` and
a`MemoryTableWidget`. The [`MemoryOptionsWidget`](./src/browser/memory-widget/memory-options-widget.tsx) is responsible for configuring the display
and fetching memory, and the [`MemoryTableWidget`](./src/browser/memory-widget/memory-table-widget.tsx) renders the memory according to the options
specified by the user in the `MemoryOptionsWidget`. The basic combination of these three classes offers variable highlighting, ascii display, and
dynamic updating in response to events from the debug session, as well as the option to lock the view to ignore changes from the session.

### Diff Widget

The [`MemoryDiffWidget`](./src/browser/diff-widget/memory-diff-widget-types.ts) is an elaboration of the `MemoryWidget` type that allows side-by-side
comparison of the contents of two `MemoryWidgets`.

### Register Widget

The [`RegisterWidget`](./src/browser/register-widget/register-widget-types.ts) offers functionality to view and
manipulate those values when using a debug adapter that reports register contents.

### Editable Widget

The [`MemoryEditableTableWidget`](./src/browser/editable-widget/memory-editable-table-widget.tsx) adds UI functionality to allow users to modify values in
the table display and send them to a backend that supports that operation.

## Using the Widgets

The widgets are created by the [`MemoryWidgetManager`](./src/browser/utils/memory-widget-manager.ts), and modifying the `createNewMemoryWidget()`
method of that service allows you to change what kind of widget is instantiated and under what circumstances. The widgets get memory through the
[`MemoryProviderService`](./src/browser/memory-provider/memory-provider-service.ts), which delegates to implementations `MemoryProvider` interface
that are bound as `MemoryProvider` contributions.


## Additional Information

- [API documentation for `@theia/getting-started`](https://eclipse-theia.github.io/theia/docs/next/modules/getting_started.html)
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
- [Theia - Website](https://theia-ide.org/)

## License

- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)

## Trademark
"Theia" is a trademark of the Eclipse Foundation
https://www.eclipse.org/theia
46 changes: 46 additions & 0 deletions packages/memory-inspector/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@theia/memory-inspector",
"version": "1.28.0",
"description": "Theia - Memory Inspector",
"keywords": [
"theia-extension"
],
"homepage": "https://github.com/eclipse-theia/theia",
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-theia/theia.git"
},
"bugs": {
"url": "https://github.com/eclipse-theia/theia/issues"
},
"files": [
"lib",
"src"
],
"scripts": {
"build": "theiaext build",
"clean": "theiaext clean",
"compile": "theiaext compile",
"lint": "theiaext lint",
"test": "theiaext test",
"watch": "theiaext watch"
},
"dependencies": {
"@theia/core": "1.28.0",
"@theia/debug": "1.28.0",
"@vscode/debugprotocol": "^1.51.0",
"long": "^4.0.0"
},
"devDependencies": {
"@types/long": "^4.0.0"
},
"theiaExtensions": [
{
"frontend": "lib/browser/memory-inspector-frontend-module"
}
],
"publishConfig": {
"access": "public"
}
}
Loading

1 comment on commit 9331b9b

@FernandoAscencio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case anyone read this.
Is there a reason cursor: default was added on line 219 on index.css?
Is it important for that style to have that line?
It is related to #11968 when the cursor does not display as a pointer.

Please sign in to comment.