Commit 8a7518ccae6254d2f60f96c43df338d23f3acc67

  • avatar
  • con <qtc-committer @no…a.com> (Committer)
  • Fri Oct 09 19:17:36 CEST 2009
  • avatar
  • Daniel Molkentin (Author)
  • Fri Oct 09 14:20:14 CEST 2009
Remove cygwin options now that we have a GDB which was build with MinGW.

Also, remove COM port selection on windows. It is taken from the run
configuration in case of Windows anyway.

Reviewed-By: Friedemann Kleint
(cherry picked from commit 555f8a02ec935bcb7fbdbdec4e12d16c632bdf27)
  
17201720 }
17211721}
17221722
1723#ifdef Q_OS_WIN
1724
1725// Prepend environment of the Symbian Gdb by Cygwin '/bin'
1726static void setGdbCygwinEnvironment(const QString &cygwin, QProcess *process)
1727{
1728 if (cygwin.isEmpty() || !QFileInfo(cygwin).isDir())
1729 return;
1730 const QString cygwinBinPath = QDir::toNativeSeparators(cygwin) + QLatin1String("\\bin");
1731 QStringList env = process->environment();
1732 if (env.isEmpty())
1733 env = QProcess::systemEnvironment();
1734 const QRegExp pathPattern(QLatin1String("^PATH=.*"), Qt::CaseInsensitive);
1735 const int index = env.indexOf(pathPattern);
1736 if (index == -1)
1737 return;
1738 QString pathValue = env.at(index).mid(5);
1739 if (pathValue.startsWith(cygwinBinPath))
1740 return;
1741 env[index] = QLatin1String("PATH=") + cygwinBinPath + QLatin1Char(';');
1742 process->setEnvironment(env);
1743}
1744#endif
1745
17461723void TrkGdbAdapter::startGdb()
17471724{
17481725 QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
17491749 gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
17501750 gdbArgs.append(QLatin1String("-i"));
17511751 gdbArgs.append(QLatin1String("mi"));
1752#ifdef Q_OS_WIN
1753 setGdbCygwinEnvironment(m_options->cygwin, &m_gdbProc);
1754#endif
17551752 m_gdbProc.start(m_options->gdb, gdbArgs);
17561753}
17571754
  
5454static const char *blueToothDeviceKeyC = "BlueToothDevice";
5555static const char *blueToothDeviceDefaultC = "/dev/rfcomm0";
5656static const char *gdbKeyC = "gdb";
57static const char *cygwinKeyC = "Cygwin";
5857
59static inline QString cygwinDefault()
60{
61#ifdef Q_OS_WIN
62 // Some smartness to check for Cygwin
63 static bool firstTime = true;
64 static QString rc = QLatin1String("C:/cygwin");
65 if (firstTime) {
66 if (!QFileInfo(rc).isDir())
67 rc.clear();
68 firstTime = false;
69 }
70 return rc;
71#else
72 return QString();
73#endif
74}
75
7658namespace Debugger {
7759namespace Internal {
7860
6262 mode(modeDefault),
6363 serialPort(QLatin1String(serialPortDefaultC)),
6464 blueToothDevice(QLatin1String(blueToothDeviceDefaultC)),
65 gdb(QLatin1String(gdbDefaultC)),
66 cygwin(cygwinDefault())
65 gdb(QLatin1String(gdbDefaultC))
6766{
6867}
6968
7272 mode = s->value(keyRoot + QLatin1String(modeKeyC), modeDefault).toInt();
7373 serialPort = s->value(keyRoot + QLatin1String(serialPortKeyC), QLatin1String(serialPortDefaultC)).toString();
7474 gdb = s->value(keyRoot + QLatin1String(gdbKeyC),QLatin1String(gdbDefaultC)).toString();
75 cygwin = s->value(keyRoot + QLatin1String(cygwinKeyC), cygwinDefault()).toString();
7675 blueToothDevice = s->value(keyRoot + QLatin1String(blueToothDeviceKeyC), QLatin1String(blueToothDeviceDefaultC)).toString();
7776}
7877
8282 s->setValue(QLatin1String(serialPortKeyC), serialPort);
8383 s->setValue(QLatin1String(blueToothDeviceKeyC), blueToothDevice);
8484 s->setValue(QLatin1String(gdbKeyC), gdb);
85 s->setValue(QLatin1String(cygwinKeyC), cygwin);
8685 s->endGroup();
8786}
8887
9696 *errorMessage = QCoreApplication::translate("TrkOptions", "The Symbian gdb executable '%1' could not be found in the search path.").arg(gdb);
9797 return false;
9898 }
99 if (!cygwin.isEmpty() && !QFileInfo(cygwin).isDir()) {
100 *errorMessage = QCoreApplication::translate("TrkOptions", "The Cygwin directory '%1' does not exist.").arg(cygwin);
101 return false;
102 }
10399 return true;
104100}
105101
104104 return mode == o.mode
105105 && serialPort == o.serialPort
106106 && blueToothDevice == o.blueToothDevice
107 && gdb == o.gdb
108 && cygwin == o.cygwin;
107 && gdb == o.gdb;
109108}
110109
111110QStringList TrkOptions::serialPorts()
  
4040namespace Internal {
4141
4242/* Parameter to be used for debugging S60 via TRK.
43 * GDB is a Symbian-ARM Gdb. It is Cygwin-built on Windows; the cygwin
44 * location 'x/bin' will prepended to the execution path.
43 * GDB is a Symbian-ARM Gdb.
4544 * Communication happens either via BlueTooth (Linux only) or
4645 * serial ports. */
4746
6363 QString serialPort;
6464 QString blueToothDevice;
6565 QString gdb;
66 QString cygwin; // ignored on Linux
6766};
6867
6968inline bool operator==(const TrkOptions &o1, const TrkOptions &o2)
  
4141{
4242 ui->setupUi(this);
4343 ui->gdbChooser->setExpectedKind(Utils::PathChooser::Command);
44 ui->cygwinChooser->setExpectedKind(Utils::PathChooser::Directory);
4544 ui->blueToothComboBox->addItems(TrkOptions::blueToothDevices());
4645 ui->serialComboBox->addItems(TrkOptions::serialPorts());
4746 connect(ui->commComboBox, SIGNAL(currentIndexChanged(int)), ui->commStackedWidget, SLOT(setCurrentIndex(int)));
4847 // No bluetooth on Windows yet...
4948#ifdef Q_OS_WIN
50 ui->commComboBox->setEnabled(false);
51#else
52 ui->cygwinChooser->setVisible(false);
53 ui->cygwinLabel->setVisible(false);
49 ui->commGroupBox->setVisible(false);
5450#endif
5551}
5652
7474 const int serialPortIndex = qMax(0, ui->serialComboBox->findText(o.serialPort));
7575 ui->serialComboBox->setCurrentIndex(serialPortIndex);
7676 ui->gdbChooser->setPath(o.gdb);
77 ui->cygwinChooser->setPath(o.cygwin);
7877 const int blueToothIndex = qMax(0, ui->blueToothComboBox->findText(o.blueToothDevice));
7978 ui->blueToothComboBox->setCurrentIndex(blueToothIndex);
8079}
8383 TrkOptions rc;
8484 rc.mode = ui->commComboBox->currentIndex();
8585 rc.gdb = ui->gdbChooser->path();
86 rc.cygwin = ui->cygwinChooser->path();
8786 rc.blueToothDevice = ui->blueToothComboBox->currentText();
8887 rc.serialPort = ui->serialComboBox->currentText();
8988 return rc;
  
2020 <string>Gdb</string>
2121 </property>
2222 <layout class="QFormLayout" name="formLayout">
23 <property name="fieldGrowthPolicy">
24 <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
25 </property>
2326 <item row="0" column="0">
2427 <widget class="QLabel" name="gdbLabel">
2528 <property name="text">
3232 </item>
3333 <item row="0" column="1">
3434 <widget class="Utils::PathChooser" name="gdbChooser" native="true"/>
35 </item>
36 <item row="1" column="0">
37 <widget class="QLabel" name="cygwinLabel">
38 <property name="text">
39 <string>Cygwin location:</string>
40 </property>
41 </widget>
42 </item>
43 <item row="1" column="1">
44 <widget class="Utils::PathChooser" name="cygwinChooser" native="true"/>
4535 </item>
4636 </layout>
4737 </widget>