backend.h revision bac2da505ee174b7fb984b975c5938f88f0dbab2
1642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* 2642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * This file is part of ltrace. 3642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * Copyright (C) 2012 Petr Machata, Red Hat Inc. 4642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 5642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * This program is free software; you can redistribute it and/or 6642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * modify it under the terms of the GNU General Public License as 7642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * published by the Free Software Foundation; either version 2 of the 8642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * License, or (at your option) any later version. 9642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 10642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * This program is distributed in the hope that it will be useful, but 11642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * WITHOUT ANY WARRANTY; without even the implied warranty of 12642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * General Public License for more details. 14642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 15642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * You should have received a copy of the GNU General Public License 16642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * along with this program; if not, write to the Free Software 17642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 02110-1301 USA 19642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata */ 20642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 21642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata#ifndef BACKEND_H 22642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata#define BACKEND_H 23642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 24642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata#include "forward.h" 25bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machata#include "sysdep.h" 26bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machata 27ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata#include <gelf.h> 28ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata 29ba1664b062414481d0f37d06bb01a19874c8d481Petr Machataenum process_status { 30ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_invalid, /* Failure. */ 31ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_stop, /* Job-control stop. */ 32ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_tracing_stop, 33ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_sleeping, 34ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_zombie, 35ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata ps_other, /* Necessary other states can be added as needed. */ 36ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata}; 37ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata 38642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* 39642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * This file contains documentation of back end interface. Some of 40642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * these may be implemented on an OS level (i.e. they are the same 41642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * e.g. on all Linux architectures), some may differ per architecture 42642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * on the same OS (e.g. a way to insert a breakpoint into the process 43642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * image is a likely candidate). 44642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata */ 45642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 46642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Convert a PID to a path to the corresponding binary. */ 47642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatachar *pid2name(pid_t pid); 48642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 49642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Given a PID, find a leader of thread group. */ 50642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatapid_t process_leader(pid_t pid); 51642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 52642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Given a PID of leader thread, fill in PIDs of all the tasks. The 53642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * function will initialize the pointer *RET_TASKS to a 54642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * newly-allocated array, and will store number of elements in that 55642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * array to *RET_N. You have to free that buffer when you don't need 56642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * it anymore. */ 57642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n); 58642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 59642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Answer whether the process PID is stopped. Returns 0 when not 60642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * stopped, 1 when stopped, or -1 when there was an error. */ 61642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint process_stopped(pid_t pid); 62642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 63642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Answer a status of the task PID. See enum process_status. */ 64642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataenum process_status process_status(pid_t pid); 65642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 66642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Wait for PID to be ready for tracing. */ 67ba1664b062414481d0f37d06bb01a19874c8d481Petr Machataint wait_for_proc(pid_t pid); 68642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 69642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Send a signal SIG to the task PID. */ 70642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint task_kill(pid_t pid, int sig); 71642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 72642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after PID is attached, but before it is continued. */ 73ba1664b062414481d0f37d06bb01a19874c8d481Petr Machatavoid trace_set_options(struct Process *proc); 74642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 75642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after ltrace forks. Should attach the newly created child, 76642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * in whose context this function is called. */ 77642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid trace_me(void); 78642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 79642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called when ltrace needs to attach to PID, such as when it attaches 80642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * to a running process, whose PID is given on the command line. */ 81642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint trace_pid(pid_t pid); 82642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 83642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Stop tracing PID. */ 84642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid untrace_pid(pid_t pid); 85642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 86642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* The back end may need to store arbitrary data to a process. This 87642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * is a place where it can initialize PROC->arch_dep. XXX this should 88642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * be dropped in favor of arhc_process_init on pmachata/libs. */ 89642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid get_arch_dep(struct Process *proc); 90642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 91642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Return current instruction pointer of PROC. 92642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 93642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * XXX note that the IP must fit into an arch pointer. This prevents 94642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * us to use 32-bit ltrace to trace 64-bit process, even on arches 95ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata * that would otherwise support this. Above we have a definition of 96bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machata * arch_addr_t. This should be converted to an integral type and 97642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * used for target addresses throughout. */ 98642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid *get_instruction_pointer(struct Process *proc); 99642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 100642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Set instruction pointer of PROC to ADDR. XXX see above. */ 101642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid set_instruction_pointer(struct Process *proc, void *addr); 102642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 103642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Return current stack pointer of PROC. XXX see above. */ 104642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid *get_stack_pointer(struct Process *proc); 105642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 106642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Find and return caller address, i.e. the address where the current 107642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * function returns. */ 108642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid *get_return_addr(struct Process *proc, void *stack_pointer); 109642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 110642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Adjust PROC so that when the current function returns, it returns 111642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * to ADDR. */ 112642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid set_return_addr(struct Process *proc, void *addr); 113642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 114642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Enable breakpoint SBP in process PROC. */ 115642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid enable_breakpoint(struct Process *proc, struct breakpoint *sbp); 116642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 117642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Disable breakpoint SBP in process PROC. */ 118642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid disable_breakpoint(struct Process *proc, struct breakpoint *sbp); 119642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 120642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Determine whether the event that we have just seen (and that is 121642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * recorded in STATUS) was a syscall. If it was, return 1. If it was 122642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * a return from syscall, return 2. In both cases, set *SYSNUM to the 123642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * number of said syscall. If it wasn't a syscall, return 0. If 124642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * there was an error, return -1. */ 125642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint syscall_p(struct Process *proc, int status, int *sysnum); 126642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 127642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Continue execution of the process with given PID. */ 128642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid continue_process(pid_t pid); 129642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 130642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after we received a signal SIGNUM. Should do whatever 131642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * book-keeping is necessary and continue the process if 132642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * necessary. */ 133642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid continue_after_signal(pid_t pid, int signum); 134642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 135642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after we received a system call SYSNUM. RET_P is 0 if this 136642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * is system call, otherwise it's return from a system call. The 137642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * callback should do whatever book-keeping is necessary and continue 138642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * the process if necessary. */ 139642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid continue_after_syscall(struct Process *proc, int sysnum, int ret_p); 140642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 141642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after we hit a breakpoint SBP. Should do whatever 142642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * book-keeping is necessary and then continue the process. */ 143642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid continue_after_breakpoint(struct Process *proc, struct breakpoint *sbp); 144642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 145642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called after we received a vfork. Should do whatever book-keeping 146642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * is necessary and continue the process if necessary. N.B. right 147642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * now, with Linux/GNU the only back end, this is not necessary. I 148642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * imagine other systems may be different. */ 149642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid continue_after_vfork(struct Process *proc); 150642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 151642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called when trace_me or primary trace_pid fail. This may plug in 152642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * any platform-specific knowledge of why it could be so. */ 153642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid trace_fail_warning(pid_t pid); 154642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 155642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* A pair of functions called to initiate a detachment request when 156642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * ltrace is about to exit. Their job is to undo any effects that 157642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * tracing had and eventually detach process, perhaps by way of 158642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * installing a process handler. 159642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 160642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * OS_LTRACE_EXITING_SIGHANDLER is called from a signal handler 161642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * context right after the signal was captured. It returns 1 if the 162642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * request was handled or 0 if it wasn't. 163642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 164642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * If the call to OS_LTRACE_EXITING_SIGHANDLER didn't handle the 165642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * request, OS_LTRACE_EXITING is called when the next event is 166642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * generated. Therefore it's called in "safe" context, without 167642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * re-entrancy concerns, but it's only called after an even is 168642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * generated. */ 169642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint os_ltrace_exiting_sighandler(void); 170642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid os_ltrace_exiting(void); 171642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 172642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Should copy COUNT bytes from address ADDR of process PROC to local 173642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * buffer BUF. */ 174642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatasize_t umovebytes (struct Process *proc, void *addr, void *buf, size_t count); 175642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 176642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Find out an address of symbol SYM in process PROC, and return. 177642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * Returning NULL delays breakpoint insertion and enables heaps of 178642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * arch-specific black magic that we should clean up some day. 179642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 180642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * XXX the same points as for get_instruction_pointer apply. */ 181642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid *sym2addr(struct Process *proc, struct library_symbol *sym); 182642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 183642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called at some point after we have attached to PROC. This callback 184ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata * should insert an introspection breakpoint for handling dynamic 185ba1664b062414481d0f37d06bb01a19874c8d481Petr Machata * linker library loads. */ 186bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machataint linkmap_init(struct Process *proc, arch_addr_t dyn_addr); 187642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 188642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called for breakpoints defined over an artificial symbol "". This 189642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * can be used (like it is on Linux/GNU) to add more breakpoints 190642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * because a dlopen'ed library was mapped in. 191642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * 192642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * XXX we should somehow clean up this interface. For starters, 193642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * breakpoints should have their own handler callbacks, so that we can 194642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * generalize this to e.g. systemtap SDT probes. linkmap_init could 195642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * perhaps be rolled into some other process init callback. */ 196642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_check_dbg(struct Process *proc); 197642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 198642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* This should produce and return the next event of one of the traced 199642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * processes. The returned pointer will not be freed by the core and 200642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * should be either statically allocated, or the management should be 201642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * done some other way. */ 202642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatastruct Event *next_event(void); 203642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 204642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* Called when process PROC was removed. */ 205642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid process_removed(struct Process *proc); 206642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 207642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_elf_init(struct ltelf *lte, struct library *lib); 208642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_elf_destroy(struct ltelf *lte); 209642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 210642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataenum plt_status { 211642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata plt_fail, 212642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata plt_ok, 213642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata plt_default, 214642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata}; 215642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 216642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataenum plt_status arch_elf_add_plt_entry(struct Process *p, struct ltelf *l, 217642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata const char *n, GElf_Rela *r, size_t i, 218642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata struct library_symbol **ret); 219642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 220642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_breakpoint_init(struct Process *proc, struct breakpoint *sbp); 221642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_breakpoint_destroy(struct breakpoint *sbp); 222642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_breakpoint_clone(struct breakpoint *retp, struct breakpoint *sbp); 223642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 224642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_library_init(struct library *lib); 225642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_library_destroy(struct library *lib); 226642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_library_clone(struct library *retp, struct library *lib); 227642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 228642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_library_symbol_init(struct library_symbol *libsym); 229642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_library_symbol_destroy(struct library_symbol *libsym); 230642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_library_symbol_clone(struct library_symbol *retp, 231642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata struct library_symbol *libsym); 232642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 233642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_process_init(struct Process *proc); 234642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_process_destroy(struct Process *proc); 235642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_process_clone(struct Process *retp, struct Process *proc); 236642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint arch_process_exec(struct Process *proc); 237642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 238642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* This should extract entry point address and interpreter (dynamic 239642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * linker) bias if possible. Returns 0 if there were no errors, -1 240642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * otherwise. Sets *ENTRYP and *INTERP_BIASP to non-zero values if 241642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * the corresponding value is known. Unknown values are set to 0. */ 242642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machataint process_get_entry(struct Process *proc, 243bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machata arch_addr_t *entryp, 244bac2da505ee174b7fb984b975c5938f88f0dbab2Petr Machata arch_addr_t *interp_biasp); 245642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 246642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata/* This is called after the dynamic linker is done with the 247642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata * process startup. */ 248642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machatavoid arch_dynlink_done(struct Process *proc); 249642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata 250642626096a694c6af279d25d2b1b2fba5b10ddfbPetr Machata#endif /* BACKEND_H */ 251