This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix file name generation in edit_command (was: Ver 6.3 edit command failing)


On Wed, Apr 27, 2005 at 05:30:11PM +0300, Eli Zaretskii wrote:
> > Date: Tue, 12 Apr 2005 09:58:25 -0400
> > From: bug-gdb@rich-paul.net
> > 
> > While using gdb 6.3,  I was having a problem with the directory name and the
> > file name being concatenated by the edit command without an intervening slash.
> > My solution was just to add the slash to the sprintf format string
> > in cli/cli-cmds.c, near line 650.  It worked for me.
> 
> Thanks for pointing this out.
> 
> In fact, the code there had quite a few problems besides the one you
> found: it didn't use symtab->fullname, failed miserably for DOS-style
> d:/foo/bar file names, etc.
> 
> Does anyone object to the following patch?
> 
> 2005-04-27  Eli Zaretskii  <eliz@gnu.org>
> 
> 	* cli/cli-cmds.c (edit_command): Use symtab->fullname if
> 	possible.  Use IS_ABSOLUTE_PATH instead of checking for a literal
> 	'/'.  Make sure there's a slash between the directory and the file
> 	name.  Simplify and clarify the code logic.

I can simplify this a whole lot further :-)

You should use symtab_to_fullname.  Then all the fallback logic is
unnecessary; if symtab_to_fullname fails, GDB does not know where the
file is.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]