You are not logged in.

1

Sunday, March 7th 2010, 3:32pm

Error when debugging with Qt creator.

My application compiles ok, but when I try to debug, I get:

"The inferior stopped because it received a signal from the operating system.
Signal Name: SIGSEGV
Signal Meaning: Segmentation fault"...
Running on Windows Vista.
Any sugestions how I can resolve this?
Many thanks, Nigel

2

Wednesday, March 17th 2010, 12:54pm

Thanks to @messenger, I think I have resolved the problem with the connect function, however when I try to debug, I get the previous error reported above, and the application terminates on line 2150, in QObject::connect....
this is running debug in Qt Creator 1.3.1, with Qt 4.6.2, on Windows Vista.
Once again, thanks in advance for assistance.

3

Thursday, March 18th 2010, 8:48am

When I compile a release version, I can start and run the app, however there are some things that don't work and I need to debug to find out why. In debug I am still getting this problem.
Any suggestions? Thanks.

ad5xj

Trainee

  • "ad5xj" is male

Posts: 129

Location: Louisiana

  • Send private message

4

Thursday, March 18th 2010, 7:02pm

You have two choices.

I will explain these in detail as I do not know your level of experience using debug techniques and for the benefit of other newbies.

1) On the projects folder, select the debug mode in the "Build Configuration for" project dropdown.
Go to the debug tab so you can run in debug mode and click the debug button. Allow the debug to run until it stops due to the SEG fault. This may take some time depending on your processor and the amount of memory you have, but expect quite a few seconds from the time the error pops up and the backtrace fills the debug window. The trace listed is in the reverse order the code lines were called. Look for the last line of code in your code that is reference. This is the offending line. The lines above it are the called methods in other modules that may or may not work. It may be obvious from the listing what is going wrong in your code or linkage (missing libs, etc.).

2) On the projects folder, select the debug mode in the "Build Configuration for" project dropdown. Build the project.
Open a terminal window that has the Qt SDK environment variables defined properly. Change to the debug folder of your application and execute the debugger for your executable (e.g. gdb ./myapp.exe). The debugger will open and wait for your instructions. Enter "r" to run the debugger against your executable. Wait for the error window to pop up and for gdb to display the line that it stopped on along with any error message that may be issued. In gdb enter "where" to give you a traceback list of where your app errored. It should look very similar to the listing in QtCreator debug mode with some slight differences depending on OS and debugger.

In both scenarios the debugger will give you the error backtrace to allow you to debug the problem. Often segmentation faults are due to calling on a defined but un-instantiated object. The backtrace list should point to which object that may be.
AD5XJ

5

Friday, March 19th 2010, 10:39pm

Thanks very much for this detailed explanation. As you may have seen in my more recent post, the application works in release mode, which is what confused me. I'll take a look at this, and see what I can improve on.
Learning a lot from these forums, thanks for your assistance and patience.
Nigel.

6

Wednesday, July 18th 2012, 8:13pm

I had the same problem . All I did was run the program in debug mode as stated by ad5xj ( without setting breakpoint or starting console) and then the line at which I received the error the debugger stopped.I realized that there was a redundant variable there that I was not using . Commented the variable and blamo ... the program runs in debug mode as well.

jiapei100

Beginner

  • "jiapei100" is male

Posts: 34

Location: Surrey, BC, Canada

Occupation: Programmer

  • Send private message

7

Saturday, July 21st 2012, 2:15pm

First of all, my environment:

Quoted

Ubuntu 12.04
C++ gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
Qt Creator 2.4.1 Based on Qt 4.8.0 (32 bit) Built on Mar 21 2012 at 23:05:03
Eclipse IDE for C/C++ Linux Developers Version: Indigo Service Release 2 Build id: 20120216-1857


I've got exactly the same problem now. I've got no idea why it is so.
I tried both Eclipse and QtCreator. Under Eclipse, my application runs fine, but under QtCreator, the application always meeting the SIGSEGV error:

Quoted

The inferior stopped because it received a signal from the Operating System.

Signal name :
SIGSEGV
Signal meaning :
Segmentation fault



Why the same code passed one IDE, but failed the other????weird...


Cheers
Pei
Welcome to Vision Open
http://www.visionopen.com

This post has been edited 1 times, last edit by "jiapei100" (Jul 21st 2012, 10:13pm)


8

Saturday, July 21st 2012, 4:46pm

different compiler?
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

9

Saturday, July 21st 2012, 4:48pm

either way, it means that there is something wrong with you program - most likely it is something that is 'undefined behaviour', and you are just getting lucky with one compiler/ide
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

jiapei100

Beginner

  • "jiapei100" is male

Posts: 34

Location: Surrey, BC, Canada

Occupation: Programmer

  • Send private message

10

Saturday, July 21st 2012, 10:23pm

Hi, Amleto, Thank you very much for your prompt reply ! Thank you !!

However,
1) I don't think it has something to do with the compilers.
I built 11 libraries under Eclipse, and 7 applications under QtCreator, which are based on those 11 libraries. 6 out of these 7 applications work perfect under QtCreator, and there is only 1 doesn't work properly.

Since 6 are working. Thus, I don't think there is a problem with the compiler. In fact, both Eclipse and QtCreator are using the compiler GCC.

2) I don't think there are some problems with my code as well.
Because my code work fine under Codelite (this one supports qmake well) and Visual Studio 2010 (with Qt Integrator).

Conclusion: It could be a problem about the settings of compiler? I've no idea.


Anyway, thank you for your reply.


Best regards
Pei




either way, it means that there is something wrong with you program - most likely it is something that is 'undefined behaviour', and you are just getting lucky with one compiler/ide
Welcome to Vision Open
http://www.visionopen.com

11

Sunday, July 22nd 2012, 12:13pm

pick a thread you want replies in please, I am not goign to keep looking at this thread on both forums.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.