1 /**[txh]********************************************************************
3 Copyright (c) 2004-2007 by Salvador E. Tropea.
4 Covered by the GPL license.
6 Module: Target manipulation.
8 GDB/MI commands for the "Target Manipulation" section. @<p>
11 -target-attach Yes (implemented using attach)
12 -target-compare-sections N.A. (compare-sections)
15 -target-exec-status N.A.
16 -target-list-available-targets N.A. (help target)
17 -target-list-current-targets N.A. (info file among other things)
18 -target-list-parameters N.A.
22 ***************************************************************************/
26 /* Low level versions. */
28 void mi_target_select(mi_h *h, const char *type, const char *params)
30 mi_send(h,"-target-select %s %s\n",type,params);
33 /* Note: -target-attach isn't currently implemented :-( (gdb 6.1.1) */
34 void mi_target_attach(mi_h *h, pid_t pid)
36 mi_send(h,"attach %d\n",pid);
39 void mi_target_detach(mi_h *h)
41 mi_send(h,"-target-detach\n");
44 void mi_target_download(mi_h *h)
46 mi_send(h,"-target-download\n");
49 /* High level versions. */
51 /**[txh]********************************************************************
54 Connect to a remote gdbserver using the specified methode.
56 Command: -target-select
59 ***************************************************************************/
61 int gmi_target_select(mi_h *h, const char *type, const char *params)
63 mi_target_select(h,type,params);
64 if (!mi_res_simple_connected(h))
66 mi_send_target_commands(h);
70 /**[txh]********************************************************************
73 Attach to an already running process.
75 Command: -target-attach [using attach]
76 Return: The frame of the current location, NULL on error.
78 ***************************************************************************/
80 mi_frames *gmi_target_attach(mi_h *h, pid_t pid)
82 mi_target_attach(h,pid);
83 //return mi_res_simple_done(h);
84 return mi_res_frame(h);
87 /**[txh]********************************************************************
90 Detach from an attached process.
92 Command: -target-detach
95 ***************************************************************************/
97 int gmi_target_detach(mi_h *h)
100 return mi_res_simple_done(h);
103 /**[txh]********************************************************************
106 Loads the executable onto the remote target.
108 Command: -target-download
111 ***************************************************************************/
113 int gmi_target_download(mi_h *h)
115 mi_target_download(h);
116 // TODO: this response have some data
117 return mi_res_simple_done(h);