()
| 281 | } |
| 282 | |
| 283 | private examineMemoryLegacy() { |
| 284 | function validateValue(address) { |
| 285 | if (/^0x[0-9a-f]{1,8}$/i.test(address)) { |
| 286 | return address; |
| 287 | } |
| 288 | else if (/^[0-9]+$/i.test(address)) { |
| 289 | return address; |
| 290 | } |
| 291 | else { |
| 292 | return null; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | function validateAddress(address: string) { |
| 297 | if (address === '') { |
| 298 | return null; |
| 299 | } |
| 300 | return address; |
| 301 | } |
| 302 | |
| 303 | const session = CortexDebugExtension.getActiveCDSession(); |
| 304 | if (!session) { |
| 305 | vscode.window.showErrorMessage('No cortex-debug session available'); |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | vscode.window.showInputBox({ |
| 310 | placeHolder: 'Enter a valid C/gdb expression. Use 0x prefix for hexadecimal numbers', |
| 311 | ignoreFocusOut: true, |
| 312 | prompt: 'Memory Address' |
| 313 | }).then( |
| 314 | (address) => { |
| 315 | address = address.trim(); |
| 316 | if (!validateAddress(address)) { |
| 317 | vscode.window.showErrorMessage('Invalid memory address entered'); |
| 318 | Reporting.sendEvent('Examine Memory', 'Invalid Address', address); |
| 319 | return; |
| 320 | } |
| 321 | |
| 322 | vscode.window.showInputBox({ |
| 323 | placeHolder: 'Enter a constant value. Prefix with 0x for hexadecimal format.', |
| 324 | ignoreFocusOut: true, |
| 325 | prompt: 'Length' |
| 326 | }).then( |
| 327 | (length) => { |
| 328 | length = length.trim(); |
| 329 | if (!validateValue(length)) { |
| 330 | vscode.window.showErrorMessage('Invalid length entered'); |
| 331 | Reporting.sendEvent('Examine Memory', 'Invalid Length', length); |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | Reporting.sendEvent('Examine Memory', 'Valid', `${address}-${length}`); |
| 336 | const timestamp = new Date().getTime(); |
| 337 | const addrEnc = encodeURIComponent(`${address}`); |
| 338 | // tslint:disable-next-line:max-line-length |
| 339 | const uri = vscode.Uri.parse(`examinememory:///Memory%20[${addrEnc},${length}].cdmem?address=${addrEnc}&length=${length}×tamp=${timestamp}`); |
| 340 | this.memoryProvider.PreRegister(uri); |
nothing calls this directly
no test coverage detected