I am developing a library, which untill a few days ago was working perfectly. With some changes I needed to perform I started having a segmentation fault. The problem is that I cannot understand why the fault is happening since the conclusion from gdb is the following:

Program terminated with signal 11, Segmentation fault.
[New process 31401]
#0  0x0806a53a in Solution (this=0x9e1a8d0, copysol=@0x9e21908) at ../brickh-lib/Constraint.h:647
647       class SilvaConstraint{

So, I understand it all starts when there is a copy of a Solution, but then why is gdb saying it occurs at a class declaration? What does this mean? How can I get to the bottom of the problem?
(SilvaConstraint does not have a copy constructor defined, but if I define one the gdb gives the same output; I checked the copy constructor at Solution also and I couldn't find any sign of memory violation)

Thank you for your help

Re: GDB says it happens at a class declaration 80 80

It is really hard for us to actually find the error without knowing what exactly your code is ,

Though You dont post the whole code, Post the Class And atleast 20 Lines Before and After the Class Definition,

Other-wise you can attach the whole file (donot forget to include tests in it) and post it up so someone can actually work on it.

Re: GDB says it happens at a class declaration 80 80

post the output of 'where' in gdb, that will give us the whole stack.

Re: GDB says it happens at a class declaration 80 80


I am using meta-programming so posting evrything here will probably be useless adn confusing. What I am really looking for is maybe a hint of how to further debug this or what the meaning of gdb pointing to the class declaration is. I have tried a lot of things and I've googled a lot trying to find some explanation that would help me to do more... How can it be at the class declaration?! Shouldn't it at least be in the constructor, if it is at the time of creation?

Thank you

Re: GDB says it happens at a class declaration 80 80

I tried with VC++ debugger and here I get a proper location to look for an inconsistency, not the class declaration anymore. Any hints on why this GDB behavior?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.