72 #include <asm/ptrace.h> 73 #define user_regs_struct user_pt_regs 74 #elif defined(arm) 75 #include <asm/ptrace.h> 76 #define user_regs_struct pt_regs 77 #endif 78 #if defined(s390x) 79 #include <asm/ptrace.h> 80 #endif 81 82 // This C bool type must be int for compatibility with Linux calls and 83 // it would be a mistake to equivalence it to C++ bool on many platforms 84 85 typedef int bool; 86 #define true 1 87 #define false 0 88 89 struct ps_prochandle; 90 91 // attach to a process 92 struct ps_prochandle* Pgrab(pid_t pid, char* err_buf, size_t err_buf_len); 93 94 // attach to a core dump 95 struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile); 96 97 // release a process or core 98 void Prelease(struct ps_prochandle* ph); 99 100 // functions not directly available in Solaris libproc 101 102 // initialize libproc (call this only once per app) 103 // pass true to make library verbose 104 bool init_libproc(bool verbose); 105 106 // get number of threads 107 int get_num_threads(struct ps_prochandle* ph); 108 109 // get lwp_id of n'th thread 110 lwpid_t get_lwp_id(struct ps_prochandle* ph, int index); 111 112 // get regs for a given lwp 113 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs); 114 115 // get number of shared objects 116 int get_num_libs(struct ps_prochandle* ph); 117 118 // get name of n'th lib 119 const char* get_lib_name(struct ps_prochandle* ph, int index); 120 121 // get base of lib 122 uintptr_t get_lib_base(struct ps_prochandle* ph, int index); 123 124 // returns true if given library is found in lib list | 72 #include <asm/ptrace.h> 73 #define user_regs_struct user_pt_regs 74 #elif defined(arm) 75 #include <asm/ptrace.h> 76 #define user_regs_struct pt_regs 77 #endif 78 #if defined(s390x) 79 #include <asm/ptrace.h> 80 #endif 81 82 // This C bool type must be int for compatibility with Linux calls and 83 // it would be a mistake to equivalence it to C++ bool on many platforms 84 85 typedef int bool; 86 #define true 1 87 #define false 0 88 89 struct ps_prochandle; 90 91 // attach to a process 92 JNIEXPORT struct ps_prochandle* JNICALL 93 Pgrab(pid_t pid, char* err_buf, size_t err_buf_len); 94 95 // attach to a core dump 96 JNIEXPORT struct ps_prochandle* JNICALL 97 Pgrab_core(const char* execfile, const char* corefile); 98 99 // release a process or core 100 JNIEXPORT void JNICALL 101 Prelease(struct ps_prochandle* ph); 102 103 // functions not directly available in Solaris libproc 104 105 // initialize libproc (call this only once per app) 106 // pass true to make library verbose 107 JNIEXPORT bool JNICALL 108 init_libproc(bool verbose); 109 110 // get number of threads 111 int get_num_threads(struct ps_prochandle* ph); 112 113 // get lwp_id of n'th thread 114 lwpid_t get_lwp_id(struct ps_prochandle* ph, int index); 115 116 // get regs for a given lwp 117 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs); 118 119 // get number of shared objects 120 int get_num_libs(struct ps_prochandle* ph); 121 122 // get name of n'th lib 123 const char* get_lib_name(struct ps_prochandle* ph, int index); 124 125 // get base of lib 126 uintptr_t get_lib_base(struct ps_prochandle* ph, int index); 127 128 // returns true if given library is found in lib list |