(response: DebugProtocol.Response, args: any)
| 909 | } |
| 910 | |
| 911 | public async customDisassembleRequest(response: DebugProtocol.Response, args: any): Promise<void> { |
| 912 | if (args.function) { |
| 913 | try { |
| 914 | const funcInfo: SymbolInformation = await this.getDisassemblyForFunction(args.function, args.file); |
| 915 | response.body = { |
| 916 | instructions: funcInfo.instructions, |
| 917 | name: funcInfo.name, |
| 918 | file: funcInfo.file, |
| 919 | address: funcInfo.address, |
| 920 | length: funcInfo.length |
| 921 | }; |
| 922 | this.gdbSession.sendResponse(response); |
| 923 | } |
| 924 | catch (e) { |
| 925 | this.gdbSession.sendErrorResponsePub(response, 1, `Unable to disassemble: ${e.toString()}`); |
| 926 | } |
| 927 | return; |
| 928 | } |
| 929 | else if (args.startAddress) { |
| 930 | try { |
| 931 | let funcInfo = this.gdbSession.symbolTable.getFunctionAtAddress(args.startAddress); |
| 932 | if (funcInfo) { |
| 933 | funcInfo = await this.getDisassemblyForFunction(funcInfo.name, funcInfo.file as string); |
| 934 | response.body = { |
| 935 | instructions: funcInfo.instructions, |
| 936 | name: funcInfo.name, |
| 937 | file: funcInfo.file, |
| 938 | address: funcInfo.address, |
| 939 | length: funcInfo.length |
| 940 | }; |
| 941 | this.gdbSession.sendResponse(response); |
| 942 | } |
| 943 | else { |
| 944 | // tslint:disable-next-line:max-line-length |
| 945 | const instructions: DisassemblyInstruction[] = await this.getDisassemblyForAddresses(args.startAddress, args.length || 256); |
| 946 | response.body = { instructions: instructions }; |
| 947 | this.gdbSession.sendResponse(response); |
| 948 | } |
| 949 | } |
| 950 | catch (e) { |
| 951 | this.gdbSession.sendErrorResponsePub(response, 1, `Unable to disassemble: ${e.toString()}`); |
| 952 | } |
| 953 | return; |
| 954 | } |
| 955 | else { |
| 956 | this.gdbSession.sendErrorResponsePub(response, 1, 'Unable to disassemble; invalid parameters.'); |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | public async getDisassemblyForFunction(functionName: string, file?: string): Promise<SymbolInformation> { |
| 961 | const symbol: SymbolInformation = this.gdbSession.symbolTable.getFunctionByName(functionName, file); |
no test coverage detected