Search code examples
gdbbreakpointsdev-c++

Adding breakpoints to GDB in files with comma in path


When using GDB 7.4 or 7.5 (haven't tested older versions), is it possible to add breakpoints to files which reside in a folder path that includes commas? I've been trying to get it to work (when working on the debugger interface of Dev-C++), but GDB is interpeting my commands wrong.

I use the following command to send breakpoint commands to GDB:

// sets break at line 13 in mentioned file using filename:linenum
break "C:/Foo,Bar/main.c":13

In other words, \ is replaced by / to avoid accidental escaping and for extra safety "" is added around the filename. Should work fine right?

Well, no. For some reason GDB clips the file path and tries to execute:

break "C:/Foo":13

... and it throws a generic error:

"Error in re-setting breakpoint 1: Function "C:/Foo" not defined.

Any ideas how I can fix this? I haven't been able to find anything useful regarding commas and GDB filenames here and on Google.


Solution

  • You can't do that as gdb use comma to separate multiple expression, so it react as you give it two paths.