🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #10131

core dumps and other woes in gdb

#10131
From: Thomas M. Breuel
Date: Tue, 05 Jun 1990 00:21
34 lines
1940 bytes
lem$ /usr/local/gnubin/gdb mbm2d
GDB 3.5.1, Copyright (C) 1989 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 /tmp_mnt/home/vi/tmb/mbm/mbm2d...done.
Type "help" for a list of commands.
(gdb) run image model
Starting program: /tmp_mnt/home/vi/tmb/mbm/mbm2d image model

Program received signal 11, Segmentation fault
Reading in symbols for mbm2d.c...done.
0x2ca0 in makePairing (b=(double *) 0xd1f0, r=(double *) 0x0) (mbm2d.c line 208)
208			c=makeConstraint(b,r,u,r[4]);
(gdb) p image[0]@4
$1 = {0xd1f0, 0xd220, 0xd250, 0xd280}
(gdb) p (image*)(image[0]@4)
Invalid syntax in expression.            <<< this should be possible
(gdb) p (image[2])(image[0]@4)
Memory fault - core dumped               <<< this certainly shouldn't dump core
lem$

The other obvious choice to achieve the same effect also doesn't work:

(gdb) whatis image
type = double *[1000]
(gdb) p *image@4
$11 = {0xd1f0, 0xd220, 0xd250, 0xd280}
(gdb) p *(*image@4)@2
$12 = {0xd1f0, 0xd220}  <<< this is wrong for any sensible definition of "@"
(gdb)

There really should be a clean way to print 2D arrays that are represented
as vectors-of-vectors.
Technical Details
Message-ID: <9006050021.AA04009@lem>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!snorkelwacker!tut.cis.ohio-state.edu!AI.MIT.EDU!tmb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,4e60f389bdb784af,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-06-04 22:02:16 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!snorkelwacker!tut.cis.ohio-state.edu!AI.MIT.EDU!tmb
From: tmb@AI.MIT.EDU (Thomas M. Breuel)
Newsgroups: gnu.gdb.bug
Subject: core dumps and other woes in gdb
Message-ID: <9006050021.AA04009@lem>
Date: 5 Jun 90 00:21:02 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 34
Posted: Tue Jun  5 01:21:02 1990