Bug 14657 - quotes in breakpoint linespec not saved
Summary: quotes in breakpoint linespec not saved
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-02 16:55 UTC by dje
Modified: 2018-11-08 21:38 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 dje 2012-10-02 16:55:51 UTC
This was discovered while working on bug 14643.

In a gdb that has bug 14643, e.g. 7.5, one should be able to work around the problem by quoting the file name.
However the quotes are discarded, so while the "break" command succeeds, resetting the breakpoint, e.g. when the program is run, fails.

bash$ gdb thread.c
GNU gdb (GDB) 7.5
[...]
(gdb) b thread-exit.c:42
malformed linespec error: unexpected keyword, "thread"
(gdb) b 'thread-exit.c':42
Breakpoint 1 at 0x400a28: file thread-exit.c, line 42.
(gdb) r
Starting program: /home/dje/src/play/thread-exit.x64
Error in re-setting breakpoint 1: malformed linespec error: unexpected keyword, "thread"
(gdb) i b
Num     Type           Disp Enb Address            What
1       breakpoint     keep n   0x0000000000400a28 in main at thread-exit.c:42

If a quote was supplied when the breakpoint was set, it should not be discarded.

[There is a plan to parse and save linespecs into their component pieces.
Not sure when that will happen, and if we should fix this in the mean time.]
Comment 1 Pedro Alves 2012-10-02 17:25:29 UTC
Also affects "save breakpoints":

(gdb) b 'thread.c':42
Breakpoint 5 at 0x5ca5ec: file ../../src/gdb/thread.c, line 42.
(gdb) info breakpoints 5
Num     Type           Disp Enb Address            What
5       breakpoint     keep y   0x00000000005ca5ec in inferior_thread at ../../src/gdb/thread.c:42
(gdb) save breakpoints foo.txt
Saved to file 'foo.txt'.
(gdb) shell cat foo.txt 
break thread.c:42
Comment 2 Nikolay Mitev 2018-11-08 21:38:22 UTC
This also affects breakpoints with spaces in them. Can't be restored because of missing quotes.