agent/src/os/linux/libproc.h

Print this page
rev 7258 : 8064611: AARCH64: Changes to HotSpot shared code
Summary: Everything except cpu/ and os_cpu/.
Reviewed-by: kvn


  54 unique again. We therefore use OSThread::_thread_id as unique identifier.
  55 
  56 3. There is a unique LWP id under both thread libraries. libthread_db  maps pthread_id
  57 to its underlying lwp_id under both the thread libraries. thread_info.lwp_id stores
  58 lwp_id of the thread. The lwp id is nothing but the actual pid of clone'd processes. But
  59 unfortunately libthread_db does not work very well for core dumps. So, we get pthread_id
  60 only for processes. For core dumps, we don't use libthread_db at all (like gdb).
  61 
  62 4. ptrace operates on this LWP id under both the thread libraries. When we say 'pid' for
  63 ptrace call, we refer to lwp_id of the thread.
  64 
  65 5. for core file, we parse ELF files and read data from them. For processes we  use
  66 combination of ptrace and /proc calls.
  67 
  68 *************************************************************************************/
  69 
  70 
  71 #if defined(sparc) || defined(sparcv9) || defined(ppc64)
  72 #define user_regs_struct  pt_regs
  73 #endif



  74 
  75 // This C bool type must be int for compatibility with Linux calls and
  76 // it would be a mistake to equivalence it to C++ bool on many platforms
  77 
  78 typedef int bool;
  79 #define true  1
  80 #define false 0
  81 
  82 struct ps_prochandle;
  83 
  84 // attach to a process
  85 struct ps_prochandle* Pgrab(pid_t pid);
  86 
  87 // attach to a core dump
  88 struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile);
  89 
  90 // release a process or core
  91 void Prelease(struct ps_prochandle* ph);
  92 
  93 // functions not directly available in Solaris libproc




  54 unique again. We therefore use OSThread::_thread_id as unique identifier.
  55 
  56 3. There is a unique LWP id under both thread libraries. libthread_db  maps pthread_id
  57 to its underlying lwp_id under both the thread libraries. thread_info.lwp_id stores
  58 lwp_id of the thread. The lwp id is nothing but the actual pid of clone'd processes. But
  59 unfortunately libthread_db does not work very well for core dumps. So, we get pthread_id
  60 only for processes. For core dumps, we don't use libthread_db at all (like gdb).
  61 
  62 4. ptrace operates on this LWP id under both the thread libraries. When we say 'pid' for
  63 ptrace call, we refer to lwp_id of the thread.
  64 
  65 5. for core file, we parse ELF files and read data from them. For processes we  use
  66 combination of ptrace and /proc calls.
  67 
  68 *************************************************************************************/
  69 
  70 
  71 #if defined(sparc) || defined(sparcv9) || defined(ppc64)
  72 #define user_regs_struct  pt_regs
  73 #endif
  74 #if defined(aarch64)
  75 #define user_regs_struct user_pt_regs
  76 #endif
  77 
  78 // This C bool type must be int for compatibility with Linux calls and
  79 // it would be a mistake to equivalence it to C++ bool on many platforms
  80 
  81 typedef int bool;
  82 #define true  1
  83 #define false 0
  84 
  85 struct ps_prochandle;
  86 
  87 // attach to a process
  88 struct ps_prochandle* Pgrab(pid_t pid);
  89 
  90 // attach to a core dump
  91 struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile);
  92 
  93 // release a process or core
  94 void Prelease(struct ps_prochandle* ph);
  95 
  96 // functions not directly available in Solaris libproc