forked from qt-creator/qt-creator
GDB: Escape quotes on breakpoint commands
The commands are wrapped in quotes, and if they contain quotes it gets messed up. Change-Id: I41cebd8cf4a57a8ea671e5f43a3295af1c73fd02 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
8353a6ed20
commit
787c4fc21e
@@ -2603,10 +2603,14 @@ void GdbEngine::changeBreakpoint(Breakpoint bp)
|
||||
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); };
|
||||
} else if (data.command != response.command) {
|
||||
cmd.function = "-break-commands " + bpnr;
|
||||
foreach (const QString &command, data.command.split(QLatin1String("\n"))) {
|
||||
if (!command.isEmpty())
|
||||
for (QString command : data.command.split('\n')) {
|
||||
if (!command.isEmpty()) {
|
||||
// escape backslashes and quotes
|
||||
command.replace('\\', "\\\\");
|
||||
command.replace('"', "\\\"");
|
||||
cmd.function += " \"" + command + '"';
|
||||
}
|
||||
}
|
||||
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); };
|
||||
} else if (!data.conditionsMatch(response.condition)) {
|
||||
cmd.function = "condition " + bpnr + ' ' + data.condition;
|
||||
|
Reference in New Issue
Block a user