• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
3  * Description: improve heap dump.
4  * Create: 2020/11/20
5  */
6 
7 #ifndef HEAPDUMP_H
8 #define HEAPDUMP_H
9 
10 #include "ecma-globals.h"
11 #include "ecma-helpers.h"
12 #include "jerryscript-core.h"
13 
14 #define REF_CNT_SHIFT 6
15 
16 FILE* GetHeapdumpFile(void);
17 bool GetHeapdumpTracing(void);
18 void SetHeapdumpTraring(bool flag);
19 
20 #define LogHeapdump(...) do { fprintf(GetHeapdumpFile(), __VA_ARGS__); } while (0)
21 
22 typedef enum {
23   HEAPDUMP_OBJECT_SIMPLE,
24   HEAPDUMP_OBJECT_GLOBAL,
25   HEAPDUMP_OBJECT_ROOT
26 } heapdump_object_flags_t;
27 
28 void LogHeapdumpInit(const char* filepath);
29 void LogHeapdumpClose(void);
30 
31 void DumpInfoObject(ecma_object_t* object, heapdump_object_flags_t flags);
32 void DumpInfoLexEnv(const ecma_object_t* object);
33 void DumpInfoFunction(const ecma_object_t* object);
34 void DumpPropertyPair(ecma_property_pair_t* pair);
35 
36 #endif
37