Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thierry Schneider <tpschneider1@yahoo.com>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: Thierry Schneider <tpschneider1@yahoo.com>,
	gdb-patches@sources.redhat.com
Subject: Re: [RFA] new GDB/MI command: -symbol-info-linetable
Date: Sat, 19 Apr 2003 02:49:00 -0000	[thread overview]
Message-ID: <20030419024944.GA21248@gnat.com> (raw)
In-Reply-To: <16026.59307.319875.214299@localhost.redhat.com>

[-- 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

  reply	other threads:[~2003-04-19  2:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-10  2:19 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030419024944.GA21248@gnat.com \
    --to=tpschneider1@yahoo.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox