+Fri Apr 10 15:48:10 1998 Jason Molenda (crash@bugshack.cygnus.com)
+
+ * gdbtk.c (gdb_listfiles): Allocate space for 'files' dynamically.
+
Thu Apr 9 14:20:59 1998 Martin M. Hunt <hunt@cygnus.com>
* gdbtk.c (gdbtk_init): Remove redundant variable "IDE".
struct objfile *objfile;
struct partial_symtab *psymtab;
struct symtab *symtab;
- char *lastfile, *pathname, *files[1000];
+ char *lastfile, *pathname, **files;
+ int files_size;
int i, numfiles = 0, len = 0;
Tcl_Obj *mylist;
+ files_size = 1000;
+ files = (char **) xmalloc (sizeof (char *) * files_size);
+
if (objc > 2)
{
Tcl_WrongNumArgs (interp, 1, objv, "Usage: gdb_listfiles ?pathname?");
ALL_PSYMTABS (objfile, psymtab)
{
+ if (numfiles == files_size)
+ {
+ files_size = files_size * 2;
+ files = (char **) xrealloc (files, sizeof (char *) * files_size);
+ }
if (len == 0)
{
if (psymtab->filename)
ALL_SYMTABS (objfile, symtab)
{
+ if (numfiles == files_size)
+ {
+ files_size = files_size * 2;
+ files = (char **) xrealloc (files, sizeof (char *) * files_size);
+ }
if (len == 0)
{
if (symtab->filename)
lastfile = files[i];
}
Tcl_SetObjResult (interp, mylist);
+ free (files);
return TCL_OK;
}