From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Re: storage error: stack overflow Date: Wed, 12 Aug 2015 22:34:47 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net wbrqiGoiPh6zgZZvEmCzJAGZGlxrsySzXz7MlTAYcT82BiaTp1 Cancel-Lock: sha1:r+7sKsaoC4lLVHA3fVA7mSClErM= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:27426 Date: 2015-08-12T22:34:47-03:00 List-Id: On 08/12/2015 05:27 AM, briot.emmanuel@gmail.com wrote: > Since the problem occurs on linux, run your executable with valgrind. It will help a lot identifying the issue. > My first contact with valgrind. Executed it as described in the Quick Start Guide with valgrind --leak-check=yes ./sos The valgrind's response starts as follows: ----------------------------------------------------------------- ==4823== Memcheck, a memory error detector ==4823== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==4823== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info ==4823== Command: ./sos ==4823== (process:4823): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. ==4823== Invalid read of size 4 ==4823== at 0x66FF1A0: ada__strings__unbounded__reference (in /usr/lib/x86_64-linux-gnu/libgnat-4.6.so.1) ==4823== by 0x6703851: ada__strings__unbounded___assign__2 (in /usr/lib/x86_64-linux-gnu/libgnat-4.6.so.1) ==4823== by 0x425FE5: surfaces__deep_copy_base (surfaces.adb:12) ==4823== by 0x426076: surfaces__deep_copy__2 (surfaces.adb:28) ==4823== by 0x428081: detectors__deep_copy__2 (detectors.adb:40) ==4823== by 0x42D936: setups__define_setup (setups.adb:43) ==4823== by 0x43E5F3: main_gui__initialize (main_gui.adb:73) ==4823== by 0x43FEBC: main_proc__data_handlers__marshallers__void_marshaller__call.4284 (gtk-marshallers.adb:1111) ==4823== by 0x441482: main_proc__data_handlers__first_marshaller.4777 (gtk-handlers.adb:1280) ==4823== by 0x5E3E3B7: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4002.0) ==4823== by 0x5E4FD3C: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4002.0) ==4823== by 0x5E57A28: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4002.0) ==4823== Address 0x4 is not stack'd, malloc'd or (recently) free'd ==4823== ==4823== Warning: client switching stacks? SP change: 0x6ad0d40 --> 0xffeffed18 ==4823== to suppress, use: --max-stackframe=68590690264 or greater raised PROGRAM_ERROR : adjust/finalize raised STORAGE_ERROR: stack overflow (or erroneous memory access) ---------------------------------------------------------------- I didn't read the following 330kB of output about memory losses line by line, but most of them are related to libgobject and libgtk. The referenced line of my program surfaces.adb:12 is dest.name := source.name; These record fields are declared as UBString which is defined as subtype UBString is Ada.Strings.Unbounded.Unbounded_String; So it seems that assigning unbounded strings can be a problem. By the way, I use the gnat version from the regular repository of my LinuxMint distribution, which is 4.6. -- Frank Hrebabetzky +55 / 48 / 3235 1106 Florianopolis, Brazil