Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2002 11:17:44 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Ruslan Ermilov <ru@FreeBSD.org>
Cc:        Alexander Kabaev <kan@FreeBSD.org>, "David O'Brien" <obrien@FreeBSD.org>, current@FreeBSD.org
Subject:   Re: Groff problems (was Re: alpha tinderbox failure)
Message-ID:  <15797.27672.327091.966095@grasshopper.cs.duke.edu>
In-Reply-To: <20021022142929.GB48398@sunbay.com>
References:  <200210210942.g9L9gLpM025724@beast.freebsd.org> <15796.17145.909288.498725@grasshopper.cs.duke.edu> <20021022142929.GB48398@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Ruslan Ermilov writes:
 > Well, I tried this on beast.  It is easily reproduceable.
 > 
 > It turned out that if you build groff with -DNO_CPU_CFLAGS
 > (the way it is built during the bootstrap-tools stage of
 > buildworld), it fails with the `out of memory' error in
 > contrib/groff/src/libs/libgroff/new.cc.  To reproduce, it
 > is only necessary to build the following dirs, in order,
 > with -DNO_CPU_CFLAGS:
 > 
 > gnu/usr.bin/groff/src/libs/libgroff
 > gnu/usr.bin/groff/src/roff/groff
 > 
 > And then run groff from the latter as follows:
 > 
 > groff -V
 > 
 > More fun.  Groff is built with -fno-rtti and -fno-exceptions:

FWIW, the "out of memory" is because it is attempting to malloc
a huge amount of ram.  Apparently mistakenly:

(gdb) break /usr/src/contrib/groff/src/libs/libgroff/new.cc:45
Breakpoint 1 at 0x12000c9cc: file
/usr/src/contrib/groff/src/libs/libgroff/new.cc, line 45.
(gdb) r
Starting program: /usr/src/gnu/usr.bin/groff/src/roff/groff/groff

Breakpoint 1, operator new(unsigned long) (size=4832141312)
    at /usr/src/contrib/groff/src/libs/libgroff/new.cc:45
45        if (p == 0) {
(gdb) p/x size
$1 = 0x12004a000
(gdb)

Note that 0x12004a000 looks quite a bit like an address in the data
segment.   The stack looks like this (its happening before main is entered):

(gdb) where
#0  operator new(unsigned long) (size=4832141312)
    at /usr/src/contrib/groff/src/libs/libgroff/new.cc:45
#1  0x12000d528 in operator new[](unsigned long) ()
#2  0x12000c1ac in search_path (this=0x120035930, envvar=0x0,
    standard=0x12002b8b1 "/usr/share/groff_font", add_home=1,add_current=0)
    at /usr/src/contrib/groff/src/libs/libgroff/searchpath.cc:39
#3  0x12000aec4 in __static_initialization_and_destruction_0 (    __initialize_p=1, __priority=65535)    at /usr/src/contrib/groff/src/libs/libgroff/fontfile.cc:34
#4  0x12000af30 in _GLOBAL__I__ZN4font3resE ()    at /usr/src/contrib/groff/src/libs/libgroff/fontfile.cc:34
#5  0x12002a0b8 in __do_global_ctors_aux ()
#6  0x120000150 in _init ()
#7  0x120000228 in _start ()


The code calling new is this bit of c++ code:

(gdb) frame 2
#2  0x12000c1ac in search_path (this=0x120035930, envvar=0x0,
    standard=0x12002b8b1 "/usr/share/groff_font", add_home=1,
add_current=0)
    at /usr/src/contrib/groff/src/libs/libgroff/searchpath.cc:39
39        dirs = new char[((e && *e) ? strlen(e) + 1 : 0)
(gdb) l
34        if (add_home)
35          home = getenv("HOME");
36        char *e = 0;
37        if (envvar)
38          e = getenv(envvar);
39        dirs = new char[((e && *e) ? strlen(e) + 1 : 0)
40                        + (add_current ? 1 + 1 : 0)
41                        + ((home && *home) ? strlen(home) + 1 : 0)
42                        + ((standard && *standard) ? strlen(standard) : 0)
43                        + 1];

I have no idea what 'e' is, gdb doesn't like things declared in the
middle of a scope, apparently.

Drew

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15797.27672.327091.966095>