• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <sys/types.h>
20 
21 #include <string>
22 
23 enum AllocEnum : uint8_t {
24     MALLOC = 0,
25     CALLOC,
26     MEMALIGN,
27     REALLOC,
28     FREE,
29     THREAD_DONE,
30 };
31 
32 struct AllocEntry {
33     pid_t tid;
34     AllocEnum type;
35     uint64_t ptr = 0;
36     size_t size = 0;
37     union {
38         uint64_t old_ptr = 0;
39         uint64_t n_elements;
40         uint64_t align;
41     } u;
42     uint64_t st = 0;
43     uint64_t et = 0;
44 };
45 
46 void AllocGetData(const std::string& line, AllocEntry* entry);
47