1 /* Copyright (C) 2007-2008 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef _TRACE_DEV_H_ 13 #define _TRACE_DEV_H_ 14 15 #include "goldfish_device.h" 16 17 #define CLIENT_PAGE_SIZE 4096 18 19 /* trace device registers */ 20 #define TRACE_DEV_REG_SWITCH 0 21 #define TRACE_DEV_REG_FORK 1 22 #define TRACE_DEV_REG_EXECVE_PID 2 23 #define TRACE_DEV_REG_EXECVE_VMSTART 3 24 #define TRACE_DEV_REG_EXECVE_VMEND 4 25 #define TRACE_DEV_REG_EXECVE_OFFSET 5 26 #define TRACE_DEV_REG_EXECVE_EXEPATH 6 27 #define TRACE_DEV_REG_EXIT 7 28 #define TRACE_DEV_REG_CMDLINE 8 29 #define TRACE_DEV_REG_CMDLINE_LEN 9 30 #define TRACE_DEV_REG_MMAP_EXEPATH 10 31 #define TRACE_DEV_REG_INIT_PID 11 32 #define TRACE_DEV_REG_INIT_NAME 12 33 #define TRACE_DEV_REG_CLONE 13 34 #define TRACE_DEV_REG_UNMAP_START 14 35 #define TRACE_DEV_REG_UNMAP_END 15 36 #define TRACE_DEV_REG_NAME 16 37 #define TRACE_DEV_REG_TGID 17 38 #define TRACE_DEV_REG_DYN_SYM 50 39 #define TRACE_DEV_REG_DYN_SYM_ADDR 51 40 #define TRACE_DEV_REG_REMOVE_ADDR 52 41 #define TRACE_DEV_REG_PRINT_STR 60 42 #define TRACE_DEV_REG_PRINT_NUM_DEC 61 43 #define TRACE_DEV_REG_PRINT_NUM_HEX 62 44 #define TRACE_DEV_REG_STOP_EMU 90 45 #define TRACE_DEV_REG_ENABLE 100 46 #define TRACE_DEV_REG_METHOD_ENTRY 1024 47 #define TRACE_DEV_REG_METHOD_EXIT 1025 48 #define TRACE_DEV_REG_METHOD_EXCEPTION 1026 49 #define TRACE_DEV_REG_NATIVE_ENTRY 1028 50 #define TRACE_DEV_REG_NATIVE_EXIT 1029 51 #define TRACE_DEV_REG_NATIVE_EXCEPTION 1030 52 53 /* the virtual trace device state */ 54 typedef struct { 55 struct goldfish_device dev; 56 } trace_dev_state; 57 58 /* 59 * interfaces for copy from virtual space 60 * from target-arm/op_helper.c 61 */ 62 extern void vstrcpy(target_ulong ptr, char *buf, int max); 63 64 /* 65 * interfaces to trace module to signal kernel events 66 */ 67 extern void trace_switch(int pid); 68 extern void trace_fork(int tgid, int pid); 69 extern void trace_clone(int tgid, int pid); 70 extern void trace_execve(const char *arg, int len); 71 extern void trace_exit(int exitcode); 72 extern void trace_mmap(unsigned long vstart, unsigned long vend, 73 unsigned long offset, const char *path); 74 extern void trace_munmap(unsigned long vstart, unsigned long vend); 75 extern void trace_dynamic_symbol_add(unsigned long vaddr, const char *name); 76 extern void trace_dynamic_symbol_remove(unsigned long vaddr); 77 extern void trace_init_name(int tgid, int pid, const char *name); 78 extern void trace_init_exec(unsigned long start, unsigned long end, 79 unsigned long offset, const char *exe); 80 extern void start_tracing(void); 81 extern void stop_tracing(void); 82 extern void trace_exception(uint32 target_pc); 83 84 #endif 85