From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27558 invoked by alias); 31 Mar 2003 05:38:19 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27550 invoked from network); 31 Mar 2003 05:38:18 -0000 Received: from unknown (HELO localhost.redhat.com) (24.157.166.107) by sources.redhat.com with SMTP; 31 Mar 2003 05:38:18 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 60BFF2B23; Mon, 31 Mar 2003 00:38:13 -0500 (EST) Message-ID: <3E87D445.70609@redhat.com> Date: Mon, 31 Mar 2003 05:38:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bob Rossi Cc: gdb-patches@sources.redhat.com Subject: Re: Adding -file-list-exec-source-file command to GDB/MI References: <20030329004109.GA7487@white> Content-Type: multipart/mixed; boundary="------------020102070201040706050405" X-SW-Source: 2003-03/txt/msg00604.txt.bz2 This is a multi-part message in MIME format. --------------020102070201040706050405 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1999 > 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. > * doc/gdb.texinfo: Document -file-list-exec-source-file. > * mi-file.exp: Added testcase to test -file-list-exec-source-file. I've attached a slightly tweaked version. It was checking for the path to the executable instead of the source file (separate build / config directories is the norm) (I'm also not sure what would happen if the configure contained a relative path but worry about that when someone notices :-) > + @subheading The @code{-file-list-exec-source-file} Command > + @findex -file-list-exec-source-file > + > + @subsubheading Synopsis > + > + @smallexample > + -file-list-exec-source-file Can you please expand this to include sample output vis: (gdb) 111-file-list-exec-source-file 111^done,line="23",file="/home/scratch/GDB/src/gdb/testsuite/gdb.mi/basics.c" (gdb) Rather than file=..., should the field be called something like fullname=...., realpath= or fullpath=? That way, the same term can be used consistently through out MI. > enum mi_cmd_result > mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc) > { > struct symtab_and_line st; See: http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=783 Even though there are no arguments it will want to discard any "--". A mi_getopt() call to strip off any leading "--". I think you'll want to tweak that function so that calling it is easier - allow NULL OPT and OPTARG? > /* Print to the user the line and absolute file name */ > ui_out_field_int (uiout, "line", st.line); > ui_out_field_string (uiout, "file", st.symtab->fullname); Following on from above, should it print both "file" and "fullname"? > return MI_CMD_DONE; > } --------------020102070201040706050405 Content-Type: text/plain; name="mi-file.exp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mi-file.exp" Content-length: 2224 # 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 srcfile global srcdir global subdir set abs_srcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}] # 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 (${abs_srcfile})" } test_tbreak_creation_and_listing mi_gdb_exit return 0 --------------020102070201040706050405--