summaryrefslogtreecommitdiff
path: root/gprof/cg_dfn.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-06-13 19:38:06 +0000
committerIan Lance Taylor <ian@airs.com>1999-06-13 19:38:06 +0000
commitbd917ff662c8dac56fe0ecee87816a344d54dc2f (patch)
tree145e8e0aad6a45b6451b9a85799aa7bff9e07ac3 /gprof/cg_dfn.c
parent2575273dcb1af23515c8f65502e80e887d6fc5da (diff)
downloadbinutils-gdb-bd917ff662c8dac56fe0ecee87816a344d54dc2f.tar.gz
* cg_dfn.c: Include "libiberty.h"
(DFN_INCR_DEPTH): Define instead of DFN_DEPTH. (dfn_stack): Define as pointer rather than array. (pre_visit): Reallocate dfn_stack as needed.
Diffstat (limited to 'gprof/cg_dfn.c')
-rw-r--r--gprof/cg_dfn.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gprof/cg_dfn.c b/gprof/cg_dfn.c
index c9e37ab29e5..02d64e73888 100644
--- a/gprof/cg_dfn.c
+++ b/gprof/cg_dfn.c
@@ -17,13 +17,14 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <stdio.h>
+#include "libiberty.h"
#include "gprof.h"
#include "cg_arcs.h"
#include "cg_dfn.h"
#include "symtab.h"
#include "utils.h"
-#define DFN_DEPTH 100
+#define DFN_INCR_DEPTH (128)
typedef struct
{
@@ -32,7 +33,8 @@ typedef struct
}
DFN_Stack;
-DFN_Stack dfn_stack[DFN_DEPTH];
+DFN_Stack *dfn_stack = NULL;
+int dfn_maxdepth = 0;
int dfn_depth = 0;
int dfn_counter = DFN_NAN;
@@ -194,11 +196,13 @@ static void
DEFUN (pre_visit, (parent), Sym * parent)
{
++dfn_depth;
- if (dfn_depth >= DFN_DEPTH)
+
+ if (dfn_depth >= dfn_maxdepth)
{
- fprintf (stderr, "[pre_visit] dfn_stack overflow\n");
- done (1);
+ dfn_maxdepth += DFN_INCR_DEPTH;
+ dfn_stack = xrealloc (dfn_stack, dfn_maxdepth * sizeof *dfn_stack);
}
+
dfn_stack[dfn_depth].sym = parent;
dfn_stack[dfn_depth].cycle_top = dfn_depth;
parent->cg.top_order = DFN_BUSY;