Results 1 to 10 of 10

Thread: How to detect Release crash that is not produced on Debug

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to detect Release crash that is not produced on Debug

    Hi,

    I have an application that crashes when runs on release mode but works fine on debug version.

    Is there a way to detect the error?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to detect Release crash that is not produced on Debug

    You can use a debugger like gdb.

    What is the error you get?

  3. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to detect Release crash that is not produced on Debug

    There's also the old standby of using printf debugging, dropping print statements into your code at strategic points to locate where the error occurs. Even with quite large programs, this technique can locate a point of failure in a very small number of trials, since you can normally eliminate half of the remaining code, on average, at each step. Useful when debugging instrumentation masks failures, but it won't be useful if whatever is going wrong is causing stack corruption, in which your failure point will move around with each minor code change. Still, it's often useful.

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to detect Release crash that is not produced on Debug

    Hi,
    Quote Originally Posted by tbscope View Post
    You can use a debugger like gdb.
    Note that on release compilation I don't get debug information so I can't debug it.
    Òscar Llarch i Galán

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to detect Release crash that is not produced on Debug

    Hi,

    I found that a call to "flush()" method to a socket causes the problem.
    I can't explain why I have this problem. This code has worked for a long time. Last friday I compiled the last version of the software and installed on the target machine with no errors. Then, at home I just wanted to make some tests and it starts crashing.

    It seems that just not using the "flush(" method, the socket sends the data inmediatly, so I think that there is no need to call it. Take in consideration that this calls are done in a Thread, but the socket is created on the main thread. I know that it can reach some problems but I don't know why they started now.

    Any help will be wellcome

    Thanks,
    Òscar Llarch i Galán

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to detect Release crash that is not produced on Debug

    Quote Originally Posted by ^NyAw^ View Post
    Hi,


    Note that on release compilation I don't get debug information so I can't debug it.
    Ohh? Do you now what debugging information is?
    Sure, it will be more difficult but that's where your masters degree in computer sciences kicks in ;-)

  7. #7
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to detect Release crash that is not produced on Debug

    Hi,
    Quote Originally Posted by tbscope View Post
    Ohh? Do you now what debugging information is?
    The compiler generates it so you can debug the application. If there is no debug information such symbols, data names, ... the debugger will tell you that it don't have debug information. So really, if you don't know how to help me, don't waste time writing here. Thanks,
    Òscar Llarch i Galán

  8. #8
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to detect Release crash that is not produced on Debug

    Most modern debuggers don't need the special debugging information the compiler inserts into the object file; they can produce a stack trace without it, although they may not have access to symbolic names or line numbers. It is still quite possible to use the debugger to locate the point of failure, however.

    As noted above, stick some print statements in your code and you can quickly find the failure point without such aids.

    Failure in release mode with success in debug mode is often an indicator of walking off an array; the debugger "pads" array allocations in order to avoid segmentation faults, and that coupled with various indexing errors often produces programs that run fine with debug settings but fail otherwise. But there are litteraly hundreds, if not thousands of other likely causes. You'll need to narrow the problem down before you can analyze it.

  9. #9
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to detect Release crash that is not produced on Debug

    Quote Originally Posted by ^NyAw^ View Post
    Hi,


    The compiler generates it so you can debug the application. If there is no debug information such symbols, data names, ... the debugger will tell you that it don't have debug information. So really, if you don't know how to help me, don't waste time writing here. Thanks,
    Ok, maybe I'm a little bit too hard.
    But what you tell is bullshit. There are complete businesses around debugging applications.

    Programming is a lot more than just sitting behind your pc and writing a little program as a hobby.
    You need to educate yourself to an engineering level to understand what goes on inside a computer. I do not pretend to know all of this as computer sciences are not my main speciality.
    But what I do know, and this is from experience, is that you can certainly debug applications without debugging symbols in a debugger. But you'll need to know how the computer, the operating system, the compiler and the debugger work. This is not a quick question on a forum and 5 minutes later you have a magical answer.

    As suggested above, nothing stops you from including a logger in your program to log debugging messages just like if you use qDebug().
    But if that fails, you'll need to use a debugger.

    One of your next questions could have been: "Where do I find more information about debugging my program?"
    I would have responded with: "A good place to start is the documentation of the debugger you're going to use."
    Another question could have been: "Can I compile my program in release mode and still have all my symbols available somewhere?"
    I would have responded with: "Of course you can, see the manual of your compiler and debugger. You can even split everything up!"
    Another question could have been: "What exactly is the difference between a debug and release?"
    Even another question could have been: "Why do I get this error in release mode? Does it have something to do with my compiler optimizing some critical code that I didn't guard so well in my application?"
    etc...

    Did you ever see a crash log in Windows? Can you make sense of it?

    I used to play a lot with Lego. It was fun to create little machines. Everyone can do that. Later I got a masters degree in electromechanical engineering. I now work on multi million dollar/euro infrastructure projects. I can tell you this: with the knowledge to put together little lego machines, you get nowhere. You need a much better understanding of how things work to be able to get the errors out of a design.

    Today you get all these nifty tools like finite element software. I can tell these programs "look, here's a sketch of a bridge, tell me if it will hold at least 5 cars in the winter". And 5 minutes later the program tells me if it does. But I can tell you this: a lot of people working with these programs do not know the meaning of the results, they do not know how to interpret this. And this is extremely dangerous.

    The same can be said with programming. Most people can write program code. But when you get into a situation where you are now, it takes experience and knowledge to understand what goes wrong and to solve it.
    Last edited by tbscope; 31st May 2010 at 07:28.

  10. #10
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to detect Release crash that is not produced on Debug

    Hi,
    Quote Originally Posted by tbscope View Post
    Ok, maybe I'm a little bit too hard.
    Yes, is what I felt.

    Quote Originally Posted by tbscope View Post
    Programming is a lot more than just sitting behind your pc and writing a little program as a hobby.
    You need to educate yourself to an engineering level to understand what goes on inside a computer. I do not pretend to know all of this as computer sciences are not my main speciality.
    I know a little bit programming, I've been 5 years programming on this project that I started myself. It's a machine vision application that uses multiple threads, multiple I/Os, ... and it works well.

    Quote Originally Posted by tbscope View Post
    But what I do know, and this is from experience, is that you can certainly debug applications without debugging symbols in a debugger. But you'll need to know how the computer, the operating system, the compiler and the debugger work.
    This is what I didn't know. I thought that I need to tell the compiler to gereate the debugging information to let the debugger debug it.

    Quote Originally Posted by tbscope View Post
    As suggested above, nothing stops you from including a logger in your program to log debugging messages just like if you use qDebug().
    But if that fails, you'll need to use a debugger.
    It's just a bit complicated. As I told, it uses multiple threads, but could be helpful on some situations.

    Quote Originally Posted by tbscope View Post
    One of your next questions could have been: "Where do I find more information about debugging my program?"
    I would have responded with: "A good place to start is the documentation of the debugger you're going to use."
    Ok, so if anyone knows how to debug my aplication compiled in release mode on Visual Studio debugger it will be great.

    Quote Originally Posted by tbscope View Post
    Another question could have been: "Can I compile my program in release mode and still have all my symbols available somewhere?"
    I would have responded with: "Of course you can, see the manual of your compiler and debugger. You can even split everything up!"
    This is what I need.

    Quote Originally Posted by tbscope View Post
    Another question could have been: "What exactly is the difference between a debug and release?"
    Even another question could have been: "Why do I get this error in release mode? Does it have something to do with my compiler optimizing some critical code that I didn't guard so well in my application?"
    etc...
    I know about the code optimizations. Read my post, I told that the application had been working well for a lot of time on the target machine.

    Quote Originally Posted by tbscope View Post
    Did you ever see a crash log in Windows? Can you make sense of it?
    No, I didn't check it never. I don't know where to start getting relevant information on it, ...

    Quote Originally Posted by tbscope View Post
    The same can be said with programming. Most people can write program code. But when you get into a situation where you are now, it takes experience and knowledge to understand what goes wrong and to solve it.
    [/QUOTE]
    Yes, I know. I'm sure that I'm not a begginer.

    Thanks,

    The other question is. Anyone have experienced problems when calling "flush()" from a thread that was created on the main thread?

    Thanks,
    Òscar Llarch i Galán

Similar Threads

  1. Debug or Release mode in MAC
    By ssaa in forum Installation and Deployment
    Replies: 6
    Last Post: 9th March 2010, 06:15
  2. Replies: 3
    Last Post: 3rd December 2009, 17:12
  3. Need debug and release versions of Qwt?
    By Tiansen in forum Qwt
    Replies: 1
    Last Post: 28th March 2008, 08:55
  4. Why not on release but debug
    By baray98 in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2007, 10:08
  5. Debug and Release
    By paranoid_android in forum Qt Programming
    Replies: 5
    Last Post: 18th November 2006, 14:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.