* [RFA] new GDB/MI command: -symbol-info-linetable
@ 2003-03-10 2:19 Thierry Schneider
2003-03-10 4:30 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Thierry Schneider @ 2003-03-10 2:19 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]
Hello,
To follow a suggestion made by Joel in this message:
http://sources.redhat.com/ml/gdb-patches/2003-03/msg00000.html
I have implemented in a new command that dumps the linetable
for a given source file. As recommended, I have made it a GDB/MI
command, intead of a CLI command.
Here is an example (from the documentation I wrote) of this command in
action:
(gdb)
-symbol-info-linetable basics.c
^done,linetable=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
(gdb)
Here is the ChangeLog:
2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
* mi-main.c (mi_cmd_symbol_info_linetable): New function.
* mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
* mi-cmds.c (mi_cmds): Add entry for new MI command.
* gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
new MI command.
Regarding new mi_cmd_symbol_info_linetable(), I think it should be
located in a new file, named mi-cmd-symbol.c. For the moment, I took
a simpler approach (less changes required) of putting it in mi-main.c,
which seems to be hosting a few orphan command implementations. But
I can certainly modify this patch to add this new file.
I have also created a small testcase in gdb.mi:
2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
* mi1-linetable.exp: New file.
I unfortunately do not have a valid FSF assignement on file, yet.
I have sent my application to the FSF, and I am waiting for the papers
to arrive by mail.
FYI: Since I do not have the priviledge to commit these changes myself
if/when they are approved, Joel Brobecker has offered to do it for me.
Finally, those of us who are still using GDB 5.3 won't be able to use
this MI command from the CLI, since the interpreter command has been
implemented after 5.3 has been released. For these people, I hacked
a CLI command "-symbol-info-linetable" which produces the exact same
output than the equivalent MI command. This will certainly be useful
to the GVD developpers :-). The patch to source.c is attached.
Thierry S.
(GDB newbie)
[-- Attachment #2: symbol-info-linetable.diff --]
[-- Type: text/plain, Size: 3319 bytes --]
Index: mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.7
diff -c -3 -p -r1.7 mi-cmds.h
*** mi-cmds.h 6 Feb 2003 01:19:12 -0000 1.7
--- mi-cmds.h 10 Mar 2003 00:21:50 -0000
*************** extern mi_cmd_argv_ftype mi_cmd_stack_li
*** 87,92 ****
--- 87,93 ----
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_info_linetable;
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;
Index: mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 mi-cmds.c
*** mi-cmds.c 6 Feb 2003 01:19:12 -0000 1.10
--- mi-cmds.c 10 Mar 2003 00:21:50 -0000
*************** struct mi_cmd mi_cmds[] =
*** 116,121 ****
--- 116,122 ----
{"symbol-info-file", 0, 0},
{"symbol-info-function", 0, 0},
{"symbol-info-line", 0, 0},
+ {"symbol-info-linetable", 0, 0, mi_cmd_symbol_info_linetable},
{"symbol-info-symbol", 0, 0},
{"symbol-list-functions", 0, 0},
{"symbol-list-types", 0, 0},
Index: mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.41
diff -c -3 -p -r1.41 mi-main.c
*** mi-main.c 1 Mar 2003 17:03:19 -0000 1.41
--- mi-main.c 10 Mar 2003 00:21:50 -0000
*************** mi_cmd_data_write_memory (char *command,
*** 1070,1075 ****
--- 1070,1127 ----
return MI_CMD_DONE;
}
+ /* SYMBOL-INFO-LINETABLE:
+
+ Print the table 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_info_linetable (char *command, char **argv, int argc)
+ {
+ char *filename;
+ struct symtab *s;
+ int i;
+ struct cleanup *cleanup_stack, *cleanup_tuple;
+
+ if (argc != 1)
+ {
+ xasprintf (&mi_error_message,
+ "Usage: %s filename.", command);
+ return MI_CMD_ERROR;
+ }
+
+ filename = argv[0];
+
+ s = lookup_symtab (filename);
+
+ if (s == NULL)
+ {
+ xasprintf (&mi_error_message,
+ "Unknown source file: '%s'", filename);
+ return MI_CMD_ERROR;
+ }
+
+ /* 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, "linetable");
+
+ 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;
+ }
+
/* Execute a command within a safe environment.
Return <0 for error; >=0 for ok.
[-- Attachment #3: gdbmi.texinfo.diff --]
[-- Type: text/plain, Size: 1101 bytes --]
Index: gdbmi.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
retrieving revision 1.33
diff -c -3 -r1.33 gdbmi.texinfo
*** gdbmi.texinfo 4 Feb 2003 18:41:29 -0000 1.33
--- gdbmi.texinfo 10 Mar 2003 01:25:21 -0000
***************
*** 2998,3003 ****
--- 2998,3029 ----
N.A.
+ @subheading The @code{-symbol-info-linetable} Command
+ @findex -symbol-info-linetable
+
+ @subsubheading Synopsis
+
+ @example
+ -symbol-info-linetable @var{filename}
+ @end example
+
+ Print the list of lines that contain code and their associated program
+ addresses for the given source filename. The entries are sorted in
+ ascending PC order.
+
+ @subsubheading @value{GDBN} Command
+
+ There is no corresponding @value{GDBN} comamnd.
+
+ @subsubheading Example
+ @smallexample
+ (@value{GDBP})
+ -symbol-info-linetable basics.c
+ ^done,linetable=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
+ (@value{GDBP})
+ @end smallexample
+
+
@subheading The @code{-symbol-info-symbol} Command
@findex -symbol-info-symbol
[-- Attachment #4: mi1-linetable.exp --]
[-- Type: text/plain, Size: 1949 bytes --]
# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
# 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.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
#
# Test Machine interface (MI) operations for disassembly.
#
# The goal is not to test gdb functionality, which is done by other tests,
# but to verify the correct output response to MI operations.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "basics"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
proc test_linetable {} {
global mi_gdb_prompt
global hex
global decimal
# Test linetable.
# Tests:
# -symbol-info-linetable basics.c
mi_gdb_test "-symbol-info-linetable basics.c" \
"\\^done,linetable=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
"symbol-info-linetable for source file basics.c"
}
test_linetable
mi_gdb_exit
return 0
[-- Attachment #5: source.c.diff --]
[-- Type: text/plain, Size: 2003 bytes --]
Index: source.c
===================================================================
RCS file: /nile.c/cvs/Dev/gdb/gdb-5.3/gdb/source.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 source.c
*** source.c 16 Jan 2003 10:40:07 -0000 1.2
--- source.c 10 Mar 2003 01:41:30 -0000
*************** line_info (char *arg, int from_tty)
*** 1438,1443 ****
--- 1438,1477 ----
xfree (sals.sals);
}
\f
+
+ /* Print the table of all pc addresses and lines of code
+ for the provided (full or base) source file name. */
+
+ static void
+ symbol_info_linetable_command (char *arg, int from_tty)
+ {
+ char *filename = arg;
+ struct symtab *s;
+ int i;
+
+ if (filename == NULL)
+ error ("Missing source file name");
+
+ s = lookup_symtab (filename);
+
+ if (s == NULL)
+ error ("Unknown source file");
+
+ printf_filtered ("^done,linetable=[");
+
+ if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0)
+ for (i = 0; i < LINETABLE (s)->nitems; i++)
+ {
+ printf_filtered ("{pc=\"");
+ print_address_numeric (LINETABLE (s)->item[i].pc, 1, gdb_stdout);
+ printf_filtered ("\",line=\"%d\"}", LINETABLE (s)->item[i].line);
+ if (i != LINETABLE (s)->nitems - 1)
+ printf_filtered (",");
+ }
+
+ printf_filtered ("]\n");
+ }
+
/* Commands to search the source file for a regexp. */
/* ARGSUSED */
*************** Default is to describe the last source l
*** 1684,1689 ****
--- 1718,1726 ----
This sets the default address for \"x\" to the line's first instruction\n\
so that \"x/i\" suffices to start examining the machine code.\n\
The address is also stored as the value of \"$_\".", NULL));
+
+ add_cmd ("-symbol-info-linetable", no_class, symbol_info_linetable_command,
+ "Print the line table for a given source file.", &cmdlist);
add_com ("forward-search", class_files, forward_search_command,
"Search for regular expression (see regex(3)) from last line listed.\n\
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-03-10 2:19 [RFA] new GDB/MI command: -symbol-info-linetable Thierry Schneider
@ 2003-03-10 4:30 ` Eli Zaretskii
2003-03-31 4:22 ` [RFA/ping] " Thierry Schneider
2003-04-14 16:49 ` [RFA] " Elena Zannoni
2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2003-03-10 4:30 UTC (permalink / raw)
To: tpschneider1; +Cc: gdb-patches
> Date: Sun, 9 Mar 2003 18:19:23 -0800
> From: Thierry Schneider <tpschneider1@yahoo.com>
>
> I have implemented in a new command that dumps the linetable
> for a given source file. As recommended, I have made it a GDB/MI
> command, intead of a CLI command.
>
> Here is an example (from the documentation I wrote) of this command in
> action:
>
> (gdb)
> -symbol-info-linetable basics.c
> ^done,linetable=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
> (gdb)
>
> Here is the ChangeLog:
>
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi-main.c (mi_cmd_symbol_info_linetable): New function.
> * mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
> * mi-cmds.c (mi_cmds): Add entry for new MI command.
> * gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
> new MI command.
The doco part is okay, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA/ping] new GDB/MI command: -symbol-info-linetable
2003-03-10 2:19 [RFA] new GDB/MI command: -symbol-info-linetable Thierry Schneider
2003-03-10 4:30 ` Eli Zaretskii
@ 2003-03-31 4:22 ` Thierry Schneider
2003-04-09 20:23 ` Joel Brobecker
2003-04-14 16:49 ` [RFA] " Elena Zannoni
2 siblings, 1 reply; 12+ messages in thread
From: Thierry Schneider @ 2003-03-31 4:22 UTC (permalink / raw)
To: Thierry Schneider; +Cc: gdb-patches
Hello,
> I unfortunately do not have a valid FSF assignement on file, yet.
> I have sent my application to the FSF, and I am waiting for the papers
> to arrive by mail.
First, I am pleased to announce that I now have an FSF assignment
on file.
Could a maintainer review the following change that I submitted
sometime ago, please? I also noted that somebody else (Bob Rossi)
found this new (MI) function useful.
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi-main.c (mi_cmd_symbol_info_linetable): New function.
> * mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
> * mi-cmds.c (mi_cmds): Add entry for new MI command.
> * gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
> new MI command.
>
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi1-linetable.exp: New file.
The message quoted above is at:
http://sources.redhat.com/ml/gdb-patches/2003-03/msg00208.html
Thank you,
--
Thierry S.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA/ping] new GDB/MI command: -symbol-info-linetable
2003-03-31 4:22 ` [RFA/ping] " Thierry Schneider
@ 2003-04-09 20:23 ` Joel Brobecker
2003-04-09 20:38 ` Bob Rossi
0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2003-04-09 20:23 UTC (permalink / raw)
To: gdb-patches; +Cc: Thierry Schneider
Hello,
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi-main.c (mi_cmd_symbol_info_linetable): New function.
> * mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
> * mi-cmds.c (mi_cmds): Add entry for new MI command.
> * gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
> new MI command.
I was wondering if an MI maintainer could have a look at this patch,
as it would be very useful for GVD. I think cgdb will also appreciate
it.
There are 2 aspects in this patch:
1. The new user command, its name and syntax
2. The implementation itself
If at least we could agree on 1, both GVD and cgdb could move forward
while we work on the implementation side if there is any issue with
it...
The patch with its documentation was posted in the following message:
http://sources.redhat.com/ml/gdb-patches/2003-03/msg00208.html
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA/ping] new GDB/MI command: -symbol-info-linetable
2003-04-09 20:23 ` Joel Brobecker
@ 2003-04-09 20:38 ` Bob Rossi
0 siblings, 0 replies; 12+ messages in thread
From: Bob Rossi @ 2003-04-09 20:38 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches, Thierry Schneider
On Wed, Apr 09, 2003 at 04:23:37PM -0400, Joel Brobecker wrote:
> Hello,
>
> > 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
> >
> > * mi-main.c (mi_cmd_symbol_info_linetable): New function.
> > * mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
> > * mi-cmds.c (mi_cmds): Add entry for new MI command.
> > * gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
> > new MI command.
The MI documentation gdbmi.texinfo was merged to gdb/doc/gdb.texinfo and
the format changed. You'll probably get told to fix that. Just happened to
me. :)
> I was wondering if an MI maintainer could have a look at this patch,
> as it would be very useful for GVD. I think cgdb will also appreciate
> it.
>
> There are 2 aspects in this patch:
> 1. The new user command, its name and syntax
> 2. The implementation itself
>
> If at least we could agree on 1, both GVD and cgdb could move forward
> while we work on the implementation side if there is any issue with
> it...
>
> The patch with its documentation was posted in the following message:
>
> http://sources.redhat.com/ml/gdb-patches/2003-03/msg00208.html
>
> Thanks,
> --
> Joel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-03-10 2:19 [RFA] new GDB/MI command: -symbol-info-linetable Thierry Schneider
2003-03-10 4:30 ` Eli Zaretskii
2003-03-31 4:22 ` [RFA/ping] " Thierry Schneider
@ 2003-04-14 16:49 ` Elena Zannoni
2003-04-19 2:49 ` Thierry Schneider
2 siblings, 1 reply; 12+ messages in thread
From: Elena Zannoni @ 2003-04-14 16:49 UTC (permalink / raw)
To: Thierry Schneider; +Cc: gdb-patches
Thierry Schneider writes:
> Hello,
>
> To follow a suggestion made by Joel in this message:
> http://sources.redhat.com/ml/gdb-patches/2003-03/msg00000.html
>
> I have implemented in a new command that dumps the linetable
> for a given source file. As recommended, I have made it a GDB/MI
> command, intead of a CLI command.
>
> Here is an example (from the documentation I wrote) of this command in
> action:
>
> (gdb)
> -symbol-info-linetable basics.c
> ^done,linetable=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
> (gdb)
>
> Here is the ChangeLog:
>
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi-main.c (mi_cmd_symbol_info_linetable): New function.
> * mi-cmds.h (mi_cmd_symbol_info_linetable): Add declaration.
> * mi-cmds.c (mi_cmds): Add entry for new MI command.
> * gdbmi.texinfo (GDB/MI Symbol Query): Add documentation for
> new MI command.
>
> Regarding new mi_cmd_symbol_info_linetable(), I think it should be
> located in a new file, named mi-cmd-symbol.c. For the moment, I took
> a simpler approach (less changes required) of putting it in mi-main.c,
> which seems to be hosting a few orphan command implementations. But
> I can certainly modify this patch to add this new file.
>
I would like to start a new mi-cmd-symbol.c file, if we decide to have
the new command in the symbol category.
> I have also created a small testcase in gdb.mi:
>
> 2003-03-09 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi1-linetable.exp: New file.
>
> I unfortunately do not have a valid FSF assignement on file, yet.
> I have sent my application to the FSF, and I am waiting for the papers
> to arrive by mail.
>
I think this has been sorted out now, right?
Approved, but see below for a few issues, mainly the name of the command....
> FYI: Since I do not have the priviledge to commit these changes myself
> if/when they are approved, Joel Brobecker has offered to do it for me.
>
> Finally, those of us who are still using GDB 5.3 won't be able to use
> this MI command from the CLI, since the interpreter command has been
> implemented after 5.3 has been released. For these people, I hacked
> a CLI command "-symbol-info-linetable" which produces the exact same
> output than the equivalent MI command. This will certainly be useful
> to the GVD developpers :-). The patch to source.c is attached.
>
> Thierry S.
> (GDB newbie)
> Index: mi-cmds.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
> retrieving revision 1.7
> diff -c -3 -p -r1.7 mi-cmds.h
> *** mi-cmds.h 6 Feb 2003 01:19:12 -0000 1.7
> --- mi-cmds.h 10 Mar 2003 00:21:50 -0000
> *************** extern mi_cmd_argv_ftype mi_cmd_stack_li
> *** 87,92 ****
> --- 87,93 ----
> 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_info_linetable;
> 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;
> Index: mi-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
> retrieving revision 1.10
> diff -c -3 -p -r1.10 mi-cmds.c
> *** mi-cmds.c 6 Feb 2003 01:19:12 -0000 1.10
> --- mi-cmds.c 10 Mar 2003 00:21:50 -0000
> *************** struct mi_cmd mi_cmds[] =
> *** 116,121 ****
> --- 116,122 ----
> {"symbol-info-file", 0, 0},
> {"symbol-info-function", 0, 0},
> {"symbol-info-line", 0, 0},
> + {"symbol-info-linetable", 0, 0, mi_cmd_symbol_info_linetable},
> {"symbol-info-symbol", 0, 0},
> {"symbol-list-functions", 0, 0},
> {"symbol-list-types", 0, 0},
I wonder if it would be more pertinent to call it symbol-list-lines
or make it part of the file commands, even though the distinction is blurry.
> Index: mi-main.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
> retrieving revision 1.41
> diff -c -3 -p -r1.41 mi-main.c
> *** mi-main.c 1 Mar 2003 17:03:19 -0000 1.41
> --- mi-main.c 10 Mar 2003 00:21:50 -0000
> *************** mi_cmd_data_write_memory (char *command,
> *** 1070,1075 ****
> --- 1070,1127 ----
> return MI_CMD_DONE;
> }
>
> + /* SYMBOL-INFO-LINETABLE:
> +
> + Print the table 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_info_linetable (char *command, char **argv, int argc)
> + {
> + char *filename;
> + struct symtab *s;
> + int i;
> + struct cleanup *cleanup_stack, *cleanup_tuple;
> +
> + if (argc != 1)
> + {
> + xasprintf (&mi_error_message,
> + "Usage: %s filename.", command);
> + return MI_CMD_ERROR;
> + }
> +
> + filename = argv[0];
> +
> + s = lookup_symtab (filename);
> +
> + if (s == NULL)
> + {
> + xasprintf (&mi_error_message,
> + "Unknown source file: '%s'", filename);
> + return MI_CMD_ERROR;
> + }
> +
> + /* 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, "linetable");
> +
> + 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;
> + }
> +
> /* Execute a command within a safe environment.
> Return <0 for error; >=0 for ok.
>
> Index: gdbmi.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
> retrieving revision 1.33
> diff -c -3 -r1.33 gdbmi.texinfo
> *** gdbmi.texinfo 4 Feb 2003 18:41:29 -0000 1.33
> --- gdbmi.texinfo 10 Mar 2003 01:25:21 -0000
> ***************
> *** 2998,3003 ****
> --- 2998,3029 ----
> N.A.
>
>
> + @subheading The @code{-symbol-info-linetable} Command
> + @findex -symbol-info-linetable
> +
> + @subsubheading Synopsis
> +
> + @example
> + -symbol-info-linetable @var{filename}
> + @end example
> +
> + Print the list of lines that contain code and their associated program
> + addresses for the given source filename. The entries are sorted in
> + ascending PC order.
> +
> + @subsubheading @value{GDBN} Command
> +
> + There is no corresponding @value{GDBN} comamnd.
> +
> + @subsubheading Example
> + @smallexample
> + (@value{GDBP})
> + -symbol-info-linetable basics.c
> + ^done,linetable=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
> + (@value{GDBP})
> + @end smallexample
> +
> +
> @subheading The @code{-symbol-info-symbol} Command
> @findex -symbol-info-symbol
>
> # Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
>
Copyright year is just 2003.
> # 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.
>
> # Please email any bugs, comments, and/or additions to this file to:
> # bug-gdb@prep.ai.mit.edu
>
> #
> # Test Machine interface (MI) operations for disassembly.
> #
> # The goal is not to test gdb functionality, which is done by other tests,
> # but to verify the correct output response to MI operations.
> #
>
> load_lib mi-support.exp
> set MIFLAGS "-i=mi1"
>
> gdb_exit
> if [mi_gdb_start] {
> continue
> }
>
> set testfile "basics"
> set srcfile ${testfile}.c
> set binfile ${objdir}/${subdir}/${testfile}
> if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
> gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
> }
>
> mi_delete_breakpoints
> mi_gdb_reinitialize_dir $srcdir/$subdir
> mi_gdb_load ${binfile}
>
Use mi_run_to_main which does all of the above for you. I know you
don't need a running program, but, might as well.
> proc test_linetable {} {
> global mi_gdb_prompt
> global hex
> global decimal
>
> # Test linetable.
> # Tests:
> # -symbol-info-linetable basics.c
>
> mi_gdb_test "-symbol-info-linetable basics.c" \
Don't use basics.c, use ${srcfile}.
> "\\^done,linetable=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
> "symbol-info-linetable for source file basics.c"
>
Same here.
> }
>
> test_linetable
>
> mi_gdb_exit
> return 0
Ok otherwise.
The below shouldn't be committed.
> Index: source.c
> ===================================================================
> RCS file: /nile.c/cvs/Dev/gdb/gdb-5.3/gdb/source.c,v
> retrieving revision 1.2
> diff -c -3 -p -r1.2 source.c
> *** source.c 16 Jan 2003 10:40:07 -0000 1.2
> --- source.c 10 Mar 2003 01:41:30 -0000
> *************** line_info (char *arg, int from_tty)
> *** 1438,1443 ****
> --- 1438,1477 ----
> xfree (sals.sals);
> }
> \f
> +
> + /* Print the table of all pc addresses and lines of code
> + for the provided (full or base) source file name. */
> +
> + static void
> + symbol_info_linetable_command (char *arg, int from_tty)
> + {
> + char *filename = arg;
> + struct symtab *s;
> + int i;
> +
> + if (filename == NULL)
> + error ("Missing source file name");
> +
> + s = lookup_symtab (filename);
> +
> + if (s == NULL)
> + error ("Unknown source file");
> +
> + printf_filtered ("^done,linetable=[");
> +
> + if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0)
> + for (i = 0; i < LINETABLE (s)->nitems; i++)
> + {
> + printf_filtered ("{pc=\"");
> + print_address_numeric (LINETABLE (s)->item[i].pc, 1, gdb_stdout);
> + printf_filtered ("\",line=\"%d\"}", LINETABLE (s)->item[i].line);
> + if (i != LINETABLE (s)->nitems - 1)
> + printf_filtered (",");
> + }
> +
> + printf_filtered ("]\n");
> + }
> +
> /* Commands to search the source file for a regexp. */
>
> /* ARGSUSED */
> *************** Default is to describe the last source l
> *** 1684,1689 ****
> --- 1718,1726 ----
> This sets the default address for \"x\" to the line's first instruction\n\
> so that \"x/i\" suffices to start examining the machine code.\n\
> The address is also stored as the value of \"$_\".", NULL));
> +
> + add_cmd ("-symbol-info-linetable", no_class, symbol_info_linetable_command,
> + "Print the line table for a given source file.", &cmdlist);
>
> add_com ("forward-search", class_files, forward_search_command,
> "Search for regular expression (see regex(3)) from last line listed.\n\
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-04-14 16:49 ` [RFA] " Elena Zannoni
@ 2003-04-19 2:49 ` Thierry Schneider
2003-04-19 8:06 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Thierry Schneider @ 2003-04-19 2:49 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Thierry Schneider, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
Elena,
Thank you for reviewing my changes and for the constructive feedback.
I have incorporated all your suggestions, as well as the one from Bob
Rossi who kindly informed me that the MI documentation had been merged
gdb/doc/gdb.texinfo, and this is where I added my new documentation.
Here is the updated ChangeLog:
2003-04-18 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-18 Thierry Schneider <tpschneider1@yahoo.com>
* gdb.texinfo (section GDB/MI Symbol Query): Add documentation
for new MI command.
2003-04-18 Thierry Schneider <tpschneider1@yahoo.com>
* mi1-symbol.exp (-symbol-list-lines): New test file to
validate all symbol-related commands
> > I unfortunately do not have a valid FSF assignement on file, yet.
> > I have sent my application to the FSF, and I am waiting for the papers
> > to arrive by mail.
> >
>
> I think this has been sorted out now, right?
Yes, I now have an FSF assignment on file.
Thierry S.
[-- Attachment #2: all_diffs --]
[-- Type: text/plain, Size: 4464 bytes --]
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.364
diff -c -3 -p -r1.364 Makefile.in
*** Makefile.in 15 Apr 2003 23:07:11 -0000 1.364
--- Makefile.in 19 Apr 2003 02:18:04 -0000
*************** SUBDIR_CLI_UNINSTALL=
*** 168,181 ****
SUBDIR_MI_OBS = \
mi-out.o mi-console.o \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
! mi-cmd-file.o mi-cmd-disas.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
! mi/mi-cmd-file.c mi/mi-cmd-disas.c \
mi/mi-interp.c \
mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
--- 168,181 ----
SUBDIR_MI_OBS = \
mi-out.o mi-console.o \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
! mi-cmd-file.o mi-cmd-disas.o mi-cmd-symbol.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
! mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-cmd-symbol.c \
mi/mi-interp.c \
mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
*************** mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c
*** 2566,2571 ****
--- 2566,2574 ----
mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
$(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
+ mi-cmd-symbol.o: $(srcdir)/mi/mi-cmd-symbol.c $(defs_h) \
+ $(mi_cmds_h) $(ui_out_h) $(symtab_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-symbol.c
mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
$(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-var.c
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.156
diff -c -3 -p -r1.156 gdb.texinfo
*** doc/gdb.texinfo 14 Apr 2003 18:42:28 -0000 1.156
--- doc/gdb.texinfo 19 Apr 2003 02:18:18 -0000
*************** List the functions in the executable.
*** 17117,17122 ****
--- 17117,17148 ----
N.A.
+ @subheading The @code{-symbol-list-lines} Command
+ @findex -symbol-list-lines
+
+ @subsubheading Synopsis
+
+ @smallexample
+ -symbol-list-lines @var{filename}
+ @end smallexample
+
+ Print the list of lines that contain code and their associated program
+ addresses for the given source filename. The entries are sorted in
+ ascending PC order.
+
+ @subsubheading @value{GDBN} Command
+
+ There is no corresponding @value{GDBN} command.
+
+ @subsubheading Example
+ @smallexample
+ (@value{GDBP})
+ -symbol-list-lines basics.c
+ ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
+ (@value{GDBP})
+ @end smallexample
+
+
@subheading The @code{-symbol-list-types} Command
@findex -symbol-list-types
Index: mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 mi-cmds.c
*** mi/mi-cmds.c 2 Apr 2003 22:10:35 -0000 1.11
--- mi/mi-cmds.c 19 Apr 2003 02:18:18 -0000
*************** struct mi_cmd mi_cmds[] =
*** 119,124 ****
--- 119,125 ----
{"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},
Index: mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.8
diff -c -3 -p -r1.8 mi-cmds.h
*** mi/mi-cmds.h 2 Apr 2003 22:10:35 -0000 1.8
--- mi/mi-cmds.h 19 Apr 2003 02:18:18 -0000
*************** extern mi_cmd_argv_ftype mi_cmd_stack_li
*** 88,93 ****
--- 88,94 ----
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;
[-- Attachment #3: mi-cmd-symbol.c --]
[-- Type: text/x-csrc, Size: 2176 bytes --]
/* 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;
}
[-- Attachment #4: mi1-symbol.exp --]
[-- Type: text/plain, Size: 1820 bytes --]
# Copyright 2003 Free Software Foundation, Inc.
# 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.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
#
# The goal is not to test gdb functionality, which is done by other tests,
# but to verify the correct output response to MI operations.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "basics"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
mi_run_to_main
proc test_list_lines {} {
global mi_gdb_prompt
global hex
global decimal
global srcfile
# Test list-lines.
# Tests:
# -symbol-list-lines ${srcfile}
mi_gdb_test "-symbol-list-lines ${srcfile}" \
"\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
"symbol-list-lines for source file ${srcfile}"
}
test_list_lines
mi_gdb_exit
return 0
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-04-19 2:49 ` Thierry Schneider
@ 2003-04-19 8:06 ` Eli Zaretskii
2003-04-22 14:25 ` Elena Zannoni
2003-05-16 17:58 ` [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable Thierry Schneider
2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2003-04-19 8:06 UTC (permalink / raw)
To: tpschneider1; +Cc: ezannoni, tpschneider1, gdb-patches
> Date: Fri, 18 Apr 2003 19:49:44 -0700
> From: Thierry Schneider <tpschneider1@yahoo.com>
>
> Thank you for reviewing my changes and for the constructive feedback.
> I have incorporated all your suggestions, as well as the one from Bob
> Rossi who kindly informed me that the MI documentation had been merged
> gdb/doc/gdb.texinfo, and this is where I added my new documentation.
>
> Here is the updated ChangeLog:
>
> 2003-04-18 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-18 Thierry Schneider <tpschneider1@yahoo.com>
>
> * gdb.texinfo (section GDB/MI Symbol Query): Add documentation
> for new MI command.
>
> 2003-04-18 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi1-symbol.exp (-symbol-list-lines): New test file to
> validate all symbol-related commands
The patch for gdb.texinfo is okay with me.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-04-19 2:49 ` Thierry Schneider
2003-04-19 8:06 ` Eli Zaretskii
@ 2003-04-22 14:25 ` Elena Zannoni
2003-05-04 4:05 ` Joel Brobecker
2003-05-16 17:58 ` [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable Thierry Schneider
2 siblings, 1 reply; 12+ messages in thread
From: Elena Zannoni @ 2003-04-22 14:25 UTC (permalink / raw)
To: Thierry Schneider; +Cc: Elena Zannoni, gdb-patches
Thierry Schneider writes:
>
> Elena,
>
> Thank you for reviewing my changes and for the constructive feedback.
> I have incorporated all your suggestions, as well as the one from Bob
> Rossi who kindly informed me that the MI documentation had been merged
> gdb/doc/gdb.texinfo, and this is where I added my new documentation.
>
Ok, I just realized that you also need a gdb.mi/mi-symbol.exp file,
which will use set MIFLAGS "-i=mi" instead of set MIFLAGS "-i=mi1".
You may have to update some of the test output as well.
Post that new file as well.
the rest is ok.
elena
> Here is the updated ChangeLog:
>
> 2003-04-18 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-18 Thierry Schneider <tpschneider1@yahoo.com>
>
> * gdb.texinfo (section GDB/MI Symbol Query): Add documentation
> for new MI command.
>
> 2003-04-18 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi1-symbol.exp (-symbol-list-lines): New test file to
> validate all symbol-related commands
>
> > > I unfortunately do not have a valid FSF assignement on file, yet.
> > > I have sent my application to the FSF, and I am waiting for the papers
> > > to arrive by mail.
> > >
> >
> > I think this has been sorted out now, right?
>
> Yes, I now have an FSF assignment on file.
>
> Thierry S.
> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.364
> diff -c -3 -p -r1.364 Makefile.in
> *** Makefile.in 15 Apr 2003 23:07:11 -0000 1.364
> --- Makefile.in 19 Apr 2003 02:18:04 -0000
> *************** SUBDIR_CLI_UNINSTALL=
> *** 168,181 ****
> SUBDIR_MI_OBS = \
> mi-out.o mi-console.o \
> mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
> ! mi-cmd-file.o mi-cmd-disas.o \
> mi-interp.o \
> mi-main.o mi-parse.o mi-getopt.o
> SUBDIR_MI_SRCS = \
> mi/mi-out.c mi/mi-console.c \
> mi/mi-cmds.c mi/mi-cmd-env.c \
> mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
> ! mi/mi-cmd-file.c mi/mi-cmd-disas.c \
> mi/mi-interp.c \
> mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
> SUBDIR_MI_DEPS =
> --- 168,181 ----
> SUBDIR_MI_OBS = \
> mi-out.o mi-console.o \
> mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
> ! mi-cmd-file.o mi-cmd-disas.o mi-cmd-symbol.o \
> mi-interp.o \
> mi-main.o mi-parse.o mi-getopt.o
> SUBDIR_MI_SRCS = \
> mi/mi-out.c mi/mi-console.c \
> mi/mi-cmds.c mi/mi-cmd-env.c \
> mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
> ! mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-cmd-symbol.c \
> mi/mi-interp.c \
> mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
> SUBDIR_MI_DEPS =
> *************** mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c
> *** 2566,2571 ****
> --- 2566,2574 ----
> mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
> $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h)
> $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
> + mi-cmd-symbol.o: $(srcdir)/mi/mi-cmd-symbol.c $(defs_h) \
> + $(mi_cmds_h) $(ui_out_h) $(symtab_h)
> + $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-symbol.c
> mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
> $(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h)
> $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-var.c
> Index: doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.156
> diff -c -3 -p -r1.156 gdb.texinfo
> *** doc/gdb.texinfo 14 Apr 2003 18:42:28 -0000 1.156
> --- doc/gdb.texinfo 19 Apr 2003 02:18:18 -0000
> *************** List the functions in the executable.
> *** 17117,17122 ****
> --- 17117,17148 ----
> N.A.
>
>
> + @subheading The @code{-symbol-list-lines} Command
> + @findex -symbol-list-lines
> +
> + @subsubheading Synopsis
> +
> + @smallexample
> + -symbol-list-lines @var{filename}
> + @end smallexample
> +
> + Print the list of lines that contain code and their associated program
> + addresses for the given source filename. The entries are sorted in
> + ascending PC order.
> +
> + @subsubheading @value{GDBN} Command
> +
> + There is no corresponding @value{GDBN} command.
> +
> + @subsubheading Example
> + @smallexample
> + (@value{GDBP})
> + -symbol-list-lines basics.c
> + ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
> + (@value{GDBP})
> + @end smallexample
> +
> +
> @subheading The @code{-symbol-list-types} Command
> @findex -symbol-list-types
>
> Index: mi/mi-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
> retrieving revision 1.11
> diff -c -3 -p -r1.11 mi-cmds.c
> *** mi/mi-cmds.c 2 Apr 2003 22:10:35 -0000 1.11
> --- mi/mi-cmds.c 19 Apr 2003 02:18:18 -0000
> *************** struct mi_cmd mi_cmds[] =
> *** 119,124 ****
> --- 119,125 ----
> {"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},
> Index: mi/mi-cmds.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
> retrieving revision 1.8
> diff -c -3 -p -r1.8 mi-cmds.h
> *** mi/mi-cmds.h 2 Apr 2003 22:10:35 -0000 1.8
> --- mi/mi-cmds.h 19 Apr 2003 02:18:18 -0000
> *************** extern mi_cmd_argv_ftype mi_cmd_stack_li
> *** 88,93 ****
> --- 88,94 ----
> 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;
> /* 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;
> }
> # Copyright 2003 Free Software Foundation, Inc.
>
> # 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.
>
> # Please email any bugs, comments, and/or additions to this file to:
> # bug-gdb@prep.ai.mit.edu
>
> #
> # The goal is not to test gdb functionality, which is done by other tests,
> # but to verify the correct output response to MI operations.
> #
>
> load_lib mi-support.exp
> set MIFLAGS "-i=mi1"
>
> gdb_exit
> if [mi_gdb_start] {
> continue
> }
>
> set testfile "basics"
> set srcfile ${testfile}.c
> set binfile ${objdir}/${subdir}/${testfile}
> if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
> gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
> }
>
> mi_run_to_main
>
> proc test_list_lines {} {
> global mi_gdb_prompt
> global hex
> global decimal
> global srcfile
>
> # Test list-lines.
> # Tests:
> # -symbol-list-lines ${srcfile}
>
> mi_gdb_test "-symbol-list-lines ${srcfile}" \
> "\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
> "symbol-list-lines for source file ${srcfile}"
>
> }
>
> test_list_lines
>
> mi_gdb_exit
> return 0
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new GDB/MI command: -symbol-info-linetable
2003-04-22 14:25 ` Elena Zannoni
@ 2003-05-04 4:05 ` Joel Brobecker
0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2003-05-04 4:05 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Thierry Schneider, gdb-patches
Hello,
> Ok, I just realized that you also need a gdb.mi/mi-symbol.exp file,
> which will use set MIFLAGS "-i=mi" instead of set MIFLAGS "-i=mi1".
> You may have to update some of the test output as well.
> Post that new file as well.
>
> the rest is ok.
Thierry does not have CVS write-after-approval yet, so he asked me to
check these changes in for him.
> > Here is the updated ChangeLog:
> >
> > 2003-04-18 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-18 Thierry Schneider <tpschneider1@yahoo.com>
> >
> > * gdb.texinfo (section GDB/MI Symbol Query): Add documentation
> > for new MI command.
> >
> > 2003-04-18 Thierry Schneider <tpschneider1@yahoo.com>
> >
> > * mi1-symbol.exp (-symbol-list-lines): New test file to
> > validate all symbol-related commands
Note that the ChangeLog for the Makefile was missing. Here it is:
2003-05-03 J. Brobecker <brobecker@gnat.com>
From Thierry Schneider <tpschneider1@yahoo.com>
* Makfile.in (SUBDIR_MI_OBS): Add dependency on mi-cmd-symbol.o.
(SUBDIR_MI_SRCS): Add mi-cmd-symbol.c.
(mi-cmd-symbol.o): Add rule.
--
Joel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable
2003-04-19 2:49 ` Thierry Schneider
2003-04-19 8:06 ` Eli Zaretskii
2003-04-22 14:25 ` Elena Zannoni
@ 2003-05-16 17:58 ` Thierry Schneider
2003-06-12 23:55 ` Joel Brobecker
2 siblings, 1 reply; 12+ messages in thread
From: Thierry Schneider @ 2003-05-16 17:58 UTC (permalink / raw)
To: gdb-patches; +Cc: tpschneider1
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
Elena,
> Ok, I just realized that you also need a gdb.mi/mi-symbol.exp file,
> which will use set MIFLAGS "-i=mi" instead of set MIFLAGS "-i=mi1".
> You may have to update some of the test output as well.
> Post that new file as well.
>
> the rest is ok.
>
> elena
The output of the command is identical for both MIFLAGS settings.
Here is the extra ChangeLog:
2003-05-16 Thierry Schneider <tpschneider1@yahoo.com>
* mi-symbol.exp (-symbol-list-lines): New test file to
validate all symbol-related MI commands
Thierry Schneider
[-- Attachment #2: mi-symbol.exp --]
[-- Type: text/plain, Size: 1819 bytes --]
# Copyright 2003 Free Software Foundation, Inc.
# 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.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
#
# The goal is not to test gdb functionality, which is done by other tests,
# but to verify the correct output response to MI operations.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "basics"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
mi_run_to_main
proc test_list_lines {} {
global mi_gdb_prompt
global hex
global decimal
global srcfile
# Test list-lines.
# Tests:
# -symbol-list-lines ${srcfile}
mi_gdb_test "-symbol-list-lines ${srcfile}" \
"\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
"symbol-list-lines for source file ${srcfile}"
}
test_list_lines
mi_gdb_exit
return 0
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable
2003-05-16 17:58 ` [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable Thierry Schneider
@ 2003-06-12 23:55 ` Joel Brobecker
0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2003-06-12 23:55 UTC (permalink / raw)
To: Thierry Schneider; +Cc: gdb-patches
I think this RFA fell through the cracks...
On Fri, May 16, 2003 at 10:58:09AM -0700, Thierry Schneider wrote:
>
> Elena,
>
> > Ok, I just realized that you also need a gdb.mi/mi-symbol.exp file,
> > which will use set MIFLAGS "-i=mi" instead of set MIFLAGS "-i=mi1".
> > You may have to update some of the test output as well.
> > Post that new file as well.
> >
> > the rest is ok.
> >
> > elena
>
> The output of the command is identical for both MIFLAGS settings.
>
> Here is the extra ChangeLog:
>
> 2003-05-16 Thierry Schneider <tpschneider1@yahoo.com>
>
> * mi-symbol.exp (-symbol-list-lines): New test file to
> validate all symbol-related MI commands
>
>
> Thierry Schneider
>
Content-Description: mi-symbol.exp
> # Copyright 2003 Free Software Foundation, Inc.
>
> # 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.
>
> # Please email any bugs, comments, and/or additions to this file to:
> # bug-gdb@prep.ai.mit.edu
>
> #
> # The goal is not to test gdb functionality, which is done by other tests,
> # but to verify the correct output response to MI operations.
> #
>
> load_lib mi-support.exp
> set MIFLAGS "-i=mi"
>
> gdb_exit
> if [mi_gdb_start] {
> continue
> }
>
> set testfile "basics"
> set srcfile ${testfile}.c
> set binfile ${objdir}/${subdir}/${testfile}
> if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
> gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
> }
>
> mi_run_to_main
>
> proc test_list_lines {} {
> global mi_gdb_prompt
> global hex
> global decimal
> global srcfile
>
> # Test list-lines.
> # Tests:
> # -symbol-list-lines ${srcfile}
>
> mi_gdb_test "-symbol-list-lines ${srcfile}" \
> "\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
> "symbol-list-lines for source file ${srcfile}"
>
> }
>
> test_list_lines
>
> mi_gdb_exit
> return 0
--
Joel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-06-12 23:55 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-10 2:19 [RFA] new GDB/MI command: -symbol-info-linetable Thierry Schneider
2003-03-10 4:30 ` Eli Zaretskii
2003-03-31 4:22 ` [RFA/ping] " Thierry Schneider
2003-04-09 20:23 ` Joel Brobecker
2003-04-09 20:38 ` Bob Rossi
2003-04-14 16:49 ` [RFA] " Elena Zannoni
2003-04-19 2:49 ` Thierry Schneider
2003-04-19 8:06 ` Eli Zaretskii
2003-04-22 14:25 ` Elena Zannoni
2003-05-04 4:05 ` Joel Brobecker
2003-05-16 17:58 ` [RFA] new mi-symbol.exp file for GDB/MI cmd: -symbol-info-linetable Thierry Schneider
2003-06-12 23:55 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox