summaryrefslogtreecommitdiffstats
path: root/languages/cpp/debugger/gdbcontroller.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /languages/cpp/debugger/gdbcontroller.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/debugger/gdbcontroller.cpp')
-rw-r--r--languages/cpp/debugger/gdbcontroller.cpp176
1 files changed, 88 insertions, 88 deletions
diff --git a/languages/cpp/debugger/gdbcontroller.cpp b/languages/cpp/debugger/gdbcontroller.cpp
index 05954069..3fd912ec 100644
--- a/languages/cpp/debugger/gdbcontroller.cpp
+++ b/languages/cpp/debugger/gdbcontroller.cpp
@@ -33,13 +33,13 @@
#include <kprocess.h>
#include <kwin.h>
-#include <qdatetime.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qdir.h>
-#include <qvaluevector.h>
-#include <qeventloop.h>
+#include <tqdatetime.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqstring.h>
+#include <tqdir.h>
+#include <tqvaluevector.h>
+#include <tqeventloop.h>
#include <iostream>
#include <ctype.h>
@@ -82,7 +82,7 @@ using namespace std;
// output the final echo. Hence the data will be thrown away.
// (certain "info locals" will generate this error.
//
-// queueCmd(new GDBCommand(QString().sprintf("define printlocal\n"
+// queueCmd(new GDBCommand(TQString().sprintf("define printlocal\n"
// "echo \32%c\ninfo locals\necho \32%c\n"
// "end",
// LOCALS, LOCALS)));
@@ -130,14 +130,14 @@ namespace GDBDebugger
int debug_controllerExists = false;
-GDBController::GDBController(QDomDocument &projectDom)
+GDBController::GDBController(TQDomDocument &projectDom)
: DbgController(),
currentFrame_(0),
viewedThread_(-1),
holdingZone_(),
currentCmd_(0),
tty_(0),
- badCore_(QString()),
+ badCore_(TQString()),
state_(s_dbgNotStarted|s_appNotStarted),
programHasExited_(false),
dom(projectDom),
@@ -232,7 +232,7 @@ void GDBController::configure()
// Disabled for MI port.
if (old_outputRadix != config_outputRadix_)
{
- queueCmd(new GDBCommand(QCString().sprintf("set output-radix %d",
+ queueCmd(new GDBCommand(TQCString().sprintf("set output-radix %d",
config_outputRadix_)));
// FIXME: should do this in variable widget anyway.
@@ -256,7 +256,7 @@ void GDBController::addCommand(GDBCommand* cmd)
queueCmd(cmd);
}
-void GDBController::addCommand(const QString& str)
+void GDBController::addCommand(const TQString& str)
{
queueCmd(new GDBCommand(str));
}
@@ -352,9 +352,9 @@ void GDBController::executeCmd()
return;
}
- QString commandText = currentCmd_->cmdToSend();
+ TQString commandText = currentCmd_->cmdToSend();
bool bad_command = false;
- QString message;
+ TQString message;
unsigned length = commandText.length();
// No i18n for message since it's mainly for debugging.
@@ -400,8 +400,8 @@ void GDBController::executeCmd()
commandText.length());
setStateOn(s_waitForWrite);
- QString prettyCmd = currentCmd_->cmdToSend();
- prettyCmd.replace( QRegExp("set prompt \032.\n"), "" );
+ TQString prettyCmd = currentCmd_->cmdToSend();
+ prettyCmd.replace( TQRegExp("set prompt \032.\n"), "" );
prettyCmd = "(gdb) " + prettyCmd;
if (currentCmd_->isUserCommand())
@@ -456,7 +456,7 @@ void GDBController::actOnProgramPauseMI(const GDBMI::ResultRecord& r)
bool shared_library_load = false;
if (currentCmd_)
{
- const QValueVector<QString>& lines = currentCmd_->allStreamOutput();
+ const TQValueVector<TQString>& lines = currentCmd_->allStreamOutput();
for(unsigned int i = 0; i < lines.count(); ++i)
{
if (lines[i].startsWith("Stopped due to shared library event"))
@@ -488,7 +488,7 @@ void GDBController::actOnProgramPauseMI(const GDBMI::ResultRecord& r)
return;
}
- QString reason = r["reason"].literal();
+ TQString reason = r["reason"].literal();
if (reason == "exited-normally" || reason == "exited")
{
programNoApp("Exited normally", false);
@@ -509,7 +509,7 @@ void GDBController::actOnProgramPauseMI(const GDBMI::ResultRecord& r)
if (reason == "watchpoint-scope")
{
- QString number = r["wpnum"].literal();
+ TQString number = r["wpnum"].literal();
// FIXME: shuld remove this watchpoint
// But first, we should consider if removing all
@@ -524,8 +524,8 @@ void GDBController::actOnProgramPauseMI(const GDBMI::ResultRecord& r)
if (reason == "signal-received")
{
- QString name = r["signal-name"].literal();
- QString user_name = r["signal-meaning"].literal();
+ TQString name = r["signal-name"].literal();
+ TQString user_name = r["signal-meaning"].literal();
// SIGINT is a "break into running program".
// We do this when the user set/mod/clears a breakpoint but the
@@ -613,7 +613,7 @@ void GDBController::reloadProgramState()
// an invalid program specified or ...
// gdb is still running though, but only the run command (may) make sense
// all other commands are disabled.
-void GDBController::programNoApp(const QString &msg, bool msgBox)
+void GDBController::programNoApp(const TQString &msg, bool msgBox)
{
setState(s_appNotStarted|s_programExited|(state_&s_shuttingDown));
@@ -637,7 +637,7 @@ void GDBController::programNoApp(const QString &msg, bool msgBox)
// Tty is no longer usable, delete it. Without this, QSocketNotifier
// will continiously bomd STTY with signals, so we need to either disable
- // QSocketNotifier, or delete STTY. The latter is simpler, since we can't
+ // TQSocketNotifier, or delete STTY. The latter is simpler, since we can't
// reuse it for future debug sessions anyway.
delete tty_;
@@ -654,7 +654,7 @@ void GDBController::programNoApp(const QString &msg, bool msgBox)
emit gdbUserCommandStdout(msg.ascii());
}
-void GDBController::parseCliLine(const QString& line)
+void GDBController::parseCliLine(const TQString& line)
{
if (line.startsWith("The program no longer exists")
|| line.startsWith("Program exited")
@@ -694,7 +694,7 @@ void GDBController::parseCliLine(const QString& line)
strncmp(buf, "ptrace: Operation not permitted.", 32)==0 ||
strncmp(buf, "No executable file specified.", 29)==0)
{
- programNoApp(QString(buf), true);
+ programNoApp(TQString(buf), true);
kdDebug(9012) << "Bad file <" << buf << ">" << endl;
return;
}
@@ -723,7 +723,7 @@ void GDBController::handleMiFileListExecSourceFile(const GDBMI::ResultRecord& r)
#endif
}
- QString fullname = "";
+ TQString fullname = "";
if (r.hasField("fullname"))
fullname = r["fullname"].literal();
@@ -744,7 +744,7 @@ void GDBController::maybeAnnounceWatchpointHit()
gdb does not report any reason at all. */
if ((*last_stop_result).hasField("reason"))
{
- QString last_stop_reason = (*last_stop_result)["reason"].literal();
+ TQString last_stop_reason = (*last_stop_result)["reason"].literal();
if (last_stop_reason == "watchpoint-trigger")
{
@@ -766,7 +766,7 @@ void GDBController::handleMiFrameSwitch(const GDBMI::ResultRecord& r)
const GDBMI::Value& frame = r["frame"];
- QString file;
+ TQString file;
if (frame.hasField("fullname"))
file = frame["fullname"].literal();
else if (frame.hasField("file"))
@@ -789,31 +789,31 @@ void GDBController::handleMiFrameSwitch(const GDBMI::ResultRecord& r)
// **************************************************************************
-bool GDBController::start(const QString& shell, const DomUtil::PairList& run_envvars, const QString& run_directory, const QString &application, const QString& run_arguments)
+bool GDBController::start(const TQString& shell, const DomUtil::PairList& run_envvars, const TQString& run_directory, const TQString &application, const TQString& run_arguments)
{
kdDebug(9012) << "Starting debugger controller\n";
- badCore_ = QString();
+ badCore_ = TQString();
Q_ASSERT (!dbgProcess_ && !tty_);
dbgProcess_ = new KProcess;
- connect( dbgProcess_, SIGNAL(receivedStdout(KProcess *, char *, int)),
- this, SLOT(slotDbgStdout(KProcess *, char *, int)) );
+ connect( dbgProcess_, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)),
+ this, TQT_SLOT(slotDbgStdout(KProcess *, char *, int)) );
- connect( dbgProcess_, SIGNAL(receivedStderr(KProcess *, char *, int)),
- this, SLOT(slotDbgStderr(KProcess *, char *, int)) );
+ connect( dbgProcess_, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)),
+ this, TQT_SLOT(slotDbgStderr(KProcess *, char *, int)) );
- connect( dbgProcess_, SIGNAL(wroteStdin(KProcess *)),
- this, SLOT(slotDbgWroteStdin(KProcess *)) );
+ connect( dbgProcess_, TQT_SIGNAL(wroteStdin(KProcess *)),
+ this, TQT_SLOT(slotDbgWroteStdin(KProcess *)) );
- connect( dbgProcess_, SIGNAL(processExited(KProcess*)),
- this, SLOT(slotDbgProcessExited(KProcess*)) );
+ connect( dbgProcess_, TQT_SIGNAL(processExited(KProcess*)),
+ this, TQT_SLOT(slotDbgProcessExited(KProcess*)) );
application_ = application;
- QString gdb = "gdb";
- // Prepend path to gdb, if needed. Using QDir,
+ TQString gdb = "gdb";
+ // Prepend path to gdb, if needed. Using TQDir,
// path can either end with slash, or not.
if (!config_gdbPath_.isEmpty())
{
@@ -825,7 +825,7 @@ bool GDBController::start(const QString& shell, const DomUtil::PairList& run_env
*dbgProcess_ << "/bin/sh" << "-c" << shell + " " + gdb +
+ " " + application + " --interpreter=mi2 -quiet";
emit gdbUserCommandStdout(
- QString( "/bin/sh -c " + shell + " " + gdb
+ TQString( "/bin/sh -c " + shell + " " + gdb
+ " " + application
+ " --interpreter=mi2 -quiet\n" ).latin1());
}
@@ -834,7 +834,7 @@ bool GDBController::start(const QString& shell, const DomUtil::PairList& run_env
*dbgProcess_ << gdb << application
<< "-interpreter=mi2" << "-quiet";
emit gdbUserCommandStdout(
- QString( gdb + " " + application +
+ TQString( gdb + " " + application +
" --interpreter=mi2 -quiet\n" ).latin1());
}
@@ -888,23 +888,23 @@ bool GDBController::start(const QString& shell, const DomUtil::PairList& run_env
queueCmd(new GDBCommand("set print asm-demangle off"));
// make sure output radix is always set to users view.
- queueCmd(new GDBCommand(QCString().sprintf("set output-radix %d", config_outputRadix_)));
+ queueCmd(new GDBCommand(TQCString().sprintf("set output-radix %d", config_outputRadix_)));
// Change the "Working directory" to the correct one
- QCString tmp( "cd " + QFile::encodeName( run_directory ));
+ TQCString tmp( "cd " + TQFile::encodeName( run_directory ));
queueCmd(new GDBCommand(tmp));
// Set the run arguments
if (!run_arguments.isEmpty())
queueCmd(
- new GDBCommand(QCString("set args ") + run_arguments.local8Bit()));
+ new GDBCommand(TQCString("set args ") + run_arguments.local8Bit()));
// Get the run environment variables pairs into the environstr string
// in the form of: "ENV_VARIABLE=ENV_VALUE" and send to gdb using the
// "set enviroment" command
// Note that we quote the variable value due to the possibility of
// embedded spaces
- QString environstr;
+ TQString environstr;
DomUtil::PairList::ConstIterator it;
for (it = run_envvars.begin(); it != run_envvars.end(); ++it)
{
@@ -972,8 +972,8 @@ void GDBController::slotStopDebugger()
setStateOn(s_shuttingDown);
kdDebug(9012) << "GDBController::slotStopDebugger() executing" << endl;
- QTime start;
- QTime now;
+ TQTime start;
+ TQTime now;
// Get gdb's attention if it's busy. We need gdb to be at the
// command line so we can stop it.
@@ -981,11 +981,11 @@ void GDBController::slotStopDebugger()
{
kdDebug(9012) << "gdb busy on shutdown - stopping gdb (SIGINT)" << endl;
dbgProcess_->kill(SIGINT);
- start = QTime::currentTime();
+ start = TQTime::currentTime();
while (-1)
{
- kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 20 );
- now = QTime::currentTime();
+ kapp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput, 20 );
+ now = TQTime::currentTime();
if (!stateIsOn(s_dbgBusy) || start.msecsTo( now ) > 2000)
break;
}
@@ -999,11 +999,11 @@ void GDBController::slotStopDebugger()
if (!dbgProcess_->writeStdin(detach, strlen(detach)))
kdDebug(9012) << "failed to write 'detach' to gdb" << endl;
emit gdbUserCommandStdout("(gdb) detach\n");
- start = QTime::currentTime();
+ start = TQTime::currentTime();
while (-1)
{
- kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 20 );
- now = QTime::currentTime();
+ kapp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput, 20 );
+ now = TQTime::currentTime();
if (!stateIsOn(s_attached) || start.msecsTo( now ) > 2000)
break;
}
@@ -1015,11 +1015,11 @@ void GDBController::slotStopDebugger()
kdDebug(9012) << "failed to write 'quit' to gdb" << endl;
emit gdbUserCommandStdout("(gdb) quit");
- start = QTime::currentTime();
+ start = TQTime::currentTime();
while (-1)
{
- kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 20 );
- now = QTime::currentTime();
+ kapp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput, 20 );
+ now = TQTime::currentTime();
if (stateIsOn(s_programExited) || start.msecsTo( now ) > 2000)
break;
}
@@ -1050,12 +1050,12 @@ void GDBController::slotStopDebugger()
// **************************************************************************
-void GDBController::slotCoreFile(const QString &coreFile)
+void GDBController::slotCoreFile(const TQString &coreFile)
{
setStateOff(s_programExited|s_appNotStarted);
setStateOn(s_core);
- queueCmd(new GDBCommand(QCString("core ") + coreFile.latin1()));
+ queueCmd(new GDBCommand(TQCString("core ") + coreFile.latin1()));
raiseEvent(connected_to_program);
raiseEvent(program_state_changed);
@@ -1074,12 +1074,12 @@ void GDBController::slotAttachTo(int pid)
// We can't omit application name from gdb invocation
// because for libtool binaries, we have no way to guess
// real binary name.
- queueCmd(new GDBCommand(QString("file")));
+ queueCmd(new GDBCommand(TQString("file")));
// The MI interface does not implements -target-attach yet,
// and we don't recognize whatever gibberish 'attach' pours out, so...
queueCmd(new GDBCommand(
- QCString().sprintf("attach %d", pid)));
+ TQCString().sprintf("attach %d", pid)));
raiseEvent(connected_to_program);
@@ -1101,11 +1101,11 @@ void GDBController::slotRun()
tty_ = new STTY(config_dbgTerminal_, Settings::terminalEmulatorName( *kapp->config() ));
if (!config_dbgTerminal_)
{
- connect( tty_, SIGNAL(OutOutput(const char*)), SIGNAL(ttyStdout(const char*)) );
- connect( tty_, SIGNAL(ErrOutput(const char*)), SIGNAL(ttyStderr(const char*)) );
+ connect( tty_, TQT_SIGNAL(OutOutput(const char*)), TQT_SIGNAL(ttyStdout(const char*)) );
+ connect( tty_, TQT_SIGNAL(ErrOutput(const char*)), TQT_SIGNAL(ttyStderr(const char*)) );
}
- QString tty(tty_->getSlave());
+ TQString tty(tty_->getSlave());
if (tty.isEmpty())
{
KMessageBox::information(0, i18n("GDB cannot use the tty* or pty* devices.\n"
@@ -1119,12 +1119,12 @@ void GDBController::slotRun()
return;
}
- queueCmd(new GDBCommand(QCString("tty ")+tty.latin1()));
+ queueCmd(new GDBCommand(TQCString("tty ")+tty.latin1()));
if (!config_runShellScript_.isEmpty()) {
// Special for remote debug...
- QCString tty(tty_->getSlave().latin1());
- QCString options = QCString(">") + tty + QCString(" 2>&1 <") + tty;
+ TQCString tty(tty_->getSlave().latin1());
+ TQCString options = TQCString(">") + tty + TQCString(" 2>&1 <") + tty;
KProcess *proc = new KProcess;
@@ -1148,7 +1148,7 @@ void GDBController::slotRun()
}
else {
- QFileInfo app(application_);
+ TQFileInfo app(application_);
if (!app.exists())
{
@@ -1214,7 +1214,7 @@ void GDBController::slotKill()
// **************************************************************************
-void GDBController::slotRunUntil(const QString &fileName, int lineNum)
+void GDBController::slotRunUntil(const TQString &fileName, int lineNum)
{
if (stateIsOn(s_dbgBusy|s_dbgNotStarted|s_shuttingDown))
return;
@@ -1223,23 +1223,23 @@ void GDBController::slotRunUntil(const QString &fileName, int lineNum)
if (fileName.isEmpty())
queueCmd(new GDBCommand(
- QCString().sprintf("-exec-until %d", lineNum)));
+ TQCString().sprintf("-exec-until %d", lineNum)));
else
queueCmd(new GDBCommand(
- QCString().
+ TQCString().
sprintf("-exec-until %s:%d", fileName.latin1(), lineNum)));
}
// **************************************************************************
-void GDBController::slotJumpTo(const QString &fileName, int lineNum)
+void GDBController::slotJumpTo(const TQString &fileName, int lineNum)
{
if (stateIsOn(s_dbgBusy|s_dbgNotStarted|s_shuttingDown))
return;
if (!fileName.isEmpty()) {
- queueCmd(new GDBCommand(QCString().sprintf("tbreak %s:%d", fileName.latin1(), lineNum)));
- queueCmd(new GDBCommand(QCString().sprintf("jump %s:%d", fileName.latin1(), lineNum)));
+ queueCmd(new GDBCommand(TQCString().sprintf("tbreak %s:%d", fileName.latin1(), lineNum)));
+ queueCmd(new GDBCommand(TQCString().sprintf("jump %s:%d", fileName.latin1(), lineNum)));
}
}
@@ -1324,11 +1324,11 @@ void GDBController::selectFrame(int frameNo, int threadNo)
{
if (viewedThread_ != threadNo)
queueCmd(new GDBCommand(
- QString("-thread-select %1").arg(threadNo).ascii()));
+ TQString("-thread-select %1").arg(threadNo).ascii()));
}
queueCmd(new GDBCommand(
- QString("-stack-select-frame %1").arg(frameNo).ascii()));
+ TQString("-stack-select-frame %1").arg(frameNo).ascii()));
// Will emit the 'thread_or_frame_changed' event.
queueCmd(new GDBCommand("-stack-info-frame",
@@ -1347,7 +1347,7 @@ void GDBController::selectFrame(int frameNo, int threadNo)
void GDBController::defaultErrorHandler(const GDBMI::ResultRecord& result)
{
- QString msg = result["msg"].literal();
+ TQString msg = result["msg"].literal();
if (msg.contains("No such process"))
{
@@ -1425,11 +1425,11 @@ void GDBController::slotDbgStdout(KProcess *, char *buf, int buflen)
{
static bool parsing = false;
- QCString msg(buf, buflen+1);
+ TQCString msg(buf, buflen+1);
// Copy the data out of the KProcess buffer before it gets overwritten
// Append to the back of the holding zone.
- holdingZone_ += QCString(buf, buflen+1);
+ holdingZone_ += TQCString(buf, buflen+1);
// Already parsing? then get out quick.
// VP, 2006-01-30. I'm not sure how this could happen, since
@@ -1451,7 +1451,7 @@ void GDBController::slotDbgStdout(KProcess *, char *buf, int buflen)
{
got_any_command = true;
- QCString reply(holdingZone_.left(i));
+ TQCString reply(holdingZone_.left(i));
holdingZone_ = holdingZone_.mid(i+1);
kdDebug(9012) << "REPLY: " << reply << "\n";
@@ -1561,7 +1561,7 @@ void GDBController::slotDbgStdout(KProcess *, char *buf, int buflen)
parseCliLine(s.message);
- static QRegExp print_output("^\\$(\\d+) = ");
+ static TQRegExp print_output("^\\$(\\d+) = ");
if (print_output.search(s.message) != -1)
{
kdDebug(9012) << "Found 'print' output: " << s.message << "\n";
@@ -1688,7 +1688,7 @@ void GDBController::raiseEvent(event_t e)
void GDBController::slotDbgStderr(KProcess *proc, char *buf, int buflen)
{
// At the moment, just drop a message out and redirect
- kdDebug(9012) << "STDERR: " << QString::fromLatin1(buf, buflen+1) << endl;
+ kdDebug(9012) << "STDERR: " << TQString::fromLatin1(buf, buflen+1) << endl;
slotDbgStdout(proc, buf, buflen);
}
@@ -1729,7 +1729,7 @@ void GDBController::slotDbgProcessExited(KProcess* process)
// **************************************************************************
-void GDBController::slotUserGDBCmd(const QString& cmd)
+void GDBController::slotUserGDBCmd(const TQString& cmd)
{
queueCmd(new UserCommand(cmd.latin1()));
@@ -1745,7 +1745,7 @@ void GDBController::slotUserGDBCmd(const QString& cmd)
void GDBController::explainDebuggerStatus()
{
- QString information("%1 commands in queue\n"
+ TQString information("%1 commands in queue\n"
"%2 commands being processed by gdb\n"
"Debugger state: %3\n");
information =
@@ -1754,7 +1754,7 @@ void GDBController::explainDebuggerStatus()
if (currentCmd_)
{
- QString extra("Current command class: '%1'\n"
+ TQString extra("Current command class: '%1'\n"
"Current command text: '%2'\n"
"Current command origianl text: '%3'\n");
@@ -1795,7 +1795,7 @@ void GDBController::debugStateChange(int oldState, int newState)
int delta = oldState ^ newState;
if (delta)
{
- QString out = "STATE: ";
+ TQString out = "STATE: ";
for(unsigned i = 1; i < s_lastDbgState; i <<= 1)
{
if (delta & i)
@@ -1824,7 +1824,7 @@ void GDBController::debugStateChange(int oldState, int newState)
#undef STATE_CHECK
if (!found)
- out += QString::number(i);
+ out += TQString::number(i);
out += " ";
}
@@ -1840,7 +1840,7 @@ int GDBController::qtVersion( ) const
void GDBController::demandAttention() const
{
- if ( QWidget * w = kapp->mainWidget() )
+ if ( TQWidget * w = kapp->mainWidget() )
{
KWin::demandAttention( w->winId(), true );
}