From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] 12843
Date: Wed, 31 Aug 2011 18:17:00 -0000 [thread overview]
Message-ID: <4E5E7AA1.5030209@redhat.com> (raw)
In-Reply-To: <m34o14t4la.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]
On 08/26/2011 11:22 AM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz<keiths@redhat.com> writes:
>
> Keith> PR gdb/12843
> Keith> * linespec.c (locate_first_half): Do not stop on a colon
> Keith> if the next character is a directory separator character.
>
> Ok.
>
> I suspect we should tighten this further so that only drive letters work
> and not oddball stuff like "break file:/whatever.c:73". What do you
> think?
I think we can safely do that -- especially since '/' is verboten on
unix. So in that case, "file:/whatever.c" parses to the file
"whatever.c" in the directory "file:", and we want to keep the whole
thing together anyway.
Mind you, this doesn't solve the general case of colons in filenames,
which is still broken.
Note: I've renamed the test to linespecs.exp, hoping that this file will
grow into a full-fledged specification for future linespec work. Which I
hope to do sometime soon. :-)
How about this? [Tested on x86_64-linux and i686-pc-cygwin (with much
pain).]
Keith
ChangeLog
2011-08-30 Keith Seitz <keiths@redhat.com>
PR gdb/12843
* linespec.c (locate_first_half): Keep ':' if it looks
like it could be part of a drive letter or filename.
testsuite/ChangeLog
2011-08-30 Keith Seitz <keiths@redhat.com>
PR gdb/12843
* gdb.base/linespecs.exp: New file.
[-- Attachment #2: 12843-2.patch --]
[-- Type: text/plain, Size: 2680 bytes --]
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 37ec368..721bf12 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -43,6 +43,7 @@
#include "arch-utils.h"
#include <ctype.h>
#include "cli/cli-utils.h"
+#include "filenames.h"
/* Prototypes for local functions. */
@@ -1194,6 +1195,16 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
++p;
}
}
+
+
+ /* Check for a drive letter in the filename. This is done on all hosts
+ to capture cross-compilation environments. On Unixen, directory
+ separators are illegal in filenames, so if the user enters "e:/foo.c",
+ he is referring to a directory named "e:" and a source file named
+ "foo.c", and we still want to keep these two pieces together. */
+ if (isalpha (p[0]) && p[1] == ':' && IS_DIR_SEPARATOR (p[2]))
+ p += 3;
+
for (; *p; p++)
{
if (p[0] == '<')
@@ -1218,8 +1229,7 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
line, a tab, a colon or a space. But if enclosed in double
quotes we do not break on enclosed spaces. */
if (!*p
- || p[0] == '\t'
- || (p[0] == ':')
+ || p[0] == '\t' || p[0] == ':'
|| ((p[0] == ' ') && !*is_quote_enclosed))
break;
if (p[0] == '.' && strchr (p, ':') == NULL)
diff --git a/gdb/testsuite/gdb.base/linespecs.exp b/gdb/testsuite/gdb.base/linespecs.exp
new file mode 100644
index 0000000..bd07779
--- /dev/null
+++ b/gdb/testsuite/gdb.base/linespecs.exp
@@ -0,0 +1,29 @@
+# Copyright 2011 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Linespec tests
+
+# We don't currently need our own test case for testing, so grab
+# another one.
+
+if {[prepare_for_testing linespecs.exp memattr memattr.c {debug}]} {
+ return -1
+}
+
+# PR gdb/12843
+gdb_test "list c:/foo/bar/baz.c:1" "No source file named c:/foo/bar/baz.c."
+gdb_test "list c:/foo/bar/baz.c" "Function \"c:/foo/bar/baz.c\" not defined."
+gdb_test "list fooc:/foo/bar/baz.c:1" "No source file named fooc."
+gdb_test "list fooc:/foo/bar/baz.c" "No source file named fooc."
next prev parent reply other threads:[~2011-08-31 18:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 21:59 Keith Seitz
2011-08-26 18:23 ` Tom Tromey
2011-08-26 18:46 ` Keith Seitz
2011-08-26 19:07 ` Tom Tromey
2011-08-27 8:45 ` Eli Zaretskii
2011-08-27 13:17 ` asmwarrior
2011-08-29 19:18 ` Tom Tromey
2011-08-29 7:19 ` André Pönitz
2011-08-29 10:13 ` Pedro Alves
2011-08-29 12:06 ` Matt Rice
2011-08-29 12:15 ` André Pönitz
2011-08-29 13:53 ` Pedro Alves
2011-08-29 19:21 ` Jan Kratochvil
2011-08-30 8:19 ` André Pönitz
2011-08-30 9:21 ` Jan Kratochvil
2011-08-30 15:02 ` Tom Tromey
2011-08-30 16:34 ` André Pönitz
2011-08-30 17:21 ` Tom Tromey
2011-08-31 8:54 ` André Pönitz
2011-08-29 19:46 ` Tom Tromey
2011-08-29 21:13 ` Keith Seitz
2011-08-30 2:35 ` Daniel Jacobowitz
2011-08-30 15:00 ` Tom Tromey
2011-08-30 17:24 ` Tom Tromey
2011-08-31 18:17 ` Keith Seitz [this message]
2011-08-31 18:23 ` Jan Kratochvil
2011-08-31 18:52 ` Tom Tromey
2011-09-02 16:04 ` asmwarrior
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=4E5E7AA1.5030209@redhat.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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