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