Displaying (unformatted) function code.
This commit is contained in:
@@ -21,7 +21,11 @@ module.controller('CodeTabController', function(
|
||||
$scope.selectedModule = null;
|
||||
$scope.functionList = [];
|
||||
|
||||
$rootScope.$on('refresh', function() {
|
||||
function refresh() {
|
||||
if (!app.session || !app.session.dataSource) {
|
||||
$scope.moduleList = [];
|
||||
return;
|
||||
}
|
||||
var dataSource = app.session.dataSource;
|
||||
|
||||
dataSource.getModuleList().then(function(list) {
|
||||
@@ -38,7 +42,8 @@ module.controller('CodeTabController', function(
|
||||
});
|
||||
|
||||
console.log('refresh');
|
||||
});
|
||||
};
|
||||
$rootScope.$on('refresh', refresh);
|
||||
|
||||
$scope.selectModule = function(module) {
|
||||
var moduleChange = module != $scope.selectedModule;
|
||||
@@ -55,4 +60,8 @@ module.controller('CodeTabController', function(
|
||||
log.error('Unable to fetch function list');
|
||||
});
|
||||
};
|
||||
|
||||
if (app.session.dataSource) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<div class="debugger-fnview-header-right">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'ppc'">PPC</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'source'">PPC</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'rawHir'">HIR (raw)</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'hir'">HIR</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'rawLir'">LIR (raw)</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'lir'">LIR</button>
|
||||
<button type="button" class="btn btn-default" ng-model="codeType" btn-radio="'machineCode'">MC</button>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-default">1</button>
|
||||
@@ -29,7 +32,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="debugger-fnview-body">
|
||||
<div ui-view></div>
|
||||
<div class="debugger-fnview-codeview">
|
||||
<textarea class="debugger-fnview-textarea"></textarea>
|
||||
</div>
|
||||
|
||||
@@ -17,17 +17,47 @@ var module = angular.module('xe.ui.code.functionView', [
|
||||
|
||||
module.controller('FunctionViewController', function(
|
||||
$rootScope, $scope, app, log) {
|
||||
$scope.codeType = 'ppc';
|
||||
$scope.codeType = 'source';
|
||||
|
||||
function refresh() {
|
||||
if (!app.session || !app.session.dataSource) {
|
||||
$scope.fn = null;
|
||||
return;
|
||||
}
|
||||
var dataSource = app.session.dataSource;
|
||||
|
||||
dataSource.getFunction($scope.functionAddress).then(function(fn) {
|
||||
$scope.fn = fn;
|
||||
updateCode();
|
||||
}, function(e) {
|
||||
log.error('Unable to fetch function');
|
||||
});
|
||||
};
|
||||
$rootScope.$on('refresh', refresh);
|
||||
$scope.$watch('functionAddress', refresh);
|
||||
|
||||
var textArea = document.querySelector('.debugger-fnview-textarea');
|
||||
$scope.codeMirror = CodeMirror.fromTextArea(textArea, {
|
||||
mode: 'javascript',
|
||||
theme: 'default',
|
||||
indentUnit: 2,
|
||||
tabSize: 2,
|
||||
lineNumbers: true,
|
||||
firstLineNumber: 0,
|
||||
lineNumberFormatter: function(line) {
|
||||
return String(line);
|
||||
},
|
||||
gutters: [],
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
function updateCode() {
|
||||
var codeType = $scope.codeType;
|
||||
var value = '';
|
||||
if ($scope.fn) {
|
||||
value = $scope.fn.disasm[codeType];
|
||||
}
|
||||
$scope.codeMirror.setValue(value || '');
|
||||
};
|
||||
$scope.$watch('codeType', updateCode);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user