1 // Copyright (C) 2023 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15
16 #include <link.h>
17 #include <signal.h>
18 #include <sys/types.h>
19
20 #include "berberis/base/tracing.h"
21 #include "berberis/guest_state/guest_addr.h"
22 #include "berberis/guest_state/guest_state_opaque.h"
23 #include "berberis/instrument/crash.h"
24 #include "berberis/instrument/exec.h"
25 #include "berberis/instrument/guest_call.h"
26 #include "berberis/instrument/guest_thread.h"
27 #include "berberis/instrument/loader.h"
28 #include "berberis/instrument/trampolines.h"
29
30 namespace berberis {
31
OnConsistentLinkMap(const struct link_map * link)32 void OnConsistentLinkMap(const struct link_map* link) {
33 int i = 0;
34 for (; link; link = link->l_next) {
35 TRACE("link_map[%d]: %p %s", i++, reinterpret_cast<void*>(link->l_addr), link->l_name);
36 }
37 }
38
GetOnExecInsn(GuestAddr pc)39 OnExecInsnFunc GetOnExecInsn([[maybe_unused]] GuestAddr pc) {
40 return nullptr;
41 }
42
GetOnTrampolineCall(const char * name)43 OnTrampolineFunc GetOnTrampolineCall([[maybe_unused]] const char* name) {
44 return nullptr;
45 }
46
GetOnTrampolineReturn(const char * name)47 OnTrampolineFunc GetOnTrampolineReturn([[maybe_unused]] const char* name) {
48 return nullptr;
49 }
50
OnWrappedGuestCall(ThreadState * state,GuestAddr function_addr)51 void OnWrappedGuestCall([[maybe_unused]] ThreadState* state,
52 [[maybe_unused]] GuestAddr function_addr) {}
53
OnWrappedGuestReturn(ThreadState * state,GuestAddr function_addr)54 void OnWrappedGuestReturn([[maybe_unused]] ThreadState* state,
55 [[maybe_unused]] GuestAddr function_addr) {}
56
OnSyscall(ThreadState * state,long number)57 void OnSyscall([[maybe_unused]] ThreadState* state, [[maybe_unused]] long number) {}
58
OnSyscallReturn(ThreadState * state,long number)59 void OnSyscallReturn([[maybe_unused]] ThreadState* state, [[maybe_unused]] long number) {}
60
OnCrash(int sig,siginfo_t * info,void * context)61 void OnCrash([[maybe_unused]] int sig,
62 [[maybe_unused]] siginfo_t* info,
63 [[maybe_unused]] void* context) {}
64
OnInsertGuestThread(pid_t tid,GuestThread * thread)65 void OnInsertGuestThread([[maybe_unused]] pid_t tid, [[maybe_unused]] GuestThread* thread) {}
66
OnRemoveGuestThread(pid_t tid,GuestThread * thread)67 void OnRemoveGuestThread([[maybe_unused]] pid_t tid, [[maybe_unused]] GuestThread* thread) {}
68
69 } // namespace berberis
70