Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QProcess execute GDB cannot popup a terminal window for input/output.
Forum Update on Monday, May 27th 2025

[Solved] QProcess execute GDB cannot popup a terminal window for input/output.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saki
    wrote on last edited by
    #1

    We are now using Qt to build a simple IDE for single file compile & run(only terminal application). We got some trouble when we are writing the debugger module. We used QProcess to execute GDB (machine interface), and use readyReadStandardOutput signal to receive messages. We hope we could popup a terminal window like most other IDEs for input and output. But now there's no window popup.

    Let me show you an example:

    Here's a simple C program, let's say it's a.c:

    @
    #include <stdio.h>
    int main()
    {
    printf(“Hello World!\n”);
    return 0;
    }
    @

    Compile the a.c, and we get a.exe. Then we use QProcess to execute GDB to debug it. Normally, it should show a terminal window(CMD) with "Hello world!" on it. But now there's nothing happend.

    Here's what we do:

    @
    QStringList _arg;
    _arg<<filePath<<"--interpreter"<<"mi"
    <<QString("--tty=" + getServerName());

        connect(gdbProcess.data(),
                SIGNAL(readyReadStandardOutput()),
                this,
                SLOT(readGdbStandardOutput()));
        connect(gdbProcess.data(),
                SIGNAL(readyReadStandardError()),
                this,
                SLOT(readGdbStandardError()));
    
        gdbProcess-&gt;start(gdbPath,_arg);
    

    @

    The "Hello World!" was received by readGdbStandardOutput slot. We take a look at the Qt Creator source code. I find out Qt Creator was using tty to redirect IO to a QMLJS terminal which was written by itself. But we find another IDE: Manna, which was known as GUIDE(Gait Universal IDE) in China, they finished this function with nothing special. Here's the source code of debugging module in Manna:

    https://www.assembla.com/code/manna/subversion/nodes/3/trunk/Manna/src/gdbdebug.cpp

    So, how can I do to popup a terminal? Is it the problem of args? How Manna does this? I have been confused by this problem for a long time. Now, I've to ask for coummunity for help. Please help me to solve this problem. Thanks a lot!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Saki
      wrote on last edited by
      #2

      Well, I've solved this.
      In Windows, write 'set new-console on'.
      In UNIX/Linux, use TTY instead. That's all write.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved