Skip to content

Instantly share code, notes, and snippets.

@ppetraki
Last active February 23, 2016 18:22
Show Gist options
  • Save ppetraki/a0080da047047ea184c6 to your computer and use it in GitHub Desktop.
Save ppetraki/a0080da047047ea184c6 to your computer and use it in GitHub Desktop.
qtcreator - run gdb via sudo
--- qtcreator-3.0.1.orig/src/plugins/debugger/gdb/gdbprocess.cpp
+++ qtcreator-3.0.1/src/plugins/debugger/gdb/gdbprocess.cpp
@@ -59,7 +59,11 @@ QByteArray GdbProcess::readAllStandardEr
void GdbProcess::start(const QString &cmd, const QStringList &args)
{
- m_gdbProc.setCommand(cmd, Utils::QtcProcess::joinArgs(args));
+ QStringList sudoArgs;
+ sudoArgs << cmd << args;
+ QString sudoCmd = QString::fromUtf8("/usr/bin/sudo");
+
+ m_gdbProc.setCommand(sudoCmd, Utils::QtcProcess::joinArgs(sudoArgs));
m_gdbProc.start();
}
@ppetraki
Copy link
Author

This is crud, but it works. Start a terminal and just 'sudo ls' to get your auth activated (or use passwordless sudo if you're nuts) and then launch qtcreator. I'll work on a plugin based solution later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment