[gnu.gdb.bug] gdb 3.2 core-dumping fix.

bryan@UUNET.UU.NET (Bryan Boreham) (07/20/89)

I think this is a valid fix for gdb:

*** dbxread.c~  Tue Jul 11 03:38:46 1989
--- dbxread.c   Wed Jul 19 16:16:42 1989
***************
*** 4254,4259 ****
--- 4254,4263 ----
       The `?' is a placeholder for one of '+' (public visibility),
       '0' (protected visibility), and '-' (private visibility).  */

+ /* Change by Bryan Boreham, Kewill, Wed Jul 19 15:02:04 1989.
+    We better set p right now, in case there are no fields at all...    */
+   p = *pp;
+
    while (**pp != ';')
      {
        int visibility;


I'm sorry, but I don't have a example small enough to post that
demonstrates the core-dump.

The problem occurred whilst using C++ 1.35.1-. Basically, if there are
no data fields in a struct, then in function read_struct_type, **pp
will be ';' the first time we get to line 4257, so the loop will be
skipped, leading to line 4344, that reads "if (p[1] == ':')", and p
has not been initialised.

My fix cures the core-dump, but I don't know enough about gdb or dbx
format to tell if it will break something else.

Bryan Boreham			bryan@kewill.uucp  
Software Engineer	||	bryan%kewill@uunet.uu.net
Kewill Systems PLC	||  ... uunet!mcvax!ukc!root44!kewill!bryan
Walton-On-Thames	
Surrey, England		Telephone: (+44) 932 248 328