metz@iam.unibe.ch (Igor Metz) (08/09/89)
The following g++ code causes gdb 3.2 to dump core:
-------------------------------------
#include <ACG.h>
#include <DiscreteUniform.h>
#include <stream.h>
void
main()
{
ACG gen(10, 10);
DiscreteUniform ran(0, 128, &gen);
cout << " Hello \n";
}
-------------------------------------
Here is a session log:
-------------------------------------
evisa:/u-siam/metz/diss/code% g++ -g test-neighbor.cc
evisa:/u-siam/metz/diss/code% gdb a.out
GDB 3.2, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /u-siam/metz/diss/code/a.out...done.
No symbol "command" in current context.
Type "help" for a list of commands.
(gdb) br 11
Reading in symbols for test-neighbor.cc...done.
Breakpoint 1 at 0x2292: file test-neighbor.cc, line 11.
(gdb) run
Starting program: /u-siam/metz/diss/code/a.out
Bpt 1, main () (test-neighbor.cc line 11)
11 cout << " Hello \n";
(gdb) i lo
gen = {
<struct RNG> = {singleMantissa = {s = 1.17549e-38, u = 8388607},
doubleMantissa = {d = 2.225073858507201e-308, u = {1048575, 4294967295}},
_vptr$RNG = 0x2042c}
members of struct ACG: state = 0x24aa8, auxState = 0x24ad0, stateSize = 10,
auxSize = 32, lcgRecurr = 350636604, j = 7, k = 4}
ran = {
Segmentation fault (core dumped)
--------------------------------------
gdb crashes when it tries to print the name of the baseclass of class
DiscreteUniform (it is Random), since the name is missing in gdbs data
structure (instead there is a null pointer!). The following patch is a a
cure for the symptom:
*** utils.c.orig Wed Aug 9 13:58:11 1989
--- utils.c Wed Aug 9 13:58:42 1989
***************
*** 571,577 ****
necessary. */
lineptr = linebuffer;
! while (*lineptr)
{
/* Possible new page. */
if (lines_printed >= lines_per_page - 1)
--- 571,577 ----
necessary. */
lineptr = linebuffer;
! while (lineptr && *lineptr)
{
/* Possible new page. */
if (lines_printed >= lines_per_page - 1)