• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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::string &,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)34 bool ReadSymbolsFromDexFileInMemory(void*, uint64_t, const std::string&,
35                                     const std::vector<uint64_t>&,
36                                     const std::function<void(DexFileSymbol*)>&) {
37   return true;
38 }
39 
ReadSymbolsFromDexFile(const std::string &,const std::vector<uint64_t> &,const std::function<void (DexFileSymbol *)> &)40 bool ReadSymbolsFromDexFile(const std::string&, const std::vector<uint64_t>&,
41                             const std::function<void(DexFileSymbol*)>&) {
42   return true;
43 }
44 
GetTraceFsDir()45 const char* GetTraceFsDir() {
46   return nullptr;
47 }
48 
49 class NoOpOfflineUnwinder : public OfflineUnwinder {
50  public:
UnwindCallChain(const ThreadEntry &,const RegSet &,const char *,size_t,std::vector<uint64_t> *,std::vector<uint64_t> *)51   bool UnwindCallChain(const ThreadEntry&, const RegSet&, const char*, size_t,
52                        std::vector<uint64_t>*, std::vector<uint64_t>*) override {
53     return false;
54   }
55 };
56 
Create(bool)57 std::unique_ptr<OfflineUnwinder> OfflineUnwinder::Create(bool) {
58   return std::unique_ptr<OfflineUnwinder>(new NoOpOfflineUnwinder);
59 }
60 
GetProcessUid(pid_t)61 std::optional<uint32_t> GetProcessUid(pid_t) {
62   return std::nullopt;
63 }
64 
65 }  // namespace simpleperf