1 /*
2 * Copyright (C) 2015 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 // Add fake functions to build successfully on darwin.
18 #include <android-base/logging.h>
19
20 #include "OfflineUnwinder.h"
21 #include "environment.h"
22 #include "read_dex_file.h"
23
24 namespace simpleperf {
25
GetThreadMmapsInProcess(pid_t,std::vector<ThreadMmap> *)26 bool GetThreadMmapsInProcess(pid_t, std::vector<ThreadMmap>*) {
27 return false;
28 }
29
GetKernelBuildId(BuildId *)30 bool GetKernelBuildId(BuildId*) {
31 return false;
32 }
33
GetModuleBuildId(const std::string &,BuildId *,const std::string &)34 bool GetModuleBuildId(const std::string&, BuildId*, const std::string&) {
35 return false;
36 }
37
ReadThreadNameAndPid(pid_t,std::string *,pid_t *)38 bool ReadThreadNameAndPid(pid_t, std::string*, pid_t*) {
39 return false;
40 }
41
CanRecordRawData()42 bool CanRecordRawData() {
43 return false;
44 }
45
ReadSymbolsFromDexFileInMemory(void *,uint64_t,const std::string &,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)46 bool ReadSymbolsFromDexFileInMemory(void*, uint64_t, const std::string&,
47 const std::vector<uint64_t>&,
48 const std::function<void(DexFileSymbol*)>&) {
49 return true;
50 }
51
ReadSymbolsFromDexFile(const std::string &,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)52 bool ReadSymbolsFromDexFile(const std::string&, const std::vector<uint64_t>&,
53 const std::function<void(DexFileSymbol*)>&) {
54 return true;
55 }
56
GetTraceFsDir()57 const char* GetTraceFsDir() {
58 return nullptr;
59 }
60
61 class NoOpOfflineUnwinder : public OfflineUnwinder {
62 public:
UnwindCallChain(const ThreadEntry &,const RegSet &,const char *,size_t,std::vector<uint64_t> *,std::vector<uint64_t> *)63 bool UnwindCallChain(const ThreadEntry&, const RegSet&, const char*, size_t,
64 std::vector<uint64_t>*, std::vector<uint64_t>*) override {
65 return false;
66 }
67 };
68
Create(bool)69 std::unique_ptr<OfflineUnwinder> OfflineUnwinder::Create(bool) {
70 return std::unique_ptr<OfflineUnwinder>(new NoOpOfflineUnwinder);
71 }
72
GetProcessUid(pid_t)73 std::optional<uint32_t> GetProcessUid(pid_t) {
74 return std::nullopt;
75 }
76
77 } // namespace simpleperf