1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00
cdt/debug/org.eclipse.cdt.debug.mi.core/design.txt

111 lines
3.1 KiB
Text
Raw Normal View History

2002-07-31 03:46:51 +00:00
<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.
2002-08-04 04:44:37 +00:00
* Command/Response channels
2002-07-31 03:46:51 +00:00
To create an MISession an InputStream and OutputStream are
2003-05-25 02:29:46 +00:00
needed(assuming it is the pipe connected to gdb).
MISession misession = new MISession(InputStream, OutputStream);
2002-07-31 03:46:51 +00:00
During initialisation of the session(MISession) two threads
2003-05-25 02:29:46 +00:00
are created TxThread, RxThread and associative list queues
TxQueue and RxQueue:
- The RxThread thread is block on readig the output of the pipe(gdb) for
any responses.
- The TxThread thread is block waiting for command.
MI Commands are created via the CommandFactory and
2002-07-31 03:46:51 +00:00
are added to the TxQueue, the TxThread will then wake up
2003-05-25 02:29:46 +00:00
generate a token(ID) for the command and send it to the pipe(gdb), after
2002-07-31 03:46:51 +00:00
transmission the command is then move to the RxQueue waiting for the
result(MIResultRecord).
2003-05-25 02:29:46 +00:00
Any responses will wake the RxThread, the thread will parse
the response constructing an MIOutput, then it searches the RxQueue
2002-07-31 03:46:51 +00:00
for any commands with the same token waking any thread waiting
for a synchronous response(MIResultRecord). Any out-of-band
2003-05-25 02:29:46 +00:00
responses(MIOOBRecord) are dispatch to MISession observers, clients interested
in notifications should register to the MISession.
2002-07-31 03:46:51 +00:00
2002-08-04 04:44:37 +00:00
* MI Parsing
2003-05-25 02:29:46 +00:00
There is a generic MI parser (MIParser) constructing an syntax tree of the output.
For example, a ResultRecord response after a "-break-insert", the parser will
generate this tree:
10-break-insert main
10^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
2002-08-04 04:44:37 +00:00
addr="0x08048468",func="main",file="hello.c",line="4",times="0"}
- MIOutput
- MIOOBRecord[0]
- MIResutRecord
2003-05-25 02:29:46 +00:00
- token = 10
2002-08-04 04:44:37 +00:00
- 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.
2002-07-31 03:46:51 +00:00
****
2003-07-10 19:34:22 +00:00
MI Process
For convienience, to java.lang.Process is provided.
MISession.getSessionProcess();
This Process talks directly to gdb and is smart enough to wrap any command
in CLICommand etc ..
MISession.getMIInferior()
MIInferior implements Process for the Inferiror.
*****
2002-07-31 03:46:51 +00:00
MI <==> CDI Adapters
To do.
</pre>
</body>
2002-08-04 04:44:37 +00:00
</html>