Hello!
I've been working with the GUI version GDB built from ecosSWtools-990319 src
for a period of time. ecosSWtools is an useful tool kit and I have especial
interest in the DIR src/gdb/mswin. I'd like to know when it will be
upgraded. Could you tell me?
I encountered a few bugs. They may be common, I show the banner printed by
GDB in any case:

GNU gdb 4.17-ecosSWtools-990319
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.  This version of GDB is supported
for customers of Cygnus Solutions.  Type "show warranty" for details.
This GDB was configured as "--host=i386-windows --target=powerpc-eabi".

Bugs:
1 After 'symbol [file]', browser window may be opened. If 'symbol [file]' is
executed again, clicking 'Browser' on the 'Window' menu will cause
"unhandled exception". I found CSrcB::rethink() is called while opening
browser window. It traverses the link of source files( the link is in the
stucture p which is defined as "static struct gui_symtab_file *p"), accesses
the symbol tables of the source files. But 'symbol [file]' calls
free_objfile() to eliminate part of the content of the strcture p. So the
crash will occur if CSrcB::rethink() access them again.
  I added a variable "symbol_discarded" as a tag. It is set to 1 after
free_objfile() is called in syms_from_objfile() (in gdb/symfile.c). At the
beginning of CSrcB::rethink() (in gdb/mswin/srcb.cpp), there are 2 lines
existed:
 if (!p)
   p = gdbwin_list_symbols(0, 1);

  I added a branch of "else". Now the sentence looks like:
 if (!p)
   p = gdbwin_list_symbols(0, 1);
 else
  if (symbol_discarded)
  {
   symbol_discarded = 0;
   gdbwin_list_symbols_free(p);
// gdbwin_list_symbols_free(p) must be called with symbol discarded by
free_objfile().
   p = gdbwin_list_symbols(0, 1);
  }

  I don't know whether the change is fit.


2 In CSrcSplit::select_symtab() (in gdb/mswin/srcwin.cpp), there's a line
commented:
 // SetWindowText(title);
  I uncommented that and changed it to:
 doc->SetTitle(t->title);
  Now source window can show the path of the source file as the title.

3 If a file is larger than 1.7M bytes, 'symbol [file]' will cause a crash.
  One of my teammates modified ALL_PSYMTABS() (in gdb/mswin/gdbwin.c). Now,
there's no more crash.

  The original ALL_PSYMTABS():
  ALL_PSYMTABS (objfile, ps)
  {
    struct partial_symbol *bound, *gbound, *sbound;
    int keep_going = 1;

    if (ps->readin)
      continue;

    gbound = *objfile->global_psymbols.list + ps->globals_offset +
ps->n_global_syms;
    sbound = *objfile->static_psymbols.list + ps->statics_offset +
ps->n_static_syms;
    bound = gbound;

    /* Go through all of the symbols stored in a partial
       symtab in one loop. */
    psym = *objfile->global_psymbols.list + ps->globals_offset;
    while (keep_going)
      {
 if (psym >= bound)
   {
     if (bound == gbound && ps->n_static_syms != 0)
       {
  psym = *objfile->static_psymbols.list + ps->statics_offset;
  bound = sbound;
       }
     else
       keep_going = 0;
     continue;
   }
 else
   {
     QUIT;

     /* If it would match (logic taken from loop below)
        load the file and go on to the next one */

     if ((regexp == NULL || SYMBOL_MATCHES_REGEXP (psym))
  && ((class == 0 && SYMBOL_CLASS (psym) != LOC_TYPEDEF
       && SYMBOL_CLASS (psym) != LOC_BLOCK)
      || (class == 1 && SYMBOL_CLASS (psym) == LOC_BLOCK)
      || (class == 2 && SYMBOL_CLASS (psym) == LOC_TYPEDEF)
      || (class == 3 && SYMBOL_CLASS (psym) == LOC_BLOCK)))
       {
  PSYMTAB_TO_SYMTAB (ps);
  keep_going = 0;
       }
   }
 psym++;
      }
  }

  The modified ALL_PSYMTABS():
  ALL_PSYMTABS (objfile, ps)
  {
*   struct partial_symbol **bound, **gbound, **sbound, **ppsym;
    int keep_going = 1;

    if (ps->readin)
      continue;

*   gbound = objfile->global_psymbols.list + ps->globals_offset +
ps->n_global_syms;
*   sbound = objfile->static_psymbols.list + ps->statics_offset +
ps->n_static_syms;
    bound = gbound;

    /* Go through all of the symbols stored in a partial
       symtab in one loop. */
*   ppsym = objfile->global_psymbols.list + ps->globals_offset;
    while (keep_going)
      {
* if (ppsym >= bound)
   {
     if (bound == gbound && ps->n_static_syms != 0)
       {
*  ppsym = objfile->static_psymbols.list + ps->statics_offset;
  bound = sbound;
       }
     else
       keep_going = 0;
     continue;
   }
 else
   {
     QUIT;

     /* If it would match (logic taken from loop below)
        load the file and go on to the next one */
+     psym = *ppsym;
     if ((regexp == NULL || SYMBOL_MATCHES_REGEXP (psym))
  && ((class == 0 && SYMBOL_CLASS (psym) != LOC_TYPEDEF
       && SYMBOL_CLASS (psym) != LOC_BLOCK)
      || (class == 1 && SYMBOL_CLASS (psym) == LOC_BLOCK)
      || (class == 2 && SYMBOL_CLASS (psym) == LOC_TYPEDEF)
      || (class == 3 && SYMBOL_CLASS (psym) == LOC_BLOCK)))
       {
  PSYMTAB_TO_SYMTAB (ps);
  keep_going = 0;
       }
   }
* ppsym++;
      }
  }
  Lines with a "*" ahead are changed. The line with a "+" ahead is inserted.

  Is the change reasonable?



Any help would be greatly appreciated. Thanks in advance.

Reply via email to