Finishing off module info for now.

This commit is contained in:
Ben Vanik 2013-12-24 22:08:44 -08:00
parent dcd9f8b6ff
commit 44cbe1bbcf
8 changed files with 326 additions and 7 deletions

View File

@ -336,3 +336,44 @@ body {
max-height: 80vh; max-height: 80vh;
overflow-y: auto; overflow-y: auto;
} }
.debugger-module-info-outer-table {
}
.debugger-module-info-outer-table tbody tr td:nth-child(1) {
width: 110px;
}
.debugger-module-info-inner-table {
width: 300px;
}
.debugger-module-info-inner-table td:nth-child(1) {
text-align: right;
}
.debugger-module-info-headers {
width: 400px;
}
.debugger-module-info-sections {
width: 400px;
}
.debugger-module-info-static-libraries {
width: 400px;
}
.debugger-module-info-imports {
width: 900px;
}
.debugger-module-info-imports td:nth-child(1) {
width: 40px;
}
.debugger-module-info-imports td:nth-child(2) {
width: 64px;
}
.debugger-module-info-imports td:nth-child(3) {
width: 60px;
}
.debugger-module-info-imports td:nth-child(4) {
width: 100%;
}
.debugger-module-info-imports td:nth-child(5) {
width: 80px;
}
.debugger-module-info-imports td:nth-child(6) {
width: 80px;
}

View File

@ -38,7 +38,7 @@
<div class="debugger-fnlist-list"> <div class="debugger-fnlist-list">
<table class="table table-hover"> <table class="table table-hover">
<tr ng-repeat="fn in functionList | filter:functionFilter | orderBy:'address'"> <tr ng-repeat="fn in functionList | filter:functionFilter | orderBy:'address'">
<td><a ui-sref="session.code.function({function: (fn.address | hex32)})">{{fn.name}}</a></td> <td><a xe-coderef="{{fn.address|hex32}}">{{fn.name}}</a></td>
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -5,7 +5,214 @@
<h4 class="modal-title">{{ moduleName }}</h4> <h4 class="modal-title">{{ moduleName }}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
{{ moduleInfo }} <table class="table debugger-module-info-outer-table">
<tbody>
<tr>
<td>Module</td>
<td>
<table class="table table-hover table-condensed debugger-module-info-inner-table">
<tbody>
<tr>
<td>Module Flags</td>
<td>{{ moduleInfo.moduleFlags | hex32 }}</td>
</tr>
<tr>
<td>System Flags</td>
<td>{{ moduleInfo.systemFlags | hex32 }}</td>
</tr>
<tr>
<td>EXE Address</td>
<td><a xe-memref="{{ moduleInfo.exeAddress | hex32 }}" ng-click="$close()">{{ moduleInfo.exeAddress | hex32 }}</a></td>
</tr>
<tr>
<td>Entry Point</td>
<td><a xe-coderef="{{ moduleInfo.exeEntryPoint | hex32 }}" ng-click="$close()">{{ moduleInfo.exeEntryPoint | hex32 }}</a></td>
</tr>
<tr>
<td>Stack Size</td>
<td>{{ moduleInfo.exeStackSize }}b</td>
</tr>
<tr>
<td>Heap Size</td>
<td>{{ moduleInfo.exeHeapSize }}b</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>Execution</td>
<td>
<table class="table table-hover table-condensed debugger-module-info-inner-table">
<tbody>
<tr>
<td>Media ID</td>
<td>{{ moduleInfo.executionInfo.mediaId | hex32 }}</td>
</tr>
<tr>
<td>Version</td>
<td>{{ moduleInfo.executionInfo.version }}</td>
</tr>
<tr>
<td>Base Version</td>
<td>{{ moduleInfo.executionInfo.baseVersion }}</td>
</tr>
<tr>
<td>Title ID</td>
<td>{{ moduleInfo.executionInfo.titleId | hex32 }}</td>
</tr>
<tr>
<td>Platform</td>
<td>{{ moduleInfo.executionInfo.platform | hex32 }}</td>
</tr>
<tr>
<td>Executable Table</td>
<td>{{ moduleInfo.executionInfo.executableTable | hex32 }}</td>
</tr>
<tr>
<td>Disc</td>
<td>{{ moduleInfo.executionInfo.discNumber }} / {{ moduleInfo.executionInfo.discCount }}</td>
</tr>
<tr>
<td>Save Game ID</td>
<td>{{ moduleInfo.executionInfo.savegameId | hex32 }}</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>Loader</td>
<td>
<table class="table table-hover table-condensed debugger-module-info-inner-table">
<tbody>
<tr>
<td>Image Flags</td>
<td>{{ moduleInfo.loaderInfo.imageFlags | hex32 }}</td>
</tr>
<tr>
<td>Game Regions</td>
<td>{{ moduleInfo.loaderInfo.gameRegions | hex32 }}</td>
</tr>
<tr>
<td>Media Flags</td>
<td>{{ moduleInfo.loaderInfo.mediaFlags | hex32 }}</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>TLS</td>
<td>
<table class="table table-hover table-condensed debugger-module-info-inner-table">
<tbody>
<tr>
<td>Slot Count</td>
<td>{{ moduleInfo.tlsInfo.slotCount }}</td>
</tr>
<tr>
<td>Data Size</td>
<td>{{ moduleInfo.tlsInfo.dataSize }}b</td>
</tr>
<tr>
<td>Raw Data Address</td>
<td>{{ moduleInfo.tlsInfo.rawDataAddress | hex32 }}</td>
</tr>
<tr>
<td>Raw Data Size</td>
<td>{{ moduleInfo.tlsInfo.rawDataSize }}b</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table class="table table-hover table-condensed debugger-module-info-headers">
<thead>
<tr>
<th><a href="" ng-click="changeSort(headerSort, 'key')">Key</a></th>
<th><a href="" ng-click="changeSort(headerSort, 'value')">Value</a></th>
<th><a href="" ng-click="changeSort(headerSort, 'length')">Length</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="header in moduleInfo.headers | orderBy:headerSort.column:headerSort.reverse">
<td>{{ header.key | hex32 }}</td>
<td>{{ header.value | hex32 }}</td>
<td>{{ header.length }}b</td>
</tr>
</tbody>
</table>
<h3>Sections</h3>
<table class="table table-hover table-condensed debugger-module-info-sections">
<thead>
<tr>
<th><a href="" ng-click="changeSort(sectionSort, '$index')">#</a></th>
<th><a href="" ng-click="changeSort(sectionSort, 'type')">Type</a></th>
<th><a href="" ng-click="changeSort(sectionSort, 'startAddress')">Start</a></th>
<th><a href="" ng-click="changeSort(sectionSort, 'endAddress')">End</a></th>
<th><a href="" ng-click="changeSort(sectionSort, 'totalLength')">Length</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="section in moduleInfo.sections | orderBy:sectionSort.column:sectionSort.reverse">
<td>{{ $index }}</td>
<td>{{ section.type }}</td>
<td><a xe-memref="{{section.startAddress|hex32}}" ng-click="$close()">{{ section.startAddress | hex32 }}</a></td>
<td><a xe-memref="{{section.endAddress|hex32}}" ng-click="$close()">{{ section.endAddress | hex32 }}</a></td>
<td>{{ section.totalLength }}b</td>
</tr>
</tbody>
</table>
<h3>Static Libraries</h3>
<table class="table table-hover table-condensed debugger-module-info-static-libraries">
<thead>
<tr>
<th><a href="" ng-click="changeSort(staticLibrarySort, 'name')">Name</a></th>
<th><a href="" ng-click="changeSort(staticLibrarySort, 'version')">Version</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="library in moduleInfo.staticLibraries | orderBy:staticLibrarySort.column:staticLibrarySort.reverse">
<td>{{ library.name }}</td>
<td>{{ library.version }}</td>
</tr>
</tbody>
</table>
<h3>Imports</h3>
<div ng-repeat="library in moduleInfo.libraryImports | orderBy:'name'">
<h4>{{ library.name }}</h4>
Version: {{ library.version }} / min version: {{ library.minVersion }}<br/>
<table class="table table-hover table-condensed debugger-module-info-imports">
<thead>
<tr>
<th><a href="" ng-click="changeSort(importSort, 'implemented')">Impl</a></th>
<th><a href="" ng-click="changeSort(importSort, 'ordinal')">Ordinal</a></th>
<th><a href="" ng-click="changeSort(importSort, 'type')">Type</a></th>
<th><a href="" ng-click="changeSort(importSort, 'name')">Name</a></th>
<th><a href="" ng-click="changeSort(importSort, 'valueAddress')">Value</a></th>
<th><a href="" ng-click="changeSort(importSort, 'thunkAddress')">Thunk</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="import in library.imports | orderBy:importSort.column:importSort.reverse"
ng-class="{danger: !import.implemented}">
<td>{{ import.implemented }}</td>
<td>{{ import.ordinal | hex16 }}</td>
<td>{{ import.type }}</td>
<td><a href="https://www.google.com/search?as_epq={{import.name}}" target="_blank">{{ import.name }}</a></td>
<td><a xe-memref="{{import.valueAddress|hex32}}" ng-click="$close()">{{ import.valueAddress | hex32 }}</a></td>
<td><a xe-coderef="{{import.thunkAddress|hex32}}" ng-click="$close()">{{ import.thunkAddress | hex32 }}</a></td>
</tr>
</tbody>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,6 +21,31 @@ module.controller('ModuleInfoController', function(
$scope.moduleName = moduleName; $scope.moduleName = moduleName;
$scope.moduleInfo = moduleInfo; $scope.moduleInfo = moduleInfo;
$scope.headerSort = {
column: 'key',
reverse: false
};
$scope.sectionSort = {
column: 'startAddress',
reverse: false
};
$scope.staticLibrarySort = {
column: 'name',
reverse: false
};
$scope.importSort = {
column: 'ordinal',
reverse: false
};
$scope.changeSort = function(sort, column) {
if (sort.column == column) {
sort.reverse = !sort.reverse;
} else {
sort.column = column;
sort.reverse = false;
}
};
$scope.close = function() { $scope.close = function() {
$scope.$close(null); $scope.$close(null);
}; };

View File

@ -9,7 +9,9 @@
'use strict'; 'use strict';
var module = angular.module('xe.directives', []); var module = angular.module('xe.directives', [
'ui.router'
]);
module.directive('uiEnter', function() { module.directive('uiEnter', function() {
@ -49,3 +51,39 @@ module.directive('uiScrollDownOn', function() {
}; };
}); });
module.directive('xeCoderef', function($state) {
return {
priority: 1,
link: function($scope, element, attrs) {
var target = attrs.xeCoderef;
var stateName = 'session.code.function';
var stateParams = {
function: target,
a: null
};
element.attr('href', $state.href(stateName, stateParams));
element.bind('click', function(e) {
e.preventDefault();
$state.go(stateName, stateParams);
});
}
};
});
module.directive('xeMemref', function($state) {
return {
priority: 1,
link: function($scope, element, attrs) {
var target = attrs.xeMemref;
var stateName = 'session.memory';
var stateParams = {
a: target
};
element.attr('href', $state.href(stateName, stateParams));
element.bind('click', function(e) {
e.preventDefault();
$state.go(stateName, stateParams);
});
}
};
});

View File

@ -12,6 +12,16 @@
var module = angular.module('xe.filters', []); var module = angular.module('xe.filters', []);
module.filter('hex16', function() {
return function(number) {
if (number !== null && number !== undefined) {
var str = '' + number.toString(16).toUpperCase();
while (str.length < 4) str = '0' + str;
return str;
}
};
});
module.filter('hex32', function() { module.filter('hex32', function() {
return function(number) { return function(number) {
if (number !== null && number !== undefined) { if (number !== null && number !== undefined) {

View File

@ -109,7 +109,7 @@ module.config(function($stateProvider, $urlRouterProvider) {
}); });
$stateProvider.state('session.memory', { $stateProvider.state('session.memory', {
url: '/memory', url: '/memory?a',
templateUrl: 'assets/ui/memory/memory-tab.html', templateUrl: 'assets/ui/memory/memory-tab.html',
controller: function($stateParams) { controller: function($stateParams) {
}, },

View File

@ -499,8 +499,6 @@ json_t* Processor::DumpModule(XexModule* module, bool& succeeded) {
json_t* header_entry_json = json_object(); json_t* header_entry_json = json_object();
json_object_set_integer_new( json_object_set_integer_new(
header_entry_json, "key", opt_header->key); header_entry_json, "key", opt_header->key);
json_object_set_integer_new(
header_entry_json, "offset", opt_header->offset);
json_object_set_integer_new( json_object_set_integer_new(
header_entry_json, "length", opt_header->length); header_entry_json, "length", opt_header->length);
json_object_set_integer_new( json_object_set_integer_new(
@ -610,7 +608,7 @@ json_t* Processor::DumpModule(XexModule* module, bool& succeeded) {
import_json, "valueAddress", info->value_address); import_json, "valueAddress", info->value_address);
if (kernel_export && kernel_export->type == KernelExport::Variable) { if (kernel_export && kernel_export->type == KernelExport::Variable) {
json_object_set_string_new( json_object_set_string_new(
import_json, "type", "function"); import_json, "type", "variable");
} else if (kernel_export) { } else if (kernel_export) {
json_object_set_string_new( json_object_set_string_new(
import_json, "type", "function"); import_json, "type", "function");