Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cc35c19a4b5a27fcc579dd3d646fee0f1bb7e051 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*******************************************************************************
 * Copyright (c) 2010-2019 Wind River Systems, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.services;

import java.util.Map;

import org.eclipse.tcf.protocol.IService;
import org.eclipse.tcf.protocol.IToken;

/**
 * TCF Disassembly service interface.
 *
 * @noimplement This interface is not intended to be implemented by clients.
 */

public interface IDisassembly extends IService {

    /**
     * This service name, as it appears on the wire - a TCF name of the service.
     */
    static final String NAME = "Disassembly";

    static final String
        /** The name of the instruction set architecture, String */
        CAPABILITY_ISA = "ISA",

        /** If true, simplified mnemonics are supported or requested, Boolean */
        CAPABILITY_SIMPLIFIED = "Simplified",

        /** If true, pseudo-instructions are supported or requested, Boolean */
        CAPABILITY_PSEUDO = "Pseudo",

        /** If true, instruction code bytes are supported or requested, Boolean */
        CAPABILITY_OPCODE = "OpcodeValue";

    /**
     * Retrieve disassembly service capabilities a given context-id.
     * @param context_id - a context ID, usually one returned by Run Control or Memory services.
     * @param done - command result call back object.
     * @return - pending command handle.
     */
    IToken getCapabilities(String context_id, DoneGetCapabilities done);

    /**
     * Call back interface for 'getCapabilities' command.
     */
    interface DoneGetCapabilities {
        /**
         * Called when capabilities retrieval is done.
         * @param token - command handle.
         * @param error - error object or null.
         * @param capabilities - array of capabilities, see CAPABILITY_* for contents of each array element.
         */
        void doneGetCapabilities(IToken token, Throwable error, Map<String,Object>[] capabilities);
    }

    /**
     * Disassemble instruction code from a specified range of memory addresses, in a specified context.
     * @param context_id - a context ID, usually one returned by Run Control or Memory services.
     * @param addr - address of first instruction to disassemble.
     * @param size - size in bytes of the address range.
     * @param params - properties to control the disassembly output, an element of capabilities array, see getCapabilities.
     * @param done - command result call back object.
     * @return - pending command handle.
     */
    IToken disassemble(String context_id, Number addr, int size, Map<String,Object> params, DoneDisassemble done);

    /**
     * Call back interface for 'disassemble' command.
     */
    interface DoneDisassemble {
        /**
         * Called when disassembling is done.
         * @param token - command handle.
         * @param error - error object or null.
         * @param disassembly - array of disassembly lines.
         */
        void doneDisassemble(IToken token, Throwable error, IDisassemblyLine[] disassembly);
    }

    /**
     * Interface to represent a single disassembly line.
     */
    interface IDisassemblyLine {

        /**
         * @return instruction address.
         */
        Number getAddress();

        /**
         * @return instruction size in bytes.
         */
        int getSize();

        /**
         * @return instruction binary representation.
         */
        byte[] getOpcodeValue();

        /**
         * @return array of instruction fields, each field is a collection of field properties, see FIELD_*.
         */
        Map<String,Object>[] getInstruction();
    }

    /** Instruction field properties */
    static final String
        /** The type of the instruction field. See FTYPE_*, String. */
        FIELD_TYPE = "Type",

        /** Value of the field for "String" and "Register" types, String. */
        FIELD_TEXT = "Text",

        /** Value of the field for "Address", "Displacement", or "Immediate" types, Number. */
        FIELD_VALUE = "Value",

        /** Context ID of the address space used with "Address" types, String. */
        FIELD_ADDRESS_SPACE = "AddressSpace";

    /** Instruction field types */
    static final String
        FTYPE_STRING = "String",
        FTYPE_ADDRESS = "Address",
        FTYPE_DISPLACEMENT = "Displacement",
        FTYPE_IMMEDIATE = "Immediate";
    /** @since 1.7 */
    static final String
        FTYPE_REGISTER = "Register";

    /**
     * @deprecated
     */
    static final String
        FTYPE_Register = "Register";
}

Back to the top