OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gdb-7.1/gdb/mi
    from Rev 816 to Rev 834
    Reverse comparison

Rev 816 → Rev 834

/mi-cmds.h File deleted
mi-cmds.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-common.h =================================================================== --- mi-common.h (revision 816) +++ mi-common.h (nonexistent) @@ -1,59 +0,0 @@ -/* Interface for common GDB/MI data - Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_COMMON_H -#define MI_COMMON_H - -/* Represents the reason why GDB is sending an asynchronous command to the - front end. NOTE: When modifing this, don't forget to update gdb.texinfo! */ -enum async_reply_reason -{ - EXEC_ASYNC_BREAKPOINT_HIT = 0, - EXEC_ASYNC_WATCHPOINT_TRIGGER, - EXEC_ASYNC_READ_WATCHPOINT_TRIGGER, - EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER, - EXEC_ASYNC_FUNCTION_FINISHED, - EXEC_ASYNC_LOCATION_REACHED, - EXEC_ASYNC_WATCHPOINT_SCOPE, - EXEC_ASYNC_END_STEPPING_RANGE, - EXEC_ASYNC_EXITED_SIGNALLED, - EXEC_ASYNC_EXITED, - EXEC_ASYNC_EXITED_NORMALLY, - EXEC_ASYNC_SIGNAL_RECEIVED, - /* This is here only to represent the number of enums. */ - EXEC_ASYNC_LAST -}; - -const char *async_reason_lookup (enum async_reply_reason reason); - -struct mi_interp -{ - /* MI's output channels */ - struct ui_file *out; - struct ui_file *err; - struct ui_file *log; - struct ui_file *targ; - struct ui_file *event_channel; - - /* This is the interpreter for the mi... */ - struct interp *mi2_interp; - struct interp *mi1_interp; - struct interp *mi_interp; -}; - -#endif
mi-common.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: ChangeLog-1999-2003 =================================================================== --- ChangeLog-1999-2003 (revision 816) +++ ChangeLog-1999-2003 (nonexistent) @@ -1,2180 +0,0 @@ -2003-11-06 Andrew Cagney - - * mi-cmd-var.c (mi_cmd_var_set_format): Replace STREQN with - strncmp. - -2003-10-24 Andrew Cagney - - * tui-out.c: Fix "fortunatly"[sic]. - -2003-10-02 Andrew Cagney - - * mi-main.c: Rename REGISTER_RAW_SIZE to - DEPRECATED_REGISTER_RAW_SIZE. - -2003-09-30 Andrew Cagney - - * mi-main.c: Rename REGISTER_VIRTUAL_SIZE to - DEPRECATED_REGISTER_VIRTUAL_SIZE. - -2003-09-17 Andrew Cagney - - * mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE. - -2003-09-10 Elena Zannoni - - * mi-main.c (mi_setup_architecture_data): Don't use - DEPRECATED_REGISTER_BYTES because some architecture don't set it - and its default is 0. - -2003-08-08 Andrew Cagney - - * mi-main.c (captured_mi_execute_command): Add "mi2" and "mi3" to - interpreters that hack around CLI. - * mi-interp.c (mi3_command_loop): New function. - (mi_interpreter_resume): Check for "mi3", default to "mi2". - -2003-08-07 Andrew Cagney - - * mi-interp.c (_initialize_mi_interp): Register "mi2" and "mi3". - Make "mi" select "mi2". - -2003-08-05 Andrew Cagney - - * mi-cmd-env.c (env_execute_cli_command): Use an explicit "%s %s" - when constructing the run command. - (mi_cmd_env_cd, mi_cmd_env_path, mi_cmd_env_dir): Simplify command - string removing the "%s". - -2003-08-04 Andrew Cagney - - * mi-cmds.h (struct mi_cli): Define. - (struct mi_cmd): Change type of "cli" to "struct mi_cli". - * mi-cmds.c (mi_cmds): Update table. - * mi-parse.c (mi_parse): Update. - * mi-main.c (mi_execute_cli_command): Add "args_p" parameter, make - others constant. - (mi_cmd_execute): Update call. - (captured_mi_execute_command): Ditto. - -2003-08-04 David Carlton - - * mi-main.c (mi_error_last_message): Add "%s" second argument to - xasprintf call. - -2003-06-28 Daniel Jacobowitz - - * mi-out.c (mi_ui_out_impl): Add NULL for redirect member. - -2003-06-17 Daniel Jacobowitz - - * mi-cmds.c (mi_cmds): Add "-target-disconnect". - -2003-06-11 David Carlton - - * mi-cmd-stack.c: Include dictionary.h. - (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS. - -2003-06-11 Andrew Cagney - - * mi-main.c (get_register): Replace REGISTER_CONVERTIBLE with - DEPRECATED_REGISTER_CONVERTIBLE. - -2003-06-08 Andrew Cagney - - * mi-parse.c (_initialize_mi_parse): Delete function. - * mi-main.c: Include "mi-main.h". - * mi-interp.c (_initialize_mi_interp): Add declaration. - * mi-cmd-stack.c: Include "stack.h". - (select_frame_command_wrapper): Delete extern declaration. - (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper - with select_frame_command. - -2003-05-16 Andrew Cagney - - * mi-main.c (mi_setup_architecture_data): - -2003-05-12 Elena Zannoni - - * mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to - VAR_DOMAIN. - -2003-05-11 Andrew Cagney - - * mi-symbol-cmds.c: Rename "mi-cmd-symbol.c", avoid 8.3 problem. - -2003-05-08 Andrew Cagney - - * mi-main.c (register_changed_p): Use MAX_REGISTER_SIZE instead of - MAX_REGISTER_RAW_SIZE. - -2003-05-08 Andrew Cagney - - * mi-main.c (get_register): Use MAX_REGISTER_SIZE. - -2003-05-05 Andrew Cagney - - * mi-main.c (mi_cmd_data_write_register_values): Replace - REGISTER_SIZE with DEPRECATED_REGISTER_SIZE. - -2003-05-03 J. Brobecker - - From Thierry Schneider : - * mi-cmds.h (mi_cmd_symbol_list_lines): Add declaration. - * mi-cmds.c (mi_cmds): Add entry for new MI command. - * mi-cmd-symbol.c (mi_cmd_symbol_list_lines): New source file - for all symbol-related commands. - -2003-04-02 Bob Rossi - - * mi-cmd-file.c: New file to implement mi file commands. - * mi-getopt.c (mi_valid_noargs): Added mi_valid_noargs to verify - if a set of parameters passed to an MI function has no arguments - * mi-getopt.h (mi_valid_noargs): Declare. - * mi-cmds.c (mi_cmds): Added -file-list-exec-source-file command. - * mi-cmds.h (mi_cmd_file_list_exec_source_file): Declare. - -2003-03-27 Andrew Cagney - - * gdbmi.texinfo: Delete file. Contents moved to - ../doc/gdb.texinfo. - -2003-03-12 Andrew Cagney - - * mi-main.c (get_register): Use frame_register instead of - get_saved_register. - -2003-03-08 Andrew Cagney - - * mi-out.c: Update copyright. - (mi_out_data): Define typedef. Use instead of ui_out_data. - -2003-03-01 Andrew Cagney - - * mi-main.c (get_register): Use register_type instead of - REGISTER_VIRTUAL_TYPE. - -2003-02-25 David Carlton - - * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with - DEPRECATED_SYMBOL_NAME. Update copyright. - -2003-02-21 Daniel Jacobowitz - - * mi-cmd-stack.c (list_args_or_locals): Handle LOC_COMPUTED and - LOC_COMPUTED_ARG. - -2003-02-19 David Carlton - - * mi-cmd-stack.c: #include "block.h" - -2003-02-09 Andrew Cagney - - * mi-interp.c (mi_remove_notify_hooks): Convert function - definition to ISO C. - -2003-02-06 Andrew Cagney - - * mi-cmd-env.c: Include "gdb_stat.h" instead of . - -2003-02-04 Jim Ingham - Keith Seitz - Elena Zannoni - Andrew Cagney - - * mi-main.h: New file. - * mi-interp.c: New file. - * mi-main.c: Include "interps.h". - (mi_error_message): Make global. - (mi_input): Delete static function, moved to "mi-interp.c". - (mi_execute_command, mi_execute_command_wrapper): Ditto. - (mi_command_loop, mi1_command_loop, mi2_command_loop): Ditto. - (mi_load_progress): Make non-static. - (mi_error_last_message): New function. - (captured_mi_execute_command): If the interpreter changed, don't - print anything. - (mi_load_progress): Use current_interp_named_p. - (mi_init_ui): Delete function. - (_initialize_mi_main): Don't install the mi interpreter, handled - by "mi-interp.c". - (mi_exec_async_cli_cmd_continuation): Make static. - * mi-console.h (mi_console_file_new): Add `quote' parameter. - * mi-console.c (struct mi_console_file): Add `quote'. - (mi_console_file_new): Add `quote' parameter. Initialize `quote'. - (mi_console_raw_packet): Only quote the output when `quote'. - * mi-cmds.h (mi_cmd_interpreter_exec): Declare. - (mi_error_message, mi_error_last_message): Declare. - (mi_execute_command): Declare. - * mi-cmds.c: Add `interpreter-exec' command. - -2003-02-04 Andrew Cagney - - From Keith Seitz : - * gdbmi.texinfo (GDB/MI Miscellaneous Commands): Document the - interpreter-exec command. - -2003-02-02 Andrew Cagney - - From 2002-11-10 Jason Molenda (jason-cl@molenda.com): - * mi-cmd-var.c (mi_cmd_var_list_children): CHILDREN field is - now a list; still a tuple when in mi1. - * gdbmi.texinfo: Update var-list-children example. - -2003-01-13 Andrew Cagney - - * mi-cmd-env.c: Update copyright. - -2003-01-13 Elena Zannoni - - * mi-main.c (mi_cmd_exec_return): Use print_stack_frame instead of - show_and_print_stack_frame. - -2003-01-09 Andrew Cagney - - * mi-cmd-env.c: Include "gdb_string.h" instead of . - Move all includes to after "defs.h". - -2002-12-13 Jeff Johnston - - * mi-cmds.c (-environment-directory) Change to use mi_cmd_env_dir, - (-environment-cd): Change to use mi_cmd_env_cd,. - (-environment-pwd): Change to use mi_cmd_env_pwd. - (-environment-path): Change to use mi_cmd_env_path. - * mi-cmds.h (mi_cmd_env_cd, mi_cmd_env_dir): New prototypes. - (mi_cmd_env_path, mi_cmd_env_pwd): Ditto. - * mi-cmd-env.c: New file. Part of fix for PR gdb/741. - * gdbmi.texinfo (environment-cd): Update output and example. - (environment-pwd): Ditto. - (environment-dir): Update output, description, and examples. - (environment-path): Ditto. - -2002-11-29 Andrew Cagney - - * mi/mi-cmd-stack.c, mi/mi-main.c: Update to use - deprecated_selected_frame. - -2002-11-13 Andrew Cagney - - * mi-main.c (mi_cmd_data_write_register_values): Use - deprecated_write_register_bytes instead of write_register_bytes. - -2002-11-11 Jeff Johnston - - * gdbmi.texinfo (-var-assign): Add comments about interaction - with -var-update and add an example. Part of fix for gdb/702. - -2002-11-08 Jeff Johnston - - * mi-main.c (mi_command_loop): Initialize raw_stdout and gdb_stdout - only if mi version is <= 1. - (mi_init_ui): Initialize raw_stdout and gdb_stdout if mi version - is > 1 so startup message is treated as console output. This is - part of fix for PR gdb/604. - -2002-11-06 Jeff Johnston - - * mi-cmd-var.c (mi_cmd_var_create): Change the function used to - parse the frame addr from parse_and_eval_address() to - string_to_core_addr(). This is a fix for PR gdb/494. - -2002-10-23 Jeff Johnston - - * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin - to make_cleanup_ui_out_tuple_begin_end. Change all remaining - occurrences of ui_out_list_begin to make_cleanup_ui_out_list_begin_end. - Use do_cleanups instead of ui_out_list_end or ui_out_tuple_end. This - is a fix for PR gdb/680. - * mi-cmd-stack.c: Ditto. - * mi-main.c: Ditto. - -2002-10-22 Keith Seitz - - * mi-main.c (mi_cmd_thread_select): Only return MI_CMD_CAUGHT_ERROR - when we really did catch an error(). If we got GDB_RC_FAIL, return - MI_CMD_ERROR instead. - -2002-10-03 Jeff Johnston - - * gdbmi.texinfo: Fix examples that show frames to remove - extraneous blank in level field. Part of fix for PR gdb/192. - -2002-10-03 Jeff Johnston - - * mi-cmd-var.c (mi_cmd_var_update): Fix for PR gdb/672. For m2, - output list begin and end for "changelist" rather than tuple begin/end. - (varobj_update_one): For m2, add tuple begin and end for varobj - update output. - -2002-10-02 Elena Zannoni - - * mi-main.c (mi_cmd_exec_return): Don't use - return_command_wrapper, use return_command instead. - (mi_cmd_exec_interrupt): Don't use - interrupt_target_command_wrapper, use interrupt_target_command - instead. - (return_command_wrapper, interrupt_target_command_wrapper): - Delete. - Include frame.h. - -2002-10-01 Andrew Cagney - - * mi-main.c (mi2_command_loop): New function. - (mi0_command_loop): Delete function. - (_initialize_mi_main): Recognize, and default to, "mi2". Do not - recognize "mi0". - * mi-out.c (mi_table_begin): Remove mi0 code. - (mi_table_body, mi_table_end): Ditto. - (mi_table_header, mi_open, mi_close): Ditto. - -2002-09-29 Andrew Cagney - - * mi-out.c (mi_version): New function. - * mi-out.h (mi_version): Declare. - -2002-09-27 Andrew Cagney - - From 2002-07-12 Mo DeJong - * gdbmi.texinfo (var-evaluate-expression): Note that - var-list-children must be invoked before child variable - values can be evaluated. - -2002-09-26 Elena Zannoni - - * mi-cmd-disas.c (dump_insns): Add text only output for CLI. - (do_mixed_source_and_assembly): Ditto. - -2002-09-11 Keith Seitz - - * mi-main.c (mi_cmd_data_list_register_names): Use cleanups - for the uiout list. Do the cleanups when returning an error. - (mi_cmd_data_list_changed_registers): Ditto. - (mi_cmd_data_list_register_values): Use cleanups for the uiout list - and tuples. Do the cleanups when returning errors. - -2002-07-29 Andrew Cagney - - * mi-cmd-var.c: Include "gdb_string.h". - * mi-cmd-disas.c: Ditto. - -2002-06-17 Keith Seitz - - * gdbmi.texinfo: Update command examples with real MI behavior. - -2002-05-20 Keith Seitz - - * mi-main.c (captured_mi_execute_command): Add uiout parameter. - "data" is now a structure which is used to pass data to/from this - function to mi_execute_command. - Modify function to comply with requirements from catch_exceptions. - Store real return result and command's return result in data. - (mi_execute_command): Use catch_exceptions. - Use enum to handle actions to be performed instead of overloading - catch_errors return result and the mi return result. - -2002-04-14 Andrew Cagney - - * mi-main.c (mi_cmd_exec_return): - -2002-04-09 Andrew Cagney - - * mi-main.c (register_changed_p): Use frame_register_read instead - of read_relative_register_raw_bytes. - (get_register): Delete out-of-date comment. - -2002-04-07 Elena Zannoni - - * mi-cmd-disas.c: Run through indent. - -2002-04-07 Elena Zannoni - - * mi-cmd-disas.c (dump_insns): New function. - (do_mixed_source_and_assembly): New function. - (do_assembly_only): New function. - (do_disassembly): New function. - (mi_cmd_disassemble): Rewrite using smaller, more modular - functions. - -2002-04-05 Jim Blandy - - * mi-cmd-stack.c (list_args_or_locals): Pass new arg to - get_frame_block. (See entry in gdb/ChangeLog.) - -2002-04-05 Elena Zannoni - - * mi-cmd-disas.c (mi_cmd_disassemble): Use TARGET_PRINT_INSN - instead of tm_print_insn. - Update copyright year. - -2002-04-04 Daniel Jacobowitz - - * mi-cmd-disas.c (mi_cmd_disassemble): Skip end-of-function - markers in the line table. - -2002-03-15 Andrew Cagney - - * mi-main.c (XMALLOC): Delete macro. - * mi-out.c (XMALLOC): Ditto. - * mi-parse.c (XMALLOC): Ditto. - * mi-console.c (XMALLOC): Ditto. - * mi-cmd-var.c (XMALLOC): Ditto. - * mi-cmd-break.c (XMALLOC): Ditto. - - * mi/mi-cmd-var.c, mi/mi-console.c, mi/mi-out.c: Update copyright - * mi/mi-parse.c: Ditto. - -2002-02-24 Andrew Cagney - - From wiz at danbala: - * gdbmi.texinfo: Fix grammar and typos. - Fix PR gdb/287. - -2002-02-03 Jim Blandy - - * mi-cmd-stack.c (list_args_or_locals): Move declaration of - print_me inside the loop body, so it gets re-initialized every - iteration. The cases for the different symbol kinds leave - print_me unchanged if they don't want the symbol printed. - -2002-01-22 Andrew Cagney - - * gdbmi.texinfo: Remove makeinfo 3.12 hacks. - -2002-01-21 Andrew Cagney - - * mi-cmd-stack.c: Remove #else clause of #ifdef UI_OUT. - * mi-cmd-break.c: Ditto. - * mi-main.c: Ditto. - -2001-12-30 Eli Zaretskii - - * gdbmi.texinfo: Fix the application of GFDL in the Copyright notice. - -2001-10-12 Daniel Jacobowitz - - * mi-cmd-stack.c (list_args_or_locals): Use ALL_BLOCK_SYMBOLS. - -2001-09-18 Andrew Cagney - - * mi-main.c (mi_cmd_thread_select): Pass uiout to - gdb_thread_select. - (mi_cmd_thread_list_ids): Pass uiout to gdb_list_thread_ids. - - * mi-cmd-break.c (breakpoint_notify): Pass uiout to - gdb_breakpoint_query. - -2001-08-17 Keith Seitz - - * mi-cmd-var.c (varobj_update_one): Update call to - varobj_update to reflect recent api change. - -2001-07-26 Andrew Cagney - - * mi-main.c: Include "gdb.h". - * mi-cmd-break.c: Include "gdb.h". - -2001-07-12 Andrew Cagney - - * mi-main.c (mi_execute_command): Flush output after ``(gdb)'' - prompt. Bug reported by David Whedon. - (mi_execute_async_cli_command): Ditto. - (mi_exec_async_cli_cmd_continuation): Ditto. - (mi_command_loop): Ditto. - -2001-07-10 Mark Kettenis - - * mi-out.c (mi_out_new): Initialize suppress_ouput field of newly - created `struct ui_out_data'. - -2001-07-09 Kevin Buettner - - * mi-main.c (register_changed_p, get_register): Use alloca() - to allocate space previously allocated via gcc's - variable-length array extension. - (mi_cmd_data_write_register_values, mi_cmd_data_write_memory): - Change type of ``buffer'' to ``void *''. Don't cast return value - from xmalloc(). Add a cleanup to free the xmalloc'd buffer. - -2001-07-07 Andrew Cagney - - * mi-main.c (mi_cmd_data_evaluate_expression): Replace value_ptr - with `struct value *'. - -2001-07-08 Kevin Buettner - - * mi-out.c (mi_table_header, mi_field_int, mi_field_skip) - (mi_field_string) Make function declarators match earlier - declarations. - -2001-07-04 Andrew Cagney - - * mi-out.c (mi_ui_out_impl): Initialize is_mi_like_p to one. - -2001-06-27 Andrew Cagney - - * mi-out.c (mi_table_begin): Include nr_cols and nr_rows in mi1 - table output. - * mi-out.c (mi_table_begin): Only suppress output when mi0. Change - the header to a list. - (mi_table_body): For mi1, close the header list and open a table - body list. - (mi_table_end): For mi1, close the body list. - (mi_table_header): For mi1, output a tuple containing all the - header information. - (mi_open, mi_close): Reverse logic of mi_version test. - * gdbmi.texinfo (GDB/MI Breakpoint Table Commands): Update. - -2001-06-26 Andrew Cagney - - * gdbmi.texinfo (GDB/MI Output Syntax): Delete reference to query - packet. - -2001-06-26 Andrew Cagney - - * mi-cmd-stack.c (list_args_or_locals): Output a list of "args" or - "locals" entries. - * gdbmi.texinfo (stack-list-locals, stack-list-arguments) - (exec-interrupt, target-select, thread-select): Update - documentation. - -2001-06-26 Andrew Cagney - - * mi-cmd-stack.c (mi_cmd_stack_list_frames): Output a list of - "stack" entries. - (mi_cmd_stack_list_args): Ditto for "stack-args". - * gdbmi.texinfo (stack-list-frames, stack-list-arguments): Update - documentation. - (GDB/MI Stack Manipulation Commands): Fix section title. Was - Stack Manipulation Commands in GDB/MI. - -2001-06-25 Andrew Cagney - - * gdbmi.texinfo: Update output examples that contain stop reason - output, change the args=.... to a list. - (exec-return): Ditto. - -2001-06-25 Andrew Cagney - - * mi-main.c (mi_cmd_data_read_memory): Output the memory contents - - memory and data - as a list. - * gdbmi.texinfo (data-read-memory): Update documentation. - -2001-06-25 Andrew Cagney - - * mi-main.c (mi_cmd_data_list_register_values): Output a list of - register values. - * gdbmi.texinfo (data-list-register-values): Update documentation. - -2001-06-25 Andrew Cagney - - * mi-main.c (mi_cmd_data_list_register_names): Output a list of - register names. - (mi_cmd_data_list_register_names): Include the pseudo registers. - (mi_cmd_data_list_register_names): Don't leave holes in the list, - output "" for NULL registers. - * gdbmi.texinfo (data-list-register-names): Update documentation. - -2001-06-23 Andrew Cagney - - * mi-main.c (mi_cmd_data_list_changed_registers): Output a list of - register numbers. - * gdbmi.texinfo (data-list-changed-registers): Update - documentation. - -2001-06-23 Andrew Cagney - - * gdbmi.texinfo (data-disassemble): Update documentation of - output. Produces a list of instructions and a list of source - lines. - -2001-06-22 Andrew Cagney - - * mi-cmd-disas.c (mi_cmd_disassemble): For "-data-disassemble", - output a list instead of a tupple. - -2001-06-21 Andrew Cagney - - * mi-out.c (struct ui_out_data): Replace field first_header with - suppress_output. - (mi_begin, mi_end): Check suppress_header. - (mi_field_int, mi_field_skip): Ditto. - (mi_field_string, mi_field_fmt): Ditto. - (mi_table_begin): When nr_rows is zero, set suppress_header else, - output the start of the header. - (mi_table_body): Clear suppress header. - -2001-06-21 Andrew Cagney - - * mi-out.c (mi_open): For lists, when mi_version > 0, use ``[''. - (mi_close): Ditto for ``]''. - -2001-06-20 Andrew Cagney - - * mi-out.c (mi_table_header): Add parameter ``col_name''. - -2001-06-18 Andrew Cagney - - * mi-out.c: Include "gdb_assert.h". - (mi_table_begin): Add parameter ``nr_rows''. - -2001-06-18 Andrew Cagney - - * mi-main.c: Use strncmp as the "mi" test. Allow "mi", "mi0" and - "mi1". - (mi_command_loop): Add parameter mi_version, pass to mi_out_new. - (mi1_command_loop, mi0_command_loop): New functions. - (_initialize_mi_main): Recognize "mi", "mi0" and "mi1". - * mi-out.c (mi_out_new): Add parameter mi_version. - (struct ui_out_data): Add field mi_version. - * mi-out.h (mi_out_new): Update. - -2001-06-07 Andrew Cagney - - * gdbmi.texinfo (GDB/MI Output Syntax): Add tuples and lists to - syntax. - (GDB/MI Draft Changes to Output Syntax): Delete section. - -Mon Jun 11 17:22:25 2001 Andrew Cagney - - * mi-out.c: Fix typo. s/supress/suppress/. - -2001-06-09 Andrew Cagney - - * mi-out.c (mi_table_end, mi_table_begin, mi_begin, mi_end): Move - supress_field_separator updates from here. - (mi_open, mi_close): To here. - (mi_open): Add parameter name. Output a field_separator. - (mi_table_begin): Update. - (mi_table_header): Update. - (mi_begin): Update. - -2001-06-09 Andrew Cagney - - * mi-out.c (mi_table_begin): Make char* parameters constant. - (mi_table_header): Ditto. - (mi_field_int): Ditto. - (mi_field_skip): Ditto. - (mi_field_string): Ditto. - (mi_field_fmt): Ditto. - (mi_text): Ditto. - (mi_message): Ditto. - -2001-05-12 Andrew Cagney - - * mi-out.c (mi_close, mi_open): Output ``[]'' when a list. - -Fri May 11 13:55:07 2001 Andrew Cagney - - * mi-cmd-var.c: Replace ui_out_list_begin, ui_out_list_end and - make_cleanup_ui_out_list_end with ui_out_tupple_begin, - ui_out_tupple_end and make_cleanup_ui_out_tupple_begin_end. - * mi-cmd-stack.c: Ditto. - * mi-cmd-disas.c: Ditto. - * mi-main.c: Ditto. - -2001-05-10 Andrew Cagney - - * mi-out.c (mi_open, mi_close): Replace list_open and list_close. - (mi_table_begin): Update. - (mi_table_header): Update. - (mi_begin): Update. - (mi_table_body): Update. - (mi_table_end): Update. - (mi_end): Update. - -Thu May 10 16:28:13 2001 Andrew Cagney - - * mi-main.c (mi_execute_async_cli_command): Always initialize - old_cleanups. - -2001-05-08 Andrew Cagney - - * mi-out.c (mi_begin, mi_end): Replace mi_list_begin and - mi_list_end. - (mi_ui_out_impl): Update. - -2001-03-28 Andrew Cagney - - * mi-main.c (mi_cmd_data_read_memory): Use xcalloc. - -2001-03-26 Eli Zaretskii - - * gdbmi.texinfo: Update copyright. Change Permissions to GFDL. - -2001-03-20 Andrew Cagney - - * mi-cmd-disas.c (mi_cmd_disassemble): Initialize ``file_string'' - and ``line_num''. Consolidate declaration of argument variables. - -2001-03-19 Andrew Cagney - - * mi-out.h: Remove #ifdef __STDC__. - -2001-03-08 Andrew Cagney - - * mi-main.c (mi_cmd_data_list_register_names): Use NUM_REGS, not - ARCH_NUM_REGS. - (mi_cmd_data_list_changed_registers): Ditto. - (mi_cmd_data_list_register_values): Ditto. - (mi_cmd_data_write_register_values): Ditto. - -2001-03-06 Kevin Buettner - - * gdbmi.texinfo, mi-cmd-disas.c, mi-cmd-stack.c, mi-cmd-var.c, - mi-cmds.c, mi-cmds.h, mi-console.c, mi-console.h, mi-getopt.c, - mi-getopt.h, mi-out.c, mi-out.h, mi-parse.c, mi-parse.h: - Update/correct copyright notices. - -Wed Feb 7 19:50:37 2001 Andrew Cagney - - * mi-getopt.c: Add __FILE__ and __LINE__ parameter to calls to - internal_error. - * mi-console.c: Ditto. - * mi-cmds.c: Ditto. - * mi-cmd-break.c: Ditto. - -2001-01-27 Fernando Nasser - - From Momchil Velikov - * mi-cmd-disas.c (gdb_dis_asm_read_memory): Add missing memory - attributes argument in the call to `xfer_memory'. - -2000-12-14 Kevin Buettner - - * mi-cmd-disas.c, mi-cmd-var.c, mi-console.c, mi-main.c, - mi-parse.c: Replace occurrences of free() with xfree(). - -Fri Nov 17 16:07:23 2000 Andrew Cagney - - * mi-main.c: Replace asprintf with xasprintf. - * mi-cmd-var.c (mi_cmd_var_create): Ditto. - -2000-10-16 Eli Zaretskii - - * gdbmi.texinfo (GDB/MI Variable Objects): Dimensions of - multitable changed to "@columnfractions .4 .6". Suggested by - Dmitry Sivachenko . - -2000-08-23 Eli Zaretskii - - * gdbmi.texinfo: Change flathead -> @sc{gdb/mi}. - Fix typos and markup mistakes (from Dmitry S. - Sivachenko ). - -2000-07-24 Eli Zaretskii - - * gdbmi.texinfo: Change GDB -> @value{GDBN}, and - (gdb) -> (@value{GDBP}). Fix a few typos and some markup. From - Dmitry S. Sivachenko . - -Tue May 16 14:13:41 2000 Andrew Cagney - - * mi-main.c (mi_cmd_execute): Use free_current_contents. - (free_and_reset): Delete. - -Mon May 15 16:17:56 2000 Andrew Cagney - - * mi-main.c (mi_cmd_data_assign, mi_cmd_data_evaluate_expression), - mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete): Delete - make_cleanup_func casts. Not needed. - -2000-05-07 Eli Zaretskii - - * gdbmi.texinfo: Lots of typos and grammar fixes from Brian - Youmans <3diff@flib.gnu.ai.mit.edu>. - -Wed Apr 26 18:35:19 2000 Andrew Cagney - - * gdbmi.texinfo (GDB/MI Output Syntax v2.0): Convert Draft 2.0 - Output Syntax into a new section. Cross reference. - (menu): Fix tipo. GDB/MI Compatibility with CLI. - -2000-04-23 Eli Zaretskii - - * gdbmi.texinfo: Lots of changes, to include this document as part - of the GDB manual. - -2000-03-13 James Ingham - - * mi-cmd-var.c (mi_cmd_var_create): Add special frame cookie "@" - to indicate an "USE_CURRENT_FRAME" variable. - (varobj_update_one): Add "in_scope" and "type_changed" to the - result. - -2000-03-06 Elena Zannoni - - * mi-cmds.h: Export mi_cmd_data_write_register_values. - - * mi-cmds.c (mi_cmds): Implement data-write-register-values with - mi_cmd_data_write_register_values. - - * mi-main.c (mi_cmd_data_write_register_values): New - function. Write a value into a register. - -2000-03-06 Elena Zannoni - - * gdbmi.texinfo: Update data-disassemble documentation. - -2000-03-01 Elena Zannoni - - * mi-cmd-disas.c (mi_cmd_disassemble): Use - ui_out_field_core_addr() instead of print_address_numeric(), to - maintain consistency throughout MI. - -Wed Feb 23 17:09:39 2000 Andrew Cagney - - * mi-cmd-break.c, mi-cmd-disas.c, mi-cmd-stack.c, mi-cmd-var.c, - mi-cmds.c, mi-cmds.h, mi-console.c, mi-console.h, mi-getopt.c, - mi-getopt.h, mi-main.c, mi-out.c, mi-out.h, mi-parse.c, - mi-parse.h: Update copyright information. - -Wed Feb 23 13:31:16 2000 Andrew Cagney - - * mi-cmd-disas.c (gdb_dis_asm_read_memory): Change LEN to unsigned - long. Match ../include/dis-asm.h change. - -Wed Feb 23 10:30:55 2000 Andrew Cagney - - * gdbmi.texinfo: Update copyright - FSF. Update version - information. - - mi-cmd-break.c, mi-cmd-disas.c, mi-cmd-stack.c, mi-cmd-var.c, - mi-cmds.h, mi-main.c, mi-parse.c, mi-parse.h: Re-format using GNU - indent. - -2000-02-21 Elena Zannoni - - * mi-main.c: Add include of gdbcore.h for write_memory() - prototype. - -2000-02-18 Elena Zannoni - - * mi-cmd-disas.c (mi_cmd_disassemble): Change syntax of - command. Now use options. - Instead of printing the symbolic address of instructions via - print_address_symbolic(), use build_address_symbolic() and format - properly for output. - (gdb_do_disassmble): Delete. - -2000-02-18 Elena Zannoni - - * mi-cmd-disas.c (mi_cmd_disassemble): - -2000-02-17 Elena Zannoni - - * mi-main.c (mi_cmd_data_write_memory): New function. Write a - value into target memory. - - * mi-cmds.h (mi_cmd_data_write_memory): Export. - - * mi-cmds.c (mi_cmds): Hook up data-write-memory to - mi_cmd_data_write_memory(). - -2000-02-17 Elena Zannoni - - * mi-main.c (mi_cmd_target_download): Correct error message to - report right function name. - (mi_cmd_target_select): Add doing exec cleanups at end. - (mi_cmd_data_read_memory): Correct typo. - (mi_cmd_execute): Do not simply free last_async_command, but reset - it to NULL as well. - (free_and_reset): New function, free the argument and set it to - NULL. - (mi_cmd_target_select_continuation): Delete prototype. - -Tue Feb 1 00:17:12 2000 Andrew Cagney - - * mi-cmd-disas.c, mi-cmds.h, mi-console.c, mi-console.h, - mi-main.c, mi-out.c, mi-out.h: Update to reflect rename of - gdb-file / GDB_FILE to ui-file / ``struct ui_file''. - -Mon Jan 31 18:33:28 2000 Andrew Cagney - - * mi-main.c (mi_command_loop): Delete reference to - fputs_unfiltered_hook. - -2000-01-27 Elena Zannoni - - * mi-cmds.c (mi_cmds): Update entries for - mi_cmd_data_list_register_names, - mi_cmd_data_list_changed_registers, - mi_cmd_data_list_register_values. - - * mi-cmds.h (mi_cmd_data_list_register_names, - mi_cmd_data_list_changed_registers, - mi_cmd_data_list_register_values): Update to mi_cmd_argv_ftype. - - * mi-main.c (mi_cmd_data_list_register_names, - mi_cmd_data_list_changed_registers, - mi_cmd_data_list_register_values): Update to use argc, argv - parameters. - -2000-01-27 Elena Zannoni - - * mi-main.c (mi_cmd_data_read_memory): Correct the computation of - next-row. - -2000-01-27 Fernando Nasser - - * mi-cmd-var.c (mi_cmd_var_create): Test for NULL type. - (mi_cmd_var_set_format, mi_cmd_var_show_format, - mi_cmd_var_info_num_children, mi_cmd_var_list_children, - mi_cmd_var_info_type, mi_cmd_var_info_expression, - mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression, - mi_cmd_var_assign, mi_cmd_var_update): Prevent possibility of memory - leak on error. - -2000-01-27 Fernando Nasser - - * mi-out.c (mi_field_string): Test for NULL string pointer. - -2000-01-17 Elena Zannoni - - * mi-cmd-stack.c (mi_cmd_stack_list_frames): Call - print_frmae_info() with the correct arguments. - - * mi-main.c (mi_cmd_exec_return): Call - show_and_print_stack_frame() with LOC_AND_ADDRESS, so it does the - right thing. Update Copyright. - -2000-01-13 Elena Zannoni - - * mi-main.c: Move disassemble commands from here. - - * mi-cmd-disas.c: To here. New file. - -2000-01-13 Elena Zannoni - - * mi-cmd-stack.c: Remove include of mi-out.h. - - * mi-main.c (mi_cmd_disassemble): Update function to use argc/argv - interface. - - * mi-cmds.h: Ditto. - - * mi-cmds.c: Ditto. - -2000-01-12 Elena Zannoni - - * gdbmi.texinfo: Update stack commands descriptions. - Add thread commands descriptions and examples. - - * mi-main.c (mi_cmd_thread_list_ids): Fix typo. - -2000-01-12 Elena Zannoni - - * mi-main.c (mi_cmd_thread_list_ids): New function, print a list - of currently known threads ids, and the total number of threads. - (mi_cmd_thread_select): New function. Switch current thread. - - * mi-cmds.c (mi_cmds): Implement thread-list-ids by - mi_cmd_thread_list_ids, and thread-select by mi_cmd_thread_select. - - * mi-cmds.h (mi_cmd_thread_select, mi_cmd_thread_list_ids): Export. - -2000-01-11 Elena Zannoni - - * mi-main.c: Move stack commands from here. - - * mi-cmd-stack.c: To here. New file. - -2000-01-07 Elena Zannoni - - * mi-main.c (list_args_or_locals): Add a new paramter, the frame - for which to display args or locals. Don't use selected_frame - anymore, use the new parameter instead. Return void instead of - mi_cmd_result, let callers do so. - (mi_cmd_stack_list_args): Change interface. Now accept low and - high frame numbers to display args for a range of frames. Without - these two, display args for the whole stack. - (mi_cmd_stack_list_locals): Adapt to new interface for - list_args_or_locals. - -2000-01-06 Elena Zannoni - - * mi-main.c (mi_cmd_stack_info_depth, mi_cmd_stack_list_args, - mi_cmd_stack_list_frames, mi_cmd_stack_list_locals, - mi_cmd_stack_select_frame): Change to use argv type of parameters. - - * mi-cmds.c (mi_cmds): Change stack-info-depth, - stack-list-arguments, stack-list-frames, stack-list-locals, - stack-select-frame to use argv parameters. - - * mi-cmds.h (mi_cmd_stack_info_depth, mi_cmd_stack_list_args, - mi_cmd_stack_list_frames, mi_cmd_stack_list_locals, - mi_cmd_stack_select_frame): Update definitions. - -Tue Jan 4 12:38:54 2000 Andrew Cagney - - * mi-main.c (mi_command_loop): Force the MI interface to use seven - bit strings. - * gdbmi.texinfo: Make it clear that a quoted C string is seven - bit. - -Thu Dec 30 14:15:22 1999 Andrew Cagney - - * mi-getopt.c (mi_getopt): Rewrite. Allow long options. - * mi-getopt.h (struct mi_opt): Declare. - (mi_getopt): Update. - - * mi-main.c (mi_cmd_data_read_memory), mi-cmd-break.c - (mi_cmd_break_insert, mi_cmd_break_watch): Update. - -Wed Dec 29 23:38:35 1999 Andrew Cagney - - * mi-cmd-break.c (mi_cmd_break_insert): Add support for -c - , -i and -p . - (breakpoint_notify): New function. - (mi_cmd_break_insert): Wrap GDB call with callback hooks so that - MI is notified when ever a breakpoint is created. - - * gdbmi.texinfo: Update. - -Fri Dec 24 11:23:22 1999 Andrew Cagney - - * mi-main.c (gdb_do_disassemble): Strip out more useless #ifdef - UI_OUTs. - -1999-12-23 Elena Zannoni - - * mi-main.c (gdb_do_disassemble): Fix output. Lines that have no - assembly instructions must still be outputted, to keep the source - line numbering correct. - Remove #ifdef UI_OUT's, they are useless. - -1999-12-17 Elena Zannoni - - * mi-main.c (gdb_do_disassemble): Don't print a new list in mixed - mode, every time. Just do it when we actually encounter a new - source line. - -1999-12-17 Fernando Nasser - - * mi-cmd-var.c (mi_cmd_var_list_children): Add test for C++ pseudo - variable objects (private, public, protected) as these do not have - a type and the -var-list-children operation was dumping core. - -Fri Dec 17 20:23:33 1999 Andrew Cagney - - * gdbmi.texinfo: Document recommended syntax for options. - - * mi-main.c (mi_cmd_data_read_memory): Add support for ``-o - ''. - * gdbmi.texinfo: Document. - -Wed Dec 15 17:43:08 1999 Andrew Cagney - - * mi-getopt.h (mi_getopt): Change optarg to a char pointer. Check - optind. - * mi-cmd-break.c (mi_cmd_break_insert): Update. - - * mi-main.c (mi_cmd_data_read_memory): Add fields "next-row-addr", - "prev-row-addr", "next-page-addr", "prev-page-addr" and a per row - "addr". - * gdbmi.texinfo: Update. - -Wed Dec 15 01:05:40 1999 Andrew Cagney - - * mi-cmds.h (mi_cmd_result): Add MI_CMD_CAUGHT_ERROR for when the - error is caught. - - * mi-main.c (captured_mi_execute_command): When - MI_CMD_CAUGHT_ERROR return 0 rethrowing the eror. - -1999-12-13 Elena Zannoni - - * mi-cmd-break.c (mi_cmd_break_insert): Remove unused var. - - * mi-cmd-var.c (mi_cmd_var_update): Remove unused variables. - -Mon Dec 13 18:43:36 1999 Andrew Cagney - - * mi-parse.c (mi_parse): Quote the command when printing it. - (mi_parse_argv): Fix handling of quoted strings. Was not - de-quoting them. - (mi_parse_argv): Make static. - -Mon Dec 13 18:30:03 1999 Andrew Cagney - - * mi-cmds.h (mi_cmd_break_insert, mi_cmd_break_watch): Change type - to mi_cmd_argv_ftype. - * mi-cmds.c (mi_cmds): Update. - * mi-cmd-break.c (mi_cmd_break_insert, mi_cmd_break_watch): Change - to new style of arguments with argc and argv. Parse arguments - using mi_getopt. - - * mi-cmd-break.c (mi_cmd_break_insert): Wrap body in #ifdef UI_OUT - to avoid non-ui compile problems. - -Mon Dec 13 15:08:36 1999 Andrew Cagney - - * mi-getopt.h, mi-getopt.c: New files. Similar to getopt but with - well defined semantics. - -Mon Dec 13 14:22:21 1999 Andrew Cagney - - * mi-main.c (mi_cmd_break_insert, mi_cmd_break_watch, enum - wp_type, enum bp_type): Move from here. - * mi-cmd-break.c: To here. New file. - (mi_cmd_break_insert, mi_cmd_break_insert, mi_cmd_break_watch): - Use error to report problems. - -1999-12-09 Elena Zannoni - - * gdbmi.texinfo: Update description of exec-interrupt. - - * mi-main.c (mi_cmd_exec_interrupt): If the program is not - executing, don't try to interrupt it, but error out instead. Make - sure previous_async_command is not null before duplicating it into - last_async_command. - - * gdbmi.texinfo: Add examples for data-evaluate-expression. - -1999-12-08 Elena Zannoni - - * mi-cmd-var.c (mi_cmd_var_assign, mi_cmd_var_create, - mi_cmd_var_delete, mi_cmd_var_evaluate_expression, - mi_cmd_var_info_expression, mi_cmd_var_info_num_children, - mi_cmd_var_info_type, mi_cmd_var_list_children, - mi_cmd_var_set_format, mi_cmd_var_show_attributes, - mi_cmd_var_show_format, mi_cmd_var_update): Change to use new - style of arguments with argc and argv. - (next_arg): Delete. - (which_var): Delete. - - * mi-cmds.c (mi_cmds): Update entries for mi_cmd_var_assign, - mi_cmd_var_create, mi_cmd_var_delete, - mi_cmd_var_evaluate_expression, mi_cmd_var_info_expression, - mi_cmd_var_info_num_children, mi_cmd_var_info_type, - mi_cmd_var_list_children, mi_cmd_var_set_format, - mi_cmd_var_show_attributes, mi_cmd_var_show_format, - mi_cmd_var_update. - - * mi-cmds.h (mi_cmd_var_assign, mi_cmd_var_create, - mi_cmd_var_delete, mi_cmd_var_evaluate_expression, - mi_cmd_var_info_expression, mi_cmd_var_info_num_children, - mi_cmd_var_info_type, mi_cmd_var_list_children, - mi_cmd_var_set_format, mi_cmd_var_show_attributes, - mi_cmd_var_show_format, mi_cmd_var_update): Update declarations. - -1999-12-08 Elena Zannoni - - * gdbmi.texinfo: Comment out -data-assign command. * mi-main.c - (mi_cmd_data_assign): Do not use, comment out. * mi-cmds.h - (mi_cmd_data_assign): Remove. * mi-cmds.c: Remove -data-assign - command from MI interface. - -1999-12-07 Elena Zannoni - - * mi-parse.c (mi_parse): Add '\n' at end of error messages, so - that prompt comes out on new line. - - * gdbmi.texinfo: Update disassembly command output. - -1999-12-06 Elena Zannoni - - * mi-main.c (gdb_do_disassemble): Update output for UI_OUT case. - -1999-12-02 Elena Zannoni - - * gdbmi.texinfo: Update exec-until output, including the reason - for stopping. - -Thu Dec 2 17:17:22 1999 Andrew Cagney - - * mi-cmds.c: Include for memset. - -1999-12-01 Elena Zannoni - - * mi-main.c (mi_cmd_exec_return): ifdef the references to - return_command_wrapper(). - -1999-12-01 Elena Zannoni - - * mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_interrupt, - mi_cmd_target_select, mi_execute_async_cli_command, - mi_exec_async_cli_cmd_continuation, mi_load_progress): Don't print - last_async_command if it is NULL. - (mi_cmd_exec_return): - -1999-12-01 Elena Zannoni - - * mi-main.c (mi_cmd_exec_return): Reimplement using - return_command() instead of mi_execute_async_cli_command(). - -1999-12-01 Elena Zannoni - - * mi-cmds.h: Export mi_cmd_data_assign and - mi_cmd_data_evaluate_expression. - - * mi-cmds.c (mi_cmds): Hook data-assign to mi_cmd_data_assign and - data-evaluate-expression to mi_cmd_data_evaluate_expression. - - * mi-main.c (mi_cmd_data_assign): New function. Implement - data-assign command. - (mi_cmd_data_evaluate_expression): New function. Implement - data-evaluate-expression command. - -1999-12-01 Elena Zannoni - - * gdbmi.texinfo: Fix some texinfo formatting errors. - -1999-12-01 Elena Zannoni - - * gdbmi.texinfo: Update data-list-register-values description. - - * mi-cmds.h: Export mi_cmd_data_list_register_values. - - * mi-cmds.c (mi_cmds): Hook data-list-register-values to - mi_cmd_data_list_register_values. - - * mi-main.c (mi_cmd_data_list_register_values): New - function. Implements the -data-list-register-values command. - (get_register): New function. Output the contents of a given - register. - -Wed Dec 1 20:27:22 1999 Andrew Cagney - - * mi-main.c (mi_execute_async_cli_command): Append missing "\n" - for synchronous stopped message. - -1999-11-30 James Ingham - - * gdbmi.texinfo: Fix obvious typo in @end statement. - -Wed Dec 1 12:36:27 1999 Andrew Cagney - - * mi-cmd-var.c: Include "value.h". - * mi-console.c: Include . - -Wed Dec 1 00:21:03 1999 Andrew Cagney - - * mi-main.c (captured_mi_execute_command): For a CLI command, pass - "%s" to mi_execute_cli_command to stop core dumps. - (captured_mi_execute_command): Echo CLI commands on gdb_stdlog. - -Wed Dec 1 00:10:07 1999 Andrew Cagney - - * gdbmi.texinfo: Explain NR-BYTES and ADDR. - -Tue Nov 30 23:31:57 1999 Andrew Cagney - - * mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete, - mi_cmd_var_set_format, mi_cmd_var_show_format, - mi_cmd_var_info_num_children, mi_cmd_var_list_children, - mi_cmd_var_info_type, mi_cmd_var_info_expression, - mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression, - mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one, next_arg, - which_var): New file. Move varobj commands to here from - mi-main.c. - - * mi-console.h, mi-console.c (mi_console_file_new, - mi_console_file_delete, mi_console_file_fputs, - mi_console_raw_packet, mi_console_file_flush): New files. Move - mi_console_file to here from mi-main.c. - -Tue Nov 30 19:37:25 1999 Andrew Cagney - - * mi-main.c (captured_mi_execute_command): Use fputstr_unfiltered - when printing error messages. - (mi_cmd_execute): Ditto. - -1999-11-29 Elena Zannoni - - * gdbmi.texinfo: Describe -data-list-changed-registers, - -data-list-register-names. Add examples for - -exec-next-instruction, exec-step-instruction, -exec-run, - -exec-until. Format examples for -data-read-memory. - update example for -target-download. - -1999-11-29 Elena Zannoni - - * gdbmi.texinfo: Remove mentioning of inaccurate watchpoint hit - count. - -Mon Nov 29 19:28:55 1999 Andrew Cagney - - * mi-main.c (mi_execute_async_cli_command): Return ``enum - mi_cmd_cmd_result''. mi_cmd_exec_run, mi_cmd_exec_next, - mi_cmd_exec_step, mi_cmd_exec_step_instruction, - mi_cmd_exec_finish, mi_cmd_exec_until, mi_cmd_exec_return, - mi_cmd_exec_continue): Update call. - (mi_execute_async_cli_command): When target is synchronous, fake - asynchronous behavour (ulgh). Allows tests to be run on built-in - simulator and native targets. - -Mon Nov 29 15:15:16 1999 Andrew Cagney - - * mi-cmds.h (mi_cmd_gdb_exit), mi-cmds.c (mi_cmds), mi-main.c - (mi_cmd_gdb_exit): Change function signature to mi_cmd_argv_ftype. - -1999-11-28 Andew Cagney - - * mi-parse.c: Include and - -1999-11-26 Elena Zannoni - - * gdbmi.texinfo: Added watchpoint command descriptions and - examples. - - * mi-main.c (mi_load_progress): Add parameter for total sent so far. - Print it as well. - -Fri Nov 26 10:17:49 1999 Andrew Cagney - - * gdbmi.texinfo (section Output Syntax): For lists, the - part of a is optional. Clarify syntax. - (appendix Proposed v2.0 Output Syntax): New section. Provide - record of discussion of possible changes to syntax. - -Wed Nov 24 19:41:35 1999 Andrew Cagney - - * mi-main.c (mi_cmd_data_read_memory): Simplify. Fix coredump - when arguments were bad. - (mi_cmd_execute): Change parameter to ``struct mi_parse''. Handle - case of argv_func as well as args_func. - (captured_mi_execute_command): Update. - - * mi-cmds.c (struct mi_cmd): Add field for mi_cmd_argv_ftype. - (mi_cmds): Update mi_cmd_data_read_memory. - (mi_lookup): Return - - * mi-cmds.h (mi_cmd_args_ftype): Rename mi_cmd_ftype. Make all - functions of type this type. - (mi_cmd_argv_ftype): Declare. - (mi_cmd_data_read_memory): Change type to mi_cmd_argv_fytpe. - (struct mi_cmd): Move declaration to here from mi-cmds.c. - (mi_lookup): Return a pointer to ``struct mi_cmd''. - -Wed Nov 24 15:03:34 1999 Andrew Cagney - - * mi-parse.c (mi_parse): Initialize TOKEN when a CLI command. - - * gdbmi.texinfo: Allow a before a CLI command. - - * mi-parse.h (struct mi_parse): Declare. - (mi_parse): Change to return a ``struct mi_parse''. - (enum mi_command_type): Delete PARSE_ERROR. - - * mi-main.c (struct mi_execute_command_context): Delete. - (captured_mi_execute_command): Update - (mi_execute_command): Update. Check for mi_parse returning NULL. - -Wed Nov 24 12:57:14 1999 Andrew Cagney - - * mi-parse.h: Remove const, from cmd parameter. Causes cascading - warnings. - -Wed Nov 24 15:03:34 1999 Andrew Cagney - - * mi-parse.c (mi_parse): New function. Move parse code to here. - * mi-main.c (parse): From here. Delete. - -Wed Nov 24 12:57:14 1999 Andrew Cagney - - * mi-parse.c, mi-parse.h: New files. Implement mi_parse_env. - -Wed Nov 24 11:24:05 1999 Andrew Cagney - - * mi-out.c (mi_field_string): Make string parameter constant. - -1999-11-23 Elena Zannoni - - * mi-cmds.h (mi_cmd_target_download): Export. - - * mi-cmds.c (mi_cmds): Add mi_cmd_target_download. - - * mi-main.c: Include . - (mi_cmd_target_download): New function, implement the - target-download command. - (mi_load_progress): New function. Called via the - show_load_progress hook. Prints updates every 0.5 secs. - (mi_command_loop): Initialize the show_load_progress hook. - -1999-11-22 Elena Zannoni - - * mi-main.c (mi_cmd_exec_until): New function. Implement until - command. - (mi_cmd_exec_step_instruction): New function. Implement stepi - command. - (mi_cmd_exec_next_instruction): New function. Implement nexti - command. - - * mi-cmds.c (mi_cmds): Add mi_cmd_exec_step_instruction, - mi_cmd_exec_next_instruction, mi_cmd_exec_until. - - * mi-cmds.h (mi_cmd_exec_step_instruction, - mi_cmd_exec_next_instruction, mi_cmd_exec_until): Export. - -Tue Nov 23 00:30:37 1999 Andrew Cagney - - * mi/gdbmi.texinfo: Document -data-read-memory. - - * mi-main.c (mi_cmd_data_read_memory): Fix off-by-one check of - argc. - (mi_cmd_data_read_memory): Label the output table with "memory". - -Thu Nov 18 18:15:53 1999 Andrew Cagney - - * mi-main.c (mi_cmd_exec_interrupt, mi_cmd_break_insert, - mi_cmd_break_watch, mi_cmd_disassemble, mi_cmd_execute): Replace - strdup with xstrdup. - -Thu Nov 18 20:50:09 1999 Andrew Cagney - - * mi-main.c (mi_cmd_data_read_memory): New function. Implement - data-read-memory. - - * mi-cmds.h, mi-cmds.c: Add mi_cmd_data_read_memory. - * mi-cmds.c (mi_cmds): Ditto. - -1999-11-11 Elena Zannoni - - * mi-cmds.h (mi_cmd_break_watch): Export. - - * mi-cmds.c (mi_cmds): Hook up break-watch to function - mi_cmd_break_watch. - - * mi-main.c (wp_type): New enumeration for the possible types of - watchpoints. - (mi_cmd_break_watch): New function, implements the break-watch - command. - -1999-11-11 Elena Zannoni - - * mi-main.c (mi_cmd_break_insert): Handle case in which the command is - just a -break-insert w/o args. - -Fri Nov 12 00:01:52 1999 Andrew Cagney - - * mi-out.c (mi_field_string): Always quote the string. - -1999-11-10 Elena Zannoni - - * mi-cmds.h(mi_cmd_data_list_changed_registers, - mi_cmd_data_list_register_names): Export. - - * mi-cmds.c (mi_cmds): Hook up data-list-changed-registers to - mi_cmd_data_list_changed_registers and data-list-register-names to - mi_cmd_data_list_register_names. - - * mi-main.c (mi_cmd_data_list_changed_registers): New function, - implements the data-list-changed-registers command. - (mi_cmd_data_list_register_names): New function, implements the - data-list-register-names command. - (register_changed_p): New function. Decide whether the register - contents have changed. - (setup_architecture_data): New function. Initialize registers - memory. - (_initialize_mi_main): Call setup_architecture_data(), and - register_gdbarch_swap(). - -Wed Nov 10 18:35:08 1999 Andrew Cagney - - * mi-main.c (mi_execute_command): Correctly quote error messages. - -Wed Nov 10 11:05:14 1999 Andrew Cagney - - * mi/gdbmi.texinfo: Delete . Replaced by - . - - * mi-main.c (mi_console_raw_packet): Always quote console output. - -Tue Nov 9 17:53:05 1999 Andrew Cagney - - * mi-main.c (mi_console_file_new), mi-out.c (mi_out_new): Replace - the tui_file with a mem_file. Ya! - - * mi-out.c (do_write): New function, wrapper to gdb_file_write. - (mi_out_put): Pass do_write to gdb_file_put. - - * mi-main.c (mi_console_file_flush): Rewrite. Use - mi_console_raw_packet to send data to the console. - (mi_console_raw_packet): New function. Correctly - create quoted C string packets. - -1999-11-08 Elena Zannoni - - * mi-cmds.c (mi_cmds): Break-insert is now implemented by - mi_cmd_break_insert. - * mi-cmds.h (mi_cmd_break_insert): Export. - * mi-main.c (bp_type): New enumeration. - (mi_cmd_break_insert): New function. Implements all flavors of - breakpoint insertion. - -Mon Nov 8 17:49:17 1999 Andrew Cagney - - * mi-main.c (mi_console_file_flush): Replace gdb_file_get_strbuf - with tui_file_get_strbuf. - -Fri Nov 5 17:06:07 1999 Andrew Cagney - - * mi-main.c (mi_console_file_delete, mi_console_file_fputs, - mi_console_file_flush): Call internal_error instead of error. - -Thu Nov 4 19:53:32 1999 Andrew Cagney - - * mi-main.c (captured_mi_execute_command): New function. - (mi_execute_command): Rewrite. Replace SET_TOP_LEVEL() with call - to captured_mi_execute_command via catch_errors. - -Thu Nov 4 20:33:58 1999 Andrew Cagney - - * mi-main.c (clean): Delete. - (mi_command_loop): Delete extern declaration of - mi_execute_command. - -1999-10-28 Elena Zannoni - - * mi-main.c (mi_cmd_stack_select_frame): Conditionalize the body - on UI_OUT, because select_frame_command_wrapper is only defined if - UI_OUT is. - (mi_cmd_exec_interrupt): Conditionalize the body on UI_OUT, - because interrupt_target_command_wrapper is only defined if UI_OUT is. - - * mi-cmds.c (mi_cmds): Implement command exec-interrupt by - mi_cmd_exec_interrupt. - - * mi-main.c (mi_cmd_exec_interrupt): New function. Implements - exec-interrupt command. - (mi_cmd_execute): If the target is running save execution command - token in previous_async_command. If the command is not 'interrupt' - and the target is running, reject it. - (clean): New function. Free the arg and reset it to NULL. - - * mi-cmds.h (mi_cmd_exec_interrupt):Export. - -1999-10-28 Elena Zannoni - - * mi-cmds.c (mi_cmds): Implement command stack-select-frame by - mi_cmd_stack_select_frame. - - * mi-main.c (mi_cmd_stack_select_frame): New function. Implements - stack-select-frame command. - - * mi-cmds.h (mi_cmd_select_frame):Export. - -1999-10-26 Elena Zannoni - - * mi-cmds.c (mi_cmds): Implement commands stack-list-locals and - stack-list-arguments by mi_cmd_stack_list_locals and - mi_cmd_stack_list_args. - - * mi-main.c (mi_cmd_stack_list_locals): New function. Implements - stack-list-locals command. - (mi_cmd_stack_list_args): New function. Implements - stack-list-arguments command. - (list_args_or_locals): New function. Do all the work for the - listing of locals or arguments. - - * mi-cmds.h (mi_cmd_stack_list_args,mi_cmd_stack_list_locals) : - Export. - -1999-10-25 Elena Zannoni - - * mi-cmds.c (mi_cmds): Add new command stack-info-depth. - - * mi-main.c (mi_cmd_stack_info_depth): New function. Implements - the stack-info-depth command. - * mi-cmds.h (mi_cmd_stack_info_depth): Export. - - -1999-10-22 Elena Zannoni - - * mi-main.c (mi_execute_command): Handle MI_CMD_ERROR case - properly, for command that return error code and don't set - mi_error_message. - - * mi-cmds.c (mi_cmds): Hook stack-list-frames command to - mi_cmd_stack_list_frames function. - * mi-cmds.h (mi_cmd_stack_list_frames): Export. - - * mi-main.c (mi_execute_command): Deal with a return code of - MI_CMD_ERROR from the execution of mi commands. - (mi_error_message): Static string variable, to contain the error - message from mi commands. - (mi_cmd_stack_list_frames): New function. Prints a backtrace. - -1999-10-18 Elena Zannoni - - * mi-main.c (mi_cmd_disassemble): Handle the new command line - parameter that specifies the number of disassembly lines to be - displayed. - (gdb_do_disassemble): Add new parameter. Count the number of lines - that have been displayed, and stop when limit is reached. - -Wed Oct 13 18:04:13 1999 Andrew Cagney - - * mi-main.c (mi_command_loop): Don't initialize ``flush_hook''. - -1999-10-13 Elena Zannoni - - * mi/gdbmi.texinfo: More reformatting of the grammars. - -1999-10-12 Elena Zannoni - - * mi/gdbmi.texinfo: More TeX formatting. - -1999-10-11 Elena Zannoni - - * mi/gdbmi.texinfo: First pass completed. All commands should have - some comments/info. - Escape '@' output special char. - Reformat for TeX. - -1999-10-08 Elena Zannoni - - * mi/gdbmi.texinfo: Filled in part of file command section, and - stack section. - -1999-10-07 Elena Zannoni - - * mi/gdbmi.texinfo: Filled in some sections about execution - commands. - -Tue Oct 5 15:27:28 1999 Andrew Cagney - - * mi-cmds.h: Sort table - * mi-cmds.c: Ditto. - (MI_TABLE_SIZE): Increase to 251. - -1999-10-04 Fernando Nasser - - * mi-main.c (mi_cmd_var_create, mi_cmd_var_delete): Add missing - cleanups. - -1999-10-04 Fernando Nasser - - * mi-main.c (next_arg): Returns lenght as well. - (which_var, mi_cmd_var_create, mi_cmd_var_delete, - mi_cmd_var_set_format, mi_cmd_var_update): Do not modify the input - string, use allocated storage instead. - (mi_cmd_var_assign): Adjust call to next_arg() to include new - argument. - -1999-10-04 Fernando Nasser - - * mi-main.c (mi_execute_command): Fix handling of errors. - -1999-10-04 Fernando Nasser - - * mi-out.c (mi_out_new): Call tui_sfileopen() instead of - deprecated gdb_file_init_astream(). - * mi-main.c (mi_console_file_new): Ditto. - -Mon Oct 4 15:17:29 1999 Andrew Cagney - - * mi-cmds.h: Sort function declarations. - (mi_lookup): Add extern. - - * mi-cmds.c (mi_lookup): Delete dead code. - (build_table): Call internal_error instead of error. - (build_table): Send trace output to gdb_stdlog. - -1999-10-01 Elena Zannoni - - * mi-main.c (mi_execute_async_cli_command): Don't do the cleanups - if target_executing is null. - -1999-09-28 Elena Zannoni - - * mi-main.c (async_p): Change var name to event_loop_p. - -Mon Sep 27 15:11:00 1999 Andrew Cagney - - * mi-main.c (mi_execute_async_cli_command, mi_execute_command): - Replace target_has_async with function target_can_async_p. - -Sun Sep 26 00:12:52 1999 Andrew Cagney - - * mi-main.c (mi_cmd_target_select_continuation): Delete function. - (mi_cmd_target_select): Simplify. target-connect is guarenteed to - be synchronous. - -Sun Sep 26 00:12:52 1999 Andrew Cagney - - * mi-cmds.h (mi_cmd_ftype): Replace mi_impl_ftype. - (enum mi_cmd_result): Define. - * mi-cmds.c (struct mi_cmd): Update. - (mi_lookup): Update. - * mi-main.c (mi_cmd_execute): Update. - - * mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_run, mi_cmd_exec_next, - mi_cmd_exec_step, mi_cmd_target_select, mi_cmd_exec_continue, - mi_cmd_exec_return, mi_cmd_exec_finish, mi_cmd_disassemble, - mi_cmd_var_create, mi_cmd_var_delete, mi_cmd_var_set_format, - mi_cmd_var_show_format, mi_cmd_var_info_num_children, - mi_cmd_var_list_children, mi_cmd_var_info_type, - mi_cmd_var_info_expression, mi_cmd_var_show_attributes, - mi_cmd_var_evaluate_expression, mi_cmd_var_update): Update. - Return MI_CMD_DONE. - -1999-09-22 Fernando Nasser - - * mi-main.c (mi_cmd_var_create): Use paddr() to format address - on trace output. - -1999-09-21 Fernando Nasser - - * mi-main.c (mi_cmd_var_create): Test for varobjdebug before - printing trace and send it to gdb_stdlog. - -Mon Sep 20 13:41:04 1999 Andrew Cagney - - * Makefile.in (mi-out.o): Add dependency list. - * mi-out.c: Include "mi-out.h". - -1999-09-18 Elena Zannoni - - * mi-main.c (_initialize_mi_main): Events on stadin are now - handled by stdin_event_handler. - -1999-09-17 Fernando Nasser - - * mi-cmds.c (mi_cmds): Add var-* commands. - -1999-09-17 Fernando Nasser - - * mi-main.c (mi_cmd_var_create, mi_cmd_var_delete, - mi_cmd_var_set_format, mi_cmd_var_show_format, - mi_cmd_var_info_num_children, mi_cmd_var_list_children, - mi_cmd_var_info_type, mi_cmd_var_info_expression, - mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression, - mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one, - which_var, next_arg): New functions. Implement the -var-* - commands. - * mi-cmds.h: Add prototypes for the above. - -1999-09-14 Fernando Nasser - - * mi-cmds.c (mi_cmds): Add detach command. - -1999-09-09 Fernando Nasser - - * mi-cmds.c (lookup_table): Fix typo. - -1999-09-09 Fernando Nasser - - * mi-cmds.c (mi_cmds): Fix typo and missing command. - -1999-09-09 Fernando Nasser - - * mi-main.c: Properly align function prototypes. - (mi_cmd_target_select): Proper check for NULL value. - -1999-09-09 Fernando Nasser - - * mi-main.c (mi_execute_async_cli_command): Fix for native targets - that do not have async yet. - -1999-09-01 Elena Zannoni - - * mi-main.c (mi_cmd_disassemble): Remove unused var. - (gdb_do_disassemble): Ditto. - -1999-08-30 Elena Zannoni - - * mi-main.c: Replace all the occurrences of 'asynch' in variable - or function names with 'async' to make it consistent with the rest - of gdb. - -Mon Aug 30 18:16:39 1999 Andrew Cagney - - * mi-main.c: #include for isspace(). - -1999-08-27 Elena Zannoni - - * mi-main.c (gdb_do_disassemble): This function returns void, not - int. - -1999-08-26 Elena Zannoni - - * mi-main.c (mi_cmd_disassemble): Don't use atoi() on the high - address string, just treat it same as address low. - (gdb_do_disassemble): Parse high_address string before seeing if - it is zero. - -1999-08-25 Elena Zannoni - - * mi-main.c (mi_cmd_disassemble): New function to produce - disassembly output for mi. - (gdb_dis_asm_read_memory): New function. Read the disassembly from - the executable file, instead of target memory. - (compare_lines): New function. Compare order of disassembly lines. - (gdb_do_disassemble): New function. Do the real job of getting the - assembly code out. - - * mi-cmds.c (mi_cmds): Do data-disassemble mi command via the - mi_cmd_disassemble function. - - * mi-cmds.h: Export new function mi_cmd_disassemble. - -Wed Aug 25 15:58:31 1999 Andrew Cagney - - * mi-main.c (mi_command_loop): Remove references to ui-hooks. - -1999-08-21 Elena Zannoni - - * mi-main.c (mi_execute_asynch_cli_command): Fix the incorrect - usage of strcat(): allocate enough space for the string. - -1999-08-13 Elena Zannoni - - From Christopher Faylor - * mi-main.c (mi_execute_command): Make sure we flush all the - output after each command. - -1999-08-10 Elena Zannoni - - * mi-main.c (_initialize_mi_main): Remove casting in call to - add_file_handler. - -Sun Aug 8 17:20:57 1999 Andrew Cagney - - * mi-main.c (mi_cmd_target_select, mi_execute_asynch_cli_command): - Replace call to fatal with call to internal_error. - -1999-07-26 Fernando Nasser - - * mi-main.c (mi_cmd_execute): Add return code. - (mi_execute_command): Make appropriate changes when calling the - function mentioned above. - (mi_cmd_gdb_exit, mi_cmd_target_select, - mi_cmd_target_select_continuation, mi_execute_command, - mi_exec_asynch_cli_cmd, mi_exec_asynch_cli_cmd_continuation): - Print token, prefix, class and output (if any) in one single group - of statements. - (mi_execute_command, mi_cmd_execute): Fix error prefix. - (mi_cmd_execute): Use exec cleanup for token. - * mi-out.c (mi_out_rewind): New function. - * mi-out.h: Prototype for the above. - -1999-07-16 Fernando Nasser - - * mi-main.c (mi_cmd_gdb_exit): Use buffer for exit message. - (mi_cmd_execute): Route error messages to correct file. - (mi_execute_asynch_cli_command): Insert line feed after running - message. - -1999-07-16 Fernando Nasser - - * mi-out.h (mi_out_buffered): Add extern declaration. - * mi-out.c (mi_out_buffered): New function. Insert a string at the - current buffer position. - * mi-main.c (mi_cmd_target_select, mi_execute_command, - mi_cmd_execute, mi_execute_asynch_cli_command): Use the above - function instead of printing to raw_stdout. - (mi_cmd_target_select, mi_cmd_target_select_continuation, - mi_execute_command, mi_cmd_execute, mi_execute_cli_command, - mi_exec_asynch_cli_cmd_continuation): Fix handling of token and - prefix. - (mi_execute_cli_command): Remove parameter no longer needed. - -1999-07-15 Elena Zannoni - - * mi-main.c (mi_cmd_target_select_continuation): Print the numeric - token when we are connected. - (mi_execute_command): Don't print the token now, do it later. - (mi_execute_cli_command): Add a new parameter for the numeric - token. Print the token, the prefix and the class after the - command has executed, not before. - (mi_execute_asynch_cli_command): Don't print an extra blank line. - -1999-07-15 Fernando Nasser - - * mi-main.c (mi_gdb_exit): Add \n at the end. - -1999-07-15 Fernando Nasser - - * mi-main.c (mi_cmd_execute): New function. Dispatch a mi operation. - (mi_execute_command): Use the above. - -1999-07-15 Fernando Nasser - - * mi-main.c: Fix identation. - -1999-07-15 Elena Zannoni - - * mi-main.c: Include target.h and inferior.h. - (mi_cmd_target_select): New function to execute the target-select - mi operation. - (mi_cmd_target_select_continuation): New function. Continuation - for the target-select operation. - (mi_execute_command): In case of an MI command which requires - asynchronous execution, do not try to display the result now. If - the execution has to look synchronous don't display the "(gdb)" - prompt. - (mi_execute_asynch_cli_command): Invoke real asynchronous - commands, set up exec_cleanups, and continuations. - (mi_exec_asynch_cli_cmd_continuation): New function. Continuation - for all the MI execution commands except 'target-select'. - (mi_execute_command): Handle null commands by exiting gdb, instead - of core dumping. - - * mi-cmds.c (mi_cmds): Hook up -target-select operation to new mi - function. - - * mi-cmds.h (mi_cmd_target_select): Add extern declaration. - -Thu Jul 15 10:31:39 1999 Andrew Cagney - - * mi-main.c (struct mi_console_file): Add field ``prefix''. - (mi_console_file_new): Add argument prefix. Initialize prefix - field. - (mi_console_file_flush): Use ``prefix'' instead of "~" as the - prefix string. - (mi_command_loop): Update stream output prefixes. gdb_stdout == - "~", gdb_stderr / gdb_stdlog == "&", gdb_stdtarg == "@". - -1999-07-13 Fernando Nasser - - * mi-main.c (ui_out_data): New field first_header. Fix output when - no breakpoints are found. - (mi_table_begin, mi_table_body, mi_table_header): Test for - first_header. - (mi_table_end): Test for supress_field_separator. - (mi_message): Remove messages from MI output. - -1999-06-30 Fernando Nasser - - * mi-cmds.c (mi_cmds[]): Delete gdb-cli operation. - * mi-main.c (parse): Remove ifdefs for cli commands parsing. - (mi-execute-command): Ditto. - -Mon Jun 28 13:06:52 1999 Andrew Cagney - - * mi-out.h: New file. - (mi_out_new, mi_out_put): Move mi specific delcarations to here. - * ui-out.h: From here. - - * mi-main.c: Include "mi-out.h". - -1999-06-25 Fernando Nasser - - * top.c (print_gdb_version): Add the word HEADLESS when output - follows headless format. - (print_command_lines): Fix typo. - -1999-06-25 Elena Zannoni - - * event-loop.h: Export input_fd. - * mi-main.c (mi_command_loop): Use the event loop if running - asynchronously. - (mi_execute_command_wrapper): New function. - (_initialize_mi-main): Set things up for running asynchronously. - -1999-06-18 Fernando Nasser - - * mi-cmds.c (mi_lookup): Deleted. - (lookup_table): New function. Replaces old mi_lookup() for local - use. - (mi_lookup): New function. External interface for command table - searchs. - (build_table): New definition. - (mi_cmds[]): Add several command implementations and the gdb-cli - special operation. - (mi_cmd_execute): Deleted. - * mi-cmds.h: Add type definition for command implementation - function pointers, add declaration for new implementation - functions and a declaration for mi_lookup(). - * mi-main.c (mi_execute_asynch_cli_command): New - function. Captures code that was repeated for all asynch - operations. - (mi_cmd_exec_*): Use the above new function. - (mi_gdb_cmd_exit): Fix the output, printing something appropriate. - (mi_cmd_exec_finish): New operation implementation function. - (mi_cmd_exec_return): Ditto. - (parse): Prepare to remove cli commands. - (mi_execute_command): Fix the output and change the way mi-cmds is - used. - -1999-06-18 Fernando Nasser - - * mi-out.c (mi_table_begin): Add missing field separator call. - -Thu Jun 17 21:05:40 1999 Fernando Nasser - - * breakpoint.c (breakpoint_1): Remove space in breakpoint table - id. - (mention): Use ui_out for last new line (forgotten). - -1999-06-16 Fernando Nasser - - * mi-main.c (mi_console_file_flush): Prevent prefix printing when - buffer empty; change prefix to '~'. - (mi_cmd_exec_*): Prefix normal output with '^' instead of - ','; remove unwanted new lines before "stopped". - -1999-06-16 Fernando Nasser - - * mi-cmds.c (struct mi_cmds): Updated entries for -exec-continue - and exec-next operations. - (mi_cmd_execute): New text for error messages. - * mi-cmds.h: Add declaration for mi_cmd_exec_next and - mi_cmd_exec_continue. - * mi-main.c (mi_cmd_exec_next): New function. Implements exec-next - operation. - (mi_cmd_exec_continue): New function. Implements exec-continue - operation. - (mi_execute_comand): Add missing space to prompt. - (mi_cmd_exec_run): Ditto. - (mi_cmd_exec_step): Ditto. - * mi-out.c (mi_out_new): Add flags argument to ui_out_new call. - (ui_list_end): Reset supress_field_separator flag. - -Sat Jun 12 11:49:10 1999 Andrew Cagney - - * mi-cmds.h. mi-cmds.c (exec step): Command implemented by - mi_cmd_exec_step instead of cli call. - * mi-main.c (mi_cmd_exec_step): New function. - - * mi-cmds.h. mi-cmds.c (exec run): Command implemented by - mi_cmd_exec_run instead of cli call. - * mi-main.c (mi_cmd_exec_run): New function. - - * mi-cmds.h. mi-cmds.c (gdb exit): Command implemented by - mi_cmd_gdb_exit instead of quit_force. - * mi-main.c (mi_cmd_gdb_exit): New function. - -Sat Jun 12 11:33:23 1999 Andrew Cagney - - * mi-main.c (mi_command_loop): Pass mi_input to - simplified_command_loop. - (mi_input): New function. Calls gdb_readline with no prompt. - -Sat Jun 12 11:19:02 1999 Andrew Cagney - - * mi-main.c (mi_console_file_fputs): Re-implement. Use a buffer - to accumulate output. - - * mi-main.c (struct mi_console_file): Add a buffer. - (mi_console_file_new): Create a buffer. - (mi_console_file_flush): New function. - -Sat Jun 12 10:59:39 1999 Andrew Cagney - - * mi-cmds.h (raw_stdout): Declare. Will be moved later. - * mi-cmds.c (mi_cmd_execute): Send error messages to RAW stdout. - (mi_cmds): Sort by class. - - * mi-main.c (raw_stdout): Make global. - * mi-main.c: Remove #ifdef UI_OUT. File assumes UI_OUT is - present. - * mi-main.c: Include "gdb_string.h". - (mi_out_put): Delete declaration. - -1999-06-11 Fernando Nasser - - * mi-main.c: Add pre-processor test for UI_OUT. - (mi_execute_command): Add pre-processor test for UI_OUT. - -Fri Jun 11 23:11:41 1999 Andrew Cagney - - * mi-main.c (raw_stdout): New variable. - (mi_execute_command): Write mi-out direct to raw_stdout. - (mi_command_loop): Create raw_stdout. Attach gdb_stdout to the - console. - (mi_console_file_fputs, mi_console_file_delete, - mi_console_file_new): New functions. - (struct mi_console_file): Declare. - -Fri Jun 11 18:34:33 1999 Andrew Cagney - - * mi-main.c (mi_execute_command): Call mi_out_put to display the - result. - * mi-out.c (mi_out_put): New function. - * ui-out.h (mi_out_put): Add declare. Will move later. - * Makefile.in (mi-cmds.o, mi-main.o): Add dependency on ui-out.h. - - * mi-out.c (mi_field_string, mi_field_fmt, mi_message, mi_flush, - out_field_fmt, list_open, list_close): Replace gdb_stdout with - data->buffer. - (field_separator, list_open, list_close): Add uiout parameter. - (mi_table_begin, mi_table_body, mi_table_end, mi_list_begin, - mi_list_end, mi_field_string, mi_field_fmt, out_field_fmt, - out_field_fmt): Update. - - * mi-out.c (mi_out_new): Initialize supress_field_separator. - (supress_field_separator): Move into mi-out local data object. - (mi_table_begin, mi_list_begin, field_separator): Update. - -Fri Jun 11 16:08:37 1999 Andrew Cagney - - * mi-out.c (mi_out_new): New function, replace init_mi_out. - * mi-main.c (mi_command_loop): Call mi_out_new(). - - * ui-out.h (mi_out_new): Add declaration. Will move later. - (mi_ui_out_impl): Delete. - -Wed Jun 9 16:42:16 1999 Andrew Cagney - - * mi-main.c: Include "ui-hooks.h". - (mi_init_ui, mi_command_loop): New functions. - (_initialize_mi_main): Install ``mi'' as the interpreter when - selected. - -Mon Jun 7 18:43:43 1999 Andrew Cagney - - From Fernando Nasser - * mi-cmds.c (build_table): Clean up error message. - * mi-cmds.c (mi_cmd_execute), mi-main.c (mi_execute_command): Only - print debug information when mi_debug_p. - * mi-cmds.h (mi_debug_p), mi-main.c: Global, control debug messages. - -Thu Jun 3 00:44:52 1999 Andrew Cagney - - From Fernando Nasser : - * mi-cmds.c: Add CLI definitions for "exec-arguments", - "exec-next", "gdb-exit", "break-list", "break-info", "exec-step" - and "stack-list-frames" to mi_cmds. - (struct mi_command): Add ``from_tty'' argument to func. - * mi-cmds.h (quit_force): Declare. - -1999-05-31 Fernando Nasser - - * mi-out.c (mi_table_end): Remove unwanted "\n". - -Thu May 27 14:59:06 1999 Andrew Cagney - - * top.c: Include "ui-hooks.h". - (call_interp_loop): Tempoary. Pass mi_execute_command to - simplified_command_loop. Initialize gdb_stdout & gdb_stderr to - stdio gdb_file streams. Force all hooks to null. - - * mi-cmds.h, mi-main.c, mi-cmds.c: New files. - * Makefile.in (SFILES): Add mi-main.c, mi-cmds.c - (COMMON_OBS): Add mi-main.o, mi-cmds.o. - (mi_cmds_h): Define. - -Wed May 26 12:39:49 1999 Andrew Cagney - - * top.c (call_interp_loop): Hack. Add extern declaration for - mi_ui_out_impl. - -1999-05-25 Fernando Nasser - - * mi-out.c: New table syntax. - -Mon May 24 16:16:29 1999 Andrew Cagney - - mi-out.c (_initialize_mi_out): Add external declaration. - -1999-05-21 Fernando Nasser - - * mi-out.c (mi_table_begin): Added missing parameter. - -1999-05-21 Fernando Nasser - - * mi-out.c: Changed table markers and added table id. - -1999-05-21 Fernando Nasser - - * mi-out.c: New file. Implements low-level ui-out primitives for - CLI-based interaction. - - -Local Variables: -mode: change-log -left-margin: 8 -fill-column: 74 -version-control: never -End: Index: mi-interp.c =================================================================== --- mi-interp.c (revision 816) +++ mi-interp.c (nonexistent) @@ -1,534 +0,0 @@ -/* MI Interpreter Definitions and Commands for GDB, the GNU debugger. - - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "gdb_string.h" -#include "interps.h" -#include "event-top.h" -#include "event-loop.h" -#include "inferior.h" -#include "ui-out.h" -#include "top.h" -#include "exceptions.h" -#include "mi-main.h" -#include "mi-cmds.h" -#include "mi-out.h" -#include "mi-console.h" -#include "mi-common.h" -#include "observer.h" -#include "gdbthread.h" -#include "solist.h" - -/* These are the interpreter setup, etc. functions for the MI interpreter */ -static void mi_execute_command_wrapper (char *cmd); -static void mi_command_loop (int mi_version); - -/* These are hooks that we put in place while doing interpreter_exec - so we can report interesting things that happened "behind the mi's - back" in this command */ -static int mi_interp_query_hook (const char *ctlstr, va_list ap) - ATTR_FORMAT (printf, 1, 0); - -static void mi3_command_loop (void); -static void mi2_command_loop (void); -static void mi1_command_loop (void); - -static void mi_insert_notify_hooks (void); -static void mi_remove_notify_hooks (void); -static void mi_on_normal_stop (struct bpstats *bs, int print_frame); - -static void mi_new_thread (struct thread_info *t); -static void mi_thread_exit (struct thread_info *t, int silent); -static void mi_inferior_appeared (int pid); -static void mi_inferior_exit (int pid); -static void mi_on_resume (ptid_t ptid); -static void mi_solib_loaded (struct so_list *solib); -static void mi_solib_unloaded (struct so_list *solib); -static void mi_about_to_proceed (void); - -static void * -mi_interpreter_init (int top_level) -{ - struct mi_interp *mi = XMALLOC (struct mi_interp); - - /* HACK: We need to force stdout/stderr to point at the console. This avoids - any potential side effects caused by legacy code that is still - using the TUI / fputs_unfiltered_hook. So we set up output channels for - this now, and swap them in when we are run. */ - - raw_stdout = stdio_fileopen (stdout); - - /* Create MI channels */ - mi->out = mi_console_file_new (raw_stdout, "~", '"'); - mi->err = mi_console_file_new (raw_stdout, "&", '"'); - mi->log = mi->err; - mi->targ = mi_console_file_new (raw_stdout, "@", '"'); - mi->event_channel = mi_console_file_new (raw_stdout, "=", 0); - - if (top_level) - { - observer_attach_new_thread (mi_new_thread); - observer_attach_thread_exit (mi_thread_exit); - observer_attach_inferior_appeared (mi_inferior_appeared); - observer_attach_inferior_exit (mi_inferior_exit); - observer_attach_normal_stop (mi_on_normal_stop); - observer_attach_target_resumed (mi_on_resume); - observer_attach_solib_loaded (mi_solib_loaded); - observer_attach_solib_unloaded (mi_solib_unloaded); - observer_attach_about_to_proceed (mi_about_to_proceed); - } - - return mi; -} - -static int -mi_interpreter_resume (void *data) -{ - struct mi_interp *mi = data; - /* As per hack note in mi_interpreter_init, swap in the output channels... */ - - gdb_setup_readline (); - - /* These overwrite some of the initialization done in - _intialize_event_loop. */ - call_readline = gdb_readline2; - input_handler = mi_execute_command_wrapper; - add_file_handler (input_fd, stdin_event_handler, 0); - async_command_editing_p = 0; - /* FIXME: This is a total hack for now. PB's use of the MI - implicitly relies on a bug in the async support which allows - asynchronous commands to leak through the commmand loop. The bug - involves (but is not limited to) the fact that sync_execution was - erroneously initialized to 0. Duplicate by initializing it thus - here... */ - sync_execution = 0; - - gdb_stdout = mi->out; - /* Route error and log output through the MI */ - gdb_stderr = mi->err; - gdb_stdlog = mi->log; - /* Route target output through the MI. */ - gdb_stdtarg = mi->targ; - /* Route target error through the MI as well. */ - gdb_stdtargerr = mi->targ; - - /* Replace all the hooks that we know about. There really needs to - be a better way of doing this... */ - clear_interpreter_hooks (); - - deprecated_show_load_progress = mi_load_progress; - - /* If we're _the_ interpreter, take control. */ - if (current_interp_named_p (INTERP_MI1)) - deprecated_command_loop_hook = mi1_command_loop; - else if (current_interp_named_p (INTERP_MI2)) - deprecated_command_loop_hook = mi2_command_loop; - else if (current_interp_named_p (INTERP_MI3)) - deprecated_command_loop_hook = mi3_command_loop; - else - deprecated_command_loop_hook = mi2_command_loop; - - return 1; -} - -static int -mi_interpreter_suspend (void *data) -{ - gdb_disable_readline (); - return 1; -} - -static struct gdb_exception -mi_interpreter_exec (void *data, const char *command) -{ - static struct gdb_exception ok; - char *tmp = alloca (strlen (command) + 1); - strcpy (tmp, command); - mi_execute_command_wrapper (tmp); - return exception_none; -} - -/* Never display the default gdb prompt in mi case. */ -static int -mi_interpreter_prompt_p (void *data) -{ - return 0; -} - -void -mi_cmd_interpreter_exec (char *command, char **argv, int argc) -{ - struct interp *interp_to_use; - int i; - struct interp_procs *procs; - char *mi_error_message = NULL; - struct cleanup *old_chain; - - if (argc < 2) - error ("mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command"); - - interp_to_use = interp_lookup (argv[0]); - if (interp_to_use == NULL) - error ("mi_cmd_interpreter_exec: could not find interpreter \"%s\"", argv[0]); - - if (!interp_exec_p (interp_to_use)) - error ("mi_cmd_interpreter_exec: interpreter \"%s\" does not support command execution", - argv[0]); - - /* Insert the MI out hooks, making sure to also call the interpreter's hooks - if it has any. */ - /* KRS: We shouldn't need this... Events should be installed and they should - just ALWAYS fire something out down the MI channel... */ - mi_insert_notify_hooks (); - - /* Now run the code... */ - - old_chain = make_cleanup (null_cleanup, 0); - for (i = 1; i < argc; i++) - { - struct gdb_exception e = interp_exec (interp_to_use, argv[i]); - if (e.reason < 0) - { - mi_error_message = xstrdup (e.message); - make_cleanup (xfree, mi_error_message); - break; - } - } - - mi_remove_notify_hooks (); - - if (mi_error_message != NULL) - error ("%s", mi_error_message); - do_cleanups (old_chain); -} - -/* - * mi_insert_notify_hooks - This inserts a number of hooks that are meant to produce - * async-notify ("=") MI messages while running commands in another interpreter - * using mi_interpreter_exec. The canonical use for this is to allow access to - * the gdb CLI interpreter from within the MI, while still producing MI style output - * when actions in the CLI command change gdb's state. -*/ - -static void -mi_insert_notify_hooks (void) -{ - deprecated_query_hook = mi_interp_query_hook; -} - -static void -mi_remove_notify_hooks (void) -{ - deprecated_query_hook = NULL; -} - -static int -mi_interp_query_hook (const char *ctlstr, va_list ap) -{ - return 1; -} - -static void -mi_execute_command_wrapper (char *cmd) -{ - mi_execute_command (cmd, stdin == instream); -} - -static void -mi1_command_loop (void) -{ - mi_command_loop (1); -} - -static void -mi2_command_loop (void) -{ - mi_command_loop (2); -} - -static void -mi3_command_loop (void) -{ - mi_command_loop (3); -} - -static void -mi_command_loop (int mi_version) -{ - /* Turn off 8 bit strings in quoted output. Any character with the - high bit set is printed using C's octal format. */ - sevenbit_strings = 1; - /* Tell the world that we're alive */ - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - start_event_loop (); -} - -static void -mi_new_thread (struct thread_info *t) -{ - struct mi_interp *mi = top_level_interpreter_data (); - - fprintf_unfiltered (mi->event_channel, - "thread-created,id=\"%d\",group-id=\"%d\"", - t->num, t->ptid.pid); - gdb_flush (mi->event_channel); -} - -static void -mi_thread_exit (struct thread_info *t, int silent) -{ - struct mi_interp *mi; - - if (silent) - return; - - mi = top_level_interpreter_data (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, - "thread-exited,id=\"%d\",group-id=\"%d\"", - t->num,t->ptid.pid); - gdb_flush (mi->event_channel); -} - -void -mi_inferior_appeared (int pid) -{ - struct mi_interp *mi = top_level_interpreter_data (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, "thread-group-created,id=\"%d\"", - pid); - gdb_flush (mi->event_channel); -} - -static void -mi_inferior_exit (int pid) -{ - struct mi_interp *mi = top_level_interpreter_data (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, "thread-group-exited,id=\"%d\"", - pid); - gdb_flush (mi->event_channel); -} - -static void -mi_on_normal_stop (struct bpstats *bs, int print_frame) -{ - /* Since this can be called when CLI command is executing, - using cli interpreter, be sure to use MI uiout for output, - not the current one. */ - struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); - struct mi_interp *mi = top_level_interpreter_data (); - - if (print_frame) - { - int core; - if (uiout != mi_uiout) - { - /* The normal_stop function has printed frame information into - CLI uiout, or some other non-MI uiout. There's no way we - can extract proper fields from random uiout object, so we print - the frame again. In practice, this can only happen when running - a CLI command in MI. */ - struct ui_out *saved_uiout = uiout; - uiout = mi_uiout; - print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC); - uiout = saved_uiout; - } - - ui_out_field_int (mi_uiout, "thread-id", - pid_to_thread_id (inferior_ptid)); - if (non_stop) - { - struct cleanup *back_to = make_cleanup_ui_out_list_begin_end - (mi_uiout, "stopped-threads"); - ui_out_field_int (mi_uiout, NULL, - pid_to_thread_id (inferior_ptid)); - do_cleanups (back_to); - } - else - ui_out_field_string (mi_uiout, "stopped-threads", "all"); - - core = target_core_of_thread (inferior_ptid); - if (core != -1) - ui_out_field_int (mi_uiout, "core", core); - } - - fputs_unfiltered ("*stopped", raw_stdout); - mi_out_put (mi_uiout, raw_stdout); - mi_out_rewind (mi_uiout); - mi_print_timing_maybe (); - fputs_unfiltered ("\n", raw_stdout); - gdb_flush (raw_stdout); -} - -static void -mi_about_to_proceed (void) -{ - /* Suppress output while calling an inferior function. */ - - if (!ptid_equal (inferior_ptid, null_ptid)) - { - struct thread_info *tp = inferior_thread (); - if (tp->in_infcall) - return; - } - - mi_proceeded = 1; -} - -static int -mi_output_running_pid (struct thread_info *info, void *arg) -{ - ptid_t *ptid = arg; - - if (ptid_get_pid (*ptid) == ptid_get_pid (info->ptid)) - fprintf_unfiltered (raw_stdout, - "*running,thread-id=\"%d\"\n", - info->num); - - return 0; -} - -static int -mi_inferior_count (struct inferior *inf, void *arg) -{ - if (inf->pid != 0) - { - int *count_p = arg; - (*count_p)++; - } - - return 0; -} - -static void -mi_on_resume (ptid_t ptid) -{ - struct thread_info *tp = NULL; - - if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)) - tp = inferior_thread (); - else - tp = find_thread_ptid (ptid); - - /* Suppress output while calling an inferior function. */ - if (tp->in_infcall) - return; - - /* To cater for older frontends, emit ^running, but do it only once - per each command. We do it here, since at this point we know - that the target was successfully resumed, and in non-async mode, - we won't return back to MI interpreter code until the target - is done running, so delaying the output of "^running" until then - will make it impossible for frontend to know what's going on. - - In future (MI3), we'll be outputting "^done" here. */ - if (!running_result_record_printed && mi_proceeded) - { - fprintf_unfiltered (raw_stdout, "%s^running\n", - current_token ? current_token : ""); - } - - if (PIDGET (ptid) == -1) - fprintf_unfiltered (raw_stdout, "*running,thread-id=\"all\"\n"); - else if (ptid_is_pid (ptid)) - { - int count = 0; - - /* Backwards compatibility. If there's only one inferior, - output "all", otherwise, output each resumed thread - individually. */ - iterate_over_inferiors (mi_inferior_count, &count); - - if (count == 1) - fprintf_unfiltered (raw_stdout, "*running,thread-id=\"all\"\n"); - else - iterate_over_threads (mi_output_running_pid, &ptid); - } - else - { - struct thread_info *ti = find_thread_ptid (ptid); - gdb_assert (ti); - fprintf_unfiltered (raw_stdout, "*running,thread-id=\"%d\"\n", ti->num); - } - - if (!running_result_record_printed && mi_proceeded) - { - running_result_record_printed = 1; - /* This is what gdb used to do historically -- printing prompt even if - it cannot actually accept any input. This will be surely removed - for MI3, and may be removed even earler. */ - /* FIXME: review the use of target_is_async_p here -- is that - what we want? */ - if (!target_is_async_p ()) - fputs_unfiltered ("(gdb) \n", raw_stdout); - } - gdb_flush (raw_stdout); -} - -static void -mi_solib_loaded (struct so_list *solib) -{ - struct mi_interp *mi = top_level_interpreter_data (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, - "library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"%d\"", - solib->so_original_name, solib->so_original_name, - solib->so_name, solib->symbols_loaded); - gdb_flush (mi->event_channel); -} - -static void -mi_solib_unloaded (struct so_list *solib) -{ - struct mi_interp *mi = top_level_interpreter_data (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, - "library-unloaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\"", - solib->so_original_name, solib->so_original_name, - solib->so_name); - gdb_flush (mi->event_channel); -} - - -extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */ - -void -_initialize_mi_interp (void) -{ - static const struct interp_procs procs = - { - mi_interpreter_init, /* init_proc */ - mi_interpreter_resume, /* resume_proc */ - mi_interpreter_suspend, /* suspend_proc */ - mi_interpreter_exec, /* exec_proc */ - mi_interpreter_prompt_p /* prompt_proc_p */ - }; - - /* The various interpreter levels. */ - interp_add (interp_new (INTERP_MI1, NULL, mi_out_new (1), &procs)); - interp_add (interp_new (INTERP_MI2, NULL, mi_out_new (2), &procs)); - interp_add (interp_new (INTERP_MI3, NULL, mi_out_new (3), &procs)); - - /* "mi" selects the most recent released version. "mi2" was - released as part of GDB 6.0. */ - interp_add (interp_new (INTERP_MI, NULL, mi_out_new (2), &procs)); -}
mi-interp.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-console.c =================================================================== --- mi-console.c (revision 816) +++ mi-console.c (nonexistent) @@ -1,124 +0,0 @@ -/* MI Console code. - - Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-console.h" -#include "gdb_string.h" - -/* MI-console: send output to std-out but correcty encapsulated */ - -static ui_file_fputs_ftype mi_console_file_fputs; -static ui_file_flush_ftype mi_console_file_flush; -static ui_file_delete_ftype mi_console_file_delete; - -struct mi_console_file - { - int *magic; - struct ui_file *raw; - struct ui_file *buffer; - const char *prefix; - char quote; - }; - -int mi_console_file_magic; - -struct ui_file * -mi_console_file_new (struct ui_file *raw, - const char *prefix, char quote) -{ - struct ui_file *ui_file = ui_file_new (); - struct mi_console_file *mi_console = XMALLOC (struct mi_console_file); - mi_console->magic = &mi_console_file_magic; - mi_console->raw = raw; - mi_console->buffer = mem_fileopen (); - mi_console->prefix = prefix; - mi_console->quote = quote; - set_ui_file_fputs (ui_file, mi_console_file_fputs); - set_ui_file_flush (ui_file, mi_console_file_flush); - set_ui_file_data (ui_file, mi_console, mi_console_file_delete); - return ui_file; -} - -static void -mi_console_file_delete (struct ui_file *file) -{ - struct mi_console_file *mi_console = ui_file_data (file); - if (mi_console->magic != &mi_console_file_magic) - internal_error (__FILE__, __LINE__, - _("mi_console_file_delete: bad magic number")); - xfree (mi_console); -} - -static void -mi_console_file_fputs (const char *buf, - struct ui_file *file) -{ - struct mi_console_file *mi_console = ui_file_data (file); - if (mi_console->magic != &mi_console_file_magic) - internal_error (__FILE__, __LINE__, - "mi_console_file_fputs: bad magic number"); - /* Append the text to our internal buffer */ - fputs_unfiltered (buf, mi_console->buffer); - /* Flush when an embedded \n */ - if (strchr (buf, '\n') != NULL) - gdb_flush (file); -} - -/* Transform a byte sequence into a console output packet. */ -static void -mi_console_raw_packet (void *data, - const char *buf, - long length_buf) -{ - struct mi_console_file *mi_console = data; - if (mi_console->magic != &mi_console_file_magic) - internal_error (__FILE__, __LINE__, - _("mi_console_file_transform: bad magic number")); - - if (length_buf > 0) - { - fputs_unfiltered (mi_console->prefix, mi_console->raw); - if (mi_console->quote) - { - fputs_unfiltered ("\"", mi_console->raw); - fputstrn_unfiltered (buf, length_buf, mi_console->quote, mi_console->raw); - fputs_unfiltered ("\"\n", mi_console->raw); - } - else - { - fputstrn_unfiltered (buf, length_buf, 0, mi_console->raw); - fputs_unfiltered ("\n", mi_console->raw); - } - gdb_flush (mi_console->raw); - } -} - -static void -mi_console_file_flush (struct ui_file *file) -{ - struct mi_console_file *mi_console = ui_file_data (file); - if (mi_console->magic != &mi_console_file_magic) - internal_error (__FILE__, __LINE__, - _("mi_console_file_flush: bad magic number")); - ui_file_put (mi_console->buffer, mi_console_raw_packet, mi_console); - ui_file_rewind (mi_console->buffer); -}
mi-console.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-getopt.c =================================================================== --- mi-getopt.c (revision 816) +++ mi-getopt.c (nonexistent) @@ -1,91 +0,0 @@ -/* MI Command Set - MI Option Parser. - Copyright (C) 2000, 2001, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-getopt.h" -#include "gdb_string.h" - -int -mi_getopt (const char *prefix, - int argc, char **argv, - struct mi_opt *opts, - int *optind, char **optarg) -{ - char *arg; - struct mi_opt *opt; - /* We assume that argv/argc are ok. */ - if (*optind > argc || *optind < 0) - internal_error (__FILE__, __LINE__, - _("mi_getopt_long: optind out of bounds")); - if (*optind == argc) - return -1; - arg = argv[*optind]; - /* ``--''? */ - if (strcmp (arg, "--") == 0) - { - *optind += 1; - *optarg = NULL; - return -1; - } - /* End of option list. */ - if (arg[0] != '-') - { - *optarg = NULL; - return -1; - } - /* Look the option up. */ - for (opt = opts; opt->name != NULL; opt++) - { - if (strcmp (opt->name, arg + 1) != 0) - continue; - if (opt->arg_p) - { - /* A non-simple optarg option. */ - if (argc < *optind + 2) - error (_("%s: Option %s requires an argument"), prefix, arg); - *optarg = argv[(*optind) + 1]; - *optind = (*optind) + 2; - return opt->index; - } - else - { - *optarg = NULL; - *optind = (*optind) + 1; - return opt->index; - } - } - error (_("%s: Unknown option ``%s''"), prefix, arg + 1); -} - -int -mi_valid_noargs (const char *prefix, int argc, char **argv) -{ - int optind = 0; - char *optarg; - static struct mi_opt opts[] = - { - { 0, 0, 0 } - }; - - if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1) - return 1; - else - return 0; -}
mi-getopt.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-disas.c =================================================================== --- mi-cmd-disas.c (revision 816) +++ mi-cmd-disas.c (nonexistent) @@ -1,161 +0,0 @@ -/* MI Command Set - disassemble commands. - Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "arch-utils.h" -#include "target.h" -#include "value.h" -#include "mi-cmds.h" -#include "mi-getopt.h" -#include "gdb_string.h" -#include "ui-out.h" -#include "disasm.h" - -/* The arguments to be passed on the command line and parsed here are: - - either: - - START-ADDRESS: address to start the disassembly at. - END-ADDRESS: address to end the disassembly at. - - or: - - FILENAME: The name of the file where we want disassemble from. - LINE: The line around which we want to disassemble. It will - disassemble the function that contins that line. - HOW_MANY: Number of disassembly lines to display. In mixed mode, it - is the number of disassembly lines only, not counting the source - lines. - - always required: - - MODE: 0 or 1 for disassembly only, or mixed source and disassembly, - respectively. */ -void -mi_cmd_disassemble (char *command, char **argv, int argc) -{ - struct gdbarch *gdbarch = get_current_arch (); - CORE_ADDR start; - - int mixed_source_and_assembly; - struct symtab *s; - - /* Which options have we processed ... */ - int file_seen = 0; - int line_seen = 0; - int num_seen = 0; - int start_seen = 0; - int end_seen = 0; - - /* ... and their corresponding value. */ - char *file_string = NULL; - int line_num = -1; - int how_many = -1; - CORE_ADDR low = 0; - CORE_ADDR high = 0; - - /* Options processing stuff. */ - int optind = 0; - char *optarg; - enum opt - { - FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT - }; - static struct mi_opt opts[] = { - {"f", FILE_OPT, 1}, - {"l", LINE_OPT, 1}, - {"n", NUM_OPT, 1}, - {"s", START_OPT, 1}, - {"e", END_OPT, 1}, - { 0, 0, 0 } - }; - - /* Get the options with their arguments. Keep track of what we - encountered. */ - while (1) - { - int opt = mi_getopt ("mi_cmd_disassemble", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case FILE_OPT: - file_string = xstrdup (optarg); - file_seen = 1; - break; - case LINE_OPT: - line_num = atoi (optarg); - line_seen = 1; - break; - case NUM_OPT: - how_many = atoi (optarg); - num_seen = 1; - break; - case START_OPT: - low = parse_and_eval_address (optarg); - start_seen = 1; - break; - case END_OPT: - high = parse_and_eval_address (optarg); - end_seen = 1; - break; - } - } - argv += optind; - argc -= optind; - - /* Allow only filename + linenum (with how_many which is not - required) OR start_addr + and_addr */ - - if (!((line_seen && file_seen && num_seen && !start_seen && !end_seen) - || (line_seen && file_seen && !num_seen && !start_seen && !end_seen) - || (!line_seen && !file_seen && !num_seen && start_seen && end_seen))) - error - ("mi_cmd_disassemble: Usage: ( [-f filename -l linenum [-n howmany]] | [-s startaddr -e endaddr]) [--] mixed_mode."); - - if (argc != 1) - error - ("mi_cmd_disassemble: Usage: [-f filename -l linenum [-n howmany]] [-s startaddr -e endaddr] [--] mixed_mode."); - - mixed_source_and_assembly = atoi (argv[0]); - if ((mixed_source_and_assembly != 0) && (mixed_source_and_assembly != 1)) - error (_("mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.")); - - - /* We must get the function beginning and end where line_num is - contained. */ - - if (line_seen && file_seen) - { - s = lookup_symtab (file_string); - if (s == NULL) - error (_("mi_cmd_disassemble: Invalid filename.")); - if (!find_line_pc (s, line_num, &start)) - error (_("mi_cmd_disassemble: Invalid line number")); - if (find_pc_partial_function (start, NULL, &low, &high) == 0) - error (_("mi_cmd_disassemble: No function contains specified address")); - } - - gdb_disassembly (gdbarch, uiout, - file_string, - mixed_source_and_assembly? DISASSEMBLY_SOURCE : 0, - how_many, low, high); -}
mi-cmd-disas.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-stack.c =================================================================== --- mi-cmd-stack.c (revision 816) +++ mi-cmd-stack.c (nonexistent) @@ -1,391 +0,0 @@ -/* MI Command Set - stack commands. - Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "target.h" -#include "frame.h" -#include "value.h" -#include "mi-cmds.h" -#include "ui-out.h" -#include "symtab.h" -#include "block.h" -#include "stack.h" -#include "dictionary.h" -#include "gdb_string.h" -#include "language.h" -#include "valprint.h" - - -enum what_to_list { locals, arguments, all }; - -static void list_args_or_locals (enum what_to_list what, - int values, struct frame_info *fi); - -/* Print a list of the stack frames. Args can be none, in which case - we want to print the whole backtrace, or a pair of numbers - specifying the frame numbers at which to start and stop the - display. If the two numbers are equal, a single frame will be - displayed. */ -void -mi_cmd_stack_list_frames (char *command, char **argv, int argc) -{ - int frame_low; - int frame_high; - int i; - struct cleanup *cleanup_stack; - struct frame_info *fi; - - if (argc > 2 || argc == 1) - error (_("mi_cmd_stack_list_frames: Usage: [FRAME_LOW FRAME_HIGH]")); - - if (argc == 2) - { - frame_low = atoi (argv[0]); - frame_high = atoi (argv[1]); - } - else - { - /* Called with no arguments, it means we want the whole - backtrace. */ - frame_low = -1; - frame_high = -1; - } - - /* Let's position fi on the frame at which to start the - display. Could be the innermost frame if the whole stack needs - displaying, or if frame_low is 0. */ - for (i = 0, fi = get_current_frame (); - fi && i < frame_low; - i++, fi = get_prev_frame (fi)); - - if (fi == NULL) - error (_("mi_cmd_stack_list_frames: Not enough frames in stack.")); - - cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack"); - - /* Now let;s print the frames up to frame_high, or until there are - frames in the stack. */ - for (; - fi && (i <= frame_high || frame_high == -1); - i++, fi = get_prev_frame (fi)) - { - QUIT; - /* Print the location and the address always, even for level 0. - args == 0: don't print the arguments. */ - print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ ); - } - - do_cleanups (cleanup_stack); -} - -void -mi_cmd_stack_info_depth (char *command, char **argv, int argc) -{ - int frame_high; - int i; - struct frame_info *fi; - - if (argc > 1) - error (_("mi_cmd_stack_info_depth: Usage: [MAX_DEPTH]")); - - if (argc == 1) - frame_high = atoi (argv[0]); - else - /* Called with no arguments, it means we want the real depth of - the stack. */ - frame_high = -1; - - for (i = 0, fi = get_current_frame (); - fi && (i < frame_high || frame_high == -1); - i++, fi = get_prev_frame (fi)) - QUIT; - - ui_out_field_int (uiout, "depth", i); -} - -static enum print_values -parse_print_values (char *name) -{ - if (strcmp (name, "0") == 0 - || strcmp (name, mi_no_values) == 0) - return PRINT_NO_VALUES; - else if (strcmp (name, "1") == 0 - || strcmp (name, mi_all_values) == 0) - return PRINT_ALL_VALUES; - else if (strcmp (name, "2") == 0 - || strcmp (name, mi_simple_values) == 0) - return PRINT_SIMPLE_VALUES; - else - error (_("Unknown value for PRINT_VALUES: must be: \ -0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), - mi_no_values, mi_all_values, mi_simple_values); -} - -/* Print a list of the locals for the current frame. With argument of - 0, print only the names, with argument of 1 print also the - values. */ -void -mi_cmd_stack_list_locals (char *command, char **argv, int argc) -{ - struct frame_info *frame; - enum print_values print_values; - - if (argc != 1) - error (_("mi_cmd_stack_list_locals: Usage: PRINT_VALUES")); - - frame = get_selected_frame (NULL); - - list_args_or_locals (locals, parse_print_values (argv[0]), frame); -} - -/* Print a list of the arguments for the current frame. With argument - of 0, print only the names, with argument of 1 print also the - values. */ -void -mi_cmd_stack_list_args (char *command, char **argv, int argc) -{ - int frame_low; - int frame_high; - int i; - struct frame_info *fi; - struct cleanup *cleanup_stack_args; - enum print_values print_values; - - if (argc < 1 || argc > 3 || argc == 2) - error (_("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); - - if (argc == 3) - { - frame_low = atoi (argv[1]); - frame_high = atoi (argv[2]); - } - else - { - /* Called with no arguments, it means we want args for the whole - backtrace. */ - frame_low = -1; - frame_high = -1; - } - - print_values = parse_print_values (argv[0]); - - /* Let's position fi on the frame at which to start the - display. Could be the innermost frame if the whole stack needs - displaying, or if frame_low is 0. */ - for (i = 0, fi = get_current_frame (); - fi && i < frame_low; - i++, fi = get_prev_frame (fi)); - - if (fi == NULL) - error (_("mi_cmd_stack_list_args: Not enough frames in stack.")); - - cleanup_stack_args = make_cleanup_ui_out_list_begin_end (uiout, "stack-args"); - - /* Now let's print the frames up to frame_high, or until there are - frames in the stack. */ - for (; - fi && (i <= frame_high || frame_high == -1); - i++, fi = get_prev_frame (fi)) - { - struct cleanup *cleanup_frame; - QUIT; - cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); - ui_out_field_int (uiout, "level", i); - list_args_or_locals (arguments, print_values, fi); - do_cleanups (cleanup_frame); - } - - do_cleanups (cleanup_stack_args); -} - -/* Print a list of the local variables (including arguments) for the - current frame. ARGC must be 1 and ARGV[0] specify if only the names, - or both names and values of the variables must be printed. See - parse_print_value for possible values. */ -void -mi_cmd_stack_list_variables (char *command, char **argv, int argc) -{ - struct frame_info *frame; - enum print_values print_values; - - if (argc != 1) - error (_("Usage: PRINT_VALUES")); - - frame = get_selected_frame (NULL); - - list_args_or_locals (all, parse_print_values (argv[0]), frame); -} - - -/* Print a list of the locals or the arguments for the currently - selected frame. If the argument passed is 0, printonly the names - of the variables, if an argument of 1 is passed, print the values - as well. */ -static void -list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi) -{ - struct block *block; - struct symbol *sym; - struct dict_iterator iter; - int nsyms; - struct cleanup *cleanup_list; - static struct ui_stream *stb = NULL; - struct type *type; - char *name_of_result; - - stb = ui_out_stream_new (uiout); - - block = get_frame_block (fi, 0); - - switch (what) - { - case locals: - name_of_result = "locals"; - break; - case arguments: - name_of_result = "args"; - break; - case all: - name_of_result = "variables"; - break; - default: - internal_error (__FILE__, __LINE__, - "unexpected what_to_list: %d", (int) what); - } - - cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, name_of_result); - - while (block != 0) - { - ALL_BLOCK_SYMBOLS (block, iter, sym) - { - int print_me = 0; - - switch (SYMBOL_CLASS (sym)) - { - default: - case LOC_UNDEF: /* catches errors */ - case LOC_CONST: /* constant */ - case LOC_TYPEDEF: /* local typedef */ - case LOC_LABEL: /* local label */ - case LOC_BLOCK: /* local function */ - case LOC_CONST_BYTES: /* loc. byte seq. */ - case LOC_UNRESOLVED: /* unresolved static */ - case LOC_OPTIMIZED_OUT: /* optimized out */ - print_me = 0; - break; - - case LOC_ARG: /* argument */ - case LOC_REF_ARG: /* reference arg */ - case LOC_REGPARM_ADDR: /* indirect register arg */ - case LOC_LOCAL: /* stack local */ - case LOC_STATIC: /* static */ - case LOC_REGISTER: /* register */ - case LOC_COMPUTED: /* computed location */ - if (what == all) - print_me = 1; - else if (what == locals) - print_me = !SYMBOL_IS_ARGUMENT (sym); - else - print_me = SYMBOL_IS_ARGUMENT (sym); - break; - } - if (print_me) - { - struct cleanup *cleanup_tuple = NULL; - struct symbol *sym2; - struct value *val; - if (values != PRINT_NO_VALUES || what == all) - cleanup_tuple = - make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym)); - if (what == all && SYMBOL_IS_ARGUMENT (sym)) - ui_out_field_int (uiout, "arg", 1); - - if (SYMBOL_IS_ARGUMENT (sym)) - sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym), - block, VAR_DOMAIN, - (int *) NULL); - else - sym2 = sym; - switch (values) - { - case PRINT_SIMPLE_VALUES: - type = check_typedef (sym2->type); - type_print (sym2->type, "", stb->stream, -1); - ui_out_field_stream (uiout, "type", stb); - if (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) - { - struct value_print_options opts; - val = read_var_value (sym2, fi); - get_raw_print_options (&opts); - opts.deref_ref = 1; - common_val_print - (val, stb->stream, 0, &opts, - language_def (SYMBOL_LANGUAGE (sym2))); - ui_out_field_stream (uiout, "value", stb); - } - break; - case PRINT_ALL_VALUES: - { - struct value_print_options opts; - val = read_var_value (sym2, fi); - get_raw_print_options (&opts); - opts.deref_ref = 1; - common_val_print - (val, stb->stream, 0, &opts, - language_def (SYMBOL_LANGUAGE (sym2))); - ui_out_field_stream (uiout, "value", stb); - } - break; - } - - if (values != PRINT_NO_VALUES || what == all) - do_cleanups (cleanup_tuple); - } - } - if (BLOCK_FUNCTION (block)) - break; - else - block = BLOCK_SUPERBLOCK (block); - } - do_cleanups (cleanup_list); - ui_out_stream_delete (stb); -} - -void -mi_cmd_stack_select_frame (char *command, char **argv, int argc) -{ - if (argc == 0 || argc > 1) - error (_("mi_cmd_stack_select_frame: Usage: FRAME_SPEC")); - - select_frame_command (argv[0], 1 /* not used */ ); -} - -void -mi_cmd_stack_info_frame (char *command, char **argv, int argc) -{ - if (argc > 0) - error (_("mi_cmd_stack_info_frame: No arguments required")); - - print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0); -}
mi-cmd-stack.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-out.c =================================================================== --- mi-out.c (revision 816) +++ mi-out.c (nonexistent) @@ -1,409 +0,0 @@ -/* MI Command Set - output generating routines. - - Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "ui-out.h" -#include "mi-out.h" - -struct ui_out_data - { - int suppress_field_separator; - int suppress_output; - int mi_version; - struct ui_file *buffer; - }; -typedef struct ui_out_data mi_out_data; - -/* These are the MI output functions */ - -static void mi_table_begin (struct ui_out *uiout, int nbrofcols, - int nr_rows, const char *tblid); -static void mi_table_body (struct ui_out *uiout); -static void mi_table_end (struct ui_out *uiout); -static void mi_table_header (struct ui_out *uiout, int width, - enum ui_align alig, const char *col_name, - const char *colhdr); -static void mi_begin (struct ui_out *uiout, enum ui_out_type type, - int level, const char *id); -static void mi_end (struct ui_out *uiout, enum ui_out_type type, int level); -static void mi_field_int (struct ui_out *uiout, int fldno, int width, - enum ui_align alig, const char *fldname, int value); -static void mi_field_skip (struct ui_out *uiout, int fldno, int width, - enum ui_align alig, const char *fldname); -static void mi_field_string (struct ui_out *uiout, int fldno, int width, - enum ui_align alig, const char *fldname, - const char *string); -static void mi_field_fmt (struct ui_out *uiout, int fldno, - int width, enum ui_align align, - const char *fldname, const char *format, - va_list args) ATTR_FORMAT (printf, 6, 0); -static void mi_spaces (struct ui_out *uiout, int numspaces); -static void mi_text (struct ui_out *uiout, const char *string); -static void mi_message (struct ui_out *uiout, int verbosity, - const char *format, va_list args) - ATTR_FORMAT (printf, 3, 0); -static void mi_wrap_hint (struct ui_out *uiout, char *identstring); -static void mi_flush (struct ui_out *uiout); - -/* This is the MI ui-out implementation functions vector */ - -/* FIXME: This can be initialized dynamically after default is set to - handle initial output in main.c */ - -struct ui_out_impl mi_ui_out_impl = -{ - mi_table_begin, - mi_table_body, - mi_table_end, - mi_table_header, - mi_begin, - mi_end, - mi_field_int, - mi_field_skip, - mi_field_string, - mi_field_fmt, - mi_spaces, - mi_text, - mi_message, - mi_wrap_hint, - mi_flush, - NULL, - 1, /* Needs MI hacks. */ -}; - -/* Prototypes for local functions */ - -extern void _initialize_mi_out (void); -static void field_separator (struct ui_out *uiout); -static void mi_open (struct ui_out *uiout, const char *name, - enum ui_out_type type); -static void mi_close (struct ui_out *uiout, enum ui_out_type type); - -/* Mark beginning of a table */ - -void -mi_table_begin (struct ui_out *uiout, - int nr_cols, - int nr_rows, - const char *tblid) -{ - mi_out_data *data = ui_out_data (uiout); - mi_open (uiout, tblid, ui_out_type_tuple); - mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/, - "nr_rows", nr_rows); - mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/, - "nr_cols", nr_cols); - mi_open (uiout, "hdr", ui_out_type_list); -} - -/* Mark beginning of a table body */ - -void -mi_table_body (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - /* close the table header line if there were any headers */ - mi_close (uiout, ui_out_type_list); - mi_open (uiout, "body", ui_out_type_list); -} - -/* Mark end of a table */ - -void -mi_table_end (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - data->suppress_output = 0; - mi_close (uiout, ui_out_type_list); /* body */ - mi_close (uiout, ui_out_type_tuple); -} - -/* Specify table header */ - -void -mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, - const char *col_name, - const char *colhdr) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - mi_open (uiout, NULL, ui_out_type_tuple); - mi_field_int (uiout, 0, 0, 0, "width", width); - mi_field_int (uiout, 0, 0, 0, "alignment", alignment); - mi_field_string (uiout, 0, 0, 0, "col_name", col_name); - mi_field_string (uiout, 0, width, alignment, "colhdr", colhdr); - mi_close (uiout, ui_out_type_tuple); -} - -/* Mark beginning of a list */ - -void -mi_begin (struct ui_out *uiout, - enum ui_out_type type, - int level, - const char *id) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - mi_open (uiout, id, type); -} - -/* Mark end of a list */ - -void -mi_end (struct ui_out *uiout, - enum ui_out_type type, - int level) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - mi_close (uiout, type); -} - -/* output an int field */ - -void -mi_field_int (struct ui_out *uiout, int fldno, int width, - enum ui_align alignment, const char *fldname, int value) -{ - char buffer[20]; /* FIXME: how many chars long a %d can become? */ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - - sprintf (buffer, "%d", value); - mi_field_string (uiout, fldno, width, alignment, fldname, buffer); -} - -/* used to ommit a field */ - -void -mi_field_skip (struct ui_out *uiout, int fldno, int width, - enum ui_align alignment, const char *fldname) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - mi_field_string (uiout, fldno, width, alignment, fldname, ""); -} - -/* other specific mi_field_* end up here so alignment and field - separators are both handled by mi_field_string */ - -void -mi_field_string (struct ui_out *uiout, - int fldno, - int width, - enum ui_align align, - const char *fldname, - const char *string) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - field_separator (uiout); - if (fldname) - fprintf_unfiltered (data->buffer, "%s=", fldname); - fprintf_unfiltered (data->buffer, "\""); - if (string) - fputstr_unfiltered (string, '"', data->buffer); - fprintf_unfiltered (data->buffer, "\""); -} - -/* This is the only field function that does not align */ - -void -mi_field_fmt (struct ui_out *uiout, int fldno, - int width, enum ui_align align, - const char *fldname, - const char *format, - va_list args) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_output) - return; - field_separator (uiout); - if (fldname) - fprintf_unfiltered (data->buffer, "%s=\"", fldname); - else - fputs_unfiltered ("\"", data->buffer); - vfprintf_unfiltered (data->buffer, format, args); - fputs_unfiltered ("\"", data->buffer); -} - -void -mi_spaces (struct ui_out *uiout, int numspaces) -{ -} - -void -mi_text (struct ui_out *uiout, const char *string) -{ -} - -void -mi_message (struct ui_out *uiout, int verbosity, - const char *format, - va_list args) -{ -} - -void -mi_wrap_hint (struct ui_out *uiout, char *identstring) -{ - wrap_here (identstring); -} - -void -mi_flush (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - gdb_flush (data->buffer); -} - -/* local functions */ - -/* access to ui_out format private members */ - -static void -field_separator (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - if (data->suppress_field_separator) - data->suppress_field_separator = 0; - else - fputc_unfiltered (',', data->buffer); -} - -static void -mi_open (struct ui_out *uiout, - const char *name, - enum ui_out_type type) -{ - mi_out_data *data = ui_out_data (uiout); - field_separator (uiout); - data->suppress_field_separator = 1; - if (name) - fprintf_unfiltered (data->buffer, "%s=", name); - switch (type) - { - case ui_out_type_tuple: - fputc_unfiltered ('{', data->buffer); - break; - case ui_out_type_list: - fputc_unfiltered ('[', data->buffer); - break; - default: - internal_error (__FILE__, __LINE__, _("bad switch")); - } -} - -static void -mi_close (struct ui_out *uiout, - enum ui_out_type type) -{ - mi_out_data *data = ui_out_data (uiout); - switch (type) - { - case ui_out_type_tuple: - fputc_unfiltered ('}', data->buffer); - break; - case ui_out_type_list: - fputc_unfiltered (']', data->buffer); - break; - default: - internal_error (__FILE__, __LINE__, _("bad switch")); - } - data->suppress_field_separator = 0; -} - -/* add a string to the buffer */ - -void -mi_out_buffered (struct ui_out *uiout, char *string) -{ - mi_out_data *data = ui_out_data (uiout); - fprintf_unfiltered (data->buffer, "%s", string); -} - -/* clear the buffer */ - -void -mi_out_rewind (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - ui_file_rewind (data->buffer); -} - -/* dump the buffer onto the specified stream */ - -static void -do_write (void *data, const char *buffer, long length_buffer) -{ - ui_file_write (data, buffer, length_buffer); -} - -void -mi_out_put (struct ui_out *uiout, - struct ui_file *stream) -{ - mi_out_data *data = ui_out_data (uiout); - ui_file_put (data->buffer, do_write, stream); - ui_file_rewind (data->buffer); -} - -/* Current MI version. */ - -int -mi_version (struct ui_out *uiout) -{ - mi_out_data *data = ui_out_data (uiout); - return data->mi_version; -} - -/* initalize private members at startup */ - -struct ui_out * -mi_out_new (int mi_version) -{ - int flags = 0; - mi_out_data *data = XMALLOC (mi_out_data); - data->suppress_field_separator = 0; - data->suppress_output = 0; - data->mi_version = mi_version; - /* FIXME: This code should be using a ``string_file'' and not the - TUI buffer hack. */ - data->buffer = mem_fileopen (); - return ui_out_new (&mi_ui_out_impl, data, flags); -} - -/* standard gdb initialization hook */ -void -_initialize_mi_out (void) -{ - /* nothing happens here */ -}
mi-out.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-console.h =================================================================== --- mi-console.h (revision 816) +++ mi-console.h (nonexistent) @@ -1,27 +0,0 @@ -/* MI Command Set - MI Console. - Copyright (C) 2000, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_CONSOLE_H -#define MI_CONSOLE_H - -extern struct ui_file *mi_console_file_new (struct ui_file *raw, - const char *prefix, - char quote); - -#endif
mi-console.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-getopt.h =================================================================== --- mi-getopt.h (revision 816) +++ mi-getopt.h (nonexistent) @@ -1,78 +0,0 @@ -/* MI Option Parser. - Copyright (C) 2000, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_GETOPT_H -#define MI_GETOPT_H - -/* Like getopt() but with simpler semantics. - - An option has the form ``-''. The special option ``--'' - denotes the end of the option list. An option can be followed by a - separate argument (on a per option basis). - - On entry OPTIND contains the index of the next element of ARGV that - needs parsing. OPTIND is updated to indicate the index of the next - argument before mi_getopt() returns. - - If ARGV[OPTIND] is an option, that options INDEX is returned. - OPTARG is set to the options argument or NULL. OPTIND is updated. - - If ARGV[OPTIND] is not an option, -1 is returned and OPTIND updated - to specify the non-option argument. OPTARG is set to NULL. - - mi_getopt() calls ``error("%s: Unknown option %c", prefix, - option)'' if an unknown option is encountered. */ - -struct mi_opt; -extern int mi_getopt (const char *prefix, int argc, char **argv, - struct mi_opt *opt, int *optind, char **optarg); - -/* The option list. Terminated by NAME==NULL. ARG_P that the option - requires an argument. INDEX is returned to identify th option. */ - -struct mi_opt - { - const char *name; - int index; - int arg_p; - }; - -struct mi_opt; - -/* mi_valid_noargs - - Determines if ARGC/ARGV are a valid set of parameters to satisfy - an MI function that is not supposed to recieve any arguments. - - An MI function that should not recieve arguments can still be - passed parameters after the special option '--' such as below. - - Example: The MI function -exec-run takes no args. - However, the client may pass '-exec-run -- -a ...' - See PR-783 - - PREFIX is passed to mi_getopt for an error message. - - This function Returns 1 if the parameter pair ARGC/ARGV are valid - for an MI function that takes no arguments. Otherwise, it returns 0 - and the appropriate error message is displayed by mi_getopt. */ - -extern int mi_valid_noargs (const char *prefix, int argc, char **argv); - -#endif
mi-getopt.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-parse.c =================================================================== --- mi-parse.c (revision 816) +++ mi-parse.c (nonexistent) @@ -1,265 +0,0 @@ -/* MI Command Set - MI parser. - - Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-cmds.h" -#include "mi-parse.h" - -#include -#include "gdb_string.h" - -static void -mi_parse_argv (char *args, struct mi_parse *parse) -{ - char *chp = args; - int argc = 0; - char **argv = xmalloc ((argc + 1) * sizeof (char *)); - argv[argc] = NULL; - while (1) - { - char *arg; - /* skip leading white space */ - while (isspace (*chp)) - chp++; - /* Three possibilities: EOF, quoted string, or other text. */ - switch (*chp) - { - case '\0': - parse->argv = argv; - parse->argc = argc; - return; - case '"': - { - /* A quoted string. */ - int len; - char *start = chp + 1; - /* Determine the buffer size. */ - chp = start; - len = 0; - while (*chp != '\0' && *chp != '"') - { - if (*chp == '\\') - { - chp++; - if (parse_escape (&chp) <= 0) - { - /* Do not allow split lines or "\000" */ - freeargv (argv); - return; - } - } - else - chp++; - len++; - } - /* Insist on a closing quote. */ - if (*chp != '"') - { - freeargv (argv); - return; - } - /* Insist on trailing white space. */ - if (chp[1] != '\0' && !isspace (chp[1])) - { - freeargv (argv); - return; - } - /* create the buffer. */ - arg = xmalloc ((len + 1) * sizeof (char)); - /* And copy the characters in. */ - chp = start; - len = 0; - while (*chp != '\0' && *chp != '"') - { - if (*chp == '\\') - { - chp++; - arg[len] = parse_escape (&chp); - } - else - arg[len] = *chp++; - len++; - } - arg[len] = '\0'; - chp++; /* that closing quote. */ - break; - } - default: - { - /* An unquoted string. Accumulate all non blank - characters into a buffer. */ - int len; - char *start = chp; - while (*chp != '\0' && !isspace (*chp)) - { - chp++; - } - len = chp - start; - arg = xmalloc ((len + 1) * sizeof (char)); - strncpy (arg, start, len); - arg[len] = '\0'; - break; - } - } - /* Append arg to argv. */ - argv = xrealloc (argv, (argc + 2) * sizeof (char *)); - argv[argc++] = arg; - argv[argc] = NULL; - } -} - - -void -mi_parse_free (struct mi_parse *parse) -{ - if (parse == NULL) - return; - if (parse->command != NULL) - xfree (parse->command); - if (parse->token != NULL) - xfree (parse->token); - if (parse->args != NULL) - xfree (parse->args); - if (parse->argv != NULL) - freeargv (parse->argv); - xfree (parse); -} - - -struct mi_parse * -mi_parse (char *cmd) -{ - char *chp; - struct mi_parse *parse = XMALLOC (struct mi_parse); - memset (parse, 0, sizeof (*parse)); - parse->thread = -1; - parse->frame = -1; - - /* Before starting, skip leading white space. */ - while (isspace (*cmd)) - cmd++; - - /* Find/skip any token and then extract it. */ - for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++) - ; - parse->token = xmalloc ((chp - cmd + 1) * sizeof (char *)); - memcpy (parse->token, cmd, (chp - cmd)); - parse->token[chp - cmd] = '\0'; - - /* This wasn't a real MI command. Return it as a CLI_COMMAND. */ - if (*chp != '-') - { - while (isspace (*chp)) - chp++; - parse->command = xstrdup (chp); - parse->op = CLI_COMMAND; - return parse; - } - - /* Extract the command. */ - { - char *tmp = chp + 1; /* discard ``-'' */ - for (; *chp && !isspace (*chp); chp++) - ; - parse->command = xmalloc ((chp - tmp + 1) * sizeof (char *)); - memcpy (parse->command, tmp, chp - tmp); - parse->command[chp - tmp] = '\0'; - } - - /* Find the command in the MI table. */ - parse->cmd = mi_lookup (parse->command); - if (parse->cmd == NULL) - { - /* FIXME: This should be a function call. */ - fprintf_unfiltered - (raw_stdout, - "%s^error,msg=\"Undefined MI command: %s\"\n", - parse->token, parse->command); - mi_parse_free (parse); - return NULL; - } - - /* Skip white space following the command. */ - while (isspace (*chp)) - chp++; - - /* Parse the --thread and --frame options, if present. At present, - some important commands, like '-break-*' are implemented by forwarding - to the CLI layer directly. We want to parse --thread and --frame - here, so as not to leave those option in the string that will be passed - to CLI. */ - for (;;) - { - char *start = chp; - size_t ts = sizeof ("--thread ") - 1; - size_t fs = sizeof ("--frame ") - 1; - if (strncmp (chp, "--thread ", ts) == 0) - { - if (parse->thread != -1) - error ("Duplicate '--thread' option"); - chp += ts; - parse->thread = strtol (chp, &chp, 10); - } - else if (strncmp (chp, "--frame ", fs) == 0) - { - if (parse->frame != -1) - error ("Duplicate '--frame' option"); - chp += fs; - parse->frame = strtol (chp, &chp, 10); - } - else - break; - - if (*chp != '\0' && !isspace (*chp)) - error ("Invalid value for the '%s' option", - start[2] == 't' ? "--thread" : "--frame"); - while (isspace (*chp)) - chp++; - } - - /* For new argv commands, attempt to return the parsed argument - list. */ - if (parse->cmd->argv_func != NULL) - { - mi_parse_argv (chp, parse); - if (parse->argv == NULL) - { - /* FIXME: This should be a function call. */ - fprintf_unfiltered - (raw_stdout, - "%s^error,msg=\"Problem parsing arguments: %s %s\"\n", - parse->token, parse->command, chp); - mi_parse_free (parse); - return NULL; - } - } - - /* FIXME: DELETE THIS */ - /* For CLI commands, also return the remainder of the - command line as a single string. */ - if (parse->cmd->cli.cmd != NULL) - parse->args = xstrdup (chp); - - /* Fully parsed. */ - parse->op = MI_COMMAND; - return parse; -}
mi-parse.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-out.h =================================================================== --- mi-out.h (revision 816) +++ mi-out.h (nonexistent) @@ -1,34 +0,0 @@ -/* MI Command Set - MI output generating routines for GDB. - Copyright (C) 2000, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_OUT_H -#define MI_OUT_H 1 - -struct ui_out; -struct ui_file; - -extern struct ui_out *mi_out_new (int mi_version); -extern void mi_out_put (struct ui_out *uiout, struct ui_file *stream); -extern void mi_out_rewind (struct ui_out *uiout); -extern void mi_out_buffered (struct ui_out *uiout, char *string); - -/* Return the version number of the current MI. */ -extern int mi_version (struct ui_out *uiout); - -#endif /* MI_OUT_H */
mi-out.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-parse.h =================================================================== --- mi-parse.h (revision 816) +++ mi-parse.h (nonexistent) @@ -1,65 +0,0 @@ -/* MI Command Set - MI Command Parser. - Copyright (C) 2000, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_PARSE_H -#define MI_PARSE_H - -#include - -/* MI parser */ - -/* Timestamps for current command and last asynchronous command. */ -struct mi_timestamp { - struct timeval wallclock; - struct timeval utime; - struct timeval stime; -}; - -enum mi_command_type - { - MI_COMMAND, CLI_COMMAND - }; - -struct mi_parse - { - enum mi_command_type op; - char *command; - char *token; - const struct mi_cmd *cmd; - struct mi_timestamp *cmd_start; - char *args; - char **argv; - int argc; - int thread; - int frame; - }; - -/* Attempts to parse CMD returning a ``struct mi_command''. If CMD is - invalid, an error mesage is reported (MI format) and NULL is - returned. For a CLI_COMMAND, COMMAND, TOKEN and OP are initialized. - For an MI_COMMAND COMMAND, TOKEN, ARGS and OP are - initialized. Un-initialized fields are zero. */ - -extern struct mi_parse *mi_parse (char *cmd); - -/* Free a command returned by mi_parse_command. */ - -extern void mi_parse_free (struct mi_parse *cmd); - -#endif
mi-parse.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-file.c =================================================================== --- mi-cmd-file.c (revision 816) +++ mi-cmd-file.c (nonexistent) @@ -1,115 +0,0 @@ -/* MI Command Set - breakpoint and watchpoint commands. - Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-cmds.h" -#include "mi-getopt.h" -#include "ui-out.h" -#include "symtab.h" -#include "source.h" -#include "objfiles.h" - -/* Return to the client the absolute path and line number of the - current file being executed. */ - -void -mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) -{ - struct symtab_and_line st; - int optind = 0; - char *optarg; - - if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_file", argc, argv)) - error (_("mi_cmd_file_list_exec_source_file: Usage: No args")); - - /* Set the default file and line, also get them */ - set_default_source_symtab_and_line (); - st = get_current_source_symtab_and_line (); - - /* We should always get a symtab. - Apparently, filename does not need to be tested for NULL. - The documentation in symtab.h suggests it will always be correct */ - if (!st.symtab) - error (_("mi_cmd_file_list_exec_source_file: No symtab")); - - /* Extract the fullname if it is not known yet */ - symtab_to_fullname (st.symtab); - - /* Print to the user the line, filename and fullname */ - ui_out_field_int (uiout, "line", st.line); - ui_out_field_string (uiout, "file", st.symtab->filename); - - /* We may not be able to open the file (not available). */ - if (st.symtab->fullname) - ui_out_field_string (uiout, "fullname", st.symtab->fullname); - - ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0); -} - -void -mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) -{ - struct symtab *s; - struct partial_symtab *ps; - struct objfile *objfile; - - if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_files", argc, argv)) - error (_("mi_cmd_file_list_exec_source_files: Usage: No args")); - - /* Print the table header */ - ui_out_begin (uiout, ui_out_type_list, "files"); - - /* Look at all of the symtabs */ - ALL_SYMTABS (objfile, s) - { - ui_out_begin (uiout, ui_out_type_tuple, NULL); - - ui_out_field_string (uiout, "file", s->filename); - - /* Extract the fullname if it is not known yet */ - symtab_to_fullname (s); - - if (s->fullname) - ui_out_field_string (uiout, "fullname", s->fullname); - - ui_out_end (uiout, ui_out_type_tuple); - } - - /* Look at all of the psymtabs */ - ALL_PSYMTABS (objfile, ps) - { - if (!ps->readin) - { - ui_out_begin (uiout, ui_out_type_tuple, NULL); - - ui_out_field_string (uiout, "file", ps->filename); - - /* Extract the fullname if it is not known yet */ - psymtab_to_fullname (ps); - - if (ps->fullname) - ui_out_field_string (uiout, "fullname", ps->fullname); - - ui_out_end (uiout, ui_out_type_tuple); - } - } - - ui_out_end (uiout, ui_out_type_list); -}
mi-cmd-file.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-main.c =================================================================== --- mi-main.c (revision 816) +++ mi-main.c (nonexistent) @@ -1,1935 +0,0 @@ -/* MI Command Set. - - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* Work in progress. */ - -#include "defs.h" -#include "arch-utils.h" -#include "target.h" -#include "inferior.h" -#include "gdb_string.h" -#include "exceptions.h" -#include "top.h" -#include "gdbthread.h" -#include "mi-cmds.h" -#include "mi-parse.h" -#include "mi-getopt.h" -#include "mi-console.h" -#include "ui-out.h" -#include "mi-out.h" -#include "interps.h" -#include "event-loop.h" -#include "event-top.h" -#include "gdbcore.h" /* For write_memory(). */ -#include "value.h" -#include "regcache.h" -#include "gdb.h" -#include "frame.h" -#include "mi-main.h" -#include "mi-common.h" -#include "language.h" -#include "valprint.h" -#include "inferior.h" -#include "osdata.h" -#include "splay-tree.h" - -#include -#include - -#if defined HAVE_SYS_RESOURCE_H -#include -#endif - -#ifdef HAVE_GETRUSAGE -struct rusage rusage; -#endif - -enum - { - FROM_TTY = 0 - }; - -int mi_debug_p; -struct ui_file *raw_stdout; - -/* This is used to pass the current command timestamp - down to continuation routines. */ -static struct mi_timestamp *current_command_ts; - -static int do_timings = 0; - -char *current_token; -int running_result_record_printed = 1; - -/* Flag indicating that the target has proceeded since the last - command was issued. */ -int mi_proceeded; - -extern void _initialize_mi_main (void); -static void mi_cmd_execute (struct mi_parse *parse); - -static void mi_execute_cli_command (const char *cmd, int args_p, - const char *args); -static void mi_execute_async_cli_command (char *cli_command, - char **argv, int argc); -static int register_changed_p (int regnum, struct regcache *, - struct regcache *); -static void get_register (struct frame_info *, int regnum, int format); - -/* Command implementations. FIXME: Is this libgdb? No. This is the MI - layer that calls libgdb. Any operation used in the below should be - formalized. */ - -static void timestamp (struct mi_timestamp *tv); - -static void print_diff_now (struct mi_timestamp *start); -static void print_diff (struct mi_timestamp *start, struct mi_timestamp *end); - -void -mi_cmd_gdb_exit (char *command, char **argv, int argc) -{ - /* We have to print everything right here because we never return. */ - if (current_token) - fputs_unfiltered (current_token, raw_stdout); - fputs_unfiltered ("^exit\n", raw_stdout); - mi_out_put (uiout, raw_stdout); - gdb_flush (raw_stdout); - /* FIXME: The function called is not yet a formal libgdb function. */ - quit_force (NULL, FROM_TTY); -} - -void -mi_cmd_exec_next (char *command, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - mi_execute_async_cli_command ("reverse-next", argv + 1, argc - 1); - else - mi_execute_async_cli_command ("next", argv, argc); -} - -void -mi_cmd_exec_next_instruction (char *command, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - mi_execute_async_cli_command ("reverse-nexti", argv + 1, argc - 1); - else - mi_execute_async_cli_command ("nexti", argv, argc); -} - -void -mi_cmd_exec_step (char *command, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - mi_execute_async_cli_command ("reverse-step", argv + 1, argc - 1); - else - mi_execute_async_cli_command ("step", argv, argc); -} - -void -mi_cmd_exec_step_instruction (char *command, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - mi_execute_async_cli_command ("reverse-stepi", argv + 1, argc - 1); - else - mi_execute_async_cli_command ("stepi", argv, argc); -} - -void -mi_cmd_exec_finish (char *command, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - mi_execute_async_cli_command ("reverse-finish", argv + 1, argc - 1); - else - mi_execute_async_cli_command ("finish", argv, argc); -} - -void -mi_cmd_exec_return (char *command, char **argv, int argc) -{ - /* This command doesn't really execute the target, it just pops the - specified number of frames. */ - if (argc) - /* Call return_command with from_tty argument equal to 0 so as to - avoid being queried. */ - return_command (*argv, 0); - else - /* Call return_command with from_tty argument equal to 0 so as to - avoid being queried. */ - return_command (NULL, 0); - - /* Because we have called return_command with from_tty = 0, we need - to print the frame here. */ - print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS); -} - -void -mi_cmd_exec_jump (char *args, char **argv, int argc) -{ - /* FIXME: Should call a libgdb function, not a cli wrapper. */ - mi_execute_async_cli_command ("jump", argv, argc); -} - -static int -proceed_thread_callback (struct thread_info *thread, void *arg) -{ - int pid = *(int *)arg; - - if (!is_stopped (thread->ptid)) - return 0; - - if (PIDGET (thread->ptid) != pid) - return 0; - - switch_to_thread (thread->ptid); - clear_proceed_status (); - proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); - return 0; -} - -static void -exec_continue (char **argv, int argc) -{ - if (argc == 0) - continue_1 (0); - else if (argc == 1 && strcmp (argv[0], "--all") == 0) - continue_1 (1); - else if (argc == 2 && strcmp (argv[0], "--thread-group") == 0) - { - struct cleanup *old_chain; - int pid; - if (argv[1] == NULL || argv[1] == '\0') - error ("Thread group id not specified"); - pid = atoi (argv[1]); - if (!in_inferior_list (pid)) - error ("Invalid thread group id '%s'", argv[1]); - - old_chain = make_cleanup_restore_current_thread (); - iterate_over_threads (proceed_thread_callback, &pid); - do_cleanups (old_chain); - } - else - error ("Usage: -exec-continue [--reverse] [--all|--thread-group id]"); -} - -/* continue in reverse direction: - XXX: code duplicated from reverse.c */ - -static void -exec_direction_default (void *notused) -{ - /* Return execution direction to default state. */ - execution_direction = EXEC_FORWARD; -} - -static void -exec_reverse_continue (char **argv, int argc) -{ - enum exec_direction_kind dir = execution_direction; - struct cleanup *old_chain; - - if (dir == EXEC_ERROR) - error (_("Target %s does not support this command."), target_shortname); - - if (dir == EXEC_REVERSE) - error (_("Already in reverse mode.")); - - if (!target_can_execute_reverse) - error (_("Target %s does not support this command."), target_shortname); - - old_chain = make_cleanup (exec_direction_default, NULL); - execution_direction = EXEC_REVERSE; - exec_continue (argv, argc); - do_cleanups (old_chain); -} - -void -mi_cmd_exec_continue (char *command, char **argv, int argc) -{ - if (argc > 0 && strcmp(argv[0], "--reverse") == 0) - exec_reverse_continue (argv + 1, argc - 1); - else - exec_continue (argv, argc); -} - -static int -interrupt_thread_callback (struct thread_info *thread, void *arg) -{ - int pid = *(int *)arg; - - if (!is_running (thread->ptid)) - return 0; - - if (PIDGET (thread->ptid) != pid) - return 0; - - target_stop (thread->ptid); - return 0; -} - -/* Interrupt the execution of the target. Note how we must play around - with the token variables, in order to display the current token in - the result of the interrupt command, and the previous execution - token when the target finally stops. See comments in - mi_cmd_execute. */ -void -mi_cmd_exec_interrupt (char *command, char **argv, int argc) -{ - if (argc == 0) - { - if (!is_running (inferior_ptid)) - error ("Current thread is not running."); - - interrupt_target_1 (0); - } - else if (argc == 1 && strcmp (argv[0], "--all") == 0) - { - if (!any_running ()) - error ("Inferior not running."); - - interrupt_target_1 (1); - } - else if (argc == 2 && strcmp (argv[0], "--thread-group") == 0) - { - struct cleanup *old_chain; - int pid; - if (argv[1] == NULL || argv[1] == '\0') - error ("Thread group id not specified"); - pid = atoi (argv[1]); - if (!in_inferior_list (pid)) - error ("Invalid thread group id '%s'", argv[1]); - - old_chain = make_cleanup_restore_current_thread (); - iterate_over_threads (interrupt_thread_callback, &pid); - do_cleanups (old_chain); - } - else - error ("Usage: -exec-interrupt [--all|--thread-group id]"); -} - -static int -find_thread_of_process (struct thread_info *ti, void *p) -{ - int pid = *(int *)p; - if (PIDGET (ti->ptid) == pid && !is_exited (ti->ptid)) - return 1; - - return 0; -} - -void -mi_cmd_target_detach (char *command, char **argv, int argc) -{ - if (argc != 0 && argc != 1) - error ("Usage: -target-detach [thread-group]"); - - if (argc == 1) - { - struct thread_info *tp; - char *end = argv[0]; - int pid = strtol (argv[0], &end, 10); - if (*end != '\0') - error (_("Cannot parse thread group id '%s'"), argv[0]); - - /* Pick any thread in the desired process. Current - target_detach deteches from the parent of inferior_ptid. */ - tp = iterate_over_threads (find_thread_of_process, &pid); - if (!tp) - error (_("Thread group is empty")); - - switch_to_thread (tp->ptid); - } - - detach_command (NULL, 0); -} - -void -mi_cmd_thread_select (char *command, char **argv, int argc) -{ - enum gdb_rc rc; - char *mi_error_message; - - if (argc != 1) - error ("mi_cmd_thread_select: USAGE: threadnum."); - - rc = gdb_thread_select (uiout, argv[0], &mi_error_message); - - if (rc == GDB_RC_FAIL) - { - make_cleanup (xfree, mi_error_message); - error ("%s", mi_error_message); - } -} - -void -mi_cmd_thread_list_ids (char *command, char **argv, int argc) -{ - enum gdb_rc rc; - char *mi_error_message; - - if (argc != 0) - error ("mi_cmd_thread_list_ids: No arguments required."); - - rc = gdb_list_thread_ids (uiout, &mi_error_message); - - if (rc == GDB_RC_FAIL) - { - make_cleanup (xfree, mi_error_message); - error ("%s", mi_error_message); - } -} - -void -mi_cmd_thread_info (char *command, char **argv, int argc) -{ - int thread = -1; - - if (argc != 0 && argc != 1) - error ("Invalid MI command"); - - if (argc == 1) - thread = atoi (argv[0]); - - print_thread_info (uiout, thread, -1); -} - -struct collect_cores_data -{ - int pid; - - VEC (int) *cores; -}; - -static int -collect_cores (struct thread_info *ti, void *xdata) -{ - struct collect_cores_data *data = xdata; - - if (ptid_get_pid (ti->ptid) == data->pid) - { - int core = target_core_of_thread (ti->ptid); - if (core != -1) - VEC_safe_push (int, data->cores, core); - } - - return 0; -} - -static int * -unique (int *b, int *e) -{ - int *d = b; - while (++b != e) - if (*d != *b) - *++d = *b; - return ++d; -} - -struct print_one_inferior_data -{ - int recurse; - VEC (int) *inferiors; -}; - -static int -print_one_inferior (struct inferior *inferior, void *xdata) -{ - struct print_one_inferior_data *top_data = xdata; - - if (VEC_empty (int, top_data->inferiors) - || bsearch (&(inferior->pid), VEC_address (int, top_data->inferiors), - VEC_length (int, top_data->inferiors), sizeof (int), - compare_positive_ints)) - { - struct collect_cores_data data; - struct cleanup *back_to - = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - - ui_out_field_fmt (uiout, "id", "%d", inferior->pid); - ui_out_field_string (uiout, "type", "process"); - ui_out_field_int (uiout, "pid", inferior->pid); - - data.pid = inferior->pid; - data.cores = 0; - iterate_over_threads (collect_cores, &data); - - if (!VEC_empty (int, data.cores)) - { - int elt; - int i; - int *b, *e; - struct cleanup *back_to_2 = - make_cleanup_ui_out_list_begin_end (uiout, "cores"); - - qsort (VEC_address (int, data.cores), - VEC_length (int, data.cores), sizeof (int), - compare_positive_ints); - - b = VEC_address (int, data.cores); - e = b + VEC_length (int, data.cores); - e = unique (b, e); - - for (; b != e; ++b) - ui_out_field_int (uiout, NULL, *b); - - do_cleanups (back_to_2); - } - - if (top_data->recurse) - print_thread_info (uiout, -1, inferior->pid); - - do_cleanups (back_to); - } - - return 0; -} - -/* Output a field named 'cores' with a list as the value. The elements of - the list are obtained by splitting 'cores' on comma. */ - -static void -output_cores (struct ui_out *uiout, const char *field_name, const char *xcores) -{ - struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (uiout, - field_name); - char *cores = xstrdup (xcores); - char *p = cores; - - make_cleanup (xfree, cores); - - for (p = strtok (p, ","); p; p = strtok (NULL, ",")) - ui_out_field_string (uiout, NULL, p); - - do_cleanups (back_to); -} - -static void -free_vector_of_ints (void *xvector) -{ - VEC (int) **vector = xvector; - VEC_free (int, *vector); -} - -static void -do_nothing (splay_tree_key k) -{ -} - -static void -free_vector_of_osdata_items (splay_tree_value xvalue) -{ - VEC (osdata_item_s) *value = (VEC (osdata_item_s) *) xvalue; - /* We don't free the items itself, it will be done separately. */ - VEC_free (osdata_item_s, value); -} - -static int -splay_tree_int_comparator (splay_tree_key xa, splay_tree_key xb) -{ - int a = xa; - int b = xb; - return a - b; -} - -static void -free_splay_tree (void *xt) -{ - splay_tree t = xt; - splay_tree_delete (t); -} - -static void -list_available_thread_groups (VEC (int) *ids, int recurse) -{ - struct osdata *data; - struct osdata_item *item; - int ix_items; - /* This keeps a map from integer (pid) to VEC (struct osdata_item *)* - The vector contains information about all threads for the given pid. - This is assigned an initial value to avoid "may be used uninitialized" - warning from gcc. */ - splay_tree tree = NULL; - - /* get_osdata will throw if it cannot return data. */ - data = get_osdata ("processes"); - make_cleanup_osdata_free (data); - - if (recurse) - { - struct osdata *threads = get_osdata ("threads"); - make_cleanup_osdata_free (threads); - - tree = splay_tree_new (splay_tree_int_comparator, - do_nothing, - free_vector_of_osdata_items); - make_cleanup (free_splay_tree, tree); - - for (ix_items = 0; - VEC_iterate (osdata_item_s, threads->items, - ix_items, item); - ix_items++) - { - const char *pid = get_osdata_column (item, "pid"); - int pid_i = strtoul (pid, NULL, 0); - VEC (osdata_item_s) *vec = 0; - - splay_tree_node n = splay_tree_lookup (tree, pid_i); - if (!n) - { - VEC_safe_push (osdata_item_s, vec, item); - splay_tree_insert (tree, pid_i, (splay_tree_value)vec); - } - else - { - vec = (VEC (osdata_item_s) *) n->value; - VEC_safe_push (osdata_item_s, vec, item); - n->value = (splay_tree_value) vec; - } - } - } - - make_cleanup_ui_out_list_begin_end (uiout, "groups"); - - for (ix_items = 0; - VEC_iterate (osdata_item_s, data->items, - ix_items, item); - ix_items++) - { - struct cleanup *back_to; - - const char *pid = get_osdata_column (item, "pid"); - const char *cmd = get_osdata_column (item, "command"); - const char *user = get_osdata_column (item, "user"); - const char *cores = get_osdata_column (item, "cores"); - - int pid_i = strtoul (pid, NULL, 0); - - /* At present, the target will return all available processes - and if information about specific ones was required, we filter - undesired processes here. */ - if (ids && bsearch (&pid_i, VEC_address (int, ids), - VEC_length (int, ids), - sizeof (int), compare_positive_ints) == NULL) - continue; - - - back_to = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - - ui_out_field_fmt (uiout, "id", "%s", pid); - ui_out_field_string (uiout, "type", "process"); - if (cmd) - ui_out_field_string (uiout, "description", cmd); - if (user) - ui_out_field_string (uiout, "user", user); - if (cores) - output_cores (uiout, "cores", cores); - - if (recurse) - { - splay_tree_node n = splay_tree_lookup (tree, pid_i); - if (n) - { - VEC (osdata_item_s) *children = (VEC (osdata_item_s) *) n->value; - struct osdata_item *child; - int ix_child; - - make_cleanup_ui_out_list_begin_end (uiout, "threads"); - - for (ix_child = 0; - VEC_iterate (osdata_item_s, children, ix_child, child); - ++ix_child) - { - struct cleanup *back_to_2 = - make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - - const char *tid = get_osdata_column (child, "tid"); - const char *tcore = get_osdata_column (child, "core"); - ui_out_field_string (uiout, "id", tid); - if (tcore) - ui_out_field_string (uiout, "core", tcore); - - do_cleanups (back_to_2); - } - } - } - - do_cleanups (back_to); - } -} - -void -mi_cmd_list_thread_groups (char *command, char **argv, int argc) -{ - struct cleanup *back_to; - int available = 0; - int recurse = 0; - VEC (int) *ids = 0; - - enum opt - { - AVAILABLE_OPT, RECURSE_OPT - }; - static struct mi_opt opts[] = - { - {"-available", AVAILABLE_OPT, 0}, - {"-recurse", RECURSE_OPT, 1}, - { 0, 0, 0 } - }; - - int optind = 0; - char *optarg; - - while (1) - { - int opt = mi_getopt ("-list-thread-groups", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case AVAILABLE_OPT: - available = 1; - break; - case RECURSE_OPT: - if (strcmp (optarg, "0") == 0) - ; - else if (strcmp (optarg, "1") == 0) - recurse = 1; - else - error ("only '0' and '1' are valid values for the '--recurse' option"); - break; - } - } - - for (; optind < argc; ++optind) - { - char *end; - int inf = strtoul (argv[optind], &end, 0); - if (*end != '\0') - error ("invalid group id '%s'", argv[optind]); - VEC_safe_push (int, ids, inf); - } - if (VEC_length (int, ids) > 1) - qsort (VEC_address (int, ids), - VEC_length (int, ids), - sizeof (int), compare_positive_ints); - - back_to = make_cleanup (free_vector_of_ints, &ids); - - if (available) - { - list_available_thread_groups (ids, recurse); - } - else if (VEC_length (int, ids) == 1) - { - /* Local thread groups, single id. */ - int pid = *VEC_address (int, ids); - if (!in_inferior_list (pid)) - error ("Invalid thread group id '%d'", pid); - print_thread_info (uiout, -1, pid); - } - else - { - struct print_one_inferior_data data; - data.recurse = recurse; - data.inferiors = ids; - - /* Local thread groups. Either no explicit ids -- and we - print everything, or several explicit ids. In both cases, - we print more than one group, and have to use 'groups' - as the top-level element. */ - make_cleanup_ui_out_list_begin_end (uiout, "groups"); - update_thread_list (); - iterate_over_inferiors (print_one_inferior, &data); - } - - do_cleanups (back_to); -} - -void -mi_cmd_data_list_register_names (char *command, char **argv, int argc) -{ - struct gdbarch *gdbarch; - int regnum, numregs; - int i; - struct cleanup *cleanup; - - /* Note that the test for a valid register must include checking the - gdbarch_register_name because gdbarch_num_regs may be allocated for - the union of the register sets within a family of related processors. - In this case, some entries of gdbarch_register_name will change depending - upon the particular processor being debugged. */ - - gdbarch = get_current_arch (); - numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - - cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-names"); - - if (argc == 0) /* No args, just do all the regs. */ - { - for (regnum = 0; - regnum < numregs; - regnum++) - { - if (gdbarch_register_name (gdbarch, regnum) == NULL - || *(gdbarch_register_name (gdbarch, regnum)) == '\0') - ui_out_field_string (uiout, NULL, ""); - else - ui_out_field_string (uiout, NULL, - gdbarch_register_name (gdbarch, regnum)); - } - } - - /* Else, list of register #s, just do listed regs. */ - for (i = 0; i < argc; i++) - { - regnum = atoi (argv[i]); - if (regnum < 0 || regnum >= numregs) - error ("bad register number"); - - if (gdbarch_register_name (gdbarch, regnum) == NULL - || *(gdbarch_register_name (gdbarch, regnum)) == '\0') - ui_out_field_string (uiout, NULL, ""); - else - ui_out_field_string (uiout, NULL, - gdbarch_register_name (gdbarch, regnum)); - } - do_cleanups (cleanup); -} - -void -mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) -{ - static struct regcache *this_regs = NULL; - struct regcache *prev_regs; - struct gdbarch *gdbarch; - int regnum, numregs, changed; - int i; - struct cleanup *cleanup; - - /* The last time we visited this function, the current frame's register - contents were saved in THIS_REGS. Move THIS_REGS over to PREV_REGS, - and refresh THIS_REGS with the now-current register contents. */ - - prev_regs = this_regs; - this_regs = frame_save_as_regcache (get_selected_frame (NULL)); - cleanup = make_cleanup_regcache_xfree (prev_regs); - - /* Note that the test for a valid register must include checking the - gdbarch_register_name because gdbarch_num_regs may be allocated for - the union of the register sets within a family of related processors. - In this case, some entries of gdbarch_register_name will change depending - upon the particular processor being debugged. */ - - gdbarch = get_regcache_arch (this_regs); - numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - - make_cleanup_ui_out_list_begin_end (uiout, "changed-registers"); - - if (argc == 0) /* No args, just do all the regs. */ - { - for (regnum = 0; - regnum < numregs; - regnum++) - { - if (gdbarch_register_name (gdbarch, regnum) == NULL - || *(gdbarch_register_name (gdbarch, regnum)) == '\0') - continue; - changed = register_changed_p (regnum, prev_regs, this_regs); - if (changed < 0) - error ("mi_cmd_data_list_changed_registers: Unable to read register contents."); - else if (changed) - ui_out_field_int (uiout, NULL, regnum); - } - } - - /* Else, list of register #s, just do listed regs. */ - for (i = 0; i < argc; i++) - { - regnum = atoi (argv[i]); - - if (regnum >= 0 - && regnum < numregs - && gdbarch_register_name (gdbarch, regnum) != NULL - && *gdbarch_register_name (gdbarch, regnum) != '\000') - { - changed = register_changed_p (regnum, prev_regs, this_regs); - if (changed < 0) - error ("mi_cmd_data_list_register_change: Unable to read register contents."); - else if (changed) - ui_out_field_int (uiout, NULL, regnum); - } - else - error ("bad register number"); - } - do_cleanups (cleanup); -} - -static int -register_changed_p (int regnum, struct regcache *prev_regs, - struct regcache *this_regs) -{ - struct gdbarch *gdbarch = get_regcache_arch (this_regs); - gdb_byte prev_buffer[MAX_REGISTER_SIZE]; - gdb_byte this_buffer[MAX_REGISTER_SIZE]; - - /* Registers not valid in this frame return count as unchanged. */ - if (!regcache_valid_p (this_regs, regnum)) - return 0; - - /* First time through or after gdbarch change consider all registers as - changed. Same for registers not valid in the previous frame. */ - if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch - || !regcache_valid_p (prev_regs, regnum)) - return 1; - - /* Get register contents and compare. */ - regcache_cooked_read (prev_regs, regnum, prev_buffer); - regcache_cooked_read (this_regs, regnum, this_buffer); - - return memcmp (prev_buffer, this_buffer, - register_size (gdbarch, regnum)) != 0; -} - -/* Return a list of register number and value pairs. The valid - arguments expected are: a letter indicating the format in which to - display the registers contents. This can be one of: x (hexadecimal), d - (decimal), N (natural), t (binary), o (octal), r (raw). After the - format argumetn there can be a sequence of numbers, indicating which - registers to fetch the content of. If the format is the only argument, - a list of all the registers with their values is returned. */ -void -mi_cmd_data_list_register_values (char *command, char **argv, int argc) -{ - struct frame_info *frame; - struct gdbarch *gdbarch; - int regnum, numregs, format; - int i; - struct cleanup *list_cleanup, *tuple_cleanup; - - /* Note that the test for a valid register must include checking the - gdbarch_register_name because gdbarch_num_regs may be allocated for - the union of the register sets within a family of related processors. - In this case, some entries of gdbarch_register_name will change depending - upon the particular processor being debugged. */ - - if (argc == 0) - error ("mi_cmd_data_list_register_values: Usage: -data-list-register-values [...]"); - - format = (int) argv[0][0]; - - frame = get_selected_frame (NULL); - gdbarch = get_frame_arch (frame); - numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - - list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values"); - - if (argc == 1) /* No args, beside the format: do all the regs. */ - { - for (regnum = 0; - regnum < numregs; - regnum++) - { - if (gdbarch_register_name (gdbarch, regnum) == NULL - || *(gdbarch_register_name (gdbarch, regnum)) == '\0') - continue; - tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - get_register (frame, regnum, format); - do_cleanups (tuple_cleanup); - } - } - - /* Else, list of register #s, just do listed regs. */ - for (i = 1; i < argc; i++) - { - regnum = atoi (argv[i]); - - if (regnum >= 0 - && regnum < numregs - && gdbarch_register_name (gdbarch, regnum) != NULL - && *gdbarch_register_name (gdbarch, regnum) != '\000') - { - tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - get_register (frame, regnum, format); - do_cleanups (tuple_cleanup); - } - else - error ("bad register number"); - } - do_cleanups (list_cleanup); -} - -/* Output one register's contents in the desired format. */ -static void -get_register (struct frame_info *frame, int regnum, int format) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - gdb_byte buffer[MAX_REGISTER_SIZE]; - int optim; - int realnum; - CORE_ADDR addr; - enum lval_type lval; - static struct ui_stream *stb = NULL; - - stb = ui_out_stream_new (uiout); - - if (format == 'N') - format = 0; - - frame_register (frame, regnum, &optim, &lval, &addr, &realnum, buffer); - - if (optim) - error ("Optimized out"); - - if (format == 'r') - { - int j; - char *ptr, buf[1024]; - - strcpy (buf, "0x"); - ptr = buf + 2; - for (j = 0; j < register_size (gdbarch, regnum); j++) - { - int idx = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? - j : register_size (gdbarch, regnum) - 1 - j; - sprintf (ptr, "%02x", (unsigned char) buffer[idx]); - ptr += 2; - } - ui_out_field_string (uiout, "value", buf); - /*fputs_filtered (buf, gdb_stdout); */ - } - else - { - struct value_print_options opts; - get_formatted_print_options (&opts, format); - opts.deref_ref = 1; - val_print (register_type (gdbarch, regnum), buffer, 0, 0, - stb->stream, 0, &opts, current_language); - ui_out_field_stream (uiout, "value", stb); - ui_out_stream_delete (stb); - } -} - -/* Write given values into registers. The registers and values are - given as pairs. The corresponding MI command is - -data-write-register-values [ ... ]*/ -void -mi_cmd_data_write_register_values (char *command, char **argv, int argc) -{ - struct regcache *regcache; - struct gdbarch *gdbarch; - int numregs, i; - char format; - - /* Note that the test for a valid register must include checking the - gdbarch_register_name because gdbarch_num_regs may be allocated for - the union of the register sets within a family of related processors. - In this case, some entries of gdbarch_register_name will change depending - upon the particular processor being debugged. */ - - regcache = get_current_regcache (); - gdbarch = get_regcache_arch (regcache); - numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - - if (argc == 0) - error ("mi_cmd_data_write_register_values: Usage: -data-write-register-values [ ... ]"); - - format = (int) argv[0][0]; - - if (!target_has_registers) - error ("mi_cmd_data_write_register_values: No registers."); - - if (!(argc - 1)) - error ("mi_cmd_data_write_register_values: No regs and values specified."); - - if ((argc - 1) % 2) - error ("mi_cmd_data_write_register_values: Regs and vals are not in pairs."); - - for (i = 1; i < argc; i = i + 2) - { - int regnum = atoi (argv[i]); - - if (regnum >= 0 && regnum < numregs - && gdbarch_register_name (gdbarch, regnum) - && *gdbarch_register_name (gdbarch, regnum)) - { - LONGEST value; - - /* Get the value as a number. */ - value = parse_and_eval_address (argv[i + 1]); - - /* Write it down. */ - regcache_cooked_write_signed (regcache, regnum, value); - } - else - error ("bad register number"); - } -} - -/* Evaluate the value of the argument. The argument is an - expression. If the expression contains spaces it needs to be - included in double quotes. */ -void -mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) -{ - struct expression *expr; - struct cleanup *old_chain = NULL; - struct value *val; - struct ui_stream *stb = NULL; - struct value_print_options opts; - - stb = ui_out_stream_new (uiout); - - if (argc != 1) - { - ui_out_stream_delete (stb); - error ("mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression"); - } - - expr = parse_expression (argv[0]); - - old_chain = make_cleanup (free_current_contents, &expr); - - val = evaluate_expression (expr); - - /* Print the result of the expression evaluation. */ - get_user_print_options (&opts); - opts.deref_ref = 0; - val_print (value_type (val), value_contents (val), - value_embedded_offset (val), value_address (val), - stb->stream, 0, &opts, current_language); - - ui_out_field_stream (uiout, "value", stb); - ui_out_stream_delete (stb); - - do_cleanups (old_chain); -} - -/* DATA-MEMORY-READ: - - ADDR: start address of data to be dumped. - WORD-FORMAT: a char indicating format for the ``word''. See - the ``x'' command. - WORD-SIZE: size of each ``word''; 1,2,4, or 8 bytes. - NR_ROW: Number of rows. - NR_COL: The number of colums (words per row). - ASCHAR: (OPTIONAL) Append an ascii character dump to each row. Use - ASCHAR for unprintable characters. - - Reads SIZE*NR_ROW*NR_COL bytes starting at ADDR from memory and - displayes them. Returns: - - {addr="...",rowN={wordN="..." ,... [,ascii="..."]}, ...} - - Returns: - The number of bytes read is SIZE*ROW*COL. */ - -void -mi_cmd_data_read_memory (char *command, char **argv, int argc) -{ - struct gdbarch *gdbarch = get_current_arch (); - struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); - CORE_ADDR addr; - long total_bytes; - long nr_cols; - long nr_rows; - char word_format; - struct type *word_type; - long word_size; - char word_asize; - char aschar; - gdb_byte *mbuf; - int nr_bytes; - long offset = 0; - int optind = 0; - char *optarg; - enum opt - { - OFFSET_OPT - }; - static struct mi_opt opts[] = - { - {"o", OFFSET_OPT, 1}, - { 0, 0, 0 } - }; - - while (1) - { - int opt = mi_getopt ("mi_cmd_data_read_memory", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case OFFSET_OPT: - offset = atol (optarg); - break; - } - } - argv += optind; - argc -= optind; - - if (argc < 5 || argc > 6) - error ("mi_cmd_data_read_memory: Usage: ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR]."); - - /* Extract all the arguments. */ - - /* Start address of the memory dump. */ - addr = parse_and_eval_address (argv[0]) + offset; - /* The format character to use when displaying a memory word. See - the ``x'' command. */ - word_format = argv[1][0]; - /* The size of the memory word. */ - word_size = atol (argv[2]); - switch (word_size) - { - case 1: - word_type = builtin_type (gdbarch)->builtin_int8; - word_asize = 'b'; - break; - case 2: - word_type = builtin_type (gdbarch)->builtin_int16; - word_asize = 'h'; - break; - case 4: - word_type = builtin_type (gdbarch)->builtin_int32; - word_asize = 'w'; - break; - case 8: - word_type = builtin_type (gdbarch)->builtin_int64; - word_asize = 'g'; - break; - default: - word_type = builtin_type (gdbarch)->builtin_int8; - word_asize = 'b'; - } - /* The number of rows. */ - nr_rows = atol (argv[3]); - if (nr_rows <= 0) - error ("mi_cmd_data_read_memory: invalid number of rows."); - - /* Number of bytes per row. */ - nr_cols = atol (argv[4]); - if (nr_cols <= 0) - error ("mi_cmd_data_read_memory: invalid number of columns."); - - /* The un-printable character when printing ascii. */ - if (argc == 6) - aschar = *argv[5]; - else - aschar = 0; - - /* Create a buffer and read it in. */ - total_bytes = word_size * nr_rows * nr_cols; - mbuf = xcalloc (total_bytes, 1); - make_cleanup (xfree, mbuf); - - /* Dispatch memory reads to the topmost target, not the flattened - current_target. */ - nr_bytes = target_read_until_error (current_target.beneath, - TARGET_OBJECT_MEMORY, NULL, mbuf, - addr, total_bytes); - if (nr_bytes <= 0) - error ("Unable to read memory."); - - /* Output the header information. */ - ui_out_field_core_addr (uiout, "addr", gdbarch, addr); - ui_out_field_int (uiout, "nr-bytes", nr_bytes); - ui_out_field_int (uiout, "total-bytes", total_bytes); - ui_out_field_core_addr (uiout, "next-row", - gdbarch, addr + word_size * nr_cols); - ui_out_field_core_addr (uiout, "prev-row", - gdbarch, addr - word_size * nr_cols); - ui_out_field_core_addr (uiout, "next-page", gdbarch, addr + total_bytes); - ui_out_field_core_addr (uiout, "prev-page", gdbarch, addr - total_bytes); - - /* Build the result as a two dimentional table. */ - { - struct ui_stream *stream = ui_out_stream_new (uiout); - struct cleanup *cleanup_list_memory; - int row; - int row_byte; - cleanup_list_memory = make_cleanup_ui_out_list_begin_end (uiout, "memory"); - for (row = 0, row_byte = 0; - row < nr_rows; - row++, row_byte += nr_cols * word_size) - { - int col; - int col_byte; - struct cleanup *cleanup_tuple; - struct cleanup *cleanup_list_data; - struct value_print_options opts; - - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_core_addr (uiout, "addr", gdbarch, addr + row_byte); - /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */ - cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data"); - get_formatted_print_options (&opts, word_format); - for (col = 0, col_byte = row_byte; - col < nr_cols; - col++, col_byte += word_size) - { - if (col_byte + word_size > nr_bytes) - { - ui_out_field_string (uiout, NULL, "N/A"); - } - else - { - ui_file_rewind (stream->stream); - print_scalar_formatted (mbuf + col_byte, word_type, &opts, - word_asize, stream->stream); - ui_out_field_stream (uiout, NULL, stream); - } - } - do_cleanups (cleanup_list_data); - if (aschar) - { - int byte; - ui_file_rewind (stream->stream); - for (byte = row_byte; byte < row_byte + word_size * nr_cols; byte++) - { - if (byte >= nr_bytes) - { - fputc_unfiltered ('X', stream->stream); - } - else if (mbuf[byte] < 32 || mbuf[byte] > 126) - { - fputc_unfiltered (aschar, stream->stream); - } - else - fputc_unfiltered (mbuf[byte], stream->stream); - } - ui_out_field_stream (uiout, "ascii", stream); - } - do_cleanups (cleanup_tuple); - } - ui_out_stream_delete (stream); - do_cleanups (cleanup_list_memory); - } - do_cleanups (cleanups); -} - -/* DATA-MEMORY-WRITE: - - COLUMN_OFFSET: optional argument. Must be preceeded by '-o'. The - offset from the beginning of the memory grid row where the cell to - be written is. - ADDR: start address of the row in the memory grid where the memory - cell is, if OFFSET_COLUMN is specified. Otherwise, the address of - the location to write to. - FORMAT: a char indicating format for the ``word''. See - the ``x'' command. - WORD_SIZE: size of each ``word''; 1,2,4, or 8 bytes - VALUE: value to be written into the memory address. - - Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE). - - Prints nothing. */ -void -mi_cmd_data_write_memory (char *command, char **argv, int argc) -{ - struct gdbarch *gdbarch = get_current_arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR addr; - char word_format; - long word_size; - /* FIXME: ezannoni 2000-02-17 LONGEST could possibly not be big - enough when using a compiler other than GCC. */ - LONGEST value; - void *buffer; - struct cleanup *old_chain; - long offset = 0; - int optind = 0; - char *optarg; - enum opt - { - OFFSET_OPT - }; - static struct mi_opt opts[] = - { - {"o", OFFSET_OPT, 1}, - { 0, 0, 0 } - }; - - while (1) - { - int opt = mi_getopt ("mi_cmd_data_write_memory", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case OFFSET_OPT: - offset = atol (optarg); - break; - } - } - argv += optind; - argc -= optind; - - if (argc != 4) - error ("mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE."); - - /* Extract all the arguments. */ - /* Start address of the memory dump. */ - addr = parse_and_eval_address (argv[0]); - /* The format character to use when displaying a memory word. See - the ``x'' command. */ - word_format = argv[1][0]; - /* The size of the memory word. */ - word_size = atol (argv[2]); - - /* Calculate the real address of the write destination. */ - addr += (offset * word_size); - - /* Get the value as a number. */ - value = parse_and_eval_address (argv[3]); - /* Get the value into an array. */ - buffer = xmalloc (word_size); - old_chain = make_cleanup (xfree, buffer); - store_signed_integer (buffer, word_size, byte_order, value); - /* Write it down to memory. */ - write_memory (addr, buffer, word_size); - /* Free the buffer. */ - do_cleanups (old_chain); -} - -void -mi_cmd_enable_timings (char *command, char **argv, int argc) -{ - if (argc == 0) - do_timings = 1; - else if (argc == 1) - { - if (strcmp (argv[0], "yes") == 0) - do_timings = 1; - else if (strcmp (argv[0], "no") == 0) - do_timings = 0; - else - goto usage_error; - } - else - goto usage_error; - - return; - - usage_error: - error ("mi_cmd_enable_timings: Usage: %s {yes|no}", command); -} - -void -mi_cmd_list_features (char *command, char **argv, int argc) -{ - if (argc == 0) - { - struct cleanup *cleanup = NULL; - cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features"); - - ui_out_field_string (uiout, NULL, "frozen-varobjs"); - ui_out_field_string (uiout, NULL, "pending-breakpoints"); - ui_out_field_string (uiout, NULL, "thread-info"); - -#if HAVE_PYTHON - ui_out_field_string (uiout, NULL, "python"); -#endif - - do_cleanups (cleanup); - return; - } - - error ("-list-features should be passed no arguments"); -} - -void -mi_cmd_list_target_features (char *command, char **argv, int argc) -{ - if (argc == 0) - { - struct cleanup *cleanup = NULL; - cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features"); - - if (target_can_async_p ()) - ui_out_field_string (uiout, NULL, "async"); - - do_cleanups (cleanup); - return; - } - - error ("-list-target-features should be passed no arguments"); -} - -/* Execute a command within a safe environment. - Return <0 for error; >=0 for ok. - - args->action will tell mi_execute_command what action - to perfrom after the given command has executed (display/suppress - prompt, display error). */ - -static void -captured_mi_execute_command (struct ui_out *uiout, void *data) -{ - struct cleanup *cleanup; - struct mi_parse *context = (struct mi_parse *) data; - - if (do_timings) - current_command_ts = context->cmd_start; - - current_token = xstrdup (context->token); - cleanup = make_cleanup (free_current_contents, ¤t_token); - - running_result_record_printed = 0; - mi_proceeded = 0; - switch (context->op) - { - case MI_COMMAND: - /* A MI command was read from the input stream. */ - if (mi_debug_p) - /* FIXME: gdb_???? */ - fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n", - context->token, context->command, context->args); - - - mi_cmd_execute (context); - - /* Print the result if there were no errors. - - Remember that on the way out of executing a command, you have - to directly use the mi_interp's uiout, since the command could - have reset the interpreter, in which case the current uiout - will most likely crash in the mi_out_* routines. */ - if (!running_result_record_printed) - { - fputs_unfiltered (context->token, raw_stdout); - /* There's no particularly good reason why target-connect results - in not ^done. Should kill ^connected for MI3. */ - fputs_unfiltered (strcmp (context->command, "target-select") == 0 - ? "^connected" : "^done", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); - mi_print_timing_maybe (); - fputs_unfiltered ("\n", raw_stdout); - } - else - /* The command does not want anything to be printed. In that - case, the command probably should not have written anything - to uiout, but in case it has written something, discard it. */ - mi_out_rewind (uiout); - break; - - case CLI_COMMAND: - { - char *argv[2]; - /* A CLI command was read from the input stream. */ - /* This "feature" will be removed as soon as we have a - complete set of mi commands. */ - /* Echo the command on the console. */ - fprintf_unfiltered (gdb_stdlog, "%s\n", context->command); - /* Call the "console" interpreter. */ - argv[0] = "console"; - argv[1] = context->command; - mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); - - /* If we changed interpreters, DON'T print out anything. */ - if (current_interp_named_p (INTERP_MI) - || current_interp_named_p (INTERP_MI1) - || current_interp_named_p (INTERP_MI2) - || current_interp_named_p (INTERP_MI3)) - { - if (!running_result_record_printed) - { - fputs_unfiltered (context->token, raw_stdout); - fputs_unfiltered ("^done", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); - mi_print_timing_maybe (); - fputs_unfiltered ("\n", raw_stdout); - } - else - mi_out_rewind (uiout); - } - break; - } - - } - - do_cleanups (cleanup); - - return; -} - - -void -mi_execute_command (char *cmd, int from_tty) -{ - struct mi_parse *command; - struct ui_out *saved_uiout = uiout; - - /* This is to handle EOF (^D). We just quit gdb. */ - /* FIXME: we should call some API function here. */ - if (cmd == 0) - quit_force (NULL, from_tty); - - target_log_command (cmd); - - command = mi_parse (cmd); - - if (command != NULL) - { - struct gdb_exception result; - ptid_t previous_ptid = inferior_ptid; - - if (do_timings) - { - command->cmd_start = (struct mi_timestamp *) - xmalloc (sizeof (struct mi_timestamp)); - timestamp (command->cmd_start); - } - - result = catch_exception (uiout, captured_mi_execute_command, command, - RETURN_MASK_ALL); - if (result.reason < 0) - { - /* The command execution failed and error() was called - somewhere. */ - fputs_unfiltered (command->token, raw_stdout); - fputs_unfiltered ("^error,msg=\"", raw_stdout); - if (result.message == NULL) - fputs_unfiltered ("unknown error", raw_stdout); - else - fputstr_unfiltered (result.message, '"', raw_stdout); - fputs_unfiltered ("\"\n", raw_stdout); - mi_out_rewind (uiout); - } - - bpstat_do_actions (); - - if (/* The notifications are only output when the top-level - interpreter (specified on the command line) is MI. */ - ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())) - /* Don't try report anything if there are no threads -- - the program is dead. */ - && thread_count () != 0 - /* -thread-select explicitly changes thread. If frontend uses that - internally, we don't want to emit =thread-selected, since - =thread-selected is supposed to indicate user's intentions. */ - && strcmp (command->command, "thread-select") != 0) - { - struct mi_interp *mi = top_level_interpreter_data (); - int report_change = 0; - - if (command->thread == -1) - { - report_change = (!ptid_equal (previous_ptid, null_ptid) - && !ptid_equal (inferior_ptid, previous_ptid) - && !ptid_equal (inferior_ptid, null_ptid)); - } - else if (!ptid_equal (inferior_ptid, null_ptid)) - { - struct thread_info *ti = inferior_thread (); - report_change = (ti->num != command->thread); - } - - if (report_change) - { - struct thread_info *ti = inferior_thread (); - target_terminal_ours (); - fprintf_unfiltered (mi->event_channel, - "thread-selected,id=\"%d\"", - ti->num); - gdb_flush (mi->event_channel); - } - } - - mi_parse_free (command); - } - - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - /* Print any buffered hook code. */ - /* ..... */ -} - -static void -mi_cmd_execute (struct mi_parse *parse) -{ - struct cleanup *cleanup; - int i; - - prepare_execute_command (); - - cleanup = make_cleanup (null_cleanup, NULL); - - if (parse->frame != -1 && parse->thread == -1) - error (_("Cannot specify --frame without --thread")); - - if (parse->thread != -1) - { - struct thread_info *tp = find_thread_id (parse->thread); - if (!tp) - error (_("Invalid thread id: %d"), parse->thread); - - if (is_exited (tp->ptid)) - error (_("Thread id: %d has terminated"), parse->thread); - - switch_to_thread (tp->ptid); - } - - if (parse->frame != -1) - { - struct frame_info *fid; - int frame = parse->frame; - fid = find_relative_frame (get_current_frame (), &frame); - if (frame == 0) - /* find_relative_frame was successful */ - select_frame (fid); - else - error (_("Invalid frame id: %d"), frame); - } - - if (parse->cmd->argv_func != NULL) - parse->cmd->argv_func (parse->command, parse->argv, parse->argc); - else if (parse->cmd->cli.cmd != 0) - { - /* FIXME: DELETE THIS. */ - /* The operation is still implemented by a cli command. */ - /* Must be a synchronous one. */ - mi_execute_cli_command (parse->cmd->cli.cmd, parse->cmd->cli.args_p, - parse->args); - } - else - { - /* FIXME: DELETE THIS. */ - struct ui_file *stb; - - stb = mem_fileopen (); - - fputs_unfiltered ("Undefined mi command: ", stb); - fputstr_unfiltered (parse->command, '"', stb); - fputs_unfiltered (" (missing implementation)", stb); - - make_cleanup_ui_file_delete (stb); - error_stream (stb); - } - do_cleanups (cleanup); -} - -/* FIXME: This is just a hack so we can get some extra commands going. - We don't want to channel things through the CLI, but call libgdb directly. - Use only for synchronous commands. */ - -void -mi_execute_cli_command (const char *cmd, int args_p, const char *args) -{ - if (cmd != 0) - { - struct cleanup *old_cleanups; - char *run; - if (args_p) - run = xstrprintf ("%s %s", cmd, args); - else - run = xstrdup (cmd); - if (mi_debug_p) - /* FIXME: gdb_???? */ - fprintf_unfiltered (gdb_stdout, "cli=%s run=%s\n", - cmd, run); - old_cleanups = make_cleanup (xfree, run); - execute_command ( /*ui */ run, 0 /*from_tty */ ); - do_cleanups (old_cleanups); - return; - } -} - -void -mi_execute_async_cli_command (char *cli_command, char **argv, int argc) -{ - struct cleanup *old_cleanups; - char *run; - - if (target_can_async_p ()) - run = xstrprintf ("%s %s&", cli_command, argc ? *argv : ""); - else - run = xstrprintf ("%s %s", cli_command, argc ? *argv : ""); - old_cleanups = make_cleanup (xfree, run); - - execute_command ( /*ui */ run, 0 /*from_tty */ ); - - if (target_can_async_p ()) - { - /* If we're not executing, an exception should have been throw. */ - gdb_assert (is_running (inferior_ptid)); - do_cleanups (old_cleanups); - } - else - { - /* Do this before doing any printing. It would appear that some - print code leaves garbage around in the buffer. */ - do_cleanups (old_cleanups); - } -} - -void -mi_load_progress (const char *section_name, - unsigned long sent_so_far, - unsigned long total_section, - unsigned long total_sent, - unsigned long grand_total) -{ - struct timeval time_now, delta, update_threshold; - static struct timeval last_update; - static char *previous_sect_name = NULL; - int new_section; - struct ui_out *saved_uiout; - - /* This function is called through deprecated_show_load_progress - which means uiout may not be correct. Fix it for the duration - of this function. */ - saved_uiout = uiout; - - if (current_interp_named_p (INTERP_MI) - || current_interp_named_p (INTERP_MI2)) - uiout = mi_out_new (2); - else if (current_interp_named_p (INTERP_MI1)) - uiout = mi_out_new (1); - else if (current_interp_named_p (INTERP_MI3)) - uiout = mi_out_new (3); - else - return; - - update_threshold.tv_sec = 0; - update_threshold.tv_usec = 500000; - gettimeofday (&time_now, NULL); - - delta.tv_usec = time_now.tv_usec - last_update.tv_usec; - delta.tv_sec = time_now.tv_sec - last_update.tv_sec; - - if (delta.tv_usec < 0) - { - delta.tv_sec -= 1; - delta.tv_usec += 1000000L; - } - - new_section = (previous_sect_name ? - strcmp (previous_sect_name, section_name) : 1); - if (new_section) - { - struct cleanup *cleanup_tuple; - xfree (previous_sect_name); - previous_sect_name = xstrdup (section_name); - - if (current_token) - fputs_unfiltered (current_token, raw_stdout); - fputs_unfiltered ("+download", raw_stdout); - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_string (uiout, "section", section_name); - ui_out_field_int (uiout, "section-size", total_section); - ui_out_field_int (uiout, "total-size", grand_total); - do_cleanups (cleanup_tuple); - mi_out_put (uiout, raw_stdout); - fputs_unfiltered ("\n", raw_stdout); - gdb_flush (raw_stdout); - } - - if (delta.tv_sec >= update_threshold.tv_sec && - delta.tv_usec >= update_threshold.tv_usec) - { - struct cleanup *cleanup_tuple; - last_update.tv_sec = time_now.tv_sec; - last_update.tv_usec = time_now.tv_usec; - if (current_token) - fputs_unfiltered (current_token, raw_stdout); - fputs_unfiltered ("+download", raw_stdout); - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_string (uiout, "section", section_name); - ui_out_field_int (uiout, "section-sent", sent_so_far); - ui_out_field_int (uiout, "section-size", total_section); - ui_out_field_int (uiout, "total-sent", total_sent); - ui_out_field_int (uiout, "total-size", grand_total); - do_cleanups (cleanup_tuple); - mi_out_put (uiout, raw_stdout); - fputs_unfiltered ("\n", raw_stdout); - gdb_flush (raw_stdout); - } - - xfree (uiout); - uiout = saved_uiout; -} - -static void -timestamp (struct mi_timestamp *tv) - { - long usec; - gettimeofday (&tv->wallclock, NULL); -#ifdef HAVE_GETRUSAGE - getrusage (RUSAGE_SELF, &rusage); - tv->utime.tv_sec = rusage.ru_utime.tv_sec; - tv->utime.tv_usec = rusage.ru_utime.tv_usec; - tv->stime.tv_sec = rusage.ru_stime.tv_sec; - tv->stime.tv_usec = rusage.ru_stime.tv_usec; -#else - usec = get_run_time (); - tv->utime.tv_sec = usec/1000000L; - tv->utime.tv_usec = usec - 1000000L*tv->utime.tv_sec; - tv->stime.tv_sec = 0; - tv->stime.tv_usec = 0; -#endif - } - -static void -print_diff_now (struct mi_timestamp *start) - { - struct mi_timestamp now; - timestamp (&now); - print_diff (start, &now); - } - -void -mi_print_timing_maybe (void) -{ - /* If the command is -enable-timing then do_timings may be - true whilst current_command_ts is not initialized. */ - if (do_timings && current_command_ts) - print_diff_now (current_command_ts); -} - -static long -timeval_diff (struct timeval start, struct timeval end) - { - return ((end.tv_sec - start.tv_sec) * 1000000L) - + (end.tv_usec - start.tv_usec); - } - -static void -print_diff (struct mi_timestamp *start, struct mi_timestamp *end) - { - fprintf_unfiltered - (raw_stdout, - ",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}", - timeval_diff (start->wallclock, end->wallclock) / 1000000.0, - timeval_diff (start->utime, end->utime) / 1000000.0, - timeval_diff (start->stime, end->stime) / 1000000.0); - }
mi-main.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-break.c =================================================================== --- mi-cmd-break.c (revision 816) +++ mi-cmd-break.c (nonexistent) @@ -1,304 +0,0 @@ -/* MI Command Set - breakpoint and watchpoint commands. - Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "arch-utils.h" -#include "mi-cmds.h" -#include "ui-out.h" -#include "mi-out.h" -#include "breakpoint.h" -#include "gdb_string.h" -#include "mi-getopt.h" -#include "gdb.h" -#include "exceptions.h" -#include "observer.h" - -enum - { - FROM_TTY = 0 - }; - -/* True if MI breakpoint observers have been registered. */ - -static int mi_breakpoint_observers_installed; - -/* Control whether breakpoint_notify may act. */ - -static int mi_can_breakpoint_notify; - -/* Output a single breakpoint, when allowed. */ - -static void -breakpoint_notify (int b) -{ - if (mi_can_breakpoint_notify) - gdb_breakpoint_query (uiout, b, NULL); -} - -enum bp_type - { - REG_BP, - HW_BP, - REGEXP_BP - }; - -/* Implements the -break-insert command. - See the MI manual for the list of possible options. */ - -void -mi_cmd_break_insert (char *command, char **argv, int argc) -{ - char *address = NULL; - enum bp_type type = REG_BP; - int temp_p = 0; - int thread = -1; - int ignore_count = 0; - char *condition = NULL; - int pending = 0; - int enabled = 1; - - struct gdb_exception e; - struct gdb_events *old_hooks; - enum opt - { - HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT, - IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT - }; - static struct mi_opt opts[] = - { - {"h", HARDWARE_OPT, 0}, - {"t", TEMP_OPT, 0}, - {"c", CONDITION_OPT, 1}, - {"i", IGNORE_COUNT_OPT, 1}, - {"p", THREAD_OPT, 1}, - {"f", PENDING_OPT, 0}, - {"d", DISABLE_OPT, 0}, - { 0, 0, 0 } - }; - - /* Parse arguments. It could be -r or -h or -t, or ``--'' - to denote the end of the option list. */ - int optind = 0; - char *optarg; - while (1) - { - int opt = mi_getopt ("mi_cmd_break_insert", argc, argv, opts, &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case TEMP_OPT: - temp_p = 1; - break; - case HARDWARE_OPT: - type = HW_BP; - break; -#if 0 - case REGEXP_OPT: - type = REGEXP_BP; - break; -#endif - case CONDITION_OPT: - condition = optarg; - break; - case IGNORE_COUNT_OPT: - ignore_count = atol (optarg); - break; - case THREAD_OPT: - thread = atol (optarg); - break; - case PENDING_OPT: - pending = 1; - break; - case DISABLE_OPT: - enabled = 0; - } - } - - if (optind >= argc) - error (_("mi_cmd_break_insert: Missing ")); - if (optind < argc - 1) - error (_("mi_cmd_break_insert: Garbage following ")); - address = argv[optind]; - - /* Now we have what we need, let's insert the breakpoint! */ - if (! mi_breakpoint_observers_installed) - { - observer_attach_breakpoint_created (breakpoint_notify); - observer_attach_breakpoint_modified (breakpoint_notify); - observer_attach_breakpoint_deleted (breakpoint_notify); - mi_breakpoint_observers_installed = 1; - } - - mi_can_breakpoint_notify = 1; - /* Make sure we restore hooks even if exception is thrown. */ - TRY_CATCH (e, RETURN_MASK_ALL) - { - switch (type) - { - case REG_BP: - set_breakpoint (get_current_arch (), address, condition, - 0 /*hardwareflag */ , temp_p, - thread, ignore_count, - pending, enabled); - break; - case HW_BP: - set_breakpoint (get_current_arch (), address, condition, - 1 /*hardwareflag */ , temp_p, - thread, ignore_count, - pending, enabled); - break; -#if 0 - case REGEXP_BP: - if (temp_p) - error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint")); - else - rbreak_command_wrapper (address, FROM_TTY); - break; -#endif - default: - internal_error (__FILE__, __LINE__, - _("mi_cmd_break_insert: Bad switch.")); - } - } - mi_can_breakpoint_notify = 0; - if (e.reason < 0) - throw_exception (e); -} - -enum wp_type -{ - REG_WP, - READ_WP, - ACCESS_WP -}; - -/* Insert a watchpoint. The type of watchpoint is specified by the - first argument: - -break-watch --> insert a regular wp. - -break-watch -r --> insert a read watchpoint. - -break-watch -a --> insert an access wp. */ - -void -mi_cmd_break_watch (char *command, char **argv, int argc) -{ - char *expr = NULL; - enum wp_type type = REG_WP; - enum opt - { - READ_OPT, ACCESS_OPT - }; - static struct mi_opt opts[] = - { - {"r", READ_OPT, 0}, - {"a", ACCESS_OPT, 0}, - { 0, 0, 0 } - }; - - /* Parse arguments. */ - int optind = 0; - char *optarg; - while (1) - { - int opt = mi_getopt ("mi_cmd_break_watch", argc, argv, opts, &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case READ_OPT: - type = READ_WP; - break; - case ACCESS_OPT: - type = ACCESS_WP; - break; - } - } - if (optind >= argc) - error (_("mi_cmd_break_watch: Missing ")); - if (optind < argc - 1) - error (_("mi_cmd_break_watch: Garbage following ")); - expr = argv[optind]; - - /* Now we have what we need, let's insert the watchpoint! */ - switch (type) - { - case REG_WP: - watch_command_wrapper (expr, FROM_TTY); - break; - case READ_WP: - rwatch_command_wrapper (expr, FROM_TTY); - break; - case ACCESS_WP: - awatch_command_wrapper (expr, FROM_TTY); - break; - default: - error (_("mi_cmd_break_watch: Unknown watchpoint type.")); - } -} - -/* The mi_read_next_line consults these variable to return successive - command lines. While it would be clearer to use a closure pointer, - it is not expected that any future code will use read_command_lines_1, - therefore no point of overengineering. */ - -static char **mi_command_line_array; -static int mi_command_line_array_cnt; -static int mi_command_line_array_ptr; - -static char * -mi_read_next_line () -{ - if (mi_command_line_array_ptr == mi_command_line_array_cnt) - return NULL; - else - return mi_command_line_array[mi_command_line_array_ptr++]; -} - -void -mi_cmd_break_commands (char *command, char **argv, int argc) -{ - struct command_line *break_command; - char *endptr; - int bnum; - struct breakpoint *b; - - if (argc < 1) - error ("USAGE: %s [ [...]]", command); - - bnum = strtol (argv[0], &endptr, 0); - if (endptr == argv[0]) - error ("breakpoint number argument \"%s\" is not a number.", - argv[0]); - else if (*endptr != '\0') - error ("junk at the end of breakpoint number argument \"%s\".", - argv[0]); - - b = get_breakpoint (bnum); - if (b == NULL) - error ("breakpoint %d not found.", bnum); - - mi_command_line_array = argv; - mi_command_line_array_ptr = 1; - mi_command_line_array_cnt = argc; - - break_command = read_command_lines_1 (mi_read_next_line, 1); - breakpoint_set_commands (b, break_command); -} -
mi-cmd-break.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmds.c =================================================================== --- mi-cmds.c (revision 816) +++ mi-cmds.c (nonexistent) @@ -1,221 +0,0 @@ -/* MI Command Set for GDB, the GNU debugger. - - Copyright (C) 2000, 2001, 2003, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "top.h" -#include "mi-cmds.h" -#include "gdb_string.h" - -extern void _initialize_mi_cmds (void); -struct mi_cmd; -static struct mi_cmd **lookup_table (const char *command); -static void build_table (struct mi_cmd *commands); - - -struct mi_cmd mi_cmds[] = -{ - { "break-after", { "ignore", 1 }, NULL }, - { "break-condition", { "cond", 1 }, NULL }, - { "break-commands", { NULL, 0 }, mi_cmd_break_commands }, - { "break-delete", { "delete breakpoint", 1 }, NULL }, - { "break-disable", { "disable breakpoint", 1 }, NULL }, - { "break-enable", { "enable breakpoint", 1 }, NULL }, - { "break-info", { "info break", 1 }, NULL }, - { "break-insert", { NULL, 0 }, mi_cmd_break_insert}, - { "break-list", { "info break", }, NULL }, - { "break-watch", { NULL, 0 }, mi_cmd_break_watch}, - { "data-disassemble", { NULL, 0 }, mi_cmd_disassemble}, - { "data-evaluate-expression", { NULL, 0 }, mi_cmd_data_evaluate_expression}, - { "data-list-changed-registers", { NULL, 0 }, mi_cmd_data_list_changed_registers}, - { "data-list-register-names", { NULL, 0 }, mi_cmd_data_list_register_names}, - { "data-list-register-values", { NULL, 0 }, mi_cmd_data_list_register_values}, - { "data-read-memory", { NULL, 0 }, mi_cmd_data_read_memory}, - { "data-write-memory", { NULL, 0 }, mi_cmd_data_write_memory}, - { "data-write-register-values", { NULL, 0 }, mi_cmd_data_write_register_values}, - { "enable-timings", { NULL, 0 }, mi_cmd_enable_timings}, - { "enable-pretty-printing", { NULL, 0 }, mi_cmd_enable_pretty_printing}, - { "environment-cd", { NULL, 0 }, mi_cmd_env_cd}, - { "environment-directory", { NULL, 0 }, mi_cmd_env_dir}, - { "environment-path", { NULL, 0 }, mi_cmd_env_path}, - { "environment-pwd", { NULL, 0 }, mi_cmd_env_pwd}, - { "exec-arguments", { "set args", 1 }, NULL }, - { "exec-continue", { NULL, 0 }, mi_cmd_exec_continue}, - { "exec-finish", { NULL, 0 }, mi_cmd_exec_finish}, - { "exec-jump", { NULL, 0 }, mi_cmd_exec_jump}, - { "exec-interrupt", { NULL, 0 }, mi_cmd_exec_interrupt}, - { "exec-next", { NULL, 0 }, mi_cmd_exec_next}, - { "exec-next-instruction", { NULL, 0 }, mi_cmd_exec_next_instruction}, - { "exec-return", { NULL, 0 }, mi_cmd_exec_return}, - { "exec-run", { "run", 1 }, NULL}, - { "exec-step", { NULL, 0 }, mi_cmd_exec_step}, - { "exec-step-instruction", { NULL, 0 }, mi_cmd_exec_step_instruction}, - { "exec-until", { "until", 1 }, NULL}, - { "file-exec-and-symbols", { "file", 1 }, NULL }, - { "file-exec-file", { "exec-file", 1 }, NULL }, - { "file-list-exec-source-file", { NULL, 0 }, mi_cmd_file_list_exec_source_file}, - { "file-list-exec-source-files", { NULL, 0 }, mi_cmd_file_list_exec_source_files }, - { "file-symbol-file", { "symbol-file", 1 }, NULL }, - { "gdb-exit", { NULL, 0 }, mi_cmd_gdb_exit}, - { "gdb-set", { "set", 1 }, NULL }, - { "gdb-show", { "show", 1 }, NULL }, - { "gdb-version", { "show version", 0 }, 0 }, - { "inferior-tty-set", { NULL, 0 }, mi_cmd_inferior_tty_set}, - { "inferior-tty-show", { NULL, 0 }, mi_cmd_inferior_tty_show}, - { "interpreter-exec", { NULL, 0 }, mi_cmd_interpreter_exec}, - { "list-features", { NULL, 0 }, mi_cmd_list_features}, - { "list-target-features", { NULL, 0 }, mi_cmd_list_target_features}, - { "list-thread-groups", { NULL, 0 }, mi_cmd_list_thread_groups }, - { "stack-info-depth", { NULL, 0 }, mi_cmd_stack_info_depth}, - { "stack-info-frame", { NULL, 0 }, mi_cmd_stack_info_frame}, - { "stack-list-arguments", { NULL, 0 }, mi_cmd_stack_list_args}, - { "stack-list-frames", { NULL, 0 }, mi_cmd_stack_list_frames}, - { "stack-list-locals", { NULL, 0 }, mi_cmd_stack_list_locals}, - { "stack-list-variables", { NULL, 0 }, mi_cmd_stack_list_variables}, - { "stack-select-frame", { NULL, 0 }, mi_cmd_stack_select_frame}, - { "symbol-list-lines", { NULL, 0 }, mi_cmd_symbol_list_lines}, - { "target-attach", { "attach", 1 }, NULL }, - { "target-detach", { NULL, 0 }, mi_cmd_target_detach }, - { "target-disconnect", { "disconnect", 0 }, 0 }, - { "target-download", { "load", 1 }, NULL}, - { "target-file-delete", { NULL, 0 }, mi_cmd_target_file_delete }, - { "target-file-get", { NULL, 0 }, mi_cmd_target_file_get }, - { "target-file-put", { NULL, 0 }, mi_cmd_target_file_put }, - { "target-select", { "target", 1 }, NULL}, - { "thread-info", { NULL, 0 }, mi_cmd_thread_info }, - { "thread-list-ids", { NULL, 0 }, mi_cmd_thread_list_ids}, - { "thread-select", { NULL, 0 }, mi_cmd_thread_select}, - { "var-assign", { NULL, 0 }, mi_cmd_var_assign}, - { "var-create", { NULL, 0 }, mi_cmd_var_create}, - { "var-delete", { NULL, 0 }, mi_cmd_var_delete}, - { "var-evaluate-expression", { NULL, 0 }, mi_cmd_var_evaluate_expression}, - { "var-info-path-expression", { NULL, 0 }, mi_cmd_var_info_path_expression}, - { "var-info-expression", { NULL, 0 }, mi_cmd_var_info_expression}, - { "var-info-num-children", { NULL, 0 }, mi_cmd_var_info_num_children}, - { "var-info-type", { NULL, 0 }, mi_cmd_var_info_type}, - { "var-list-children", { NULL, 0 }, mi_cmd_var_list_children}, - { "var-set-format", { NULL, 0 }, mi_cmd_var_set_format}, - { "var-set-frozen", { NULL, 0 }, mi_cmd_var_set_frozen}, - { "var-set-update-range", { NULL, 0 }, mi_cmd_var_set_update_range }, - { "var-set-visualizer", { NULL, 0 }, mi_cmd_var_set_visualizer}, - { "var-show-attributes", { NULL, 0 }, mi_cmd_var_show_attributes}, - { "var-show-format", { NULL, 0 }, mi_cmd_var_show_format}, - { "var-update", { NULL, 0 }, mi_cmd_var_update}, - { NULL, } -}; - -/* Pointer to the mi command table (built at run time) */ - -static struct mi_cmd **mi_table; - -/* A prime large enough to accomodate the entire command table */ -enum - { - MI_TABLE_SIZE = 227 - }; - -/* Exported function used to obtain info from the table */ -struct mi_cmd * -mi_lookup (const char *command) -{ - return *lookup_table (command); -} - -/* stat collecting */ -struct mi_cmd_stats -{ - int hit; - int miss; - int rehash; -}; -struct mi_cmd_stats stats; - -/* our lookup function */ -static struct mi_cmd ** -lookup_table (const char *command) -{ - const char *chp; - unsigned int index = 0; - /* compute our hash */ - for (chp = command; *chp; chp++) - { - /* some what arbitrary */ - index = ((index << 6) + (unsigned int) *chp) % MI_TABLE_SIZE; - } - /* look it up */ - while (1) - { - struct mi_cmd **entry = &mi_table[index]; - if ((*entry) == 0) - { - /* not found, return pointer to next free. */ - stats.miss++; - return entry; - } - if (strcmp (command, (*entry)->name) == 0) - { - stats.hit++; - return entry; /* found */ - } - index = (index + 1) % MI_TABLE_SIZE; - stats.rehash++; - } -} - -static void -build_table (struct mi_cmd *commands) -{ - int nr_rehash = 0; - int nr_entries = 0; - struct mi_cmd *command; - int sizeof_table = sizeof (struct mi_cmd **) * MI_TABLE_SIZE; - - mi_table = xmalloc (sizeof_table); - memset (mi_table, 0, sizeof_table); - for (command = commands; command->name != 0; command++) - { - struct mi_cmd **entry = lookup_table (command->name); - if (*entry) - internal_error (__FILE__, __LINE__, - _("command `%s' appears to be duplicated"), - command->name); - *entry = command; - if (0) - { - fprintf_unfiltered (gdb_stdlog, "%-30s %2d\n", - command->name, stats.rehash - nr_rehash); - } - nr_entries++; - nr_rehash = stats.rehash; - } - if (0) - { - fprintf_filtered (gdb_stdlog, "Average %3.1f\n", - (double) nr_rehash / (double) nr_entries); - } -} - -void -_initialize_mi_cmds (void) -{ - build_table (mi_cmds); - memset (&stats, 0, sizeof (stats)); -}
mi-cmds.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-target.c =================================================================== --- mi-cmd-target.c (revision 816) +++ mi-cmd-target.c (nonexistent) @@ -1,94 +0,0 @@ -/* MI Command Set - target commands. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-cmds.h" -#include "mi-getopt.h" -#include "remote.h" - -/* Get a file from the target. */ - -void -mi_cmd_target_file_get (char *command, char **argv, int argc) -{ - int optind = 0; - char *optarg; - const char *remote_file, *local_file; - static struct mi_opt opts[] = - { - { 0, 0, 0 } - }; - static const char *prefix = "mi_cmd_target_file_get"; - - if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1 - || optind != argc - 2) - error (_("mi_cmd_target_file_get: Usage: REMOTE_FILE LOCAL_FILE")); - - remote_file = argv[optind]; - local_file = argv[optind + 1]; - - remote_file_get (remote_file, local_file, 0); -} - -/* Send a file to the target. */ - -void -mi_cmd_target_file_put (char *command, char **argv, int argc) -{ - int optind = 0; - char *optarg; - const char *remote_file, *local_file; - static struct mi_opt opts[] = - { - { 0, 0, 0 } - }; - static const char *prefix = "mi_cmd_target_file_put"; - - if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1 - || optind != argc - 2) - error (_("mi_cmd_target_file_put: Usage: LOCAL_FILE REMOTE_FILE")); - - local_file = argv[optind]; - remote_file = argv[optind + 1]; - - remote_file_put (local_file, remote_file, 0); -} - -/* Delete a file on the target. */ - -void -mi_cmd_target_file_delete (char *command, char **argv, int argc) -{ - int optind = 0; - char *optarg; - const char *remote_file, *local_file; - static struct mi_opt opts[] = - { - { 0, 0, 0 } - }; - static const char *prefix = "mi_cmd_target_file_delete"; - - if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) != -1 - || optind != argc - 1) - error (_("mi_cmd_target_file_delete: Usage: REMOTE_FILE")); - - remote_file = argv[optind]; - - remote_file_delete (remote_file, 0); -} -
mi-cmd-target.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-common.c =================================================================== --- mi-common.c (revision 816) +++ mi-common.c (nonexistent) @@ -1,54 +0,0 @@ -/* Interface for common GDB/MI data - Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-common.h" - -static const char * const async_reason_string_lookup[] = -{ - "breakpoint-hit", - "watchpoint-trigger", - "read-watchpoint-trigger", - "access-watchpoint-trigger", - "function-finished", - "location-reached", - "watchpoint-scope", - "end-stepping-range", - "exited-signalled", - "exited", - "exited-normally", - "signal-received", - NULL -}; - -const char * -async_reason_lookup (enum async_reply_reason reason) -{ - return async_reason_string_lookup[reason]; -} - -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_gdb_mi_common; - -void -_initialize_gdb_mi_common (void) -{ - if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1) - internal_error (__FILE__, __LINE__, - _("async_reason_string_lookup is inconsistent")); -}
mi-common.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-var.c =================================================================== --- mi-cmd-var.c (revision 816) +++ mi-cmd-var.c (nonexistent) @@ -1,828 +0,0 @@ -/* MI Command Set - varobj commands. - - Copyright (C) 2000, 2002, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Cygnus Solutions (a Red Hat company). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-cmds.h" -#include "ui-out.h" -#include "mi-out.h" -#include "varobj.h" -#include "value.h" -#include -#include "gdb_string.h" -#include "mi-getopt.h" -#include "gdbthread.h" - -const char mi_no_values[] = "--no-values"; -const char mi_simple_values[] = "--simple-values"; -const char mi_all_values[] = "--all-values"; - -extern int varobjdebug; /* defined in varobj.c. */ - -static void varobj_update_one (struct varobj *var, - enum print_values print_values, - int explicit); - -static int mi_print_value_p (struct varobj *var, enum print_values print_values); - -/* Print variable object VAR. The PRINT_VALUES parameter controls - if the value should be printed. The PRINT_EXPRESSION parameter - controls if the expression should be printed. */ -static void -print_varobj (struct varobj *var, enum print_values print_values, - int print_expression) -{ - struct type *gdb_type; - char *type; - int thread_id; - char *display_hint; - - ui_out_field_string (uiout, "name", varobj_get_objname (var)); - if (print_expression) - ui_out_field_string (uiout, "exp", varobj_get_expression (var)); - ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); - - if (mi_print_value_p (var, print_values)) - { - char *val = varobj_get_value (var); - ui_out_field_string (uiout, "value", val); - xfree (val); - } - - type = varobj_get_type (var); - if (type != NULL) - { - ui_out_field_string (uiout, "type", type); - xfree (type); - } - - thread_id = varobj_get_thread_id (var); - if (thread_id > 0) - ui_out_field_int (uiout, "thread-id", thread_id); - - if (varobj_get_frozen (var)) - ui_out_field_int (uiout, "frozen", 1); - - display_hint = varobj_get_display_hint (var); - if (display_hint) - { - ui_out_field_string (uiout, "displayhint", display_hint); - xfree (display_hint); - } - - if (varobj_pretty_printed_p (var)) - ui_out_field_int (uiout, "dynamic", 1); -} - -/* VAROBJ operations */ - -void -mi_cmd_var_create (char *command, char **argv, int argc) -{ - CORE_ADDR frameaddr = 0; - struct varobj *var; - char *name; - char *frame; - char *expr; - struct cleanup *old_cleanups; - enum varobj_type var_type; - - if (argc != 3) - { - /* mi_error_message = xstrprintf ("mi_cmd_var_create: Usage: - ...."); return MI_CMD_ERROR; */ - error (_("mi_cmd_var_create: Usage: NAME FRAME EXPRESSION.")); - } - - name = xstrdup (argv[0]); - /* Add cleanup for name. Must be free_current_contents as - name can be reallocated */ - old_cleanups = make_cleanup (free_current_contents, &name); - - frame = xstrdup (argv[1]); - make_cleanup (xfree, frame); - - expr = xstrdup (argv[2]); - make_cleanup (xfree, expr); - - if (strcmp (name, "-") == 0) - { - xfree (name); - name = varobj_gen_name (); - } - else if (!isalpha (*name)) - error (_("mi_cmd_var_create: name of object must begin with a letter")); - - if (strcmp (frame, "*") == 0) - var_type = USE_CURRENT_FRAME; - else if (strcmp (frame, "@") == 0) - var_type = USE_SELECTED_FRAME; - else - { - var_type = USE_SPECIFIED_FRAME; - frameaddr = string_to_core_addr (frame); - } - - if (varobjdebug) - fprintf_unfiltered (gdb_stdlog, - "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n", - name, frame, hex_string (frameaddr), expr); - - var = varobj_create (name, expr, frameaddr, var_type); - - if (var == NULL) - error (_("mi_cmd_var_create: unable to create variable object")); - - print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */); - - ui_out_field_int (uiout, "has_more", varobj_has_more (var, 0)); - - do_cleanups (old_cleanups); -} - -void -mi_cmd_var_delete (char *command, char **argv, int argc) -{ - char *name; - struct varobj *var; - int numdel; - int children_only_p = 0; - struct cleanup *old_cleanups; - - if (argc < 1 || argc > 2) - error (_("mi_cmd_var_delete: Usage: [-c] EXPRESSION.")); - - name = xstrdup (argv[0]); - /* Add cleanup for name. Must be free_current_contents as - name can be reallocated */ - old_cleanups = make_cleanup (free_current_contents, &name); - - /* If we have one single argument it cannot be '-c' or any string - starting with '-'. */ - if (argc == 1) - { - if (strcmp (name, "-c") == 0) - error (_("mi_cmd_var_delete: Missing required argument after '-c': variable object name")); - if (*name == '-') - error (_("mi_cmd_var_delete: Illegal variable object name")); - } - - /* If we have 2 arguments they must be '-c' followed by a string - which would be the variable name. */ - if (argc == 2) - { - if (strcmp (name, "-c") != 0) - error (_("mi_cmd_var_delete: Invalid option.")); - children_only_p = 1; - do_cleanups (old_cleanups); - name = xstrdup (argv[1]); - make_cleanup (free_current_contents, &name); - } - - /* If we didn't error out, now NAME contains the name of the - variable. */ - - var = varobj_get_handle (name); - - numdel = varobj_delete (var, NULL, children_only_p); - - ui_out_field_int (uiout, "ndeleted", numdel); - - do_cleanups (old_cleanups); -} - -/* Parse a string argument into a format value. */ - -static enum varobj_display_formats -mi_parse_format (const char *arg) -{ - if (arg != NULL) - { - int len; - - len = strlen (arg); - - if (strncmp (arg, "natural", len) == 0) - return FORMAT_NATURAL; - else if (strncmp (arg, "binary", len) == 0) - return FORMAT_BINARY; - else if (strncmp (arg, "decimal", len) == 0) - return FORMAT_DECIMAL; - else if (strncmp (arg, "hexadecimal", len) == 0) - return FORMAT_HEXADECIMAL; - else if (strncmp (arg, "octal", len) == 0) - return FORMAT_OCTAL; - } - - error (_("Must specify the format as: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\"")); -} - -void -mi_cmd_var_set_format (char *command, char **argv, int argc) -{ - enum varobj_display_formats format; - struct varobj *var; - char *val; - - if (argc != 2) - error (_("mi_cmd_var_set_format: Usage: NAME FORMAT.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - format = mi_parse_format (argv[1]); - - /* Set the format of VAR to given format */ - varobj_set_display_format (var, format); - - /* Report the new current format */ - ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); - - /* Report the value in the new format */ - val = varobj_get_value (var); - ui_out_field_string (uiout, "value", val); - xfree (val); -} - -void -mi_cmd_var_set_visualizer (char *command, char **argv, int argc) -{ - struct varobj *var; - - if (argc != 2) - error ("Usage: NAME VISUALIZER_FUNCTION."); - - var = varobj_get_handle (argv[0]); - - if (var == NULL) - error ("Variable object not found"); - - varobj_set_visualizer (var, argv[1]); -} - -void -mi_cmd_var_set_frozen (char *command, char **argv, int argc) -{ - struct varobj *var; - int frozen; - - if (argc != 2) - error (_("-var-set-format: Usage: NAME FROZEN_FLAG.")); - - var = varobj_get_handle (argv[0]); - - if (strcmp (argv[1], "0") == 0) - frozen = 0; - else if (strcmp (argv[1], "1") == 0) - frozen = 1; - else - error (_("Invalid flag value")); - - varobj_set_frozen (var, frozen); - - /* We don't automatically return the new value, or what varobjs got new - values during unfreezing. If this information is required, client - should call -var-update explicitly. */ -} - - -void -mi_cmd_var_show_format (char *command, char **argv, int argc) -{ - enum varobj_display_formats format; - struct varobj *var; - - if (argc != 1) - error (_("mi_cmd_var_show_format: Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - format = varobj_get_display_format (var); - - /* Report the current format */ - ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); -} - -void -mi_cmd_var_info_num_children (char *command, char **argv, int argc) -{ - struct varobj *var; - - if (argc != 1) - error (_("mi_cmd_var_info_num_children: Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); -} - -/* Parse a string argument into a print_values value. */ - -static enum print_values -mi_parse_values_option (const char *arg) -{ - if (strcmp (arg, "0") == 0 - || strcmp (arg, mi_no_values) == 0) - return PRINT_NO_VALUES; - else if (strcmp (arg, "1") == 0 - || strcmp (arg, mi_all_values) == 0) - return PRINT_ALL_VALUES; - else if (strcmp (arg, "2") == 0 - || strcmp (arg, mi_simple_values) == 0) - return PRINT_SIMPLE_VALUES; - else - error (_("Unknown value for PRINT_VALUES\n\ -Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), - mi_no_values, mi_simple_values, mi_all_values); -} - -/* Return 1 if given the argument PRINT_VALUES we should display - the varobj VAR. */ - -static int -mi_print_value_p (struct varobj *var, enum print_values print_values) -{ - struct type *type; - - if (print_values == PRINT_NO_VALUES) - return 0; - - if (print_values == PRINT_ALL_VALUES) - return 1; - - if (varobj_pretty_printed_p (var)) - return 1; - - type = varobj_get_gdb_type (var); - if (type == NULL) - return 1; - else - { - type = check_typedef (type); - - /* For PRINT_SIMPLE_VALUES, only print the value if it has a type - and that type is not a compound type. */ - return (TYPE_CODE (type) != TYPE_CODE_ARRAY - && TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION); - } -} - -void -mi_cmd_var_list_children (char *command, char **argv, int argc) -{ - struct varobj *var; - VEC(varobj_p) *children; - struct varobj *child; - int numchild; - enum print_values print_values; - int ix; - int from, to; - char *display_hint; - - if (argc < 1 || argc > 4) - error (_("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME [FROM TO]")); - - /* Get varobj handle, if a valid var obj name was specified */ - if (argc == 1 || argc == 3) - var = varobj_get_handle (argv[0]); - else - var = varobj_get_handle (argv[1]); - - if (argc > 2) - { - from = atoi (argv[argc - 2]); - to = atoi (argv[argc - 1]); - } - else - { - from = -1; - to = -1; - } - - children = varobj_list_children (var, &from, &to); - ui_out_field_int (uiout, "numchild", to - from); - if (argc == 2 || argc == 4) - print_values = mi_parse_values_option (argv[0]); - else - print_values = PRINT_NO_VALUES; - - display_hint = varobj_get_display_hint (var); - if (display_hint) - { - ui_out_field_string (uiout, "displayhint", display_hint); - xfree (display_hint); - } - - if (from < to) - { - struct cleanup *cleanup_children; - if (mi_version (uiout) == 1) - cleanup_children - = make_cleanup_ui_out_tuple_begin_end (uiout, "children"); - else - cleanup_children - = make_cleanup_ui_out_list_begin_end (uiout, "children"); - for (ix = from; - ix < to && VEC_iterate (varobj_p, children, ix, child); - ++ix) - { - struct cleanup *cleanup_child; - cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child"); - print_varobj (child, print_values, 1 /* print expression */); - do_cleanups (cleanup_child); - } - do_cleanups (cleanup_children); - } - - ui_out_field_int (uiout, "has_more", varobj_has_more (var, to)); -} - -void -mi_cmd_var_info_type (char *command, char **argv, int argc) -{ - struct varobj *var; - - if (argc != 1) - error (_("mi_cmd_var_info_type: Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - ui_out_field_string (uiout, "type", varobj_get_type (var)); -} - -void -mi_cmd_var_info_path_expression (char *command, char **argv, int argc) -{ - struct varobj *var; - char *path_expr; - - if (argc != 1) - error (_("Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified. */ - var = varobj_get_handle (argv[0]); - - path_expr = varobj_get_path_expr (var); - - ui_out_field_string (uiout, "path_expr", path_expr); -} - -void -mi_cmd_var_info_expression (char *command, char **argv, int argc) -{ - enum varobj_languages lang; - struct varobj *var; - - if (argc != 1) - error (_("mi_cmd_var_info_expression: Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - lang = varobj_get_language (var); - - ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]); - ui_out_field_string (uiout, "exp", varobj_get_expression (var)); -} - -void -mi_cmd_var_show_attributes (char *command, char **argv, int argc) -{ - int attr; - char *attstr; - struct varobj *var; - - if (argc != 1) - error (_("mi_cmd_var_show_attributes: Usage: NAME.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - attr = varobj_get_attributes (var); - /* FIXME: define masks for attributes */ - if (attr & 0x00000001) - attstr = "editable"; - else - attstr = "noneditable"; - - ui_out_field_string (uiout, "attr", attstr); -} - -void -mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) -{ - struct varobj *var; - - enum varobj_display_formats format; - int formatFound; - int optind; - char *optarg; - - enum opt - { - OP_FORMAT - }; - static struct mi_opt opts[] = - { - {"f", OP_FORMAT, 1}, - { 0, 0, 0 } - }; - - /* Parse arguments */ - format = FORMAT_NATURAL; - formatFound = 0; - optind = 0; - while (1) - { - int opt = mi_getopt ("-var-evaluate-expression", argc, argv, opts, &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case OP_FORMAT: - if (formatFound) - error (_("Cannot specify format more than once")); - - format = mi_parse_format (optarg); - formatFound = 1; - break; - } - } - - if (optind >= argc) - error (_("Usage: [-f FORMAT] NAME")); - - if (optind < argc - 1) - error (_("Garbage at end of command")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[optind]); - - if (formatFound) - { - char *val = varobj_get_formatted_value (var, format); - ui_out_field_string (uiout, "value", val); - xfree (val); - } - else - { - char *val = varobj_get_value (var); - ui_out_field_string (uiout, "value", val); - xfree (val); - } -} - -void -mi_cmd_var_assign (char *command, char **argv, int argc) -{ - struct varobj *var; - char *expression, *val; - - if (argc != 2) - error (_("mi_cmd_var_assign: Usage: NAME EXPRESSION.")); - - /* Get varobj handle, if a valid var obj name was specified */ - var = varobj_get_handle (argv[0]); - - if (!varobj_editable_p (var)) - error (_("mi_cmd_var_assign: Variable object is not editable")); - - expression = xstrdup (argv[1]); - - if (!varobj_set_value (var, expression)) - error (_("mi_cmd_var_assign: Could not assign expression to variable object")); - - val = varobj_get_value (var); - ui_out_field_string (uiout, "value", val); - xfree (val); -} - -/* Type used for parameters passing to mi_cmd_var_update_iter. */ - -struct mi_cmd_var_update - { - int only_floating; - enum print_values print_values; - }; - -/* Helper for mi_cmd_var_update - update each VAR. */ - -static void -mi_cmd_var_update_iter (struct varobj *var, void *data_pointer) -{ - struct mi_cmd_var_update *data = data_pointer; - int thread_id, thread_stopped; - - thread_id = varobj_get_thread_id (var); - - if (thread_id == -1 && is_stopped (inferior_ptid)) - thread_stopped = 1; - else - { - struct thread_info *tp = find_thread_id (thread_id); - - if (tp) - thread_stopped = is_stopped (tp->ptid); - else - thread_stopped = 1; - } - - if (thread_stopped) - if (!data->only_floating || varobj_floating_p (var)) - varobj_update_one (var, data->print_values, 0 /* implicit */); -} - -void -mi_cmd_var_update (char *command, char **argv, int argc) -{ - struct cleanup *cleanup; - char *name; - enum print_values print_values; - - if (argc != 1 && argc != 2) - error (_("mi_cmd_var_update: Usage: [PRINT_VALUES] NAME.")); - - if (argc == 1) - name = argv[0]; - else - name = (argv[1]); - - if (argc == 2) - print_values = mi_parse_values_option (argv[0]); - else - print_values = PRINT_NO_VALUES; - - if (mi_version (uiout) <= 1) - cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist"); - else - cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist"); - - /* Check if the parameter is a "*" which means that we want - to update all variables */ - - if ((*name == '*' || *name == '@') && (*(name + 1) == '\0')) - { - struct mi_cmd_var_update data; - - data.only_floating = *name == '@'; - data.print_values = print_values; - - /* varobj_update_one automatically updates all the children of VAROBJ. - Therefore update each VAROBJ only once by iterating only the root - VAROBJs. */ - - all_root_varobjs (mi_cmd_var_update_iter, &data); - } - else - { - /* Get varobj handle, if a valid var obj name was specified */ - struct varobj *var = varobj_get_handle (name); - - varobj_update_one (var, print_values, 1 /* explicit */); - } - - do_cleanups (cleanup); -} - -/* Helper for mi_cmd_var_update(). */ - -static void -varobj_update_one (struct varobj *var, enum print_values print_values, - int explicit) -{ - struct varobj **cc; - struct cleanup *cleanup = NULL; - VEC (varobj_update_result) *changes; - varobj_update_result *r; - int i; - - changes = varobj_update (&var, explicit); - - for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i) - { - char *display_hint; - int from, to; - - if (mi_version (uiout) > 1) - cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_string (uiout, "name", varobj_get_objname (r->varobj)); - - switch (r->status) - { - case VAROBJ_IN_SCOPE: - if (mi_print_value_p (r->varobj, print_values)) - { - char *val = varobj_get_value (r->varobj); - ui_out_field_string (uiout, "value", val); - xfree (val); - } - ui_out_field_string (uiout, "in_scope", "true"); - break; - case VAROBJ_NOT_IN_SCOPE: - ui_out_field_string (uiout, "in_scope", "false"); - break; - case VAROBJ_INVALID: - ui_out_field_string (uiout, "in_scope", "invalid"); - break; - } - - if (r->status != VAROBJ_INVALID) - { - if (r->type_changed) - ui_out_field_string (uiout, "type_changed", "true"); - else - ui_out_field_string (uiout, "type_changed", "false"); - } - - if (r->type_changed) - ui_out_field_string (uiout, "new_type", varobj_get_type (r->varobj)); - - if (r->type_changed || r->children_changed) - ui_out_field_int (uiout, "new_num_children", - varobj_get_num_children (r->varobj)); - - display_hint = varobj_get_display_hint (var); - if (display_hint) - { - ui_out_field_string (uiout, "displayhint", display_hint); - xfree (display_hint); - } - - if (varobj_pretty_printed_p (var)) - ui_out_field_int (uiout, "dynamic", 1); - - varobj_get_child_range (r->varobj, &from, &to); - ui_out_field_int (uiout, "has_more", - varobj_has_more (r->varobj, to)); - - if (r->new) - { - int j; - varobj_p child; - struct cleanup *cleanup; - - cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children"); - for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j) - { - struct cleanup *cleanup_child; - cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - print_varobj (child, print_values, 1 /* print_expression */); - do_cleanups (cleanup_child); - } - - do_cleanups (cleanup); - VEC_free (varobj_p, r->new); - r->new = NULL; /* Paranoia. */ - } - - if (mi_version (uiout) > 1) - do_cleanups (cleanup); - } - VEC_free (varobj_update_result, changes); -} - -void -mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) -{ - if (argc != 0) - error (_("mi_cmd_enable_pretty_printing: no arguments allowed")); - varobj_enable_pretty_printing (); -} - -void -mi_cmd_var_set_update_range (char *command, char **argv, int argc) -{ - struct varobj *var; - int from, to; - - if (argc != 3) - error (_("mi_cmd_var_set_update_range: Usage: VAROBJ FROM TO")); - - var = varobj_get_handle (argv[0]); - from = atoi (argv[1]); - to = atoi (argv[2]); - - varobj_set_child_range (var, from, to); -}
mi-cmd-var.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-cmd-env.c =================================================================== --- mi-cmd-env.c (revision 816) +++ mi-cmd-env.c (nonexistent) @@ -1,279 +0,0 @@ -/* MI Command Set - environment commands. - - Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. - - Contributed by Red Hat Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "inferior.h" -#include "value.h" -#include "mi-out.h" -#include "mi-cmds.h" -#include "mi-getopt.h" -#include "symtab.h" -#include "target.h" -#include "environ.h" -#include "command.h" -#include "ui-out.h" -#include "top.h" - -#include "gdb_string.h" -#include "gdb_stat.h" - -static void env_mod_path (char *dirname, char **which_path); -extern void _initialize_mi_cmd_env (void); - -static const char path_var_name[] = "PATH"; -static char *orig_path = NULL; - -/* The following is copied from mi-main.c so for m1 and below we can - perform old behavior and use cli commands. If ARGS is non-null, - append it to the CMD. */ -static void -env_execute_cli_command (const char *cmd, const char *args) -{ - if (cmd != 0) - { - struct cleanup *old_cleanups; - char *run; - if (args != NULL) - run = xstrprintf ("%s %s", cmd, args); - else - run = xstrdup (cmd); - old_cleanups = make_cleanup (xfree, run); - execute_command ( /*ui */ run, 0 /*from_tty */ ); - do_cleanups (old_cleanups); - return; - } -} - - -/* Print working directory. */ -void -mi_cmd_env_pwd (char *command, char **argv, int argc) -{ - if (argc > 0) - error (_("mi_cmd_env_pwd: No arguments required")); - - if (mi_version (uiout) < 2) - { - env_execute_cli_command ("pwd", NULL); - return; - } - - /* Otherwise the mi level is 2 or higher. */ - - if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) - error (_("mi_cmd_env_pwd: error finding name of working directory: %s"), - safe_strerror (errno)); - - ui_out_field_string (uiout, "cwd", gdb_dirbuf); -} - -/* Change working directory. */ -void -mi_cmd_env_cd (char *command, char **argv, int argc) -{ - if (argc == 0 || argc > 1) - error (_("mi_cmd_env_cd: Usage DIRECTORY")); - - env_execute_cli_command ("cd", argv[0]); -} - -static void -env_mod_path (char *dirname, char **which_path) -{ - if (dirname == 0 || dirname[0] == '\0') - return; - - /* Call add_path with last arg 0 to indicate not to parse for - separator characters. */ - add_path (dirname, which_path, 0); -} - -/* Add one or more directories to start of executable search path. */ -void -mi_cmd_env_path (char *command, char **argv, int argc) -{ - char *exec_path; - char *env; - int reset = 0; - int optind = 0; - int i; - char *optarg; - enum opt - { - RESET_OPT - }; - static struct mi_opt opts[] = - { - {"r", RESET_OPT, 0}, - { 0, 0, 0 } - }; - - dont_repeat (); - - if (mi_version (uiout) < 2) - { - for (i = argc - 1; i >= 0; --i) - env_execute_cli_command ("path", argv[i]); - return; - } - - /* Otherwise the mi level is 2 or higher. */ - while (1) - { - int opt = mi_getopt ("mi_cmd_env_path", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case RESET_OPT: - reset = 1; - break; - } - } - argv += optind; - argc -= optind; - - - if (reset) - { - /* Reset implies resetting to original path first. */ - exec_path = xstrdup (orig_path); - } - else - { - /* Otherwise, get current path to modify. */ - env = get_in_environ (current_inferior ()->environment, path_var_name); - - /* Can be null if path is not set. */ - if (!env) - env = ""; - exec_path = xstrdup (env); - } - - for (i = argc - 1; i >= 0; --i) - env_mod_path (argv[i], &exec_path); - - set_in_environ (current_inferior ()->environment, path_var_name, exec_path); - xfree (exec_path); - env = get_in_environ (current_inferior ()->environment, path_var_name); - ui_out_field_string (uiout, "path", env); -} - -/* Add zero or more directories to the front of the source path. */ -void -mi_cmd_env_dir (char *command, char **argv, int argc) -{ - int i; - int optind = 0; - int reset = 0; - char *optarg; - enum opt - { - RESET_OPT - }; - static struct mi_opt opts[] = - { - {"r", RESET_OPT, 0}, - { 0, 0, 0 } - }; - - dont_repeat (); - - if (mi_version (uiout) < 2) - { - for (i = argc - 1; i >= 0; --i) - env_execute_cli_command ("dir", argv[i]); - return; - } - - /* Otherwise mi level is 2 or higher. */ - while (1) - { - int opt = mi_getopt ("mi_cmd_env_dir", argc, argv, opts, - &optind, &optarg); - if (opt < 0) - break; - switch ((enum opt) opt) - { - case RESET_OPT: - reset = 1; - break; - } - } - argv += optind; - argc -= optind; - - if (reset) - { - /* Reset means setting to default path first. */ - xfree (source_path); - init_source_path (); - } - - for (i = argc - 1; i >= 0; --i) - env_mod_path (argv[i], &source_path); - - ui_out_field_string (uiout, "source-path", source_path); - forget_cached_source_info (); -} - -/* Set the inferior terminal device name. */ -void -mi_cmd_inferior_tty_set (char *command, char **argv, int argc) -{ - set_inferior_io_terminal (argv[0]); -} - -/* Print the inferior terminal device name */ -void -mi_cmd_inferior_tty_show (char *command, char **argv, int argc) -{ - const char *inferior_io_terminal = get_inferior_io_terminal (); - - if ( !mi_valid_noargs ("mi_cmd_inferior_tty_show", argc, argv)) - error (_("mi_cmd_inferior_tty_show: Usage: No args")); - - if (inferior_io_terminal) - ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal); -} - -void -_initialize_mi_cmd_env (void) -{ - struct gdb_environ *environment; - char *env; - - /* We want original execution path to reset to, if desired later. - At this point, current inferior is not created, so cannot use - current_inferior ()->environment. Also, there's no obvious - place where this code can be moved suchs that it surely run - before any code possibly mangles original PATH. */ - environment = make_environ (); - init_environ (environment); - env = get_in_environ (environment, path_var_name); - - /* Can be null if path is not set. */ - if (!env) - env = ""; - orig_path = xstrdup (env); -}
mi-cmd-env.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-main.h =================================================================== --- mi-main.h (revision 816) +++ mi-main.h (nonexistent) @@ -1,37 +0,0 @@ -/* MI Internal Functions for GDB, the GNU debugger. - - Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef MI_MAIN_H -#define MI_MAIN_H - -extern void mi_load_progress (const char *section_name, - unsigned long sent_so_far, - unsigned long total_section, - unsigned long total_sent, - unsigned long grand_total); - -extern void mi_print_timing_maybe (void); - -extern char *current_token; - -extern int running_result_record_printed; -extern int mi_proceeded; - -#endif -
mi-main.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property Index: mi-symbol-cmds.c =================================================================== --- mi-symbol-cmds.c (revision 816) +++ mi-symbol-cmds.c (nonexistent) @@ -1,66 +0,0 @@ -/* MI Command Set - symbol commands. - Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include "defs.h" -#include "mi-cmds.h" -#include "symtab.h" -#include "objfiles.h" -#include "ui-out.h" - -/* SYMBOL-LIST-LINES: - - Print the list of all pc addresses and lines of code for - the provided (full or base) source file name. The entries - are sorted in ascending PC order. */ - -void -mi_cmd_symbol_list_lines (char *command, char **argv, int argc) -{ - struct gdbarch *gdbarch; - char *filename; - struct symtab *s; - int i; - struct cleanup *cleanup_stack, *cleanup_tuple; - - if (argc != 1) - error (_("mi_cmd_symbol_list_lines: Usage: SOURCE_FILENAME")); - - filename = argv[0]; - s = lookup_symtab (filename); - - if (s == NULL) - error (_("mi_cmd_symbol_list_lines: Unknown source file name.")); - - /* Now, dump the associated line table. The pc addresses are already - sorted by increasing values in the symbol table, so no need to - perform any other sorting. */ - - gdbarch = get_objfile_arch (s->objfile); - cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines"); - - if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0) - for (i = 0; i < LINETABLE (s)->nitems; i++) - { - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_core_addr (uiout, "pc", gdbarch, LINETABLE (s)->item[i].pc); - ui_out_field_int (uiout, "line", LINETABLE (s)->item[i].line); - do_cleanups (cleanup_tuple); - } - - do_cleanups (cleanup_stack); -}
mi-symbol-cmds.c Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.