From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29361 invoked by alias); 25 Aug 2011 21:59:21 -0000 Received: (qmail 29342 invoked by uid 22791); 25 Aug 2011 21:59:19 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,SUBJ_ALL_CAPS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Aug 2011 21:58:59 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7PLwxOr031664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Aug 2011 17:58:59 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7PLwuRY015351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 25 Aug 2011 17:58:58 -0400 Message-ID: <4E56C5A0.60802@redhat.com> Date: Thu, 25 Aug 2011 21:59:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [RFA] 12843 Content-Type: multipart/mixed; boundary="------------030806070006040102030207" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00473.txt.bz2 This is a multi-part message in MIME format. --------------030806070006040102030207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1515 Hi, A long time ago, some linespec hacking that I did broke the ability to use drive letters on Windows. This turned out especially bad since linespec canonicalization could unexpectedly (to the user) include them. As a result, gdb was/is unable to re-set some breakpoints on Windows hosts. This is a pretty simple patch to workaround this problem. It is not perfect, but implementing something "proper" would be very involved, and I am not quite sure I want to commit to hacking more of linespec.c without rewriting the whole thing (which would certainly interfer with Tom's ambiguous linespec work). So I'm not sure whether this should be an RFC or and RFA, but I've decided the later. This patch checks if ':' is followed by '/' and/or '\\' (depending on definition of IS_DIR_SEPARATOR). If it is, we keep looking for the next terminal in the string. This is problematic for filenames with ":\\" or "://" in them, but locate_first_half has gotten those wrong for a long, long time (in fact, any filename at all with a colon(s) in it). In any case, this patch will allow Windows hosts to function properly again, and causes no regressions on x86_64-linux and i686-pc-cygwin32. Keith ChangeLog 2011-08-25 Keith Seitz PR gdb/12843 * linespec.c (locate_first_half): Do not stop on a colon if the next character is a directory separator character. testsuite/ChangeLog 2011-08-25 Keith Seitz PR gdb/12843 * gdb.base/ls-driveletter.exp: New file. --------------030806070006040102030207 Content-Type: text/plain; name="12843.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="12843.patch" Content-length: 2399 diff --git a/gdb/linespec.c b/gdb/linespec.c index b96c79f..b35ac6a 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -43,6 +43,7 @@ #include "arch-utils.h" #include #include "cli/cli-utils.h" +#include "filenames.h" /* Prototypes for local functions. */ @@ -1216,10 +1217,16 @@ locate_first_half (char **argptr, int *is_quote_enclosed) } /* Check for the end of the first half of the linespec. End of line, a tab, a colon or a space. But if enclosed in double - quotes we do not break on enclosed spaces. */ + quotes we do not break on enclosed spaces. + + Colons are especially problematic, since we don't really want to stop + if the colon is part of a filename. The simple heuristic used here + is to keep going if the colon is followed by a directory separator. + This will capture drive letters on Windows, but it will (still) fail + for any filename containing ":", "::", ":/", or ":\\". */ if (!*p || p[0] == '\t' - || (p[0] == ':') + || (p[0] == ':' && !IS_DIR_SEPARATOR (p[1])) || ((p[0] == ' ') && !*is_quote_enclosed)) break; if (p[0] == '.' && strchr (p, ':') == NULL) diff --git a/gdb/testsuite/gdb.base/ls-driveletter.exp b/gdb/testsuite/gdb.base/ls-driveletter.exp new file mode 100644 index 0000000..66efd1f --- /dev/null +++ b/gdb/testsuite/gdb.base/ls-driveletter.exp @@ -0,0 +1,26 @@ +# 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 . + +# Test linespecs containing drive letters. +# PR gdb/12843 + +# We don't actually need our own test case to test this, so grab +# another one. + +if {[prepare_for_testing ls-driveletter.exp memattr memattr.c {debug}]} { + return -1 +} + +gdb_test "list c:/foo/bar/baz.c:1" "No source file named c:/foo/bar/baz.c." --------------030806070006040102030207--