Can't debug in QtCreator if loading a sound using ofSoundPlayer (EDIT: if you use console window in your project)

Encountered a nasty issue - if it’s the same in your case then I guess it’s a serious issue… That would mean you can’t practically debug your project in QtCreator if you’re loading sounds/music - the SIGSTOP and Disassembly won’t let you past what they report as issues with OpenAL…

I’d like anyone who has Linux and QtCreator to test debugging a code such as:

(in you ofApp.h you declare:)
ofSoundPlayer soundToLoad;

and in your main ofApp.cpp you just go something as:

void ofApp::setup(){
// yeah, I'm using QtCreator 4.11.1, but it works with OF the same as 
// the recommended 4.6.1 version in tutorial
  cout << "testing debugger gdb in QtCreator 4.11.1" << endl;

  // SIGSTOP on ofOpenAL initialization when calling load sound function
  soundToLoad.load("clank.wav");

}

If you try to continue pressing F5 again, it will lead you to the core of the problem - it points to OpenALSoundPlayer initialization that was invoked by loading a sound via ofSoundPlayer…

Originally thought this was a problem with particular Linux distro (Fedora because of its regular bleeding edge updates, including newer c++ and gdb updates), and yet again I changed a distro due to this (Debian as the most stable), though debugging via terminal using gdb worked quite ok.

Turns out it’s neither issue with a distro choice nor QtCreator, because once you comment out that sound-loading function (e.i. you can’t load sounds), Debugging (key shortcut F5) works normally.

So I wonder… did anything changed considerably inside OF v.0.11 ?

(PS: that’s quite weird; now I remember when updating between two updates in Fedora, the older managed to debug it, while since the newer update came, it was no longer possible, resulting in the same scenario as in the pictures above… must be something with new cpp/gdb linux updates, generally…)

Come on, just try it! There must be many people using OF with Linux and QtCreator I guess…
Just try to load a sound using ofSoundPlayer and Debug it in QtCreator.
Do you encounter SIGSTOP message window?

works for me on qtCreator 4.14.0 and Ubuntu 18.04.

the Application Output in qtCreator might give you hints what exactly went wrong.

apart from that you could try to compile example/sound/soundPlayerExample and see if that has issues

Hmm, alright, you say you tried to Debug (F5) with having someSound.load(“filenameOfTheSound.extension”), and it didn’t show you this…?
What version of OF are you using? Do you have the latest of_v0.11 ?

Compilation is not a problem (Build and run), but you can’t use QtCreator IDE’s integrated Debugger (shortcut F5); in current stage I have to comment out every mention of loading sounds because that’s where debugger hangs, doesn’t seem to understand and prompts you to something as “download additional highlight definition files” which is nonsense as it should be debuggable as it was before without having to install anything.

Compiling will work for sure, but I bet debugging will hang if there’s a single mention of loading a sound using ofSoundPlayer class… But I might try your (rather new?) version of QtCreator in combination with older OF version (don’t know which one do you use currently). As for Linux distro, I have Debian 10 buster currently, so that might be new as well, but nevermind…

a side note: debugging via terminal using command gdb nameOfYourBuiltOFProject with subsequent command run works somehow, even though prompting you to download some unrecognized symbols as well (guess that’s be the issue in QtCreator), but then again, debugger via terminal is not that powerful and handy as the one in QtCreator.

I don’t understand this!
Debugging example/sound/soundPlayerExample works without a problem, but if I try to make new OF projects and fill ofApp.cpp with this:

//--------------------------------------------------------------
void ofApp::setup(){
  someSnd.load("someSound.wav");
}

//--------------------------------------------------------------
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){

}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
  if(key == OF_KEY_RETURN) { someSnd.play(); }
}

the same problem I mention above occurs… Why does it work for oF example project only?

EDIT: Ok, oddly enough, choosing to add console or not to your project in QtCreator makes the whole difference in this… example/sound/soundPlayerExample does NOT have console/terminal in QtCreator (an option when you create new OF project with QtCreator wizard if you want a console or not).
Tried another untitled sound project without console and it doesn’t suffer from the issues above (as the projects that have console - I use console for every single OF project I create, cos it’s good to have console for debugging using cout <<)…
Kinda shame, cause you have to choose whether you can use QtCreator’s Debug(F5) or use cout << …
:smiley:

hey,

I’m not sure if I fully understand the issue you have, but I get all cout << in the Application Output wether I compile Debug or Release for the soundPlayerExample within qtCreator

[...setup, etc...]

//--------------------------------------------------------------
void ofApp::update(){

    ofBackground(255, 255, 255);

	// update the sound playing system:
	ofSoundUpdate();
    cout << "test test" << endl;
}

[...draw, etc...]

just to be safe, this is how it looks like for me when I hit F5:

I’m happy to try something out for you, but have not too much experience with advanced usage of gdb beyond stack tracing, etc.
Do I maybe misunderstand what you want to do? :slight_smile:

1 Like

Yeah, but thank you for showing me there’s actually another way to display console output in QtCreator.
I was using external terminal window for projects as default. Don’t know if you use Project Generator for OF projects in Linux (I didn’t even try it yet… the only instances I used PG was on Windows and other IDE than QtCreator) or openFrameworks qtCreator wizard when starting a new OF project.

If you start a new OF project in qtCreator using its wizard (you have to have it installed first via yourOFpath/scripts/qtcreator/install_template.sh as mentioned in OF Linux/QtCreator setup tutorial) - you have the option to choose if you want to use a console window for your project. Found out it can be customized in Projects->Run Settings like this: https://forum.qt.io/topic/78732/run-os-console-instead-of-application-output-in-qt-creator

Now, if you try to debug (F5) with this external terminal output window, it should SIGSTOP you because of OpenAL. That was my observation when clicked OK on SIGSTOP and continued like 2-3 more times pressing F5 (Continue with Debugging).
It then points to ofOpenALSoundPlayer::initialize.
If it doesn’t, you probably have older/not updated Linux version and/or c++/gdb versions in the system (I remember how one Fedora update (cpp / gdb versions were mentioned somewhere in the update log to be updated) somewhere in autumn 2020 totally messed this for me)…

I just tried this using the template script, added an external terminal and debugged the application, everything works fine.

I am using OF 0.11.0 and qtCreator 4.6.1, on PopOs 20.04

Mind you, I almost always use the built in terminal, it’s one less window to manage.

And you tried this with ofSoundPlayer … someSound.load(…)?
PopOs is based on Ubuntu, right? Don’t know what all versions of cpp/gdb there are circulating in the updates…
If it doesn’t SIGSTOP you with external terminal yet, it should SIGSTOP you on Fedora 32 with recent updates, or just wait for c++/gdb updates to mess it up for you… :neutral_face:
Don’t enjoy the fact but there can’t be a reasonable explanation why this is happening when it wants to “download additional highlight definitions”…

Good to know though, if that happens, disabling external terminal and keeping it in Application Output docker should eliminate the trouble.

Yes I tried i exactly as you specified.
I don’t know why you’re getting that, but I’m guessing it’s a bug that may or may not disappear in the future…