[gdb/testsuite] Fix license text in gdb.reverse/map-to-same-line.{c,exp}
[binutils-gdb.git] / gprofng / src / CallStack.h
blobc13b0470540fa95491aa1a9d5bf054d89efd9741
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2 Contributed by Oracle.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 #ifndef _CALLSTACK_H
22 #define _CALLSTACK_H
24 #include <stdio.h>
25 #include "dbe_structs.h"
26 #include "Experiment.h"
27 #include "DbeLock.h"
29 class DataDescriptor;
30 class FramePacket;
31 class DbeInstr;
32 class Histable;
33 template <class ITEM> class Vector;
34 class CallStackNode;
36 class Descendants /* : public DbeLock */
38 public:
39 Descendants ();
40 ~Descendants ();
41 CallStackNode *find (Histable *hi, int *index);
42 void append (CallStackNode *item);
43 void insert (int ind, CallStackNode *item);
44 int volatile count;
46 private:
48 enum
50 DELTA = 8
53 int limit;
54 CallStackNode **data;
55 CallStackNode *first_data[4];
58 class CallStackNode : public Descendants
60 public:
61 CallStackNode (CallStackNode *_ancestor, Histable *_instr);
62 ~CallStackNode ();
63 bool compare (long start, long end, Vector<Histable*> *objs, CallStackNode *mRoot);
64 void dump ();
66 CallStackNode *
67 get_ancestor ()
69 return ancestor;
72 Histable *
73 get_instr ()
75 return instr;
78 CallStackNode *alt_node;
79 Histable *instr;
80 CallStackNode *ancestor;
83 class CallStack
85 public:
86 static CallStack *getInstance (Experiment *exp);
87 virtual ~CallStack () { };
89 virtual void add_stack (DataDescriptor *dDscr, long idx, FramePacket *frp,
90 cstk_ctx_chunk* cstCtxChunk) = 0;
92 // Creates a call stack representation for objs and
93 // returns an opaque pointer to it
94 virtual void *add_stack (Vector<Histable*> *objs) = 0;
96 // Debugging methods
97 virtual void print (FILE *) = 0;
99 // Call stack inquiries
100 static int stackSize (void *stack);
101 static Histable *getStackPC (void *stack, int n);
102 static Vector<Histable*> *getStackPCs (void *stack, bool get_hide_stack = false);
103 static void setHideStack (void *stack, void *hideStack);
104 static int compare (void *stack1, void *stack2);
106 virtual CallStackNode *
107 get_node (int)
109 return NULL;
114 #endif /* _CALLSTACK_H */