diff options
author | Joel Brobecker <brobecker@gnat.com> | 2003-05-04 03:50:13 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2003-05-04 03:50:13 +0000 |
commit | 0d18235fb6cefd77bcb3645f3d334802452e693f (patch) | |
tree | 0185020a98b094332e2078baee12f1294ac560d9 /gdb | |
parent | 630446347239f042ffcacd56e2fb054a55c5c3ee (diff) | |
download | gdb-0d18235fb6cefd77bcb3645f3d334802452e693f.zip gdb-0d18235fb6cefd77bcb3645f3d334802452e693f.tar.gz gdb-0d18235fb6cefd77bcb3645f3d334802452e693f.tar.bz2 |
From Thierry Schneider <tpschneider1@yahoo.com>:
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/mi/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-symbol.c | 67 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.c | 1 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 1 |
4 files changed, 77 insertions, 0 deletions
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 73b4975..765143d 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,11 @@ +2003-05-03 J. Brobecker <brobecker@gnat.com> + + From Thierry Schneider <tpschneider1@yahoo.com>: + * 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 <bob_rossi@cox.net> * mi-cmd-file.c: New file to implement mi file commands. diff --git a/gdb/mi/mi-cmd-symbol.c b/gdb/mi/mi-cmd-symbol.c new file mode 100644 index 0000000..1d86d21 --- /dev/null +++ b/gdb/mi/mi-cmd-symbol.c @@ -0,0 +1,67 @@ +/* MI Command Set - symbol commands. + Copyright 2003 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "mi-cmds.h" +#include "symtab.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. */ + +enum mi_cmd_result +mi_cmd_symbol_list_lines (char *command, char **argv, int argc) +{ + 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. */ + + 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", LINETABLE (s)->item[i].pc); + ui_out_field_int (uiout, "line", LINETABLE (s)->item[i].line); + do_cleanups (cleanup_tuple); + } + + do_cleanups (cleanup_stack); + + return MI_CMD_DONE; +} diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index d677842..9ec174f 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -119,6 +119,7 @@ struct mi_cmd mi_cmds[] = {"symbol-info-line", 0, 0}, {"symbol-info-symbol", 0, 0}, {"symbol-list-functions", 0, 0}, + {"symbol-list-lines", 0, 0, mi_cmd_symbol_list_lines}, {"symbol-list-types", 0, 0}, {"symbol-list-variables", 0, 0}, {"symbol-locate", 0, 0}, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 47e1bbf..b0c8cb8 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -88,6 +88,7 @@ extern mi_cmd_argv_ftype mi_cmd_stack_list_args; extern mi_cmd_argv_ftype mi_cmd_stack_list_frames; extern mi_cmd_argv_ftype mi_cmd_stack_list_locals; extern mi_cmd_argv_ftype mi_cmd_stack_select_frame; +extern mi_cmd_argv_ftype mi_cmd_symbol_list_lines; extern mi_cmd_args_ftype mi_cmd_target_download; extern mi_cmd_args_ftype mi_cmd_target_select; extern mi_cmd_argv_ftype mi_cmd_thread_list_ids; |