Results 1 to 17 of 17

Thread: debugging problem : segmentation fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debugging problem : segmentation fault

    Nothing is wrong in previous post

    i did run my code in debug mode as you suggested
    As i am a beginner just trying to figure out what could be the error by running it in the debugging mode and i also sets break points as other suggested but it stops at the Disassembler "Dump of assembler code from 0x29654 to 0x296cc"(whom i am not totally familiar with)
    that is why i pasted the thread which i get in debug window to get further information about error

    thanks

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: debugging problem : segmentation fault

    t it stops at the Disassembler "Dump of assembler code from 0x29654 to 0x296cc"(whom i am not totally familiar with)
    You should have a call stack at that stage.
    Look at the call stack and see which is the last line which is in your code.
    That line is the line that crashed your application.
    While in the debugger you can examine the various variables in that line, and you can then see which variable is the problem.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debugging problem : segmentation fault

    call stack does not show any line number as below is the output that i get

    level function file line address

    0 ?? c:/nokiaqtsdk/maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib/libstdc++.so.6 0 0x000272b4
    1 ?? c:/nokiaqtsdk/maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib/libstdc++.so.6 0 0x00027444

    knowing the above information how can i check which line creates error ?
    if i know the line where function crashes then i may check the variable

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: debugging problem : segmentation fault

    Where in your code do you use streams?
    Can you post these code areas?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Apr 2011
    Posts
    124
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60
    Thanks
    1
    Thanked 10 Times in 10 Posts

    Default Re: debugging problem : segmentation fault

    Are you running QtCreator or some other environment?

    Set some breakpoints early in your code (somewhere you know you'll get) and become familiar with the debugger. You should have a stack display, a variable display, and a code display, though how they're arranged depends on your environment. The line of code where you stop should be highlighted in the code display. (At least, that is, if you compiled the code with debug enabled.) The stack display should display the sequence of methods you called to get to the point where you put the breakpoint.

    When you take an exception or fault, usually the stack display will show gibberish for the top several stack entries, then you'll see your methods below those. Click on the top-most line that you recognize as your code, and the code display should show you the line in your code where that is. The data display should then display the variables for that method.

  6. #6
    Join Date
    May 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debugging problem : segmentation fault

    Hi

    thank you very much for the reply my problem has been solved already a while ago but i have one more question to ask

    I am using qt creator , and i have a binary file (.exe) along with some dll files generated by Microsoft Visual C++ 2005 SP1 .
    Now i want to use the functionality of binary file (.exe) in QT creator , please let me know how can i proceed ?

    Thanks in advance

    Thanks

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: debugging problem : segmentation fault

    Sorry, your question does not make any sense.

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: debugging problem : segmentation fault

    I am using qt creator , and i have a binary file (.exe) along with some dll files generated by Microsoft Visual C++ 2005 SP1 .
    Now i want to use the functionality of binary file (.exe) in QT creator , please let me know how can i proceed ?
    You can extend QtCreators functionality by creating plugins for it.
    Google it.

    On the other hand, maybe you mean you want to link your application to an external lib.
    For this read the QtCreator documentation.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    Join Date
    May 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debugging problem : segmentation fault

    let me write in this way to make thing clear

    How to run .exe file from Qt creator ?

    I got a .exe file complied by visual C++. I have to run it with different input arguments (which I have to enter manually). I want to do this in Qt creator automatically. So my question is : How to call an executable in Qt creator ?
    It is simple to run executable file using command window (cmd.exe) but do not know how can i use in QT creator . Any hints would be helpful
    Last edited by qureshi; 8th June 2011 at 11:04. Reason: updated contents

  10. #10
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18
    Thanked 68 Times in 66 Posts

    Default Re: debugging problem : segmentation fault

    why do you want to run an .exe in QtCreator?

  11. #11
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: debugging problem : segmentation fault

    But what purpose would such an action have?
    I can understand if you want to run the application you are debugging in creator from creator, with argunents.
    For this you can set arguments in the debug settings.
    But what will you get by running an external application from creator?
    You can do it by specifying that exe in your debug settings and also the arguments.
    But I see no sense in doing this.
    Here you can see how to set run settings, there you can give your exe and arguments.
    http://doc.qt.nokia.com/qtcreator-2....-settings.html
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  12. #12
    Join Date
    May 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debugging problem : segmentation fault

    because my program in Qt creator return output (i.e some data), and i need to pass this output as an input to the .exe file , which returns data after some processing.
    At the moment i am using command windows separately for doing this (that means, first i obtained an output data from the Qt creator , then i open command window , passes my output data as an input to .exe file and finally get the final data after some processing(as processing is being done internally in the exe file and i have no access to the source code , but i have dll files available) ) so my goal is to combine this processing in QT creator so that i donot have to open command window each time separately.

Similar Threads

  1. Segmentation fault
    By impeteperry in forum Qt Programming
    Replies: 5
    Last Post: 29th December 2008, 19:59
  2. Segmentation fault
    By MarkoSan in forum Qt Programming
    Replies: 23
    Last Post: 19th October 2008, 23:40
  3. Segmentation Fault
    By Krish_ng in forum Qt Programming
    Replies: 8
    Last Post: 7th August 2007, 11:49
  4. Replies: 2
    Last Post: 19th May 2007, 19:25
  5. Segmentation Fault
    By merry in forum General Programming
    Replies: 4
    Last Post: 12th March 2007, 05:08

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.