gdbgui
gdbgui copied to clipboard
Wrong breakpoint filenames sent to GDB on Windows
Hi!
I'm on Win10, using MinGW64s GDB. I installed gdbgui with pip in WinPython.
gdbgui launches fine, loads my Binary and can run and debug it just fine. However, clicking in a line does not set the breakpoint correctly:
-break-insert "C:\PROJECTS\mysource.c:23" No source file named C.
When I manually send the command with double slashes it works fine: -break-insert "C:\\PROJECTS\\mysource.c:23"
The breakpoint will then be highlighted correctly, and clicking the set breakpoint also correctly unsets it.
gdbgui: 0.13.2.0 GNU gdb (GDB) 9.1 Chrome Browser
I'm seeing the same thing on Windows 8.1. (Everything seems to be working on Windows, except for break points.)
To track down the problem, I enabled print all commands in the gdbgui settings. From that, it's immediately obvious what the problem is. Gdbgui is including a Windows style path when setting a break point. Unfortunately a Windows path starts with a drive letter followed by a colon. GDB is interpreting the drive letter as the full file name, and of course the file does not exist.
For example, when I enter "line.exe", as the target path and load the file, then click on a line to set a break point, gdbgui sends the command:
-break-insert "C:\old_d\Line\line.c:123" No source file named C.
If I enter the command manually, without the "C:" prefix, then GDB complains:
"No source file named old_dLineline.c."
So it appears that GDB is also stripping backslashes. I was able to get gdb to accept the path if I escaped both the colon and the backslashes with (additional) backslashes. so that:
"C:\old_d\Line\line.c:123"
becomes:
"C\:\\old_d\\Line\\line.c:123"
Python code to make that transformation might look something like:
path="C:\old_d\Line\line.c" path=repr(path)[1:-1] path=path.replace(":",":") print(path) C\:\\old_d\\Line\\line.c
[Edit: I had to escape with extra backslashes, to make them all visible here... The transformed text should have a single backslash before the colon and double backslashes as directory separators. ]
Same issue, patched '\' in '/' in build.js:
return"gdb"===l.store.get("interpreter")?['-break-insert "'+e.replace(/\\/g,"/")
Corresponds to source code GdbApi.jsx:354
get_insert_break_cmd: function(fullname, line) {
if (store.get("interpreter") === "gdb") {
return [-break-insert "${fullname}:${line}"
];
} else {
console.log("TODOLLDB - find mi-friendly command");
return [breakpoint set --file ${fullname} --line ${line}
];
}
},