This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Fix file name generation in edit_command (was: Ver 6.3 edit command failing)
- From: Daniel Jacobowitz <drow at false dot org>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: bug-gdb at rich-paul dot net, bug-gdb at gnu dot org, gdb-patches at sources dot redhat dot com
- Date: Wed, 27 Apr 2005 10:36:20 -0400
- Subject: Re: [RFA] Fix file name generation in edit_command (was: Ver 6.3 edit command failing)
- References: <E1DLM3u-0000IQ-Vj@lists.gnu.org> <01c54b35$Blat.v2.4$c3f52520@zahav.net.il>
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