Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.7.3
-
None
-
Windows 7, MinGW
Description
Simple example:
#include <QtCore/QDebug> #include <QtCore/QProcessEnvironment> #include <QtGui/QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); foreach (QString s, QProcessEnvironment::systemEnvironment().toStringList()) qDebug() << s; return 0; }
1. When run application by starting .exe file - it's ok and systemEnvironment() contains all variables.
2. But when I trying to run application by "Debug - Start Debugging - Start and Debug External Application..." - systemEnvironment() not contains many variables that it must contains. E.g. I need variable "APPDATA" that not in list. qgetenv() also not contains all env. variables in this case.
It's very inconvenient bug when your application write config file in "$APPDATA" and you have to debug your application after "make install" command (with "Start and Debug External Application...").
I found workaround for this (when you need to debug app with having all env. variables).
1. Add stopping message box at begin of main():
#include <QtCore/QDebug> #include <QtCore/QProcessEnvironment> #include <QtGui/QApplication> #include <QtGui/QMessageBox> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMessageBox::information(0, "", "pause"); foreach (QString s, QProcessEnvironment::systemEnvironment().toStringList()) qDebug() << s; return 0; }
2. Put breakpoints
3. Run app (without debug, Ctrl+R)
4. Attach to process (Debug - Start Debugging - Attach to Running External Application...)
5. Wait for attaching, click F5 for step over assembler code
6. Click "OK" on message box
7. Debug starts and all the env. variables will be available by QProcessEnvironment::systemEnvironment()
P.S. I test this bug only in Windows and don't know about it in Linux and MacOS.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-20185 Environment is (almost) empty when debugging without Run in terminal
- Closed