Mail Archives: djgpp/1998/10/24/00:17:03
Message-ID: | <36318BAA.91343991@stargate.net>
|
From: | John Kissell <jdk AT stargate DOT net>
|
X-Mailer: | Mozilla 4.02 [en] (Win16; I)
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Nested structure problem (maybe)?
|
Lines: | 73
|
Date: | Sat, 24 Oct 1998 01:11:22 -0700
|
NNTP-Posting-Host: | 209.166.131.71
|
X-Complaints-To: | abuse AT sgi DOT net
|
X-Trace: | news.sgi.net 909205693 209.166.131.71 (Sat, 24 Oct 1998 01:08:13 EDT)
|
NNTP-Posting-Date: | Sat, 24 Oct 1998 01:08:13 EDT
|
Organization: | Stargate Industries, LLC.
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
The following is a snippet from a 'C' file that contains many long and
nested structures. By nested, a main structure 'OBJECT_TYPE *list'
contains pointers to other structures which contain pointers to lesser
structures and so on. It compiles and links with no errors *or warnings*
but I get a SIGSEGV at the 'p=record->text;' line. The rub is that Rhide
in 'run to cursor' and then debug shows that record->text contains a
valid string of type char, and in fact, the correct string in the
correct place for the file that was read in as a test of the code! But
the program when run unhindered under Rhide stops with a SIGSEGV at the
'p = record->text;' line? The nested structures are only four levels
deep at this point so I believe that I've made a mistake somewhere but I
dont have a clue where to begin because the structures work perfectly in
other functions. I can post all the files, but posting a small
compilable portion is impossible. Any ideas out there as to what to look
for? The behavior leads me to believe that there is a a subtle error at
the beginning of the function, but darned if I or the compiler can spot
it!
ps. I typed part of the error codes generated when the program was run
directly from the DOS prompt (from a 'print screen' printout). I would
like to capture them all to include here but I dont know how. :(
ps2: This was run under DOS 6.2 on a P75.
<snip>
int ParseFile(OBJECT_TYPE *list)
{ char command[6][2] = {"Z","X","K","I","T","G"},
*p,*p1,*p2,tmp[256],tmp2[256];
int n,G;
double CX=0,CY=0,CI=0,CJ=0,X=0,Y=0,I=0,J=0,arc,start,inc,r;
RECORD_TYPE *record;
OBJECT_TYPE *graph_win;
graph_win=TagSearch(list,GRAPH_WIN); /* in debug this points to the
correct data */
record=graph_win->file->records; /* this also */
vflag.max=vflag.graph=0; /* and this */
view_count=0; /* I'll get rid of this global
eventually */
do{
X=CX; Y=CY;
vflag.park = 0; /* this one too */
p = record->text; /******* SIGSEGV first flagged here ******/
p1 = tmp; /* Run to cursor at the *end* of this line and then
debug in Rhide shows that record->text contains exactly what it is
supposed to?
<snip>
partial error code listing:
Shutting down Allegro
Exiting due to signal SIGSEGV
Page fault at eip=000046b4, error=0004
eax=00000000 ebx=00006bc4 ecx=0000000a edx=0008f0a0 esi=00000054
edi=0004c790
ebp=0008c2dc esp=0008c04a
etc...
ps3: The OBJECT_TYPE structure does contain pointers to ALLEGRO entities
but none are referenced herein. So am I correct in assuming that the
'Shutting down Allegro' message is just a hook into DJ's shutdown
procedure to unload ALLEGRO interrupts?
- Raw text -