BUGS: pcc &/| dbx &/| gdb
Russell Kent
kent at tifsie.UUCP
Wed Jul 27 02:32:41 AEST 1988
I seem to have stumbled across a rat's nest of problems in one or more of
the following programs under Ultrix 2.[02]:
dbx 2.0
gdb 2.1 & 2.6
cc (Ultrix PCC 2.0)
vcc (VAX C)
Certain people may find this particularly interesting, to wit: DEC Ultrix
engineering and Free Software Foundation (not to be confused with OSF :-)
Relevant info:
System: DEC MicroVAX II running Ultrix 2.2 with the All_patches.tar, etc.
Here is a session showing what I did and didn't find:
Script started on Thu Jun 23 17:17:40 1988
<kent> 51. cat test.c
typedef struct {char *name;} tbl_entry;
static tbl_entry bad_words[] =
[---^^^^^^ note the difference between "bad_words" and "good_words". -RAK]
{
{ "Hell" },
{ "Hades" },
{ "Damn" }
};
tbl_entry good_words[] =
[---^^^^^^ note the difference between "bad_words" and "good_words". -RAK]
{
{ "Heaven" },
{ "Angel" },
{ "Bless" }
};
main ()
{}
<kent> 52. cc -g -o test test.c
<kent> 53. dbx test
dbx version 2.0 of 11/17/87 21:23.
Type 'help' for help.
reading symbolic information ...
(dbx) p good_words
(
(name = "Heaven")
(name = "Angel")
(name = "Bless")
)
(dbx) p good_words[0]
(name = "Heaven")
(dbx) p bad_words
[using test.bad_words]
(
(dbx) p bad_words[0]
[using test.bad_words]
(name = "\037777777777\037777777777\037777777777\037777777777[...]
[dbx freaks and prints forever - RAK]
(dbx) whatis good_words
tbl_entry good_words[3];
(dbx) whatis bad_words
[using test.bad_words]
tbl_entry bad_words[3];
[^^^ where's the "static" ? - RAK]
(dbx) q
<kent> 54. gdb test
GDB 2.6, 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 /usr1/users/kent/src/test...done.
Type "help" for a list of commands.
(gdb) info var good_words
All variables matching regular expression "good_words":
File test.c:
tbl_entry good_words[3];
(gdb) info var bad_words
All variables matching regular expression "bad_words":
File test.c:
static tbl_entry bad_words[3];
[---^^^^^^ it looks like gdb is a little "smarter" than dbx here - RAK]
(gdb) p good_words
$1 = {{name = 0x458 "Heaven"}, {name = 0x45f "Angel"},
{name = 0x465 "Bless"}}
(gdb) p good_words[0]
$2 = {name = 0x458 "Heaven"}
(gdb) p bad_words
$3 = {{name = 0x382f3033 ""}, {name = 0x33 "\357\024"},
{name = 0x448 "Hell"}}
[Huh? what's wrong with "bad_words"? - RAK]
(gdb) p bad_words[0]
$4 = {name = 0x382f3033 ""}
[Pretty cute don't you think?? RAK]
(gdb) quit
<kent> 55. vcc -g -o test test.c
[Let's try a different compiler - RAK]
<kent> 56. dbx test
dbx version 2.0 of 11/17/87 21:23.
Type 'help' for help.
reading symbolic information ...
(dbx) whatis good_words
test. good_words;
[---^^^^^^^^^^^^^^^^]
(dbx) whatis bad_words
test. bad_words;
[---^^^^^^^^^^^^^^^^ it would appear that the symbol table isn't up to snuff]
(dbx) p good_words
(
(name = "Heaven")
(name = "Angel")
(name = "Bless")
)
(dbx) p good_words[0]
subscript "0" is the wrong type
[Wow! I've never seen this before. Ideas anyone? - RAK]
(dbx) p bad_words
(
(name = "Hell")
(name = "Hades")
(name = "Damn")
)
(dbx) p bad_words[0]
subscript "0" is the wrong type
[Here we are again! Hmm... - RAK]
(dbx) p *bad_words
"bad_words" is not a pointer
(dbx) p bad_words[1]
subscript "1" is the wrong type
(dbx) p bad_words[(int)0]
"int" is not defined
(dbx) q
<kent> 57. gdb test
GDB 2.6, 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 /usr1/users/kent/src/test...done.
Type "help" for a list of commands.
(gdb) info var
All defined variables:
[Can you say "Houdini" ??? Where'd the variables go? - RAK]
(gdb) p good_words
$1 = 16 '\020'
[Well, the variables seem to be there, sort of, maybe - RAK]
(gdb) p good_words[0]
$2 = 327800152
(gdb) p bad_words
No symbol "bad_words" in current context.
[Oh this is reeeeeaaal cute. We lost one but not the other. - RAK]
(gdb) q
<kent> 58. exit
script done on Thu Jun 23 17:23:19 1988
Ok, find my mistake and bludgeon me about the head and shoulders with it.
Go ahead, I dare you. :-)
Reporting of different (but still erroneous) behavior on other systems is
encouraged.
--
Russell Kent Phone: +1 214 995 3501
Texas Instruments UUCP address:
P.O. Box 655012 MS 3635 ...!convex!smu!tifsie!kent
Dallas, TX 75265 ...!ut-sally!im4u!ti-csl!tifsie!kent
More information about the Comp.unix.ultrix
mailing list