Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob_rossi@cox.net>
To: gdb-patches@sources.redhat.com
Subject: Adding -file-list-exec-source-file command to GDB/MI
Date: Thu, 20 Mar 2003 22:44:00 -0000	[thread overview]
Message-ID: <20030320224454.GA14096@white> (raw)

----- Forwarded message from Bob Rossi <bob_rossi@cox.net> -----

Date: Thu, 20 Mar 2003 17:29:35 -0500
From: Bob Rossi <bob_rossi@cox.net>
To: gdb@sources.redhat.com
Subject: Adding -file-list-exec-source-file command to GDB/MI

----- Forwarded message from Bob Rossi <bob_rossi@cox.net> -----

Date: Sun, 9 Mar 2003 19:31:17 -0500
From: Bob Rossi <bob_rossi@cox.net>
To: gdb-patches@sources.redhat.com
Subject: Adding -file-list-exec-source-file command to GDB/MI

Hi,

This change essentially adds the command -file-list-exec-source-file to
the mi commands. 

 * mi-cmd-file.c:    Added file to implement mi file commands.
 * mi-cmds.c:        Added -file-list-exec-source-file command.
 * mi-cmds.h:        Added -file-list-exec-source-file to proto list.
 * gdbmi.texinfo:    Document -file-list-exec-source-file.
 * mi-file.exp:      Added testcase to test -file-list-exec-source-file. 

Also, do you think it would be good if the function 
-file-list-exec-source-file optionally took an argument ( a filename ).
If it reiceived an argument, it would return the absolute path to that
file.

I think the normal way a front end gets the absolute path to a file now
is,
1. list filename.c
2. info source
3. parse the output looking for 'Located in '

This optional argument would solve that problem.

Thanks,
Bob Rossi

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.328
diff -c -r1.328 Makefile.in
*** gdb/Makefile.in	7 Feb 2003 05:33:44 -0000	1.328
--- gdb/Makefile.in	10 Feb 2003 20:51:47 -0000
***************
*** 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-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-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-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 =
***************
*** 2494,2499 ****
--- 2494,2503 ----
  	$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
  	$(mi_getopt_h) $(gdb_events_h) $(gdb_h)
  	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
+ mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.c $(defs_h) $(mi_cmds_h) \
+ 	$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
+ 	$(mi_getopt_h) $(gdb_events_h) $(gdb_h)
+ 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-file.c
  mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
  	$(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h)
  	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c
Index: gdb/mi/gdbmi.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
retrieving revision 1.33
diff -c -r1.33 gdbmi.texinfo
*** gdb/mi/gdbmi.texinfo	4 Feb 2003 18:41:29 -0000	1.33
--- gdb/mi/gdbmi.texinfo	10 Feb 2003 20:51:55 -0000
***************
*** 2340,2345 ****
--- 2340,2355 ----
  @subsubheading Example
  N.A.
  
+ @subheading The @code{-file-list-exec-source-file} Command
+ @findex -file-list-exec-source-file
+ 
+ @subsubheading Synopsis
+ 
+ @example
+  -file-list-exec-source-file
+ @end example
+ 
+ List the current source file and line for the current executable.
  
  @subheading The @code{-file-list-exec-source-files} Command
  @findex -file-list-exec-source-files
Index: gdb/mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.10
diff -c -r1.10 mi-cmds.c
*** gdb/mi/mi-cmds.c	6 Feb 2003 01:19:12 -0000	1.10
--- gdb/mi/mi-cmds.c	10 Feb 2003 20:51:55 -0000
***************
*** 80,85 ****
--- 80,86 ----
    {"file-exec-and-symbols", "file %s", 0},
    {"file-exec-file", "exec-file %s", 0},
    {"file-list-exec-sections", 0, 0},
+   {"file-list-exec-source-file", 0, 0, mi_cmd_file_list_exec_source_file},
    {"file-list-exec-source-files", 0, 0},
    {"file-list-shared-libraries", 0, 0},
    {"file-list-symbol-files", 0, 0},
Index: gdb/mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.7
diff -c -r1.7 mi-cmds.h
*** gdb/mi/mi-cmds.h	6 Feb 2003 01:19:12 -0000	1.7
--- gdb/mi/mi-cmds.h	10 Feb 2003 20:51:55 -0000
***************
*** 80,85 ****
--- 80,86 ----
  extern mi_cmd_args_ftype mi_cmd_exec_step_instruction;
  extern mi_cmd_args_ftype mi_cmd_exec_until;
  extern mi_cmd_args_ftype mi_cmd_exec_interrupt;
+ extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
  extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
  extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
  extern mi_cmd_argv_ftype mi_cmd_stack_info_depth;

#   Copyright 1999 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 essential Machine interface (MI) operations
#
# Verify that, using the MI, we can run a simple program and perform basic
# debugging activities like: insert breakpoints, run the program,
# step, next, continue until it ends and, last but not least, quit.
#
# 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_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}

proc test_tbreak_creation_and_listing {} {
    global binfile
    set abs_srcfile ${binfile}.c

    # get the absolute path to the current file
    mi_gdb_test "111-file-list-exec-source-file" \
                "111\\\^done,line=\"23\",file=\"${abs_srcfile}\"" \
                "request absolute path of current source file"
}

test_tbreak_creation_and_listing

mi_gdb_exit
return 0



----- End forwarded message -----

----- End forwarded message -----


             reply	other threads:[~2003-03-20 22:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20 22:44 Bob Rossi [this message]
2003-03-21  4:34 ` Eli Zaretskii
2003-03-21  9:53 ` Jason Molenda
2003-03-21 13:16   ` Bob Rossi
2003-03-28 15:26     ` Andrew Cagney
2003-03-30  4:06       ` Bob Rossi
2003-03-31  4:22         ` Andrew Cagney
2003-03-31  8:13           ` Jason Molenda
2003-03-31 14:31             ` Andrew Cagney
2003-03-31 17:16               ` Jason Molenda
2003-03-31 18:52                 ` Andrew Cagney
2003-03-31 19:20                   ` Jason Molenda
2003-03-31 20:12                     ` Andrew Cagney
2003-03-26 22:48 ` Andrew Cagney
2003-03-28 14:35   ` Bob Rossi
2003-03-28 15:30 ` Andrew Cagney
2003-03-28 16:05   ` Bob Rossi
2003-03-28 16:10     ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2003-04-02 20:24 Bob Rossi
2003-04-02 20:24 Bob Rossi
2003-04-02 21:59 ` Andrew Cagney
2003-04-03  2:54 ` Eli Zaretskii
2003-03-29  0:41 Bob Rossi
2003-03-31  5:38 ` Andrew Cagney
2003-03-31 18:46   ` Bob Rossi
2003-03-31 18:56     ` Andrew Cagney
2003-04-02 16:15   ` Bob Rossi
2003-04-02 16:27     ` Andrew Cagney
2003-03-10  0:31 Bob Rossi
2003-03-10  4:28 ` Eli Zaretskii
2003-03-18  2:10   ` Bob Rossi
2003-03-18  5:46     ` Eli Zaretskii
2003-02-10 22:28 Michael Elizabeth Chastain
2003-02-10 22:15 Bob Rossi
2003-02-11  6:39 ` Eli Zaretskii
2003-02-13  3:00   ` Bob Rossi

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=20030320224454.GA14096@white \
    --to=bob_rossi@cox.net \
    --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