This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to set a breakpoint in file, which name has spaces?


Daniel,

On Wed, Aug 09, 2006 at 11:21:59PM -0700, Nikolay Molchanov wrote:


Hello!

There seems to be a problem with setting a breakpoint in files,
which names have spaces (usually it happens on Windows, but it
is possible to create such files in Unix filesystems as well).

Here is a part of a log file, that shows the problem.
Note that '\ ' works just great in "-file-exec-and-symbols" command,
but does not work in "-break-insert" command.



Quoting in the MI interface is generally inconsistent. If you care,
you can find a somewhat more detailed summary of the problems in the
archives a few months ago.


I would be happy to take a look at the discussion.
IMHO a good solution is to use '\ ' to escape spaces. It is standard Unix approach.
The real '\' character should be passed as double '\' ("\\").
What is nice, it works just great in "-file-exec-and-symbols" command, so it seems
a pretty straight forward solution to make other commands consistent with this one.




221-break-insert C:/Documents\ and\
Settings/nikm/.netbeans/Netbeans\ Projects/Args1/src/main.c:17
&"mi_cmd_break_insert: Garbage following <location>\n"
221^error,msg="mi_cmd_break_insert: Garbage following <location>"
(gdb)

I tried to use single and double quotes, but still no luck.
Is it a known problem? Is there a workaround?



Let's see. For current versions of GDB, -break-insert is parsed as a true MI command, which means it passes through the MI quoting rules. That's described in the GDB manual (GDB/MI Input Syntax). It says that single quotes and backslashes aren't special, only double quotes, and within double quotes things are treated as a C string. Then, after that escaping, it is passed to the normal breakpoint code.

So if you want to simulate:
break 'C:/Documents and Settings/foo.c':17


Unfortunately this does not work:

break 'C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c':17
&"break 'C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c':17\n"
&"Function \"C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c\" not defined.\n"
~"Breakpoint 3 ('C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c':17) pending.\n"
^done
(gdb)


You'd need
 -break-insert "'C:/Documents and Settings/foo.c':17"

This is actually more or less how things are supposed to work.


And this one also does not work:

221-break-insert "'C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c':17"
&"Function \"C:/Documents and Settings/nikm/.netbeans/Netbeans Projects/Args1/src/main.c\" not defined.\n"
221^done
(gdb)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]