doxygen fixes
[oweals/gnunet.git] / src / monkey / gdbmi.h
1 /**[txh]********************************************************************
2
3   Copyright (c) 2004-2009 by Salvador E. Tropea.
4   Covered by the GPL license.
5
6   Comments:
7   Main header for libmigdb.
8   
9 ***************************************************************************/
10
11 #ifdef __cplusplus
12 extern "C"
13 {
14 #if 0                           /* keep Emacsens' auto-indent happy */
15 }
16 #endif
17 #endif
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <unistd.h> /* pid_t */
22
23 #define MI_OK                      0
24 #define MI_OUT_OF_MEMORY           1
25 #define MI_PIPE_CREATE             2
26 #define MI_FORK                    3
27 #define MI_DEBUGGER_RUN            4
28 #define MI_PARSER                  5
29 #define MI_UNKNOWN_ASYNC           6
30 #define MI_UNKNOWN_RESULT          7
31 #define MI_FROM_GDB                8
32 #define MI_GDB_TIME_OUT            9
33 #define MI_GDB_DIED               10
34 #define MI_MISSING_XTERM          11
35 #define MI_CREATE_TEMPORAL        12
36 #define MI_MISSING_GDB            13
37 #define MI_LAST_ERROR             13
38
39 #define MI_R_NONE                  0 /* We are no waiting any response. */
40 #define MI_R_SKIP                  1 /* We want to discard it. */
41 #define MI_R_FE_AND_S              2 /* Wait for done. */
42 #define MI_R_E_ARGS                3
43
44 enum mi_val_type { t_const, t_tuple, t_list };
45
46 /* Types and subtypes. */
47 /* Type. */
48 #define MI_T_OUT_OF_BAND   0
49 #define MI_T_RESULT_RECORD 1
50 /* Out of band subtypes. */
51 #define MI_ST_ASYNC        0
52 #define MI_ST_STREAM       1
53 /* Async sub-subtypes. */
54 #define MI_SST_EXEC        0
55 #define MI_SST_STATUS      1
56 #define MI_SST_NOTIFY      2
57 /* Stream sub-subtypes. */
58 #define MI_SST_CONSOLE     3
59 #define MI_SST_TARGET      4
60 #define MI_SST_LOG         5
61 /* Classes. */
62 /* Async classes. */
63 #define MI_CL_UNKNOWN      0
64 #define MI_CL_STOPPED      1
65 #define MI_CL_DOWNLOAD     2
66 /* Result classes. */
67 #define MI_CL_DONE         2
68 #define MI_CL_RUNNING      3
69 #define MI_CL_CONNECTED    4
70 #define MI_CL_ERROR        5
71 #define MI_CL_EXIT         6
72
73 #define MI_DEFAULT_TIME_OUT 10
74
75 #define MI_DIS_ASM        0
76 #define MI_DIS_SRC_ASM    1
77
78 /* Implemented workaround for gdb bugs that we can dis/enable. */
79 /* At least gdb<=6.1.1 fails to find a source file with absolute path if the
80    name is for a psym instead of a sym. psym==partially loaded symbol table. */
81 #define MI_PSYM_SEARCH    0
82
83 #define MI_VERSION_STR "0.8.12"
84 #define MI_VERSION_MAJOR  0
85 #define MI_VERSION_MIDDLE 8
86 #define MI_VERSION_MINOR  12
87
88 struct mi_results_struct
89 {
90  char *var; /* Result name or NULL if just a value. */
91  enum mi_val_type type;
92  union
93  {
94   char *cstr;
95   struct mi_results_struct *rs;
96  } v;
97  struct mi_results_struct *next;
98 };
99 typedef struct mi_results_struct mi_results;
100
101 struct mi_output_struct
102 {
103  /* Type of output. */
104  char type;
105  char stype;
106  char sstype;
107  char tclass;
108  /* Content. */
109  mi_results *c;
110  /* Always modeled as a list. */
111  struct mi_output_struct *next;
112 };
113 typedef struct mi_output_struct mi_output;
114
115 typedef void (*stream_cb)(const char *, void *);
116 typedef void (*async_cb)(mi_output *o, void *);
117 typedef int  (*tm_cb)(void *);
118
119 /* Values of this structure shouldn't be manipulated by the user. */
120 struct mi_h_struct
121 {
122  /* Pipes connected to gdb. */
123  int to_gdb[2];
124  int from_gdb[2];
125  /* Streams for the pipes. */
126  FILE *to, *from;
127  /* PID of child gdb. */
128  pid_t pid;
129  char died;
130  /* Which rensponse we are waiting for. */
131  /*int response;*/
132  /* The line we are reading. */
133  char *line;
134  int   llen, lread;
135  /* Parsed output. */
136  mi_output *po, *last;
137  /* Tunneled streams callbacks. */
138  stream_cb console;
139  void *console_data;
140  stream_cb target;
141  void *target_data;
142  stream_cb log;
143  void *log_data;
144  /* Async responses callback. */
145  async_cb async;
146  void *async_data;
147  /* Callbacks to get echo of gdb dialog. */
148  stream_cb to_gdb_echo;
149  void *to_gdb_echo_data;
150  stream_cb from_gdb_echo;
151  void *from_gdb_echo_data;
152  /* Time out */
153  tm_cb time_out_cb;
154  void *time_out_cb_data;
155  int time_out;
156  /* Ugly workaround for some of the show responses :-( */
157  int catch_console;
158  char *catched_console;
159  /* MI version, currently unknown but the user can force v2 */
160  unsigned version;
161 };
162 typedef struct mi_h_struct mi_h;
163
164 #define MI_TO(a) ((a)->to_gdb[1])
165
166 enum mi_bkp_type { t_unknown=0, t_breakpoint=1, t_hw=2 };
167 enum mi_bkp_disp { d_unknown=0, d_keep=1, d_del=2 };
168 enum mi_bkp_mode { m_file_line=0, m_function=1, m_file_function=2, m_address=3 };
169
170 struct mi_bkpt_struct
171 {
172  int number;
173  enum mi_bkp_type type;
174  enum mi_bkp_disp disp; /* keep or del if temporal */
175  char enabled;
176  void *addr;
177  char *func;
178  char *file;
179  int line;
180  int ignore;
181  int times;
182
183  /* For the user: */
184  char *cond;
185  char *file_abs;
186  int thread;
187  enum mi_bkp_mode mode;
188  struct mi_bkpt_struct *next;
189 };
190 typedef struct mi_bkpt_struct mi_bkpt;
191
192 enum mi_wp_mode { wm_unknown=0, wm_write=1, wm_read=2, wm_rw=3 };
193
194 struct mi_wp_struct
195 {
196  int number;
197  char *exp;
198  enum mi_wp_mode mode;
199
200  /* For the user: */
201  struct mi_wp_struct *next;
202  char enabled;
203 };
204 typedef struct mi_wp_struct mi_wp;
205
206 struct mi_frames_struct
207 {
208  int level;  /* The frame number, 0 being the topmost frame, i.e. the innermost
209                 function. */
210  void *addr; /* The `$pc' value for that frame. */
211  char *func; /* Function name. */
212  char *file; /* File name of the source file where the function lives. */
213  char *from;
214  int line;   /* Line number corresponding to the `$pc'. */
215  /* When arguments are available: */
216  mi_results *args;
217  int thread_id;
218  /* When more than one is provided: */
219  struct mi_frames_struct *next;
220 };
221 typedef struct mi_frames_struct mi_frames;
222
223 struct mi_aux_term_struct
224 {
225  pid_t pid;
226  char *tty;
227 };
228 typedef struct mi_aux_term_struct mi_aux_term;
229
230 struct mi_pty_struct
231 {
232  char *slave;
233  int master;
234 };
235 typedef struct mi_pty_struct mi_pty;
236
237 enum mi_gvar_fmt { fm_natural=0, fm_binary=1, fm_decimal=2, fm_hexadecimal=3,
238                    fm_octal=4,
239                    /* Only for registers format: */
240                    fm_raw=5 };
241 enum mi_gvar_lang { lg_unknown=0, lg_c, lg_cpp, lg_java };
242
243 #define MI_ATTR_DONT_KNOW   0
244 #define MI_ATTR_NONEDITABLE 1
245 #define MI_ATTR_EDITABLE    2
246
247 struct mi_gvar_struct
248 {
249  char *name;
250  int   numchild;
251  char *type;
252  enum mi_gvar_fmt format;
253  enum mi_gvar_lang lang;
254  char *exp;
255  int   attr;
256
257  /* MI v2 fills it, not yet implemented here. */
258  /* Use gmi_var_evaluate_expression. */
259  char *value;
260
261  /* Pointer to the parent. NULL if none. */
262  struct mi_gvar_struct *parent;
263  /* List containing the children.
264     Filled by gmi_var_list_children.
265     NULL if numchild==0 or not yet filled. */
266  struct mi_gvar_struct *child;
267  /* Next var in the list. */
268  struct mi_gvar_struct *next;
269
270  /* For the user: */
271  char opened;  /* We will show its children. 1 when we fill "child" */
272  char changed; /* Needs to be updated. 0 when created. */
273  int vischild; /* How many items visible. numchild when we fill "child" */
274  int depth;    /* How deep is this var. */
275  char ispointer;
276 };
277 typedef struct mi_gvar_struct mi_gvar;
278
279 struct mi_gvar_chg_struct
280 {
281  char *name;
282  int   in_scope;  /* if true the other fields apply. */
283  char *new_type;  /* NULL if type_changed==false */
284  int   new_num_children; /* only when new_type!=NULL */
285
286  struct mi_gvar_chg_struct *next;
287 };
288 typedef struct mi_gvar_chg_struct mi_gvar_chg;
289
290
291 /* A list of assembler instructions. */
292 struct mi_asm_insn_struct
293 {
294  void *addr;
295  char *func;
296  unsigned offset;
297  char *inst;
298
299  struct mi_asm_insn_struct *next;
300 };
301 typedef struct mi_asm_insn_struct mi_asm_insn;
302
303 /* A list of source lines containing assembler instructions. */
304 struct mi_asm_insns_struct
305 {
306  char *file;
307  int line;
308  mi_asm_insn *ins;
309
310  struct mi_asm_insns_struct *next;
311 };
312 typedef struct mi_asm_insns_struct mi_asm_insns;
313
314 /* Changed register. */
315 struct mi_chg_reg_struct
316 {
317  int reg;
318  char *val;
319  char *name;
320  char updated;
321
322  struct mi_chg_reg_struct *next;
323 };
324 typedef struct mi_chg_reg_struct mi_chg_reg;
325
326 /*
327  Examining gdb sources and looking at docs I can see the following "stop"
328 reasons:
329
330 Breakpoints:
331 a) breakpoint-hit (bkptno) + frame
332 Also: without reason for temporal breakpoints.
333
334 Watchpoints:
335 b) watchpoint-trigger (wpt={number,exp};value={old,new}) + frame
336 c) read-watchpoint-trigger (hw-rwpt{number,exp};value={value}) + frame
337 d) access-watchpoint-trigger (hw-awpt{number,exp};value={[old,]new}) + frame
338 e) watchpoint-scope (wpnum) + frame
339
340 Movement:
341 f) function-finished ([gdb-result-var,return-value]) + frame
342 g) location-reached + frame
343 h) end-stepping-range + frame
344
345 Exit:
346 i) exited-signalled (signal-name,signal-meaning)
347 j) exited (exit-code)
348 k) exited-normally
349
350 Signal:
351 l) signal-received (signal-name,signal-meaning) + frame
352
353 Plus: thread-id
354 */
355 enum mi_stop_reason
356 {
357  sr_unknown=0,
358  sr_bkpt_hit,
359  sr_wp_trigger, sr_read_wp_trigger, sr_access_wp_trigger, sr_wp_scope,
360  sr_function_finished, sr_location_reached, sr_end_stepping_range,
361  sr_exited_signalled, sr_exited, sr_exited_normally,
362  sr_signal_received
363 };
364
365 struct mi_stop_struct
366 {
367  enum mi_stop_reason reason; /* If more than one reason just the last. */
368  /* Flags indicating if non-pointer fields are filled. */
369  char have_thread_id;
370  char have_bkptno;
371  char have_exit_code;
372  char have_wpno;
373  /* Where stopped. Doesn't exist for sr_exited*. */
374  int thread_id;
375  mi_frames *frame;
376  /* sr_bkpt_hit */
377  int bkptno;
378  /* sr_*wp_* no scope */
379  mi_wp *wp;
380  char *wp_old;
381  char *wp_val;
382  /* sr_wp_scope */
383  int wpno;
384  /* sr_function_finished. Not for void func. */
385  char *gdb_result_var;
386  char *return_value;
387  /* sr_exited_signalled, sr_signal_received */
388  char *signal_name;
389  char *signal_meaning;
390  /* sr_exited */
391  int exit_code;
392 };
393 typedef struct mi_stop_struct mi_stop;
394
395 /* Variable containing the last error. */
396 extern int mi_error;
397 extern char *mi_error_from_gdb;
398 const char *mi_get_error_str();
399
400 /* Indicate the name of gdb exe. Default is /usr/bin/gdb */
401 void mi_set_gdb_exe(const char *name);
402 const char *mi_get_gdb_exe();
403 /* Indicate the name of a file containing commands to send at start-up */
404 void mi_set_gdb_start(const char *name);
405 const char *mi_get_gdb_start();
406 /* Indicate the name of a file containing commands to send after connection */
407 void mi_set_gdb_conn(const char *name);
408 const char *mi_get_gdb_conn();
409 void mi_send_target_commands(mi_h *h);
410 /* Connect to a local copy of gdb. */
411 mi_h *mi_connect_local();
412 /* Close connection. You should ask gdb to quit first. */
413 void  mi_disconnect(mi_h *h);
414 /* Force MI version. */
415 #define MI_VERSION2U(maj,mid,min) (maj*0x1000000+mid*0x10000+min)
416 void  mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle,
417                        unsigned vMinor);
418 void  mi_set_workaround(unsigned wa, int enable);
419 int   mi_get_workaround(unsigned wa);
420 /* Parse gdb output. */
421 mi_output *mi_parse_gdb_output(const char *str);
422 /* Functions to set/get the tunneled streams callbacks. */
423 void mi_set_console_cb(mi_h *h, stream_cb cb, void *data);
424 void mi_set_target_cb(mi_h *h, stream_cb cb, void *data);
425 void mi_set_log_cb(mi_h *h, stream_cb cb, void *data);
426 stream_cb mi_get_console_cb(mi_h *h, void **data);
427 stream_cb mi_get_target_cb(mi_h *h, void **data);
428 stream_cb mi_get_log_cb(mi_h *h, void **data);
429 /* The callback to deal with async events. */
430 void mi_set_async_cb(mi_h *h, async_cb cb, void *data);
431 async_cb mi_get_async_cb(mi_h *h, void **data);
432 /* Time out in gdb responses. */
433 void mi_set_time_out_cb(mi_h *h, tm_cb cb, void *data);
434 tm_cb mi_get_time_out_cb(mi_h *h, void **data);
435 void mi_set_time_out(mi_h *h, int to);
436 int mi_get_time_out(mi_h *h);
437 /* Callbacks to "see" the dialog with gdb. */
438 void mi_set_to_gdb_cb(mi_h *h, stream_cb cb, void *data);
439 void mi_set_from_gdb_cb(mi_h *h, stream_cb cb, void *data);
440 stream_cb mi_get_to_gdb_cb(mi_h *h, void **data);
441 stream_cb mi_get_from_gdb_cb(mi_h *h, void **data);
442 /* Sends a message to gdb. */
443 int mi_send(mi_h *h, const char *format, ...);
444 /* Wait until gdb sends a response. */
445 mi_output *mi_get_response_blk(mi_h *h);
446 /* Check if gdb sent a complete response. Use with mi_retire_response. */
447 int mi_get_response(mi_h *h);
448 /* Get the last response. Use with mi_get_response. */
449 mi_output *mi_retire_response(mi_h *h);
450 /* Look for a result record in gdb output. */
451 mi_output *mi_get_rrecord(mi_output *r);
452 /* Look if the output contains an async stop.
453    If that's the case return the reason for the stop.
454    If the output contains an error the description is returned in reason. */
455 int mi_get_async_stop_reason(mi_output *r, char **reason);
456 mi_stop *mi_get_stopped(mi_results *r);
457 mi_frames *mi_get_async_frame(mi_output *r);
458 /* Wait until gdb sends a response.
459    Then check if the response is of the desired type. */
460 int mi_res_simple_exit(mi_h *h);
461 int mi_res_simple_done(mi_h *h);
462 int mi_res_simple_running(mi_h *h);
463 int mi_res_simple_connected(mi_h *h);
464 /* It additionally extracts an specified variable. */
465 mi_results *mi_res_done_var(mi_h *h, const char *var);
466 /* Extract a frames list from the response. */
467 mi_frames *mi_res_frames_array(mi_h *h, const char *var);
468 mi_frames *mi_res_frames_list(mi_h *h);
469 mi_frames *mi_parse_frame(mi_results *c);
470 mi_frames *mi_res_frame(mi_h *h);
471 /* Create an auxiliar terminal using xterm. */
472 mi_aux_term *gmi_start_xterm();
473 /* Indicate the name of xterm exe. Default is /usr/bin/X11/xterm */
474 void mi_set_xterm_exe(const char *name);
475 const char *mi_get_xterm_exe();
476 /* Kill the auxiliar terminal and release the structure. */
477 void gmi_end_aux_term(mi_aux_term *t);
478 /* Look for a free Linux VT for the child. */
479 mi_aux_term *gmi_look_for_free_vt();
480 /* Look for a free and usable Linux VT. */
481 int mi_look_for_free_vt();
482 /* Close master and release the structure. */
483 void gmi_end_pty(mi_pty *p);
484 /* Look for a free pseudo terminal. */
485 mi_pty *gmi_look_for_free_pty();
486 /* Extract a list of thread IDs from response. */
487 int mi_res_thread_ids(mi_h *h, int **list);
488 int mi_get_thread_ids(mi_output *res, int **list);
489 /* A variable response. */
490 mi_gvar *mi_res_gvar(mi_h *h, mi_gvar *cur, const char *expression);
491 enum mi_gvar_fmt mi_format_str_to_enum(const char *format);
492 const char *mi_format_enum_to_str(enum mi_gvar_fmt format);
493 char mi_format_enum_to_char(enum mi_gvar_fmt format);
494 enum mi_gvar_lang mi_lang_str_to_enum(const char *lang);
495 const char *mi_lang_enum_to_str(enum mi_gvar_lang lang);
496 int mi_res_changelist(mi_h *h, mi_gvar_chg **changed);
497 int mi_res_children(mi_h *h, mi_gvar *v);
498 mi_bkpt *mi_res_bkpt(mi_h *h);
499 mi_wp *mi_res_wp(mi_h *h);
500 char *mi_res_value(mi_h *h);
501 mi_stop *mi_res_stop(mi_h *h);
502 enum mi_stop_reason mi_reason_str_to_enum(const char *s);
503 const char *mi_reason_enum_to_str(enum mi_stop_reason r);
504 int mi_get_read_memory(mi_h *h, unsigned char *dest, unsigned ws, int *na,
505                        unsigned long *addr);
506 mi_asm_insns *mi_get_asm_insns(mi_h *h);
507 /* Starting point of the program. */
508 void mi_set_main_func(const char *name);
509 const char *mi_get_main_func();
510 mi_chg_reg *mi_get_list_registers(mi_h *h, int *how_many);
511 int mi_get_list_registers_l(mi_h *h, mi_chg_reg *l);
512 mi_chg_reg *mi_get_list_changed_regs(mi_h *h);
513 int mi_get_reg_values(mi_h *h, mi_chg_reg *l);
514 mi_chg_reg *mi_get_reg_values_l(mi_h *h, int *how_many);
515 int gmi_target_download(mi_h *h);
516
517 /* Allocation functions: */
518 void *mi_calloc(size_t count, size_t sz);
519 void *mi_calloc1(size_t sz);
520 char *mi_malloc(size_t sz);
521 mi_results       *mi_alloc_results(void);
522 mi_output        *mi_alloc_output(void);
523 mi_frames        *mi_alloc_frames(void);
524 mi_gvar          *mi_alloc_gvar(void);
525 mi_gvar_chg      *mi_alloc_gvar_chg(void);
526 mi_bkpt          *mi_alloc_bkpt(void);
527 mi_wp            *mi_alloc_wp(void);
528 mi_stop          *mi_alloc_stop(void);
529 mi_asm_insns     *mi_alloc_asm_insns(void);
530 mi_asm_insn      *mi_alloc_asm_insn(void);
531 mi_chg_reg       *mi_alloc_chg_reg(void);
532 void mi_free_output(mi_output *r);
533 void mi_free_output_but(mi_output *r, mi_output *no, mi_results *no_r);
534 void mi_free_frames(mi_frames *f);
535 void mi_free_aux_term(mi_aux_term *t);
536 void mi_free_results(mi_results *r);
537 void mi_free_results_but(mi_results *r, mi_results *no);
538 void mi_free_gvar(mi_gvar *v);
539 void mi_free_gvar_chg(mi_gvar_chg *p);
540 void mi_free_wp(mi_wp *wp);
541 void mi_free_stop(mi_stop *s);
542 void mi_free_asm_insns(mi_asm_insns *i);
543 void mi_free_asm_insn(mi_asm_insn *i);
544 void mi_free_charp_list(char **l);
545 void mi_free_chg_reg(mi_chg_reg *r);
546
547 /* Porgram control: */
548 /* Specify the executable and arguments for local debug. */
549 int gmi_set_exec(mi_h *h, const char *file, const char *args);
550 /* Start running the executable. Remote sessions starts running. */
551 int gmi_exec_run(mi_h *h);
552 /* Continue the execution after a "stop". */
553 int gmi_exec_continue(mi_h *h);
554 /* Indicate which terminal will use the target program. For local sessions. */
555 int gmi_target_terminal(mi_h *h, const char *tty_name);
556 /* Specify what's the local copy that have debug info. For remote sessions. */
557 int gmi_file_symbol_file(mi_h *h, const char *file);
558 /* Continue until function return, the return value is included in the async
559    response. */
560 int gmi_exec_finish(mi_h *h);
561 /* Stop the program using SIGINT. */
562 int gmi_exec_interrupt(mi_h *h);
563 /* Next line of code. */
564 int gmi_exec_next(mi_h *h);
565 /* Next count lines of code. */
566 int gmi_exec_next_cnt(mi_h *h, int count);
567 /* Next line of assembler code. */
568 int gmi_exec_next_instruction(mi_h *h);
569 /* Next line of code. Get inside functions. */
570 int gmi_exec_step(mi_h *h);
571 /* Next count lines of code. Get inside functions. */
572 int gmi_exec_step_cnt(mi_h *h, int count);
573 /* Next line of assembler code. Get inside calls. */
574 int gmi_exec_step_instruction(mi_h *h);
575 /* Execute until location is reached. If file is NULL then is until next line. */
576 int gmi_exec_until(mi_h *h, const char *file, int line);
577 int gmi_exec_until_addr(mi_h *h, void *addr);
578 /* Return to previous frame inmediatly. */
579 mi_frames *gmi_exec_return(mi_h *h);
580 /* Just kill the program. Please read the notes in prg_control.c. */
581 int gmi_exec_kill(mi_h *h);
582
583 /* Target manipulation: */
584 /* Connect to a remote gdbserver using the specified methode. */
585 int gmi_target_select(mi_h *h, const char *type, const char *params);
586 /* Attach to an already running process. */
587 mi_frames *gmi_target_attach(mi_h *h, pid_t pid);
588 /* Detach from an attached process. */
589 int gmi_target_detach(mi_h *h);
590
591 /* Miscellaneous commands: */
592 /* Exit gdb killing the child is it is running. */
593 void gmi_gdb_exit(mi_h *h);
594 /* Send the version to the console. */
595 int gmi_gdb_version(mi_h *h);
596 /* Set a gdb variable. */
597 int gmi_gdb_set(mi_h *h, const char *var, const char *val);
598 /* Get a gdb variable. */
599 char *gmi_gdb_show(mi_h *h, const char *var);
600
601 /* Breakpoints manipulation: */
602 /* Insert a breakpoint at file:line. */
603 mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line);
604 /* Insert a breakpoint, all available options. */
605 mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
606                                const char *cond, int count, int thread,
607                                const char *where);
608 mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
609                                   int temporary, int hard_assist,
610                                   const char *cond, int count, int thread);
611 /* Remove a breakpoint. */
612 int gmi_break_delete(mi_h *h, int number);
613 /* Free the memory used for a breakpoint description. */
614 void mi_free_bkpt(mi_bkpt *b);
615 /* Modify the "ignore" count for a breakpoint. */
616 int gmi_break_set_times(mi_h *h, int number, int count);
617 /* Associate a condition with the breakpoint. */
618 int gmi_break_set_condition(mi_h *h, int number, const char *condition);
619 /* Enable or disable a breakpoint. */
620 int gmi_break_state(mi_h *h, int number, int enable);
621 /* Set a watchpoint. It doesn't work for remote targets! */
622 mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp);
623
624 /* Data Manipulation. */
625 /* Evaluate an expression. Returns a parsed tree. */
626 char *gmi_data_evaluate_expression(mi_h *h, const char *expression);
627 /* Path for sources. */
628 int gmi_dir(mi_h *h, const char *path);
629 /* A very limited "data read memory" implementation. */
630 int gmi_read_memory(mi_h *h, const char *exp, unsigned size,
631                     unsigned char *dest, int *na, int convAddr,
632                     unsigned long *addr);
633 mi_asm_insns *gmi_data_disassemble_se(mi_h *h, const char *start,
634                                       const char *end, int mode);
635 mi_asm_insns *gmi_data_disassemble_fl(mi_h *h, const char *file, int line,
636                                       int lines, int mode);
637 mi_chg_reg *gmi_data_list_register_names(mi_h *h, int *how_many);
638 int gmi_data_list_register_names_l(mi_h *h, mi_chg_reg *l);
639 mi_chg_reg *gmi_data_list_changed_registers(mi_h *h);
640 int gmi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg *l);
641 mi_chg_reg *gmi_data_list_all_register_values(mi_h *h, enum mi_gvar_fmt fmt, int *how_many);
642
643 /* Stack manipulation. */
644 /* List of frames. Arguments aren't filled. */
645 mi_frames *gmi_stack_list_frames(mi_h *h);
646 /* List of frames. Indicating a range. */
647 mi_frames *gmi_stack_list_frames_r(mi_h *h, int from, int to);
648 /* List arguments. Only level and args filled. */
649 mi_frames *gmi_stack_list_arguments(mi_h *h, int show);
650 /* List arguments. Indicating a range. Only level and args filled. */
651 mi_frames *gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to);
652 /* Information about the current frame, including args. */
653 mi_frames *gmi_stack_info_frame(mi_h *h);
654 /* Stack info depth. error => -1 */
655 int gmi_stack_info_depth_get(mi_h *h);
656 /* Set stack info depth. error => -1 */
657 int gmi_stack_info_depth(mi_h *h, int max_depth);
658 /* Change current frame. */
659 int gmi_stack_select_frame(mi_h *h, int framenum);
660 /* List of local vars. */
661 mi_results *gmi_stack_list_locals(mi_h *h, int show);
662
663 /* Thread. */
664 /* List available thread ids. */
665 int gmi_thread_list_ids(mi_h *h, int **list);
666 /* Select a thread. */
667 mi_frames *gmi_thread_select(mi_h *h, int id);
668 /* List available threads. */
669 mi_frames *gmi_thread_list_all_threads(mi_h *h);
670
671 /* Variable objects. */
672 /* Create a variable object. */
673 mi_gvar *gmi_var_create_nm(mi_h *h, const char *name, int frame, const char *exp);
674 mi_gvar *gmi_var_create(mi_h *h, int frame, const char *exp);
675 /* Create the variable and also fill the lang and attr fields. */
676 mi_gvar *gmi_full_var_create(mi_h *h, int frame, const char *exp);
677 /* Delete a variable object. Doesn't free the mi_gvar data. */
678 int gmi_var_delete(mi_h *h, mi_gvar *var);
679 /* Set the format used to represent the result. */
680 int gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format);
681 /* Fill the format field with info from gdb. */
682 int gmi_var_show_format(mi_h *h, mi_gvar *var);
683 /* Fill the numchild field with info from gdb. */
684 int gmi_var_info_num_children(mi_h *h, mi_gvar *var);
685 /* Fill the type field with info from gdb. */
686 int gmi_var_info_type(mi_h *h, mi_gvar *var);
687 /* Fill the expression and lang fields with info from gdb.
688    Note that lang isn't filled during creation. */
689 int gmi_var_info_expression(mi_h *h, mi_gvar *var);
690 /* Fill the attr field with info from gdb.
691    Note that attr isn't filled during creation. */
692 int gmi_var_show_attributes(mi_h *h, mi_gvar *var);
693 /* Update variable. Use NULL for all.
694    Note that *changed can be NULL if none updated. */
695 int gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed);
696 /* Change variable. Fills the value field. */
697 int gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression);
698 /* Get current value for a variable. */
699 int gmi_var_evaluate_expression(mi_h *h, mi_gvar *var);
700 /* List children. It ONLY returns the first level information. :-( */
701 int gmi_var_list_children(mi_h *h, mi_gvar *var);
702
703
704
705
706 #if 0                           /* keep Emacsens' auto-indent happy */
707 {
708 #endif
709 #ifdef __cplusplus
710 }
711 #endif
712
713