texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] Strange bug with C++


From: Joris van der Hoeven
Subject: Re: [Texmacs-dev] Strange bug with C++
Date: Wed, 30 Apr 2003 13:40:11 +0200 (CEST)

> > > Also, exactly where does the segfault occur?
> >
> > During the destruction of ifstream.
>
> Maybe valgrind could be of some help here. There could conceivably be
> a memory corruption bug somewhere else which causes a crash in that
> destructor but cause no problem otherwise. Yes that is improbable.

I indeed have the impression that the problem is due to
the global new and delete. With gdb, I get:

--------------------------------------------------------
address@hidden src]$ gdb texmacs.bin
GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /home/vdhoeven/texmacs/distr/bin/texmacs.bin
sh: /home/vdhoeven/.TeXmacs/system/tmp/tmp_1891031863: No such file or directory
opening /home/vdhoeven/.TeXmacs/system/tmp/tmp_1891031863
opened

Program received signal SIGSEGV, Segmentation fault.
__builtin_vec_delete (ptr=0xfffffffc) at ./Classes/Abstract/basic.cc:73
73        register size_t s= *((size_t *) ptr);
(gdb) bt
#0  __builtin_vec_delete (ptr=0xfffffffc) at ./Classes/Abstract/basic.cc:73
#1  0x08263e5b in ifstream::~ifstream (this=0xbffff400, __in_chrg=2) at 
streambuf.h:487
#2  0x0810b283 in load_string (u={rep = 0x833e1d4}, address@hidden, 
fatal=false) at ./System/Files/file.cc:162
#3  0x081bc79f in eval_system (s={rep = 0x833e244}) at 
./System/Misc/sys_utils.cc:36
#4  0x081bc8a5 in var_eval_system (s={rep = 0x833e244}) at 
./System/Misc/sys_utils.cc:44
#5  0x0814bf8f in install_texmacs () at ./System/Boot/init_texmacs.cc:75
#6  0x08223797 in main (argc=1, argv=0xbffff684) at 
./Texmacs/Texmacs/texmacs.cc:195
#7  0x401cc507 in __libc_start_main (main=0x822378c <main>, argc=1, 
ubp_av=0xbffff684, init=0x804be7c <_init>, fini=0x8266e08 <_fini>,
    rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffff67c) at 
../sysdeps/generic/libc-start.c:129
--------------------------------------------------------

Probably, some allocations for ifstreams are done with malloc and
the destructions with delete[]. So I think that the bug comes from g++.

I think that I once have to remove the global destructors and
let them be inherited by the classes. But let's leave this for later...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]