[Qt-interest] NewBie: How to trace Segmentation Fault in Qt?
Usman Ajmal
uzmanajmal at gmail.com
Mon Jul 20 08:21:54 CEST 2009
ok i got following message after running my buggy program using gdb:
(gdb) run
Starting program: /home/usman/Memviz/QT/AnalysisModule/AnalysisModule
[Thread debugging using libthread_db enabled]
[New Thread 0xb6da96d0 (LWP 9320)]
Aspect Ratio:3.02857 Aspect Ratio:1.32075
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6da96d0 (LWP 9320)]
QGraphicsItem::scene (this=0x80f9930) at graphicsview/qgraphicsitem.cpp:839
839 QGraphicsScene *QGraphicsItem::scene() const
Now, trying to figure out what it mean. My program actually makes some
squares using a sqMap class which is inherited from QGraphicsItem. I use a
qstack to store the drawn items because during the process i need to remove
some of top of the stack squares. Following is a little snippet of my code
sqMap *square;
QStack <sqMap *> sqrBasket;
for(int j=0; j<=10; j++)
{
square = new sqMap(tempWidth, tempHeight);
square->setPos(xLocation,yLocation);
sqrBasket.push(square);
scene->addItem(square);
}
for(int pos=0 ; pos<=3; pos++)
{
scene->removeItem(sqrBasket.pop());
}
On Mon, Jul 20, 2009 at 10:52 AM, Chandru... <sekarwagmare at gmail.com> wrote:
>
> GDB is very flexible to use ... this one itself will help a lot
> http://www.cs.cmu.edu/~gilpin/tutorial/<http://www.cs.cmu.edu/%7Egilpin/tutorial/>
>
> On Mon, Jul 20, 2009 at 11:12 AM, Karol Krizka <kkrizka at gmail.com> wrote:
>
>> On Mon, 2009-07-20 at 10:26 +0500, Usman Ajmal wrote:
>> > Hi,
>> >
>> > I don't have any experience of working with any debugger on Linux and
>> > Qt. That's because i am a begineer in these fields.
>> >
>> > Having said that, i am now facing a Segmentation Fault when i run my
>> > Qt application. Please suggest me ways to trace it, and an
>> > easy-to-learn to learn tutorial for debugging C++ code on linux while
>> > developoing a Qt app.
>> >
>> What IDE are you using to develop your application?
>>
>> I would recommend that you try Qt Creator. It has a very nice debugging
>> environment that is friendly to new users. Just hit the debug button,
>> crash your application and it will show you the line in the code where
>> it crashed.
>>
>> If you are working from command line, you will probably have to use GDB.
>> But I don't know about any good tutorials for it.
>>
>> Cheers,
>> Karol Krizka
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>
> --
> WAGMARE
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090720/8d7e3303/attachment.html
More information about the Qt-interest-old
mailing list