< prev index next >

src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h

Print this page




  37 #include <asm/ptrace.h>
  38 #define user_regs_struct  pt_regs
  39 #endif
  40 #if defined(aarch64) || defined(arm64)
  41 #include <asm/ptrace.h>
  42 #define user_regs_struct user_pt_regs
  43 #elif defined(arm)
  44 #include <asm/ptrace.h>
  45 #define user_regs_struct  pt_regs
  46 #endif
  47 
  48 // This C bool type must be int for compatibility with Linux calls and
  49 // it would be a mistake to equivalence it to C++ bool on many platforms
  50 #ifndef __cplusplus
  51 typedef int bool;
  52 #define true  1
  53 #define false 0
  54 #endif
  55 
  56 struct ps_prochandle;

  57 
  58 #ifdef __cplusplus
  59 extern "C" {
  60 #endif
  61 
  62 // attach to a process
  63 JNIEXPORT struct ps_prochandle* JNICALL
  64 Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
  65 
  66 // attach to a core dump
  67 JNIEXPORT struct ps_prochandle* JNICALL
  68 Pgrab_core(const char* execfile, const char* corefile);
  69 
  70 // release a process or core
  71 JNIEXPORT void JNICALL
  72 Prelease(struct ps_prochandle* ph);
  73 
  74 // functions not directly available in Solaris libproc
  75 
  76 // initialize libproc (call this only once per app)


  81 // get number of threads
  82 int get_num_threads(struct ps_prochandle* ph);
  83 
  84 // get lwp_id of n'th thread
  85 lwpid_t get_lwp_id(struct ps_prochandle* ph, int index);
  86 
  87 // get regs for a given lwp
  88 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs);
  89 
  90 // get number of shared objects
  91 int get_num_libs(struct ps_prochandle* ph);
  92 
  93 // get name of n'th lib
  94 const char* get_lib_name(struct ps_prochandle* ph, int index);
  95 
  96 // get base of lib
  97 uintptr_t get_lib_base(struct ps_prochandle* ph, int index);
  98 
  99 // returns true if given library is found in lib list
 100 bool find_lib(struct ps_prochandle* ph, const char *lib_name);



 101 
 102 // symbol lookup
 103 uintptr_t lookup_symbol(struct ps_prochandle* ph,  const char* object_name,
 104                        const char* sym_name);
 105 
 106 // address->nearest symbol lookup. return NULL for no symbol
 107 const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset);
 108 
 109 struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj);
 110 
 111 void throw_new_debugger_exception(JNIEnv* env, const char* errMsg);
 112 
 113 #ifdef __cplusplus
 114 }
 115 #endif
 116 
 117 #endif //__LIBPROC_H_


  37 #include <asm/ptrace.h>
  38 #define user_regs_struct  pt_regs
  39 #endif
  40 #if defined(aarch64) || defined(arm64)
  41 #include <asm/ptrace.h>
  42 #define user_regs_struct user_pt_regs
  43 #elif defined(arm)
  44 #include <asm/ptrace.h>
  45 #define user_regs_struct  pt_regs
  46 #endif
  47 
  48 // This C bool type must be int for compatibility with Linux calls and
  49 // it would be a mistake to equivalence it to C++ bool on many platforms
  50 #ifndef __cplusplus
  51 typedef int bool;
  52 #define true  1
  53 #define false 0
  54 #endif
  55 
  56 struct ps_prochandle;
  57 struct lib_info;
  58 
  59 #ifdef __cplusplus
  60 extern "C" {
  61 #endif
  62 
  63 // attach to a process
  64 JNIEXPORT struct ps_prochandle* JNICALL
  65 Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
  66 
  67 // attach to a core dump
  68 JNIEXPORT struct ps_prochandle* JNICALL
  69 Pgrab_core(const char* execfile, const char* corefile);
  70 
  71 // release a process or core
  72 JNIEXPORT void JNICALL
  73 Prelease(struct ps_prochandle* ph);
  74 
  75 // functions not directly available in Solaris libproc
  76 
  77 // initialize libproc (call this only once per app)


  82 // get number of threads
  83 int get_num_threads(struct ps_prochandle* ph);
  84 
  85 // get lwp_id of n'th thread
  86 lwpid_t get_lwp_id(struct ps_prochandle* ph, int index);
  87 
  88 // get regs for a given lwp
  89 bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs);
  90 
  91 // get number of shared objects
  92 int get_num_libs(struct ps_prochandle* ph);
  93 
  94 // get name of n'th lib
  95 const char* get_lib_name(struct ps_prochandle* ph, int index);
  96 
  97 // get base of lib
  98 uintptr_t get_lib_base(struct ps_prochandle* ph, int index);
  99 
 100 // returns true if given library is found in lib list
 101 bool find_lib(struct ps_prochandle* ph, const char *lib_name);
 102 
 103 // returns lib which contains pc
 104 struct lib_info *find_lib_by_address(struct ps_prochandle* ph, uintptr_t pc);
 105 
 106 // symbol lookup
 107 uintptr_t lookup_symbol(struct ps_prochandle* ph,  const char* object_name,
 108                        const char* sym_name);
 109 
 110 // address->nearest symbol lookup. return NULL for no symbol
 111 const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset);
 112 
 113 struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj);
 114 
 115 void throw_new_debugger_exception(JNIEnv* env, const char* errMsg);
 116 
 117 #ifdef __cplusplus
 118 }
 119 #endif
 120 
 121 #endif //__LIBPROC_H_
< prev index next >