1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/debug/org.eclipse.cdt.debug.mi.core/design.txt
2002-08-04 04:44:37 +00:00

88 lines
2.5 KiB
Text

<html>
<head>
</head>
<body>
<pre>
Note this is an interim the document and subject to changes.
****
This MI implementation is base on GDB/MI 5.2.1.
* Command/Response channels
To create an MISession an InputStream and OutputStream are
needed(assuming this the pipe connected to gdb).
MISession MIPlugin.createSession(InputStream, OutputStream);
During initialisation of the session(MISession) two threads
are created(TxThread, RxThread). MI Commands created via the CommandFactory
are added to the TxQueue, the TxThread will then wake up
generate a token(ID) for the command and send it the pipe(gdb), after
transmission the command is then move to the RxQueue waiting for the
result(MIResultRecord).
Any responses will wake the RxThread, the thread would parse
the response constructing an MIOutput then search the RxQueue
for any commands with the same token waking any thread waiting
for a synchronous response(MIResultRecord). Any out-of-band
responses(MIOOBRecord) are dispatch, clients interested in those
notifications should register to MISession.
* MI Parsing
There is a generic MI parser (MIParser) constructing an Abstract
Syntax Tree. For example, a ResultRecord response after a
break-insert, the parser will generate this AST:
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x08048468",func="main",file="hello.c",line="4",times="0"}
- MIOutput
- MIOOBRecord[0]
- MIResutRecord
- token = 0
- ResultClass = "done"
- MIResult[1]
- MIResult[0]
- variable = "bkpt"
- value = MITuple
- MIResult[9]
- MiResult[0]
- variable = "number"
- MIConst = "1"
- MiResult[1]
- variable = "type"
- MIConst = "breakpoint"
- MiResult[2]
- variable = "disp"
- MIConst = "keep"
- MiResult[3]
- variable = "enabled"
- MIConst = "y"
- MiResult[4]
- variable = "addr"
- MIConst = "0x08048468"
- MiResult[5]
- variable = "func"
- MIConst = "main"
- MiResult[6]
- variable = "file"
- MIConst = "hello.c"
- MiResult[7]
- variable = "line"
- MIConst = "4"
- MiResult[8]
- variable = "times"
- MIConst = "0"
MICommands will do there own parsing:
session = MISession(in, out);
MIBreakInsert cmd = new MIBreakInsert("main");
session.postCommand(cmd); // sent to gdb.
MIBreakInsertInfo info = cmd.getBreakInsertInfo(); // Parsing of the Result Record.
****
MI <==> CDI Adapters
To do.
</pre>
</body>
</html>