VSCode Debug Console not working when debugging Qt application on target

Hi,
I’m running a Qt application on a Verdin iMX8M Mini on a Mallow carrier board. When I debug the application with the VSCode Torizon extension, the application builds and loads just fine, and I can pause execution, but I do not see anything in the Debug Console. On the upper right of the Debug Console, it shows “Failed to Open – Showing 0 of 10000”.

The call stack is shown correctly, and I can pause and resume the application and it does show me the line number where it paused. So some debug information is getting back to vscode, but not the log output to the Debug Console.

When I debug the default Qt QML template application, the debug console works correctly and shows application startup and debug logs as expected.

I’ve compared the tasks.json, settings.json, and launch.json files between my application and the template, and I see no significant differences.

When I build and deploy a release build onto the target, the application logs are visible with “docker logs” as expected.

Any idea where I could look to troubleshoot this issue?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your detailed explanation of the issue you’re facing with the Debug Console while debugging your Qt application on Verdin iMX8M Mini using the VS Code Torizon extension.

Given your observations:

  • The application builds, loads, and debugs (call stack, line information) correctly.
  • Debug Console in VS Code shows “Failed to Open – Showing 0 of 10000”, but works for the Qt QML template.
  • Application logs are visible with docker logs in release mode.
  • Configuration files are consistent with the working template.

Here are some targeted troubleshooting steps you can try:

1. Check Standard Output/Error Redirection

The VS Code Debug Console relies on receiving stdout and stderr from the application process. If your application is redirecting these streams elsewhere (e.g., to files or using custom logging frameworks that don’t write to the console), VS Code might not display log output.

  • Ensure your main.cpp does not call freopen, fclose(stdout), or similar functions.
  • If your application uses a logging framework (like QLoggingCategory), verify that log messages are still configured to go to the standard streams without explicit file targets.
  • Test by adding a basic qDebug() << “Hello, debug!”; or fprintf(stderr, “Test stderr\n”); early in main(), to see if anything appears in the Debug Console.

2. Container Entrypoint and Output

Torizon uses Docker containers; make sure your CMD, ENTRYPOINT, or launch.json configuration doesn’t accidentally run your app in background (detached mode) or redirect logs away from stdout/stderr.

3. Application Name/Path

If your application executable is named differently or placed in a different subfolder compared to the template, double-check the launch.json and tasks.json to verify program and cwd fields match the actual application.

4. Permissions and Ownership

In rare cases, incorrect file permissions might prevent the application from writing to stdout/stderr, especially if running as a non-root user in the container. Compare Dockerfile USER and chmod/chown steps to those in the working template.

5. VS Code Torizon Extension Logging

Enable debug logs for the Torizon extension (View > Output > Torizon: All Logs). There may be clues if VS Code reports issues establishing I/O with your container.

6. Compare Dockerfile and Compose Files

There may be environmental differences (e.g., ENV variables, docker-compose.yml settings) between your project and the template, which could impact how logging works inside the container.

For more information about importing and configuring Qt projects with Torizon and VS Code, you can refer to these resources:

Feel free to try the above steps, and let me know what you find! If you’d like, I can suggest additional general debugging tips specific to Qt or VS Code.

Best regards,
Toradex AI Assistant.

Hey @jeffgable,

For clarity. You don’t get debug console logs [but you do get other debug info] when working on your active project, but if you switch back to the default, the debug logs come back?

Do you know if this was always the case? Or have a inclination of when it stopped working?

Can you share anymore information on the error? Are there any logs?

-Eric

Hi @eric.tx ,
There are no logs or anything that would point me to what is wrong. It’s the “Debug Console” window in VSCode that should show application logs when debugging, but it does not. There’s no error message that I can see, just the Debug Console is blank and the filter search box in the upper right corner of the Debug Console shows “Failed to open”.

Your AI’s suggestion to enable debug logs for the Torizon Extension doesn’t make sense (View > Output > Torizon: All Logs isn’t a thing), but if there is some way to actually do that (enable more log output from the Torizon extension) that would probably be helpful.

The first commit in the project history is the default Qt template, and it works as expected. I can do a manual git bisect and try to find the point in the project history when it stopped working. That’s likely what I will try next. This application was largely developed in desktop simulation mode without hardware, so that’s why we didn’t discover that debugging was broken until a lot of code had been written.

Cheers,
Jeff

Hey @jeffgable,

Yeah, if you could that would be great, also, if you could share part of the project that I can recreate this issue, it would aid us in finding a solution as well.

-Eric

Hey Jeff,

How are you doing with this? Are you able to debug now? Or maybe create an environment that I can recreate the issue?

Eric Singer
Toradex

@eric.tx Thanks for checking in. I’ve been busy solving other problems and haven’t gotten back to this. Hopefully soon. :stuck_out_tongue:

Hi @jeffgable,

I don’t know if I get you right, but if your problem is, that you don’t get any output from qDebug() like qDebug() << "blub"; … you should try the following:

  1. Use std::cout << "blub" << std::endl;

OR

  1. If you want to you qDebug() you should place the following code in your main.cpp:
void qDebugToStdout(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
    Q_UNUSED(type);
    Q_UNUSED(context);
    QTextStream cout(stdout, QIODevice::WriteOnly);
    std::cout << msg.toStdString() << std::endl;
}

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    qInstallMessageHandler(qDebugToStdout); //print qDebug to stdout

    //your code ...

    return app.exec();
}

Hope this helps. Have a good day.

Uwe :v: