Path: utzoo!mnetor!uunet!husc6!think!ames!sdcsvax!sdcc6!loral!jlh
From: jlh@loral.UUCP (The Happy Hacker)
Newsgroups: comp.unix.wizards
Subject: any comp.dbx.wizards out there?
Message-ID: <1499@loral.UUCP>
Date: 14 Dec 87 21:20:54 GMT
Organization: Password:
Lines: 58
Keywords: &^*! bloody $#&*^ stinkin *&#$@'

From dbx, when 'foo_type' is a typedef'd structure, and foo is a foo_type,
if I tell dbx to print foo, where does it gets it's information as to
where the fields are in foo?  To be more specific, I've got the following:

typedef struct {
	int	array1[BIG_NUM];
	char	a, b, c, d, e;
	int	array2{BIG_NUM];
} foo_type;

foo_type foo;

So now lets say I want to see what a, b, c, d, and e are, so I say
'print foo'.  Dbx prints out array1, the stuff I want to see, then array2.
This is all well and good except that I want to go get coffee while
foo is being printed and the info of interest scrolled off the screen by
array2.  So I change foo_type to put array2 right after array1 and recompile
everything.  Type 'print foo'.  Hey, guess what?  It still thinks
the structure has a-e sandwiched between the 2 arrays.  But by looking
at the data it was stored in the structure at the right place.  For
example, if all entries of both arrays were 0 and a-e were 1, then
'print foo' it says array1 is all 0's, which is correct, a-e are 0,
which is not correct, then all of array2 is 0 except for the last 5
entries, which are 1.  The correct answer is that array1 is all
zeros, array2 is all zeros, and a-e are all 1.

If I say 'whatis foo' and 'whatis foo_type' I get the correct
answers.  If I say 'print foo.e' I get the correct answer.  It's only
when I try to print out the entire structure the wierdness shows up.
I've deleted all the objects and recompiled everything, I've checked
the include file with foo typedef'ed back into RCS and tried again, to
no avail.  Note that foo_type is a stripped down example, the real
structure has several large arrays with from between 512 and 2048
entries apiece in them.  The data of interest (a to e) is actually
about 15 individual fields.  Any ideas out there?

While I'm on the subject, I find that a lot of the time I just want
to see array1[10] to array1[15].  Short of either typeing out
print commands for each of these fields, or typeing out the entire
array, is there a way to just print part of a large array from dbx with
one print command?  Thanks.


							Jim


Jim Harkins 
Loral Instrumentation, San Diego
{ucbvax, ittvax!dcdwest, akgua, decvax, ihnp4}!sdcsvax!sdcc6!loral!jlh

"The opinions expressed in this article accurately reflect those held
by Ronald Reagan, George Bush, Al Haig, and Jerry Fallwell.  But you
already knew that, didn't you"

-- 
Jim Harkins 
Loral Instrumentation, San Diego
{ucbvax, ittvax!dcdwest, akgua, decvax, ihnp4}!sdcsvax!sdcc6!loral!jlh