Bug 13798 - regression: can't set breakpoint for filepath containing space (Error in re-setting breakpoint: Function not defined)
Summary: regression: can't set breakpoint for filepath containing space (Error in re-s...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: 7.4
: P2 normal
Target Milestone: 7.5
Assignee: Keith Seitz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-03 08:09 UTC by Niko Sams
Modified: 2012-06-13 18:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niko Sams 2012-03-03 08:09:38 UTC
Since gdb 7.4 setting breakpoint for a filepath containing spaces doesn't work anymore. See the following example:

niko@niko-home:~$ cat space\ spaces.c 
#include <stdio.h>

int tmp(void) {
    int a = 42;
    printf("%d", a);
}

int main(void) {
    tmp();

    return 0;
}

#gdb 7.3.1 works fine:
niko@niko-home:~$ gdb a.out 
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/niko/a.out...done.
(gdb) break "space spaces.c":4
Breakpoint 1 at 0x4004ec: file space spaces.c, line 4.
(gdb) r
Starting program: /home/niko/a.out 

Breakpoint 1, tmp () at space spaces.c:4
4           int a = 42;
(gdb) 


# gdb 7.4 doesn't:
niko@niko-home:~$ gdb a.out 
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/niko/a.out...done.
(gdb) break "space spaces.c":4
Breakpoint 1 at 0x4004ec: file space spaces.c, line 4.
(gdb) r
Starting program: /home/niko/a.out 
Error in re-setting breakpoint 1: Function "space spaces.c:4" not defined.
42[Inferior 1 (process 2008) exited normally]
(gdb)
Comment 1 Keith Seitz 2012-03-21 18:44:29 UTC
This should be fixed with the new linespec rewrite that I submitted for approval recently. Once that goes in, this should be fixed for good:

(gdb) b file with spaces.cc:10
Breakpoint 1 at 0x4004e4: file file with spaces.cc, line 10.
Comment 2 cvs-commit@gcc.gnu.org 2012-06-13 18:06:12 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	kseitz@sourceware.org	2012-06-13 18:06:07

Modified files:
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.linespec: ls-errs.exp 

Log message:
	PR breakpoints/13798 and mi/11541
	* gdb.linespec/ls-errs.exp: Add a few more tests for
	filenames with spaces and colons.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3223&r2=1.3224
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.linespec/ls-errs.exp.diff?cvsroot=src&r1=1.1&r2=1.2
Comment 3 Keith Seitz 2012-06-13 18:09:03 UTC
Confirmed fixed in the linespec parser rewrite. If you plan to use filenames
with spaces and/or colons in them, I highly recommend quoting them (single or double).