| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals lib, hterm */ |
| 8 |
| 7 'use strict'; | 9 'use strict'; |
| 8 | 10 |
| 9 // The devtools page for the debugger. | 11 // The devtools page for the debugger. |
| 10 | 12 |
| 11 lib.rtdep('lib.f', | 13 lib.rtdep('lib.f', |
| 12 'hterm'); | 14 'hterm'); |
| 13 | 15 |
| 14 | 16 |
| 15 /** | 17 /** |
| 16 * Keep a global reference to the message port used to talk to the background | 18 * Keep a global reference to the message port used to talk to the background |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 GdbTerm.prototype.onTerminalResize_ = function(width, height) { | 39 GdbTerm.prototype.onTerminalResize_ = function(width, height) { |
| 38 g_backgroundPort.postMessage({ | 40 g_backgroundPort.postMessage({ |
| 39 'name': 'input', | 41 'name': 'input', |
| 40 'msg': {'tty_resize': [ width, height ]}, | 42 'msg': {'tty_resize': [ width, height ]}, |
| 41 }); | 43 }); |
| 42 var moduleList = document.getElementById('modules'); | 44 var moduleList = document.getElementById('modules'); |
| 43 if (moduleList.hasChildNodes() && moduleList.selectedIndex < 0) { | 45 if (moduleList.hasChildNodes() && moduleList.selectedIndex < 0) { |
| 44 moduleList.firstChild.selected = true; | 46 moduleList.firstChild.selected = true; |
| 45 updateSelection(); | 47 updateSelection(); |
| 46 } | 48 } |
| 47 } | 49 }; |
| 48 | 50 |
| 49 /** | 51 /** |
| 50 * Handle a keystroke from the user. | 52 * Handle a keystroke from the user. |
| 51 * @param {string} str The keystroke. | 53 * @param {string} str The keystroke. |
| 52 */ | 54 */ |
| 53 GdbTerm.prototype.onVTKeystroke_ = function(str) { | 55 GdbTerm.prototype.onVTKeystroke_ = function(str) { |
| 54 g_backgroundPort.postMessage({ | 56 g_backgroundPort.postMessage({ |
| 55 'name': 'input', | 57 'name': 'input', |
| 56 'msg': {'gdb': str}, | 58 'msg': {'gdb': str}, |
| 57 }); | 59 }); |
| 58 } | 60 }; |
| 59 | 61 |
| 60 /** | 62 /** |
| 61 * Setup handlers after terminal start. | 63 * Setup handlers after terminal start. |
| 62 */ | 64 */ |
| 63 GdbTerm.prototype.run = function() { | 65 GdbTerm.prototype.run = function() { |
| 64 this.io_.onVTKeystroke = this.onVTKeystroke_.bind(this); | 66 this.io_.onVTKeystroke = this.onVTKeystroke_.bind(this); |
| 65 this.io_.onTerminalResize = this.onTerminalResize_.bind(this); | 67 this.io_.onTerminalResize = this.onTerminalResize_.bind(this); |
| 66 } | 68 }; |
| 67 | 69 |
| 68 | 70 |
| 69 /** | 71 /** |
| 70 * Resize the config area to a given size. | 72 * Resize the config area to a given size. |
| 71 * @param {integer} sz The width in pixels. | 73 * @param {integer} sz The width in pixels. |
| 72 */ | 74 */ |
| 73 function setWidth(sz) { | 75 function setWidth(sz) { |
| 74 var sized = document.getElementById('sized'); | 76 var sized = document.getElementById('sized'); |
| 75 var terminal = document.getElementById('terminal'); | 77 var terminal = document.getElementById('terminal'); |
| 76 var sizer = document.getElementById('sizer'); | 78 var sizer = document.getElementById('sizer'); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 var modules = msg.naclModules; | 311 var modules = msg.naclModules; |
| 310 | 312 |
| 311 var moduleList = document.getElementById('modules'); | 313 var moduleList = document.getElementById('modules'); |
| 312 document.getElementById('onStartRun').checked = settings.onStartRun; | 314 document.getElementById('onStartRun').checked = settings.onStartRun; |
| 313 document.getElementById('onStartAttach').checked = !settings.onStartRun; | 315 document.getElementById('onStartAttach').checked = !settings.onStartRun; |
| 314 document.getElementById('onFaultAttach').checked = settings.onFaultAttach; | 316 document.getElementById('onFaultAttach').checked = settings.onFaultAttach; |
| 315 document.getElementById('onFaultTerminate').checked = | 317 document.getElementById('onFaultTerminate').checked = |
| 316 !settings.onFaultAttach; | 318 !settings.onFaultAttach; |
| 317 document.getElementById('showGdb').checked = settings.showGdb; | 319 document.getElementById('showGdb').checked = settings.showGdb; |
| 318 | 320 |
| 319 function Visible(processId) { | 321 function isVisible(processId) { |
| 320 if (!(processId in modules)) { | 322 if (!(processId in modules)) { |
| 321 return false; | 323 return false; |
| 322 } | 324 } |
| 323 return msg.settings.showGdb || !isGdb(modules[processId].process.title); | 325 return msg.settings.showGdb || !isGdb(modules[processId].process.title); |
| 324 } | 326 } |
| 325 | 327 |
| 326 for (var i = 0; i < moduleList.childNodes.length; i++) { | 328 for (var i = 0; i < moduleList.childNodes.length; i++) { |
| 327 var child = moduleList.childNodes[i]; | 329 var child = moduleList.childNodes[i]; |
| 328 if (!Visible(child.id)) { | 330 if (!isVisible(child.id)) { |
| 329 moduleList.removeChild(child); | 331 moduleList.removeChild(child); |
| 330 --i; | 332 --i; |
| 331 } | 333 } |
| 332 } | 334 } |
| 333 for (var processId in modules) { | 335 for (var processId in modules) { |
| 334 var module = modules[processId]; | 336 var module = modules[processId]; |
| 335 if (!Visible(processId)) | 337 if (!isVisible(processId)) |
| 336 continue; | 338 continue; |
| 337 var item = document.getElementById(processId); | 339 var item = document.getElementById(processId); |
| 338 if (item === null) { | 340 if (item === null) { |
| 339 item = document.createElement('option'); | 341 item = document.createElement('option'); |
| 340 item.setAttribute('id', processId); | 342 item.setAttribute('id', processId); |
| 341 moduleList.appendChild(item); | 343 moduleList.appendChild(item); |
| 342 } else { | 344 } else { |
| 343 item.removeChild(item.firstChild); | 345 item.removeChild(item.firstChild); |
| 344 } | 346 } |
| 345 item.appendChild(document.createTextNode(taskTitle(module))); | 347 item.appendChild(document.createTextNode(taskTitle(module))); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 361 g_backgroundPort.onMessage.addListener(function(msg) { | 363 g_backgroundPort.onMessage.addListener(function(msg) { |
| 362 if (msg.name === 'change') { | 364 if (msg.name === 'change') { |
| 363 handleChange(msg); | 365 handleChange(msg); |
| 364 } else if (msg.name === 'message') { | 366 } else if (msg.name === 'message') { |
| 365 if (msg.data.substr(0, 3) === 'gdb') { | 367 if (msg.data.substr(0, 3) === 'gdb') { |
| 366 window.io_.print(msg.data.substr(3)); | 368 window.io_.print(msg.data.substr(3)); |
| 367 } | 369 } |
| 368 } | 370 } |
| 369 }); | 371 }); |
| 370 } | 372 } |
| OLD | NEW |