aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtk.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1998-04-10 22:49:13 +0000
committerJason Molenda <jmolenda@apple.com>1998-04-10 22:49:13 +0000
commit6da4c15f22a1ef117949dc3001b2ccc204f90884 (patch)
treeb3af06f30de27e59d03b7d4b1215154150aa8dc1 /gdb/gdbtk.c
parentc94a25c228aeedface7710ebd1fb275ebe612fc1 (diff)
downloadgdb-6da4c15f22a1ef117949dc3001b2ccc204f90884.zip
gdb-6da4c15f22a1ef117949dc3001b2ccc204f90884.tar.gz
gdb-6da4c15f22a1ef117949dc3001b2ccc204f90884.tar.bz2
Fri Apr 10 15:48:10 1998 Jason Molenda (crash@bugshack.cygnus.com)
* gdbtk.c (gdb_listfiles): Allocate space for 'files' dynamically. Harumph, my change got lost in the foundry->devo merge.
Diffstat (limited to 'gdb/gdbtk.c')
-rw-r--r--gdb/gdbtk.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index d6e66a5..a0a5d4d 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -1278,10 +1278,14 @@ gdb_listfiles (clientData, interp, objc, objv)
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?");
@@ -1294,6 +1298,11 @@ gdb_listfiles (clientData, interp, objc, objv)
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)
@@ -1307,6 +1316,11 @@ gdb_listfiles (clientData, interp, objc, objv)
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)
@@ -1328,6 +1342,7 @@ gdb_listfiles (clientData, interp, objc, objv)
lastfile = files[i];
}
Tcl_SetObjResult (interp, mylist);
+ free (files);
return TCL_OK;
}