6359295: SA utilities: "get_thread_regs failed for a lwp" from jstack(1)

David Holmes David.Holmes at oracle.com
Wed Dec 1 18:41:06 PST 2010


Hi Kevin,

Seems to me the original problem here was that on 64-bit
PTRACE_GETREGS64 is not defined when on x86_64 - I could only find
reference to it on sparcv9. Your change seems to reduce to the following:

 #ifdef _LP64
   #ifdef PTRACE_GETREGS64
     #define PTRACE_GETREGS_REQ PTRACE_GETREGS64
   #elif defined(PTRACE_GETREGS)
     #define PTRACE_GETREGS_REQ PTRACE_GETREGS
   #elif defined (PT_GETREGS)
     #define PTRACE_GETREGS_REQ PTRACE_GETREGS
   #endif
 #endif /* _LP64 */

which seems to completely ignore the 32-bit case ???

David

Kevin Walls said the following on 12/02/10 02:01:
> Hi --
> 
> I've just been hitting that as well.... I think it needs to be dealt
> with as a separate bug as there may be a few which are similar - and
> 6359295 is marked fixed in 5.0 long ago...
> 
> I just found your message after I'd done some investigating... The patch
> I was working with is to split one of the existing "if defined"
> statements, as currently the bug is: if we have PT_GETREGS defined, we
> use PTRACE_GETREGS to define PTRACE_GETREGS_REQ... We soon realise that
> may NOT be defined and give the "unsupported" message. So I can log and
> bug and get this done if it sounds good:
> 
> [kevin at oldbox make]$ hg diff  ../src/os/linux/ps_proc.c
> diff --git a/agent/src/os/linux/ps_proc.c b/agent/src/os/linux/ps_proc.c
> --- a/agent/src/os/linux/ps_proc.c
> +++ b/agent/src/os/linux/ps_proc.c
> @@ -124,9 +124,9 @@
>  #ifdef _LP64
>  #ifdef PTRACE_GETREGS64
>  #define PTRACE_GETREGS_REQ PTRACE_GETREGS64
> -#endif
> -#else
> -#if defined(PTRACE_GETREGS) || defined(PT_GETREGS)
> +#elif defined(PTRACE_GETREGS)
> +#define PTRACE_GETREGS_REQ PTRACE_GETREGS
> +#elif defined (PT_GETREGS)
>  #define PTRACE_GETREGS_REQ PTRACE_GETREGS
>  #endif
>  #endif /* _LP64 */
> 
> 
> 
> Regards
> Kevin
> 
> 
> 
> On 15/11/2010 06:46, Yasumasa Suenaga wrote:
>> Hi.
>>
>> I and co-worker use jstack for various trouble shooting.
>>
>> We mainly use Java on Linux with AMD64 architecture.
>> However, jstack -F option doesn't work our platform.
>>
>> I ran jstack -F with LIBSAPROC_DEBUG=1 (environment variable),
>> I got following messages:
>>
>>
>> /***************/
>> Thread 31933: (state = BLOCKED)
>> libsaproc DEBUG: ptrace(PTRACE_GETREGS, ...) not supported
>> Error occurred during stack walking:
>> sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
>> /***************/
>>
>>
>> In order to fix this problem, I made a patch for preprocessor
>> macro in "agent/src/os/linux/ps_proc.c" .
>> The patch that attached this mail works well on Fedora 13 x86_64.
>>
>> Please merge this patch if you don't fix this problem yet.
>>
>>
>> Best regards.
>>
>>
> 


More information about the serviceability-dev mailing list