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
GetKernelBuildId(BuildId *)26 bool GetKernelBuildId(BuildId*) {
27 return false;
28 }
29
CanRecordRawData()30 bool CanRecordRawData() {
31 return false;
32 }
33
ReadSymbolsFromDexFileInMemory(void *,uint64_t,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)34 bool ReadSymbolsFromDexFileInMemory(void*, uint64_t, const std::vector<uint64_t>&,
35 const std::function<void(DexFileSymbol*)>&) {
36 return true;
37 }
38
ReadSymbolsFromDexFile(const std::string &,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)39 bool ReadSymbolsFromDexFile(const std::string&, const std::vector<uint64_t>&,
40 const std::function<void(DexFileSymbol*)>&) {
41 return true;
42 }
43
GetTraceFsDir()44 const char* GetTraceFsDir() {
45 return nullptr;
46 }
47
48 class NoOpOfflineUnwinder : public OfflineUnwinder {
49 public:
UnwindCallChain(const ThreadEntry &,const RegSet &,const char *,size_t,std::vector<uint64_t> *,std::vector<uint64_t> *)50 bool UnwindCallChain(const ThreadEntry&, const RegSet&, const char*, size_t,
51 std::vector<uint64_t>*, std::vector<uint64_t>*) override {
52 return false;
53 }
54 };
55
Create(bool)56 std::unique_ptr<OfflineUnwinder> OfflineUnwinder::Create(bool) {
57 return std::unique_ptr<OfflineUnwinder>(new NoOpOfflineUnwinder);
58 }
59
60 } // namespace simpleperf