This document applies to version 0.8.10 of the GDB/Machine interface library.
Most of the C++ interface is fully documented. But not all the C interface is docummented.
The name of the high level C functions are derived from the corresponding GDB/MI command. For this reason I recommend using the chapter 'GDB/MI' of gdb documentation as main reference. As an example: The gdb command '-thread-list-ids' is implemented in the gmi_thread_list_ids function. This function uses the lowlevel function mi_thread_list_ids.
The mi_gdb.h header contains a lot of comments about what does each function. And the examples show how to them together.
gdb command: Implemented? -break-after Yes -break-condition Yes -break-delete Yes -break-disable Yes -break-enable Yes -break-info N.A. (info break NUMBER) (*) -break-insert Yes -break-list No (*) -break-watch Yes(*) I think the program should keep track of the breakpoints, so it will be implemented when I have more time.
GDB Bug workaround for "file -readnow": I tried to workaround a bug using it but looks like this option also have bugs!!!! so I have to use the command line option --readnow. It also have a bug!!!! when the binary is changed and gdb must reload it this option is ignored. So it looks like we have no solution but 3 gdb bugs in a row.
gdb command: Implemented? -data-disassemble Yes -data-evaluate-expression Yes -data-list-changed-registers No -data-list-register-names Yes -data-list-register-values No -data-read-memory No -display-delete N.A. (delete display) -display-disable N.A. (disable display) -display-enable N.A. (enable display) -display-insert N.A. (display) -display-list N.A. (info display) -environment-cd No -environment-directory Yes, MI v1 implementation -environment-path NoNotes:
1) -display* aren't implemented. You can use CLI command display, but the results are sent to the console. So it looks like the best is to manually use -data-evaluate-expression to emulate it.
2) GDB bug mi/1770: Affects gdb<=6.2, when you ask for the names of the registers you get it plus the name of the "pseudo-registers", but if you try to get the value of a pseudo-register you get an error saying the register number is invalid. I reported to gdb-patches@sources.redhat.com on 2004/08/25 and as I didn't get any answer I filled a bug report on 2004/09/02. The patch to fix this annoying bug is: Index: gdb/mi/mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.64 diff -u -r1.64 mi-main.c --- gdb/mi/mi-main.c 3 Aug 2004 00:57:27 -0000 1.64 +++ gdb/mi/mi-main.c 25 Aug 2004 14:12:50 -0000 @ -423,7 +423,7 @ case, some entries of REGISTER_NAME will change depending upon the particular processor being debugged. - numregs = NUM_REGS; + numregs = NUM_REGS + NUM_PSEUDO_REGS; if (argc == 0) { ---- Note I had to remove an end of comment in the patch to include it here. This bug forced me to create another set of functions. The only way is to first get the values and then the names. Fixed by Changelog entry: 2004-09-12 Salvador E. Tropea <set@users.sf.net> Andrew Cagney <cagney@gnu.org> * mi/mi-main.c (mi_cmd_data_list_changed_registers) (mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Include the PSEUDO_REGS in the register number computation.
The code comes from "lconsole.c" from Allegro project and was originally created by Marek Habersack and then modified by George Foot. I addapted it to my needs and changed license from giftware to GPL.
gdb command: Implemented? -gdb-exit Yes -gdb-set Yes -gdb-show Yes -gdb-version Yes
gdb command: Implemented? -exec-abort N.A. (*) (kill, but with non-interactive options) -exec-arguments Yes -exec-continue Yes ASYNC -exec-finish Yes ASYNC -exec-interrupt Yes ASYNC -exec-next Yes ASYNC -exec-next-instruction Yes ASYNC -exec-return Yes -exec-run Yes ASYNC -exec-show-arguments N.A. (show args) see gmi_stack_info_frame -exec-step Yes ASYNC -exec-step-instruction Yes ASYNC -exec-until Yes ASYNC -file-exec-and-symbols Yes -file-exec-file No -file-list-exec-sections N.A. (info file) -file-list-exec-source-files N.A. -file-list-shared-libraries N.A. -file-list-symbol-files N.A. -file-symbol-file Yes(*) gmi_exec_kill implements it, but you should ensure that gmi_gdb_set("confirm","off") was called.
GDB Bug workaround for -file-exec-and-symbols and -file-symbol-file: This
is complex, but a real bug. When you set a breakpoint you never know the
name of the file as it appears in the debug info. So you can be specifying
an absolute file name or a relative file name. The reference point could be
different than the one used in the debug info. To solve all the combinations
gdb does a search trying various combinations. GDB isn't very smart so you
must at least specify the working directory and the directory where the
binary is located to get a good chance (+ user options to solve the rest).
Once you did it gdb can find the file by doing transformations to the
"canonical" filename. This search works OK for already loaded symtabs
(symbol tables), but it have a bug when the search is done for psymtabs
(partial symtabs). The bug is in the use of source_full_path_of (source.c).
This function calls openp indicating try_cwd_first. It makes the search file
if the psymtab file name have at least one dirseparator. It means that
psymtabs for files compiled with relative paths will fail. The search for
symtabs uses symtab_to_filename, it calls open_source_file which finally
calls openp without try_cwd_first.
To workaround this bug we must ensure gdb loads *all* the symtabs to memory.
And here comes another problem -file-exec-and-symbols doesn't support it
according to docs. In real life that's a wrapper for "file", but as nobody
can say it won't change we must use the CLI command.
gdb command: Implemented? -stack-info-frame Yes, implemented as "frame" -stack-info-depth Yes -stack-list-arguments Yes -stack-list-frames Yes -stack-list-locals Yes -stack-select-frame Yes
gdb command: Implemented? -symbol-info-address N.A. (info address, human readable) -symbol-info-file N.A. -symbol-info-function N.A. -symbol-info-line N.A. (info line, human readable) -symbol-info-symbol N.A. (info symbol, human readable) -symbol-list-functions N.A. (info functions, human readable) -symbol-list-types N.A. (info types, human readable) -symbol-list-variables N.A. (info variables, human readable) -symbol-list-lines No (gdb 6.x) -symbol-locate N.A. -symbol-type N.A. (ptype, human readable)Note:
Only one is implemented and not in gdb 5.x.
-target-attach Yes (implemented using attach) -target-compare-sections N.A. (compare-sections) -target-detach Yes -target-download No -target-exec-status N.A. -target-list-available-targets N.A. (help target) -target-list-current-targets N.A. (info file among other things) -target-list-parameters N.A. -target-select Yes
gdb command: Implemented? -thread-info N.A. -thread-list-all-threads Yes, implemented as "info threads" -thread-list-ids Yes -thread-select Yes
gdb command: Imp? Description: -var-create Yes create a variable object -var-delete Yes delete the variable object and its children -var-set-format Yes set the display format of this variable -var-show-format Yes show the display format of this variable -var-info-num-children Yes tells how many children this object has -var-list-children Yes* return a list of the object's children -var-info-type Yes show the type of this variable object -var-info-expression Yes print what this variable object represents -var-show-attributes Yes is this variable editable? -var-evaluate-expression Yes get the value of this variable -var-assign Yes set the value of this variable -var-update Yes* update the variable and its childrenNotes:
1) I suggest letting gdb to choose the names for the variables.
2) -var-list-children supports an optional "show values" argument in MI v2.
It isn't implemented.
* MI v1 and v2 result formats supported.
gmi_break_insert(mi_h *h, const char *file, int line);Description
Insert a breakpoint at file:line.
Return Value
A new mi_bkpt structure with info about the breakpoint. NULL on error.
gmi_break_insert_full(mi_h *h, int temporary, int hard_assist, const char *cond, int count, int thread, const char *where);Description
Insert a breakpoint, all available options.
Return Value
A new mi_bkpt structure with info about the breakpoint. NULL on error.
gmi_break_insert_full_fl(mi_h *h, const char *file, int line, int temporary, int hard_assist, const char *cond, int count, int thread);Description
Insert a breakpoint, all available options.
Return Value
A new mi_bkpt structure with info about the breakpoint. NULL on error.
gmi_break_delete(mi_h *h, int number);Description
Remove a breakpoint.
Return Value
!=0 OK. Note that gdb always says OK, but errors can be sent to the console.
gmi_break_set_times(mi_h *h, int number, int count);Description
Modify the "ignore" count for a breakpoint.
Return Value
!=0 OK. Note that gdb always says OK, but errors can be sent to the console.
gmi_break_set_condition(mi_h *h, int number, const char *condition);Description
Associate a condition with the breakpoint.
Return Value
!=0 OK
gmi_break_state(mi_h *h, int number, int enable);Description
Enable or disable a breakpoint.
Return Value
!=0 OK. Note that gdb always says OK, but errors can be sent to the console.
gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp);Description
Set a watchpoint. It doesn't work for remote targets!
Return Value
A new mi_wp structure with info about the watchpoint. NULL on error.
mi_connect_local();Description
Connect to a local copy of gdb. Note that the mi_h structure is something similar to a "FILE *" for stdio.
Return Value
A new mi_h structure or NULL on error.
mi_disconnect(mi_h *h);Description
Close connection. You should ask gdb to quit first gmi_gdb_exit.
gmi_start_xterm();Description
Opens a new xterm to be used by the child process to debug.
Return Value
A new mi_aux_term structure, you can use gmi_end_aux_term to release it.
gmi_end_aux_term(mi_aux_term *t);Description
Closes the auxiliar terminal and releases the allocated memory.
mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle, unsigned vMinor);Description
Forces the MI version. Currently the library can't detect it so you must force it manually. GDB 5.x implemented MI v1 and 6.x v2.
mi_set_workaround(unsigned wa, int enable);Description
Dis/Enables the @var{wa} workaround for a bug in gdb.
mi_get_workaround(unsigned wa);Description
Finds if the @var{wa} workaround for a bug in gdb is enabled.
Return Value
!=0 if enabled.
MIDebugger::MIDebugger();Member of the class: MIDebugger
Description
Initializes a debugger object. It starts in the "disconnected" state. Use Connect after it.
MIDebugger::~MIDebugger();Member of the class: MIDebugger
Description
This is the destructor for the class. It tries to change the state to "disconnected" doing the needed actions.
MIDebugger::Connect(bool);Member of the class: MIDebugger
Description
Connects to gdb. Currently only local connections are supported, that's a gdb limitation. Call it when in "unconnected" state, on success it will change to the "connected" state. After it you should call one of the SelectTarget members. SelectTargetX11, SelectTargetLinux or SelectTargetRemote. To finish the connection use Disconnect.
Return Value
!=0 OK.
MIDebugger::Disconnect();Member of the class: MIDebugger
Description
Finishes the connection to gdb. Call when in "connected" state, on success it will change to "disconnected" state. This function first tries to exit from gdb and then close the connection. But if gdb fails to exit it will be killed.
Return Value
!=0 OK
MIDebugger::SelectTargetTTY(const char *exec, const char *args, const char *auxtty, dMode m);Member of the class: MIDebugger
Description
Protected member that implements SelectTargetX11 and SelectTargetLinux.
Return Value
!=0 OK.
MIDebugger::SelectTargetX11(const char *exec, const char *args, const char *auxtty);Member of the class: MIDebugger
Description
Starts a debug session for X11. It opens an xterm console for the program to debug and tells gdb which executable to debug and the command line options to pass. You can specify an already existing tty console to be used. Can be called when the state is "connected". On success will change to the "target_specified" state. After it you can use Run or use the members to define breakpoints and similar stuff. To finish it use TargetUnselect.
Return Value
!=0 OK.
MIDebugger::SelectTargetLinux(const char *exec, const char *args, const char *auxtty);Member of the class: MIDebugger
Description
Starts a debug session for Linux console. It selects an empty VT for the program to debug and tells gdb which executable to debug and the command line options to pass. You can specify an already existing tty console to be used. Can be called when the state is "connected". On success will change to the "target_specified" state. After it you can use Run or use the members to define breakpoints and similar stuff. To finish it use TargetUnselect.
Return Value
!=0 OK.
MIDebugger::SelectTargetRemote(const char *exec, const char *rparams, const char *rtype);Member of the class: MIDebugger
Description
Starts a remote session. The other end should be running gdbserver. You must specify a local copy of the program to debug with debug info. The remote copy can be stripped. The @var{rtype} and @var{rparams} selects the protocol and the remote machine. Read gdb docs to know more about the available options. If @var{rtype} is omitted "extended-remote" protocol is used. Can be called when the state is "connected". On success will change to the "target_specified" state. After it you can use Run or use the members to define breakpoints and similar stuff. To finish it use TargetUnselect. Note that when gdb uses remote debugging the remote program starts running. The Run member knows about it.
Return Value
!=0 OK.
Example
o->SelectTargetRemote("./exec_file","192.168.1.65:5000");
MIDebugger::SelectTargetPID(const char *exec, int pid);Member of the class: MIDebugger
Description
Starts a local session using an already running process.
Return Value
!=0 OK.
MIDebugger::TargetUnselect();Member of the class: MIDebugger
Description
Used to unselect the current target. When X11 mode it closes the auxiliar terminal. For remote debugging it uses "detach". Can be called when in "target_specified" state. On success it changes to "connected" state.
Return Value
!=0 OK
MIDebugger::Run();Member of the class: MIDebugger
Description
Starts running the program. You should set breakpoint before it. Can be called when state is "target_specified". On success will change to "running" state. After it you should poll for async responses using Poll. The program can stop for many reasons asynchronously and also exit. This information is known using Poll. You can stop the program using Stop.
Return Value
!=0 OK.
MIDebugger::Stop();Member of the class: MIDebugger
Description
Stops the program execution. GDB sends an interrupt signal to the program. Can be called when the state is "running". It won't switch to "stopped" state automatically. Instead you must poll for async events and wait for a stopped notification. After it you can call Continue to resume execution.
Return Value
Example
!=0 OK
MIDebugger::Poll(mi_stop *&rs);Member of the class: MIDebugger
Description
Polls gdb looking for async responses. Currently it just looks for "stopped" messages. You must call it when the state is "running". But the function will poll gdb even if the state isn't "running". When a stopped message is received the state changes to stopped or target_specified (the last is when we get some exit).
Return Value
!=0 if we got a response. The @var{rs} pointer will point to an mi_stop structure if we got it or will be NULL if we didn't.
MIDebugger::Continue();Member of the class: MIDebugger
Description
Resumes execution after the program "stopped". Can be called when the state is stopped. On success will change to "running" state.
Return Value
!=0 OK
MIDebugger::RunOrContinue();Member of the class: MIDebugger
Description
Starts program execution or resumes it. When the state is target_specified it calls Run otherwise it uses Continue. Can be called when the state is "target_specified" or "stopped". On success will change to "running" state.
Return Value
!=0 OK
MIDebugger::Kill();Member of the class: MIDebugger
Description
Kills the program you are debugging. Can be called when the state is "stopped" or "running". On success changes the state to "target_specified". Note that if you want to restart the program you can just call Run and if you want to just stop the program call Stop.
Return Value
!=0 OK
MIDebugger::Breakpoint(const char *file, int line);Member of the class: MIDebugger
Description
Inserts a breakpoint at @var{file} and @var{line}. Can be called when the state is "stopped" or "target_specified".
Return Value
An mi_bkpt structure or NULL if error.
MIDebugger::Breakpoint(const char *where, bool temporary, const char *cond, int count, int thread, bool hard_assist);Member of the class: MIDebugger
Description
Inserts a breakpoint at @var{where}, all options available. Can be called when the state is "stopped" or "target_specified".
Return Value
An mi_bkpt structure or NULL if error.
MIDebugger::BreakpointFull(const char *file, int line, bool temporary, const char *cond, int count, int thread, bool hard_assist);Member of the class: MIDebugger
Description
Inserts a breakpoint at @var{file} and @var{line} all options available. Can be called when the state is "stopped" or "target_specified".
Return Value
An mi_bkpt structure or NULL if error.
MIDebugger::BreakDelete(mi_bkpt *b);Member of the class: MIDebugger
Description
Removes the specified breakpoint. It doesn't free the structure. Can be called when the state is "stopped" or "target_specified".
Return Value
!=0 OK
MIDebugger::Watchpoint(enum mi_wp_mode mode, const char *exp);Member of the class: MIDebugger
Description
Inserts a watchpoint for the specified expression. Can be called when the state is "stopped" or "target_specified".
Return Value
An mi_wp structure or NULL if error.
MIDebugger::WatchDelete(mi_wp *w);Member of the class: MIDebugger
Description
Removes the specified watchpoint. It doesn't free the structure. Can be called when the state is "stopped" or "target_specified".
Return Value
!=0 OK
MIDebugger::RunToMain();Member of the class: MIDebugger
Description
Puts a temporal breakpoint in main function and starts running. Can be called when the state is "target_specified". If successful the state will change to "running".
Return Value
!=0 OK
MIDebugger::StepOver(bool inst);Member of the class: MIDebugger
Description
Executes upto the next line, doesn't follow function calls. The @var{inst} argument is for assembler. If the state is "target_specified" it will go to the first line in the main function. If the state is "stopped" will use the next command. If successfully the state will change to "running".
Return Value
!=0 OK
MIDebugger::GoTo(const char *file, int line);Member of the class: MIDebugger
Description
Executes until the specified point. If the state is "target_specified" it uses a temporal breakpoint. If the state is "stopped" it uses -exec-until. Fails for any other state.
Return Value
!=0 OK
MIDebugger::GoTo(void *addr);Member of the class: MIDebugger
Description
Executes until the specified point. If the state is "target_specified" it uses a temporal breakpoint. If the state is "stopped" it uses -exec-until. Fails for any other state.
Return Value
!=0 OK
MIDebugger::FinishFun();Member of the class: MIDebugger
Description
Resumes execution until the end of the current funtion is reached. Only usable when we are in the "stopped" state.
Return Value
!=0 OK
MIDebugger::ReturnNow();Member of the class: MIDebugger
Description
Return Value
!=NULL OK, the returned frame is the current location. That's a synchronous function.
MIDebugger::CallStack(bool args);Member of the class: MIDebugger
Description
Return Value
!=NULL OK, the list of frames is returned.
MIDebugger::TraceInto(bool inst);Member of the class: MIDebugger
Description
Executes upto the next line, it follows function calls. The @var{inst} argument is for assembler. If the state is "target_specified" it will go to the first line in the main function. If the state is "stopped" will use the next command. If successfully the state will change to "running".
Return Value
!=0 OK
MIDebugger::EvalExpression(const char *exp);Member of the class: MIDebugger
Description
Evaluates the provided expression. If we get an error the error description is returned instead. Can't be called if "disconnected" or "running".
Return Value
The result of the expression (use free) or NULL.
MIDebugger::ModifyExpression(char *exp, char *newVal);Member of the class: MIDebugger
Description
Modifies the provided expression. If we get an error the error description is returned instead. Can't be called if "disconnected" or "running".
Return Value
The result of the expression (use free) or NULL.
MIDebugger::Send(const char *command);Member of the class: MIDebugger
Description
Sends a command to gdb.
Return Value
!=0 OK
MIDebugger::FillTypeVal(mi_gvar *var);Member of the class: MIDebugger
Description
Fills the type and value fields of the mi_gvar provided list.
Return Value
!=0 OK
gmi_data_evaluate_expression(mi_h *h, const char *expression);Description
Evaluate an expression. Returns a parsed tree.
Return Value
The resulting value (as plain text) or NULL on error.
gmi_dir(mi_h *h, const char *path);Description
Path for sources. You must use it to indicate where are the sources for the program to debug. Only the MI v1 implementation is available.
Return Value
!=0 OK
mi_get_error_str();
mi_look_for_free_pty(int *master, char **slave);Description
Look for a free and usable pseudo terminal. Low level, use gmi_look_for_free_pty.
Return Value
A file descriptor connected to the master pty and the name of the slave device, or <0 on error.
gmi_look_for_free_pty();Description
Look for a free and usable pseudo terminal to be used by the child.
Return Value
A new mi_pty structure, you can use gmi_end_pty to release it.
gmi_end_pty(mi_pty *p);Description
Closes the pseudo termial master and releases the allocated memory.
mi_look_for_free_vt() 53;Description
Look for a free and usable Linux VT. Low level, use gmi_look_for_free_vt.
Return Value
The VT number or <0 on error.
gmi_look_for_free_vt() 137;Description
Look for a free and usable Linux VT to be used by the child.
Return Value
A new mi_aux_term structure, you can use gmi_end_aux_term to release it.
gmi_gdb_exit(mi_h *h);Description
Exit gdb killing the child is it is running.
gmi_gdb_version(mi_h *h);Description
Send the version to the console.
Return Value
!=0 OK
gmi_gdb_set(mi_h *h, const char *var, const char *val);Description
Set a gdb variable.
Return Value
!=0 OK
gmi_gdb_show(mi_h *h, const char *var);Description
Get a gdb variable.
Return Value
The current value of the variable or NULL on error.
gmi_set_exec(mi_h *h, const char *file, const char *args);Description
Specify the executable and arguments for local debug.
Return Value
!=0 OK
gmi_exec_run(mi_h *h);Description
Start running the executable. Remote sessions starts running.
Return Value
!=0 OK
gmi_exec_continue(mi_h *h);Description
Continue the execution after a "stop".
Return Value
!=0 OK
gmi_target_terminal(mi_h *h, const char *tty_name);Description
Indicate which terminal will use the target program. For local sessions.
Return Value
!=0 OK
Example
gmi_file_symbol_file(mi_h *h, const char *file);Description
Specify what's the local copy that have debug info. For remote sessions.
Return Value
!=0 OK
gmi_exec_finish(mi_h *h);Description
Continue until function return, the return value is included in the async response.
Return Value
!=0 OK.
gmi_exec_interrupt(mi_h *h);Description
Stop the program using SIGINT. The corresponding command should be -exec-interrupt but not even gdb 6.1.1 can do it because the "async" mode isn't really working.
Return Value
Always 1
Example
gmi_exec_next(mi_h *h);Description
Next line of code.
Return Value
!=0 OK
gmi_exec_next_cnt(mi_h *h, int count);Description
Skip count lines of code.
Return Value
!=0 OK
gmi_exec_next_instruction(mi_h *h);Description
Next line of assembler code.
Return Value
!=0 OK
gmi_exec_step(mi_h *h);Description
Next line of code. Get inside functions.
Return Value
!=0 OK
gmi_exec_step_cnt(mi_h *h, int count);Description
Next count lines of code. Get inside functions.
Return Value
!=0 OK
gmi_exec_step_instruction(mi_h *h);Description
Next line of assembler code. Get inside calls.
Return Value
!=0 OK
gmi_exec_until(mi_h *h, const char *file, int line);Description
Execute until location is reached. If file is NULL then is until next line.
Return Value
!=0 OK
gmi_exec_until_addr(mi_h *h, void *addr);Description
Execute until location is reached.
Return Value
!=0 OK
gmi_exec_return(mi_h *h);Description
Return Value
A pointer to a new mi_frames structure indicating the current location. NULL on error.
gmi_exec_kill(mi_h *h);Description
Just kill the program. That's what -exec-abort should do, but it isn't implemented by gdb. This implementation only works if the interactive mode is disabled (gmi_gdb_set("confirm","off")).
Return Value
!=0 OK
gmi_stack_list_frames(mi_h *h);Description
List of frames. Arguments aren't filled.
Return Value
A new list of mi_frames or NULL on error.
gmi_stack_list_frames_r(mi_h *h, int from, int to);Description
List of frames. Arguments aren't filled. Only the frames in the @var{from} - @var{to} range are returned.
Return Value
A new list of mi_frames or NULL on error.
gmi_stack_list_arguments(mi_h *h, int show);Description
List arguments. Only @var{level} and @var{args} filled.
Return Value
A new list of mi_frames or NULL on error.
gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to);Description
List arguments. Only @var{level} and @var{args} filled. Only for the frames in the @var{from} - @var{to} range.
Return Value
A new list of mi_frames or NULL on error.
gmi_stack_info_frame(mi_h *h);Description
Information about the current frame, including args.
Return Value
A new mi_frames or NULL on error.
gmi_stack_info_depth(mi_h *h, int max_depth);Description
Stack info depth.
Return Value
The depth or -1 on error.
gmi_stack_info_depth_get(mi_h *h);Description
Set stack info depth.
Return Value
The depth or -1 on error.
Example
gmi_stack_select_frame(mi_h *h, int framenum);Description
Change current frame.
Return Value
!=0 OK
gmi_stack_list_locals(mi_h *h, int show);Description
List of local vars.
Return Value
A new mi_results tree containing the variables or NULL on error.
gmi_target_select(mi_h *h, const char *type, const char *params);Description
Connect to a remote gdbserver using the specified methode.
Return Value
!=0 OK
gmi_target_attach(mi_h *h, pid_t pid);Description
Attach to an already running process.
Return Value
The frame of the current location, NULL on error.
gmi_target_detach(mi_h *h);Description
Detach from an attached process.
Return Value
!=0 OK
gmi_thread_list_ids(mi_h *h, int **list);Description
List available thread ids.
Return Value
!=0 OK
gmi_thread_select(mi_h *h, int id);Description
Select a thread.
Return Value
A new mi_frames or NULL on error.
gmi_thread_list_all_threads(mi_h *h);Description
Get a list of frames for each available thread. Implemented using "info thread".
Return Value
A kist of frames, NULL on error
gmi_var_create_nm(mi_h *h, const char *name, int frame, const char *exp);Description
Create a variable object. I recommend using gmi_var_create and letting gdb choose the names.
Return Value
A new mi_gvar strcture or NULL on error.
gmi_var_create(mi_h *h, int frame, const char *exp);Description
Create a variable object. The name is selected by gdb. Alternative: gmi_full_var_create.
Return Value
A new mi_gvar strcture or NULL on error.
gmi_var_delete(mi_h *h, mi_gvar *var);Description
Delete a variable object. Doesn't free the mi_gvar data.
Return Value
!=0 OK
gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format);Description
Set the format used to represent the result.
Return Value
!=0 OK
gmi_var_show_format(mi_h *h, mi_gvar *var);Description
Fill the format field with info from gdb.
Return Value
!=0 OK.
gmi_var_info_num_children(mi_h *h, mi_gvar *var);Description
Fill the numchild field with info from gdb.
Return Value
!=0 OK
gmi_var_info_type(mi_h *h, mi_gvar *var);Description
Fill the type field with info from gdb.
Return Value
!=0 OK
gmi_var_info_expression(mi_h *h, mi_gvar *var);Description
Fill the expression and lang fields with info from gdb. Note that lang isn't filled during creation.
Return Value
!=0 OK
gmi_var_show_attributes(mi_h *h, mi_gvar *var);Description
Fill the attr field with info from gdb. Note that attr isn't filled during creation.
Return Value
!=0 OK
gmi_full_var_create(mi_h *h, int frame, const char *exp);Description
Create the variable and also fill the lang and attr fields. The name is selected by gdb.
Return Value
A new mi_gvar strcture or NULL on error.
gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed);Description
Update variable. Use NULL for all. Note that *changed can be NULL if none updated.
Return Value
!=0 OK. The @var{changed} list contains the list of changed vars.
gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression);Description
Change variable. The new value replaces the @var{value} field.
Return Value
!=0 OK
gmi_var_evaluate_expression(mi_h *h, mi_gvar *var);Description
Fill the value field getting the current value for a variable.
Return Value
!=0 OK, value contains the result.
gmi_var_list_children(mi_h *h, mi_gvar *var);Description
List children. It ONLY returns the first level information. :-(
On success the child field contains the list of children.
Return Value
!=0 OK