setzer@nssdcs (William Setzer (IDM)) (07/12/89)
Consider the following program: ------- file foo1.c ------- static struct foo { char b[4]; int a; long c; }; static struct foo name; main() { printf(" "); } ------- ------- file foo2.c ------- static struct foo { long x; char y[4]; int z; }; static struct foo name; ------- (I deleted some whitespace to compact this message.) I compiled this on a Sun4 (SunOS 4.0) ['cc -g foo1.c foo2.c'], and then ran it thru dbx. Here is a partial transcript (after stopping at printf): ---------- (dbx) file foo1.c (dbx) print name `foo2`name = { x = 0; y = "" ; z = 0 } /* whitespace deleted */ (dbx) file foo1.c (dbx) print name `foo2`name = { x = 0; y = "" ; z = 0 } (dbx) file foo2.c (dbx) print name `foo2`name = { x = 0; y = "" ; z = 0 } ---------- If I type 'print `foo1`name', I get what I'm looking for, namely -- `foo1`name = { b = ""; a = 0; c = 0 }. Since the default file is foo1.c, I would expect 'print name' to print `foo1`name. Now to the question -- Is the above phenomenon a dbx bug or dbx feature? (Please note: foo1.c and foo2.c are the result of distilling 'real' code down to the smallest pieces that demonstrate the above phenomenon. I am not really interested in a solution per se [the offending variables were eventually just renamed], but I am curious as to the cause of the problem. If it's not a bug, I would like to know why not.) Thanx for any comments. -- William Setzer setzer@nssdcs.gsfc.nasa.gov