agent/src/os/linux/libproc.h

Print this page
rev 9708 : 8073139: PPC64: User-visible arch directory and os.arch value on ppc64le cause issues with Java tooling
Summary: Set LIBARCH to ppc64le, make SA and hsdis work, have os.arch return ppc64le on PowerPC64 LE
Reviewed-by: david.holmes@oracle.com, magnus.ihse.bursie@oracle.com
Contributed-by: Andrew Hughes gnu.andrew@redhat.com, Alexander Smundak asmundak@google.com


  51 ::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id
  52 was lost under NPTL. Now, we store the result of ::gettid() call in
  53 OSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is
  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 #include <asm/ptrace.h>
  76 #define user_regs_struct user_pt_regs
  77 #endif
  78 
  79 // This C bool type must be int for compatibility with Linux calls and
  80 // it would be a mistake to equivalence it to C++ bool on many platforms
  81 
  82 typedef int bool;
  83 #define true  1
  84 #define false 0
  85 
  86 struct ps_prochandle;
  87 
  88 // attach to a process
  89 struct ps_prochandle* Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
  90 
  91 // attach to a core dump




  51 ::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id
  52 was lost under NPTL. Now, we store the result of ::gettid() call in
  53 OSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is
  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) || defined(ppc64le)
  72 #define user_regs_struct  pt_regs
  73 #endif
  74 #if defined(aarch64)
  75 #include <asm/ptrace.h>
  76 #define user_regs_struct user_pt_regs
  77 #endif
  78 
  79 // This C bool type must be int for compatibility with Linux calls and
  80 // it would be a mistake to equivalence it to C++ bool on many platforms
  81 
  82 typedef int bool;
  83 #define true  1
  84 #define false 0
  85 
  86 struct ps_prochandle;
  87 
  88 // attach to a process
  89 struct ps_prochandle* Pgrab(pid_t pid, char* err_buf, size_t err_buf_len);
  90 
  91 // attach to a core dump