Page 1 of 2 12 LastLast
Results 1 to 20 of 38

Thread: what are the debug versions used for?!!

  1. #1
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default what are the debug versions used for?!!

    what is the real usefulness of the debug mode libs and executables?
    how can we use them, and with what tools and situations/scenarios, and are their uses any common and vital (or even important) for we as the application programmers?
    I personally never used them.
    my qt builds in debug mode by default; so I was confused at first.
    debug mode libs and executables have a considerably bigger size and are slower.
    I think somebody more ignorant may release them instead of release mode ones!!

  2. #2
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    I realy don't know this.
    I just have saw tools such as GDB that are very low level and seem of no real use for high level programmers.

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    debug libs are used for debugging!! ... there are many benefits of it the most important are :
    1. First of all debug libs let your debugger step inside the code of the lib.
    2. There are extra debug code in debug lib for example
    #ifdef _DEBUG_
    if(someerror)
    qDebug("error here");
    #endif
    and there are ASSERT() macros in debug mode which helps in catching logical errors.

  4. #4
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: what are the debug versions used for?!!

    Quote Originally Posted by FS Lover View Post
    I realy don't know this.
    I just have saw tools such as GDB that are very low level and seem of no real use for high level programmers.
    We would like to hear how you do debugging. Most if not all integrated development environments use gdb as backend.
    It's nice to be important but it's more important to be nice.

  5. #5
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    I don't use IDEs. (at least since those old days of the DOS compilers/IDEs)
    I always debug with classic programming means; mostly, outputting some messages in different places and levels of the program.
    Remaining (and usually substantial) task is the (re-)analyzing and thinking about the cause(s).
    complementary guesses and tests, etc.

    I think these are fast enough for me and cause me to become more stronger and gain more insight about the program (and other programs) and problems (even problems that have no sign at the moment).
    Last edited by FS Lover; 15th August 2009 at 16:22.

  6. #6
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: what are the debug versions used for?!!

    This is your personal choice of course. But I hope that you do not have to extract the file and line number of a compile error by yourself but using at least an editor that can parse the messages and jump to errors.

    Remember: The computer was made to save work and not to make more work. If the computer already knows where there error is, why should the information of line number go out of the computer into your mind and then is entered back into the computer to open the file. This is like not using copy and paste but print something out in paper from one application to be able to read it again from paper and enter it into another application.
    It's nice to be important but it's more important to be nice.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: what are the debug versions used for?!!

    Quote Originally Posted by FS Lover View Post
    I always debug with classic programming means;
    Actually the most classic programming means of debugging is to use a debugger

    mostly, outputting some messages in different places and levels of the program.
    This doesn't always work and makes it hard or even impossible to trace what is currently going on in the application.

    Remaining (and usually substantial) task is the (re-)analyzing and thinking about the cause(s).
    complementary guesses and tests, etc.
    I second what Axel has said - why reinvent the wheel if right besides you there is a person who knows wheel design inside out?

    I think these are fast enough for me and cause me to become more stronger and gain more insight about the program (and other programs) and problems (even problems that have no sign at the moment).
    That's actually a false feeling. It's like black-box testing - you can only put something in the box and then see what falls out of the box but you don't know what happens inside the box. Of course you can study the blueprint of the box but why not simply make the box transparent and see what's inside?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    I have seen some basic examples about how to use debuggers (GDB).
    they weren't much more magic.

  9. #9
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    I think my mind is more smart and at least as fast as these tools.
    probably you can't be sure this is a false claim.
    maybe you can show me with a clear real world example.
    This doesn't always work and makes it hard or even impossible to trace what is currently going on in the application
    and my brain's analysis reveals many things that by relying on a debugger can't be revealed.

    you can only put something in the box and then see what falls out of the box but you don't know what happens inside the box.
    in many cases we need to have some third eye that can see inside the box.
    no debugger can show all things that happen inside our programs, otherwise we told them to find and solve all bugs and security holes of our programs.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: what are the debug versions used for?!!

    Nobody forces you to use a debugger, really. I'm not even going to try.

    Just note that you admitted yourself, you have seen basic examples of debugger use. And sure you can do manually almost everything a debugger can do, but how much time do you need to do it compared to using the tool?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    855
    Thanks
    68
    Thanked 56 Times in 54 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    Hi,

    How many code lines has your code? Maybe you couldn't debug a 1 million code line application with your method using out messages. Outing messages don't let you inspect the variables values that you need(only inserting a new out message with the new variable out and recompiling the application).

    I think that all begginer programmers started using you method(me too) but when you get more time using the debugger it will help a lot(and save time!).
    Òscar Llarch i Galán

  12. #12
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    yes, my programs weren't long so far.
    indeed I had not much time for learning peripherals of the programming yet.
    and not even writing serious programs/apps in all of the languages that I know (but some challenging programs for exercise occasionally).
    I know PHP, C, C++, JavaScript, Action Script, Assembly and many other things related to the programming too.
    I worked with GNU/Linux - Windows - MySQL - Apache - BASH - DOS etc. at advanced levels.
    I am now learning Python.
    I am learning programming languages for several years.
    I always read the whole official reference that takes a lot of time.
    so I had not any priority for learning peripheral tools.
    and I think these are not much hard and learning how to use them takes a short time in comparison to learning a programming language completely.
    for example learning how to use a visual GUI builder like Qt Designer took just one or two days (including studying of the whole relevant reference).
    but I think some things are depending on practical experience.
    on real work and real (possibly big) projects.
    big doesn't mean much more creative and diverse than small necessarily. so I love small programs that I can learn many things from them much more quickly.
    Last edited by FS Lover; 7th October 2009 at 17:57.

  13. #13
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: what are the debug versions used for?!!

    OK: Every time you add a debug message, you will have to recompile the program. When using a debugger, you can set breakpoints whereever you please, even while the programm is running. You can output arbitrary variables whenever you please.

    Try QtCreator, set a breakpoint and start your programm. When the program hits the breakpoint, you can inspect all local variables. You will see the call stack how the program got into that method. Do you realy think you can get all this information by adding some QDebug?
    It's nice to be important but it's more important to be nice.

  14. #14
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: what are the debug versions used for?!!

    I use both methods constantly as I am a software engineer as my full time job. I always use debugger when possible, and try to use string output also when possible. Sometimes neither are possible (some embedded devices), and the only thing you have is a small light or even worse (a voltage which you have to measure).

    Whenever I don't use a debugger, it takes much longer to reach my goal as I have to constantly guess where the program could be faulty, add diagnostic code (output string, turn light on, etc), recompile, test, and loop until fixed. When I use a debugger, I recompile only once, and thats to fix the code.

    Thing of a faulty algorithm that is several hundred lines: Are you going to put a printf on every line to see what happens, or just step through with a debugger which can automatically show you whats changed?

  15. #15
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 333 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    Think about the following -
    It is hard to check the flow of code through debugging by logs...
    also you cant set breakpoints and check the values in real time...

    also when u use someone else library, u cant have log in ur file if crash occurs due to code in that library,with a debugger u might be able to trace that too. Like when using Qt,,, we many times can see what assertion failed when we get a error or crash ....

    logs are helpful when u deploy the application and u cant debug the client side.

    and as said above , why reinvent the wheel and waste ur time..?? judging what to keep in log and when to use debugger will definitely increase productivity.

  16. The following user says thank you to aamer4yu for this useful post:

    FS Lover (25th October 2009)

  17. #16
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    but i think projects should be build in release mode by default.
    so that every time we compile them, extra time isn't spent.
    we need debug versions occasionally, not most often.
    the extra time spent, is considerable and bothering.
    if we wanted a debug, we can instruct the tools to build the debug version.

  18. #17
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: what are the debug versions used for?!!

    No wrong: You usually need debug versions while developing your application. You only need release versions if you build packages for distros. If you use release by default, you have to recompile every time you want to debug. Because you want to debug everytime your programm does not act as expected, there shouldnt be the penalty of recompile to find that bug.
    It's nice to be important but it's more important to be nice.

  19. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: what are the debug versions used for?!!

    BTW. Debug versions of applications usually compile faster than release ones because they have optimizations turned off. Of course for simple applications there is not much to be optimized so the difference is insignificant.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  20. #19
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    Quote Originally Posted by axeljaeger View Post
    Because you want to debug everytime your programm does not act as expected, there shouldnt be the penalty of recompile to find that bug.
    i don't think there is need to debug with debugger tool everytime!
    there are many mistakes often that don't need a debugger to solve more quickly or more conveniently.
    many times just compiler error massages are sufficient to discover the cause shortly.
    i think a good programmer is so.

  21. #20
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what are the debug versions used for?!!

    Quote Originally Posted by wysota View Post
    BTW. Debug versions of applications usually compile faster than release ones because they have optimizations turned off. Of course for simple applications there is not much to be optimized so the difference is insignificant.
    i think optimization isn't the only or most effective parameter involved.
    and there should be several other more effective parameters in adverse.
    i think the effect of optimizations is insignificant in all or most of common cases.

    i tested on 3 of qt examples of different categories.
    the average was 100% faster. all builds were considerably faster in release mode.
    and i think you can find very few programs that compile even a little faster in debug mode, if at all!
    most or more usual programs are build considerably slower in debug mode.
    if you know exceptions introduce them to me to test!

Similar Threads

  1. Need debug and release versions of Qwt?
    By Tiansen in forum Qwt
    Replies: 1
    Last Post: 28th March 2008, 07:55
  2. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48
  3. Adding custom defines when on debug build
    By chus in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2007, 11:38
  4. Replies: 11
    Last Post: 22nd March 2006, 19:06

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.