1 /* Copyright (C) 2021 Free Software Foundation, Inc.
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)
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. */
25 #include <sys/types.h>
27 #include "dbe_types.h"
28 #include "gp-experiment.h"
29 #include "data_pckts.h"
31 #include "Data_window.h"
39 PrUsage *bind32 (void *p, bool need_swap_endian);
40 PrUsage *bind64 (void *p, bool need_swap_endian);
41 static uint64_t bind32Size ();
42 static uint64_t bind64Size ();
43 Vector<long long> * getMstateValues ();
50 // the following correspond to PROP_MSTATE LMS_* offsets; see newMstateVec()
77 extern void *getStack (VMode, DataView*, long);
78 extern int stackSize (VMode, DataView*, long);
79 extern Histable *getStackPC (int, VMode, DataView*, long);
80 extern Vector<Histable*> *getStackPCs (VMode, DataView*, long);
82 class CommonPacket // use only for RacePacket, please
86 void *getStack (VMode);
87 Histable *getStackPC (int, VMode);
88 Vector<Histable*>*getStackPCs (VMode);
89 static int cmp (const void *a, const void *b);
91 enum Tag_type { LWP, THR, CPU };
92 static const int NTAGS = 3;
93 uint32_t tags[NTAGS]; // lwp_id, thr_id, cpu_id
95 struct JThread *jthread_TBR; // pointer to JThread or NULL
96 uint64_t frinfo; // frame info
97 Vaddr leafpc; // raw leaf PC if availabe
98 void *nat_stack; // native stack
99 void *user_stack; // user stack (Java, OMP, etc.)
100 static void *jvm_overhead;
107 stackSize (bool java = false)
109 return java ? jstack->size () / 2 : stack->size ();
115 return stack->fetch (n);
119 getMthdFromStack (int n)
121 return jstack->fetch (2 * n + 1);
125 getBciFromStack (int n)
127 return (int) jstack->fetch (2 * n);
133 return stack->fetch (n) == (Vaddr) SP_LEAF_CHECK_MARKER;
137 isTruncatedStack (bool java = false)
139 return java ? jtruncated : truncated == (Vaddr) SP_TRUNC_STACK_MARKER;
143 isFailedUnwindStack ()
145 return truncated == (Vaddr) SP_FAILED_UNWIND_MARKER;
147 uint32_t omp_state; // OpenMP thread state
148 uint32_t mpi_state; // MPI state
149 uint64_t omp_cprid; // OpenMP parallel region id (omptrace)
150 Vector<Vaddr> *stack;
152 Vector<Vaddr> *jstack;
154 Vector<Vaddr> *ompstack;
158 #endif /* _EXP_LAYOUT_H */