This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: cli/1608: "edit" command doesn't put '/' between path and file
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 23 Jul 2004 04:58:00 -0000
- Subject: Re: cli/1608: "edit" command doesn't put '/' between path and file
- Reply-to: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
The following reply was made to PR cli/1608; it has been noted by GNATS.
From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
To: gdb-gnats@sources.redhat.com
Cc: xinsolo@hotmail.com
Subject: Re: cli/1608: "edit" command doesn't put '/' between path and file
Date: Fri, 23 Jul 2004 00:57:15 -0400 (EDT)
Also reported by xinsolo@hotmail.com .
I whipped up a matrix and tried it out.
This problem always happened with dwarf-2 and never happened with stabs+.
The original code was added to gdb on 2002-09-20 so it's quite likely
that the original author tested it only with stabs+.
For future reference, here's how I tested it.
.gdbinit says:
break main
run
edit
quit
Then I do:
export EDITOR=echo
for gccversion in 2.95.3 3.3.4 3.4.1 ; do
for gformat in dwarf-2 stabs+ ; do
for language in c c++ ; do
compile $program in $language with $gccversion and debug format $gformat
gdb $program
done
done
done
All the stabs+ "edit" commands look like this:
+6 /berman/home/mec.gnu/gdb/edit/hello-c.c
+6 /berman/home/mec.gnu/gdb/edit/hello-c.c
+6 /berman/home/mec.gnu/gdb/edit/hello-c.c
+6 /berman/home/mec.gnu/gdb/edit/hello-cc.cc
+6 /berman/home/mec.gnu/gdb/edit/hello-cc.cc
+6 /berman/home/mec.gnu/gdb/edit/hello-cc.cc
All the dwarf-2 "edit" commands look like this:
+6 /berman/home/mec.gnu/gdb/edithello-c.c
+6 /berman/home/mec.gnu/gdb/edithello-c.c
+6 /berman/home/mec.gnu/gdb/edithello-c.c
+6 /berman/home/mec.gnu/gdb/edithello-cc.cc
+6 /berman/home/mec.gnu/gdb/edithello-cc.cc
+6 /berman/home/mec.gnu/gdb/edithello-cc.cc
The "+6" is a line number, the first argument to the editor.
Looking at the source, edit_command has its own little bit of machinery
to concatenate the dirname and filename. I think it should be sharing
some machinery with list_command, like bits of openp or xfullpath or
gdb_realpath, not doing its own concatenation. That way it's more
likely to work on non-POSIX file systems too.