aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2021-12-17 18:42:06 +0000
committerGitHub <noreply@github.com>2021-12-17 18:42:06 +0000
commite22fb1f7fe157e2dfca494770a8f0f60eaefcf96 (patch)
tree9a0182ac1c2b6c963ce3ddbeba8c65a127cf2fa7
parent0e34de6d9b898d9ac1330c653668d0e1832f054e (diff)
parentd57c96a500f8531a46f98cc70f933e75c8186dc3 (diff)
downloadcompiler-explorer-gh-1402.tar.gz
compiler-explorer-gh-1402.zip
Merge d57c96a500f8531a46f98cc70f933e75c8186dc3 into 0e34de6d9b898d9ac1330c653668d0e1832f054egh-1402
-rw-r--r--lib/base-compiler.js70
-rw-r--r--lib/compilers/ada.js10
-rw-r--r--static/components.js22
-rw-r--r--static/hub.js9
-rw-r--r--static/panes/compiler.js40
-rw-r--r--static/panes/diff.js9
-rw-r--r--static/panes/gnatdebug-view.ts4
-rw-r--r--static/panes/gnatdebugtree-view.interfaces.ts27
-rw-r--r--static/panes/gnatdebugtree-view.ts119
-rw-r--r--views/templates.pug8
10 files changed, 296 insertions, 22 deletions
diff --git a/lib/base-compiler.js b/lib/base-compiler.js
index 9730bc1a7..86f23c0f0 100644
--- a/lib/base-compiler.js
+++ b/lib/base-compiler.js
@@ -809,22 +809,45 @@ export class BaseCompiler {
}
async processGnatDebugOutput(inputFilename, result) {
- const content = [];
+ const contentDebugExpanded = [];
+ const contentDebugTree = [];
+
const keep_stdout = [];
- // Everything before this stays in stdout.
- // Everything after is considered expanded code and is moved to the
- // corresponding pane.
- const startOfExpandedCode = /^Source recreated/;
+ // stdout layout:
+ //
+ // ----- start
+ // everything here stays
+ // ... in stdout
+ // ... until :
+ // Source recreated from tree...
+ // everything here is
+ // ... sent in expanded
+ // ... pane... until :
+ // Tree created for ...
+ // everything after is
+ // ... sent in Tree pane
+ // ----- EOF
+ const startOfExpandedCode = /^Source recreated from tree/;
+ const startOfTree = /^Tree created for/;
+
let isInExpandedCode = false;
+ let isInTree = false;
for (const obj of Object.values(result.stdout)) {
if (!isInExpandedCode && startOfExpandedCode.test(obj.text)) {
isInExpandedCode = true;
}
+ if (!isInTree && startOfTree.test(obj.text)) {
+ isInExpandedCode = false;
+ isInTree = true;
+ }
+
if (isInExpandedCode)
- content.push(obj);
+ contentDebugExpanded.push(obj);
+ else if (isInTree)
+ contentDebugTree.push(obj);
else
keep_stdout.push(obj);
}
@@ -833,15 +856,23 @@ export class BaseCompiler {
// compiler may exit with an error after the emission. This dump is also
// very usefull to debug error message.
- if (content.length === 0)
+ if (contentDebugExpanded.length === 0)
if (result.code !== 0) {
return [{text: 'GNAT exited with an error and did not create the expanded code'}];
} else {
return [{text: 'GNAT exited successfully but the expanded code is missing, something is wrong'}];
}
+ if (contentDebugTree.length === 0)
+ if (result.code !== 0) {
+ return [{text: 'GNAT exited with an error and did not create the Tree'}];
+ } else {
+ return [{text: 'GNAT exited successfully but the Tree is missing, something is wrong'}];
+ }
+
result.stdout = keep_stdout;
- return content;
+
+ return [contentDebugExpanded, contentDebugTree];
}
/**
@@ -1216,7 +1247,8 @@ export class BaseCompiler {
execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths([]);
const makeAst = backendOptions.produceAst && this.compiler.supportsAstView;
- const makeGnatDebug = backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugView;
+ const makeGnatDebug = backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugViews;
+ const makeGnatDebugTree = backendOptions.produceGnatDebugTree && this.compiler.supportsGnatDebugViews;
const makeIr = backendOptions.produceIr && this.compiler.supportsIrView;
const makeRustMir = backendOptions.produceRustMir && this.compiler.supportsRustMirView;
const makeRustMacroExp = backendOptions.produceRustMacroExp && this.compiler.supportsRustMacroExpView;
@@ -1247,9 +1279,10 @@ export class BaseCompiler {
// GNAT, GCC and rustc can produce their extra output files along
// with the main compilation command.
- const gnatDebugResult = (makeGnatDebug ?
- await this.processGnatDebugOutput(inputFilenameSafe, asmResult)
- : '');
+ const [gnatDebugResult, gnatDebugTreeResult] = (makeGnatDebug || makeGnatDebugTree ?
+ await this.processGnatDebugOutput(inputFilenameSafe, asmResult)
+ : ['', '']);
+
const gccDumpResult = (makeGccDump ?
await this.processGccDumpOutput(backendOptions.produceGccDump,
asmResult, this.compiler.removeEmptyGccDump,
@@ -1267,9 +1300,16 @@ export class BaseCompiler {
asmResult.gccDumpOutput = gccDumpResult;
}
- if (this.compiler.supportsGnatDebugView && gnatDebugResult) {
- asmResult.hasGnatDebugOutput = true;
- asmResult.gnatDebugOutput = gnatDebugResult;
+ if (this.compiler.supportsGnatDebugViews) {
+ if (gnatDebugResult) {
+ asmResult.hasGnatDebugOutput = true;
+ asmResult.gnatDebugOutput = gnatDebugResult;
+ }
+
+ if (gnatDebugTreeResult) {
+ asmResult.hasGnatDebugTreeOutput = true;
+ asmResult.gnatDebugTreeOutput = gnatDebugTreeResult;
+ }
}
asmResult.tools = toolsResult;
diff --git a/lib/compilers/ada.js b/lib/compilers/ada.js
index 47b2f27b0..daa6d538e 100644
--- a/lib/compilers/ada.js
+++ b/lib/compilers/ada.js
@@ -35,7 +35,9 @@ export class AdaCompiler extends BaseCompiler {
this.compiler.supportsGccDump = true;
this.compiler.removeEmptyGccDump = true;
this.compiler.supportsIntel = true;
- this.compiler.supportsGnatDebugView = true;
+
+ // used for all GNAT related panes (Expanded code, Tree)
+ this.compiler.supportsGnatDebugViews = true;
}
getExecutableFilename(dirPath) {
@@ -50,10 +52,14 @@ export class AdaCompiler extends BaseCompiler {
// super is needed as it handles the GCC Dump files.
const opts = super.optionsForBackend (backendOptions, outputFilename);
- if (backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugView)
+ if (backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugViews)
// This is using stdout
opts.push('-gnatGL');
+ if (backendOptions.produceGnatDebugTree && this.compiler.supportsGnatDebugViews)
+ // This is also using stdout
+ opts.push('-gnatdt');
+
return opts;
}
diff --git a/static/components.js b/static/components.js
index 882ce1e75..3148a2558 100644
--- a/static/components.js
+++ b/static/components.js
@@ -310,6 +310,28 @@ module.exports = {
},
};
},
+
+ getGnatDebugTreeView: function () {
+ return {
+ type: 'component',
+ componentName: 'gnatdebugtree',
+ componentState: {},
+ };
+ },
+ getGnatDebugTreeViewWith: function (id, source, gnatDebugTreeOutput, compilerName, editorid) {
+ return {
+ type: 'component',
+ componentName: 'gnatdebugtree',
+ componentState: {
+ id: id,
+ source: source,
+ gnatDebugTreeOutput: gnatDebugTreeOutput,
+ compilerName: compilerName,
+ editorid: editorid,
+ },
+ };
+ },
+
getGnatDebugView: function () {
return {
type: 'component',
diff --git a/static/hub.js b/static/hub.js
index 5b3f5d890..e7f4ea3c6 100644
--- a/static/hub.js
+++ b/static/hub.js
@@ -42,6 +42,7 @@ var irView = require('./panes/ir-view');
var deviceView = require('./panes/device-view');
var rustMirView = require('./panes/rustmir-view');
var gnatDebugView = require('./panes/gnatdebug-view');
+var gnatDebugTreeView = require('./panes/gnatdebugtree-view');
var rustMacroExpView = require('./panes/rustmacroexp-view');
var rustHirView = require('./panes/rusthir-view');
var gccDumpView = require('./panes/gccdump-view');
@@ -146,6 +147,10 @@ function Hub(layout, subLangId, defaultLangId) {
function (container, state) {
return self.rustMirViewFactory(container, state);
});
+ layout.registerComponent(Components.getGnatDebugTreeView().componentName,
+ function (container, state) {
+ return self.gnatDebugTreeViewFactory(container, state);
+ });
layout.registerComponent(Components.getGnatDebugView().componentName,
function (container, state) {
return self.gnatDebugViewFactory(container, state);
@@ -328,6 +333,10 @@ Hub.prototype.deviceViewFactory = function (container, state) {
return new deviceView.DeviceAsm(this, container, state);
};
+Hub.prototype.gnatDebugTreeViewFactory = function (container, state) {
+ return new gnatDebugTreeView.GnatDebugTree(this, container, state);
+};
+
Hub.prototype.gnatDebugViewFactory = function (container, state) {
return new gnatDebugView.GnatDebug(this, container, state);
};
diff --git a/static/panes/compiler.js b/static/panes/compiler.js
index ed79d2d15..93160f392 100644
--- a/static/panes/compiler.js
+++ b/static/panes/compiler.js
@@ -204,6 +204,7 @@ Compiler.prototype.close = function () {
this.outputEditor.dispose();
};
+// eslint-disable-next-line max-statements
Compiler.prototype.initPanerButtons = function () {
var outputConfig = _.bind(function () {
return Components.getOutput(this.id, this.sourceEditorId, this.sourceTreeId);
@@ -274,6 +275,11 @@ Compiler.prototype.initPanerButtons = function () {
this.lastResult.gccDumpOutput);
}, this);
+ var createGnatDebugTreeView = _.bind(function () {
+ return Components.getGnatDebugTreeViewWith(this.id, this.source, this.lastResult.gnatDebugTreeOutput,
+ this.getCompilerName(), this.sourceEditorId);
+ }, this);
+
var createGnatDebugView = _.bind(function () {
return Components.getGnatDebugViewWith(this.id, this.source, this.lastResult.gnatDebugOutput,
this.getCompilerName(), this.sourceEditorId);
@@ -408,6 +414,16 @@ Compiler.prototype.initPanerButtons = function () {
}, this));
this.container.layoutManager
+ .createDragSource(this.gnatDebugTreeButton, createGnatDebugTreeView)
+ ._dragListener.on('dragStart', togglePannerAdder);
+
+ this.gnatDebugTreeButton.click(_.bind(function () {
+ var insertPoint = this.hub.findParentRowOrColumn(this.container) ||
+ this.container.layoutManager.root.contentItems[0];
+ insertPoint.addChild(createGnatDebugTreeView);
+ }, this));
+
+ this.container.layoutManager
.createDragSource(this.gnatDebugButton, createGnatDebugView)
._dragListener.on('dragStart', togglePannerAdder);
@@ -715,6 +731,7 @@ Compiler.prototype.compile = function (bypassCache, newTools) {
},
produceOptInfo: this.wantOptInfo,
produceCfg: this.cfgViewOpen,
+ produceGnatDebugTree: this.gnatDebugTreeViewOpen,
produceGnatDebug: this.gnatDebugViewOpen,
produceIr: this.irViewOpen,
produceDevice: this.deviceViewOpen,
@@ -1299,6 +1316,21 @@ Compiler.prototype.onRustMirViewClosed = function (id) {
}
};
+Compiler.prototype.onGnatDebugTreeViewOpened = function (id) {
+ if (this.id === id) {
+ this.gnatDebugTreeButton.prop('disabled', true);
+ this.gnatDebugTreeViewOpen = true;
+ this.compile();
+ }
+};
+
+Compiler.prototype.onGnatDebugTreeViewClosed = function (id) {
+ if (this.id === id) {
+ this.gnatDebugTreeButton.prop('disabled', false);
+ this.gnatDebugTreeViewOpen = false;
+ }
+};
+
Compiler.prototype.onGnatDebugViewOpened = function (id) {
if (this.id === id) {
this.gnatDebugButton.prop('disabled', true);
@@ -1480,12 +1512,12 @@ Compiler.prototype.initButtons = function (state) {
this.astButton = this.domRoot.find('.btn.view-ast');
this.irButton = this.domRoot.find('.btn.view-ir');
this.deviceButton = this.domRoot.find('.btn.view-device');
+ this.gnatDebugTreeButton = this.domRoot.find('.btn.view-gnatdebugtree');
this.gnatDebugButton = this.domRoot.find('.btn.view-gnatdebug');
this.rustMirButton = this.domRoot.find('.btn.view-rustmir');
this.rustMacroExpButton = this.domRoot.find('.btn.view-rustmacroexp');
this.rustHirButton = this.domRoot.find('.btn.view-rusthir');
this.gccDumpButton = this.domRoot.find('.btn.view-gccdump');
- this.gnatDebugButton = this.domRoot.find('.btn.view-gnatdebug');
this.cfgButton = this.domRoot.find('.btn.view-cfg');
this.executorButton = this.domRoot.find('.create-executor');
this.libsButton = this.domRoot.find('.btn.show-libs');
@@ -1702,6 +1734,7 @@ Compiler.prototype.updateButtons = function () {
this.rustHirButton.prop('disabled', this.rustHirViewOpen);
this.cfgButton.prop('disabled', this.cfgViewOpen);
this.gccDumpButton.prop('disabled', this.gccDumpViewOpen);
+ this.gnatDebugTreeButton.prop('disabled', this.gnatDebugTreeViewOpen);
this.gnatDebugButton.prop('disabled', this.gnatDebugViewOpen);
// The executorButton does not need to be changed here, because you can create however
// many executors as you want.
@@ -1715,7 +1748,8 @@ Compiler.prototype.updateButtons = function () {
this.rustHirButton.toggle(!!this.compiler.supportsRustHirView);
this.cfgButton.toggle(!!this.compiler.supportsCfg);
this.gccDumpButton.toggle(!!this.compiler.supportsGccDump);
- this.gnatDebugButton.toggle(!!this.compiler.supportsGnatDebugView);
+ this.gnatDebugTreeButton.toggle(!!this.compiler.supportsGnatDebugViews);
+ this.gnatDebugButton.toggle(!!this.compiler.supportsGnatDebugViews);
this.executorButton.toggle(!!this.compiler.supportsExecute);
this.enableToolButtons();
@@ -1816,6 +1850,8 @@ Compiler.prototype.initListeners = function () {
this.eventHub.on('gccDumpViewClosed', this.onGccDumpViewClosed, this);
this.eventHub.on('gccDumpUIInit', this.onGccDumpUIInit, this);
+ this.eventHub.on('gnatDebugTreeViewOpened', this.onGnatDebugTreeViewOpened, this);
+ this.eventHub.on('gnatDebugTreeViewClosed', this.onGnatDebugTreeViewClosed, this);
this.eventHub.on('gnatDebugViewOpened', this.onGnatDebugViewOpened, this);
this.eventHub.on('gnatDebugViewClosed', this.onGnatDebugViewClosed, this);
diff --git a/static/panes/diff.js b/static/panes/diff.js
index 19523c061..6f804af42 100644
--- a/static/panes/diff.js
+++ b/static/panes/diff.js
@@ -41,7 +41,8 @@ var
DiffType_CompilerStdErr = 2,
DiffType_ExecStdOut = 3,
DiffType_ExecStdErr = 4,
- DiffType_GNAT_ExpandedCode = 5;
+ DiffType_GNAT_ExpandedCode = 5,
+ DiffType_GNAT_Tree = 6;
function State(id, model, difftype) {
this.id = id;
@@ -85,6 +86,11 @@ State.prototype.refresh = function () {
if (this.result.hasGnatDebugOutput)
output = this.result.gnatDebugOutput || [];
break;
+ case DiffType_GNAT_Tree:
+ if (this.result.hasGnatDebugTreeOutput)
+ output = this.result.gnatDebugTreeOutput || [];
+ break;
+
}
}
this.model.setValue(_.pluck(output, 'text').join('\n'));
@@ -136,6 +142,7 @@ function Diff(hub, container, state) {
{id: DiffType_ExecStdOut, name: 'Execution stdout'},
{id: DiffType_ExecStdErr, name: 'Execution stderr'},
{id: DiffType_GNAT_ExpandedCode, name: 'GNAT Expanded Code'},
+ {id: DiffType_GNAT_Tree, name: 'GNAT Tree Code'},
],
items: [],
render: {
diff --git a/static/panes/gnatdebug-view.ts b/static/panes/gnatdebug-view.ts
index 0fa0f44fe..46a4e5c53 100644
--- a/static/panes/gnatdebug-view.ts
+++ b/static/panes/gnatdebug-view.ts
@@ -79,7 +79,7 @@ export class GnatDebug extends Pane<monaco.editor.IStandaloneCodeEditor, GnatDeb
if (this.compilerInfo.compilerId !== compilerId) return;
if (result.hasGnatDebugOutput) {
this.showGnatDebugResults(result.gnatDebugOutput);
- } else if (compiler.supportsGnatDebugView) {
+ } else if (compiler.supportsGnatDebugViews) {
this.showGnatDebugResults([{text: '<No output>'}]);
}
}
@@ -89,7 +89,7 @@ export class GnatDebug extends Pane<monaco.editor.IStandaloneCodeEditor, GnatDeb
this.compilerInfo.compilerName = compiler ? compiler.name : '';
this.compilerInfo.editorId = editorId;
this.setTitle();
- if (compiler && !compiler.supportsGnatDebugView) {
+ if (compiler && !compiler.supportsGnatDebugViews) {
this.showGnatDebugResults([{text: '<GNAT Debug output is not supported for this compiler>'}]);
}
}
diff --git a/static/panes/gnatdebugtree-view.interfaces.ts b/static/panes/gnatdebugtree-view.interfaces.ts
new file mode 100644
index 000000000..67a51ec7b
--- /dev/null
+++ b/static/panes/gnatdebugtree-view.interfaces.ts
@@ -0,0 +1,27 @@
+// Copyright (c) 2021, Compiler Explorer Authors
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+export interface GnatDebugTreeState {
+ gnatDebugTreeOutput: any;
+}
diff --git a/static/panes/gnatdebugtree-view.ts b/static/panes/gnatdebugtree-view.ts
new file mode 100644
index 000000000..258700dce
--- /dev/null
+++ b/static/panes/gnatdebugtree-view.ts
@@ -0,0 +1,119 @@
+// Copyright (c) 2021, Compiler Explorer Authors
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+import _ from 'underscore';
+import * as monaco from 'monaco-editor';
+import { Container } from 'golden-layout';
+
+import { Pane } from './pane';
+import { GnatDebugTreeState } from './gnatdebugtree-view.interfaces';
+import { BasePaneState } from './pane.interfaces';
+
+import { ga } from '../analytics';
+import { extendConfig } from '../monaco-config';
+
+export class GnatDebugTree extends Pane<monaco.editor.IStandaloneCodeEditor, GnatDebugTreeState> {
+ constructor(hub: any, container: Container, state: GnatDebugTreeState & BasePaneState) {
+ super(hub, container, state);
+ if (state && state.gnatDebugTreeOutput) {
+ this.showGnatDebugTreeResults(state.gnatDebugTreeOutput);
+ }
+ }
+
+ override getInitialHTML(): string {
+ return $('#gnatdebugtree').html();
+ }
+
+ override createEditor(editorRoot: HTMLElement): monaco.editor.IStandaloneCodeEditor {
+ return monaco.editor.create(editorRoot, extendConfig({
+ language: 'plainText',
+ readOnly: true,
+ glyphMargin: true,
+ lineNumbersMinChars: 3,
+ }));
+ }
+
+ override registerOpeningAnalyticsEvent(): void {
+ ga.proxy('send', {
+ hitType: 'event',
+ eventCategory: 'OpenViewPane',
+ eventAction: 'GnatDebugTree',
+ });
+ }
+
+ override getPaneName(): string {
+ return `GNAT Debug Tree Viewer ${this.compilerInfo.compilerName}` +
+ `(Editor #${this.compilerInfo.editorId}, ` +
+ `Compiler #${this.compilerInfo.compilerId})`;
+ }
+
+ override registerCallbacks(): void {
+ const throttleFunction = _.throttle((event) => this.onDidChangeCursorSelection(event), 500);
+ this.editor.onDidChangeCursorSelection((event) => throttleFunction(event));
+ this.eventHub.emit('gnatDebugTreeViewOpened', this.compilerInfo.compilerId);
+ this.eventHub.emit('requestSettings');
+ }
+
+ override onCompileResult(compilerId: number, compiler: any, result: any): void {
+ if (this.compilerInfo.compilerId !== compilerId) return;
+ if (result.hasGnatDebugTreeOutput) {
+ this.showGnatDebugTreeResults(result.gnatDebugTreeOutput);
+ } else if (compiler.supportsGnatDebugViews) {
+ this.showGnatDebugTreeResults([{text: '<No output>'}]);
+ }
+ }
+
+ override onCompiler(compilerId: number, compiler: any, options: any, editorId: number): void {
+ if (this.compilerInfo.compilerId === compilerId) {
+ this.compilerInfo.compilerName = compiler ? compiler.name : '';
+ this.compilerInfo.editorId = editorId;
+ this.setTitle();
+ if (compiler && !compiler.supportsGnatDebugViews) {
+ this.showGnatDebugTreeResults([{text: '<GNAT Debug Tree output is not supported for this compiler>'}]);
+ }
+ }
+ }
+
+ showGnatDebugTreeResults(result: any[]): void {
+ if (!this.editor) return;
+ this.editor.getModel().setValue(result.length
+ ? _.pluck(result, 'text').join('\n')
+ : '<No GNAT Debug Tree generated>');
+
+ if (!this.isAwaitingInitialResults) {
+ if (this.selection) {
+ this.editor.setSelection(this.selection);
+ this.editor.revealLinesInCenter(this.selection.selectionStartLineNumber,
+ this.selection.endLineNumber);
+ }
+ this.isAwaitingInitialResults = true;
+ }
+ }
+
+ override close(): void {
+ this.eventHub.unsubscribe();
+ this.eventHub.emit('gnatDebugTreeViewClosed', this.compilerInfo.compilerId);
+ this.editor.dispose();
+ }
+}
diff --git a/views/templates.pug b/views/templates.pug
index 6b7cf0dd1..879ca0020 100644
--- a/views/templates.pug
+++ b/views/templates.pug
@@ -114,6 +114,9 @@
button.dropdown-item.btn.btn-sm.btn-light.view-gccdump(title="Show Tree/RTL dump (GCC only)")
span.dropdown-icon.fas.fa-tree
| GCC Tree/RTL output
+ button.dropdown-item.btn.btn-sm.btn-light.view-gnatdebugtree(title="Show GNAT Debug Tree")
+ span.dropdown-icon.fas.fa-tree
+ | GNAT Debug Tree
button.dropdown-item.btn.btn-sm.btn-light.view-gnatdebug(title="Show GNAT Debug Expanded Code")
span.dropdown-icon.fas.fa-tree
| GNAT Debug Expanded Code
@@ -294,6 +297,11 @@
select.change-device(placeholder="Select a device...")
.monaco-placeholder
+ #gnatdebugtree
+ .top-bar.btn-toolbar.bg-light(role="toolbar")
+ include font-size
+ .monaco-placeholder
+
#gnatdebug
.top-bar.btn-toolbar.bg-light(role="toolbar")
include font-size