aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtk.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1998-03-04 23:35:30 +0000
committerJason Molenda <jmolenda@apple.com>1998-03-04 23:35:30 +0000
commitd7363521cf56276cde08ae8911cb405c33ccda97 (patch)
tree7570b99ecbc279f6c2e6cc83bc5fd4a1b89be9f6 /gdb/gdbtk.c
parent9ce23bf9510da915a612c550a8d4e32da9840a26 (diff)
downloadgdb-d7363521cf56276cde08ae8911cb405c33ccda97.zip
gdb-d7363521cf56276cde08ae8911cb405c33ccda97.tar.gz
gdb-d7363521cf56276cde08ae8911cb405c33ccda97.tar.bz2
Wed Mar 4 15:34:49 1998 Jason Molenda (crash@bugshack.cygnus.com)
* gdbtk.c (gdb_listfiles): Allocate space for 'files' dynamically.
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 6041f71..81338a1 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -1217,10 +1217,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?");
@@ -1233,6 +1237,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)
@@ -1246,6 +1255,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)
@@ -1267,6 +1281,7 @@ gdb_listfiles (clientData, interp, objc, objv)
lastfile = files[i];
}
Tcl_SetObjResult (interp, mylist);
+ free (files);
return TCL_OK;
}