Re: C++ SEGMENT fault and vtable issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jonathan;

I haven't been ignoring you (no sir). I just started to try to pare down the 
code so that the 'experience' is highlighted, and at the same time, make some 
coordinated changes to the original code. without understanding why, the 
original code now works correctly (or seems to). There are still some unsolved 
problems which I am quite confused over, but, time (and space) being what they 
are, I'm going to try to finish my regression tests before the cows come home. 
So, sigh. all is lost.

Thank you for taking the time to reply. I would really have liked to find the 
root cause of the issues that I saw, but, I'd rather finish the project. 


art



----- Original Message ----
From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
To: Arthur Schwarz <aschwarz1309@xxxxxxx>
Cc: gcc-help@xxxxxxxxxxx
Sent: Sun, October 14, 2012 4:19:13 PM
Subject: Re: C++ SEGMENT fault and vtable issues

On 14 October 2012 20:29, Arthur Schwarz wrote:
> Product Version = NetBeans IDE 7.2 (Build 201207171143)
> Operating System = Windows 7 version 6.1 running on x86
> Java; VM; Vendor = 1.7.0_03
> Runtime = Java HotSpot(TM) Client VM 22.1-b02

I doubt your IDE or JVM is relevant.


> Cygwin gcc 4.5.3
>              gdb 4.5.3
>
> I have a problem with my C++ application. I have tried to find what is wrong 
in
> my code and am unsuccessful, and amm hping that you can identify the issue.
>
> The code fails (for different reasons) in two locations:
> [code]
>   SlipHeader* oldHeader;
>    delete oldHeader;     // SEGMENT fault; custom defined delete
>
>   SlipHeader* header;
>   stringstream pretty;
>   pretty << header->toString(); // call to pure virtual function
> [/code]

Clearly this isn't the real code, because oldHeader and header are
never initialized.  If you show the real code, preferably reduced to
the minimum necessary to demonstrate the problem, then someone might
be able to suggest where to look for the bug.

It sounds like using an object after it's been deleted or some other
memory/lifetime issue.  On GNU/Linux I'd use valgrind to check for
that sort of problem.  There are tools to do a similar job on Windows,
but the only one I've tried is far inferior to valgrind and isn't free
(as in beer or freedom) so I won't recommend it.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux