Thanks both for pointing out that I didn't notice I was smashing the
32-bit case. 8-)

I can now build and test 32 and 64-bit OK with...

#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 PT_GETREGS
#endif
#else
#if defined(PTRACE_GETREGS) || defined(PT_GETREGS)
#define PTRACE_GETREGS_REQ PTRACE_GETREGS
#endif
#endif /* _LP64 */

My 64-bit system is Fedora and really needs to use PT_REGS as that's the
only definition. My 32-bit system is a different RedHat and has
PTRACE_GETREGS defined so the 32-bit build does work. Am tempted to
change the 32-bit side of the ifdef to also use PT_GETREGS as a last
resort...

Thanks
Kevin


On 02/12/2010 02:23, Yasumasa Suenaga wrote:
> Thank you for the reply.
>
> I've read your patch on a webrev.
> Your patch will work on AMD64 architecture.
> However, this patch will not work on x86 (32bit) architecture.
> Preprocessor in GCC for i386 does not define "_LP64" .
>
> -----------------
> [r...@rhel4-4 test]# cat /etc/redhat-release
> Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
> [r...@rhel4-4 test]# uname -a
> Linux RHEL4-4 2.6.9-42.EL #1 Wed Jul 12 23:16:43 EDT 2006 i686 i686 i386 
> GNU/Linux
> [r...@rhel4-4 test]# rpm -q glibc
> glibc-2.3.4-2.25
> [r...@rhel4-4 test]# rpm -q gcc
> gcc-3.4.6-3
> [r...@rhel4-4 test]# touch test.h
> [r...@rhel4-4 test]# cpp -dM test.h | grep _LP64
> [r...@rhel4-4 test]#
> -----------------
>
>
> So, you need to modify the patch as follows:
>
> -----------------
> [r...@fedora13 OpenJDK7]# diff -u 
> b118/openjdk/hotspot/agent/src/os/linux/ps_proc.c trunk/
> openjdk/hotspot/agent/src/os/linux/ps_proc.c
> --- a/agent/src/os/linux/ps_proc.c   2010-11-12 05:43:12.000000000 +0900
> +++ b/agent/src/os/linux/ps_proc.c   2010-12-02 10:45:09.117050388 +0900
> @@ -124,6 +124,8 @@
>  #ifdef _LP64
>  #ifdef PTRACE_GETREGS64
>  #define PTRACE_GETREGS_REQ PTRACE_GETREGS64
> +#elif defined(PTRACE_GETREGS)
> +#define PTRACE_GETREGS_REQ PTRACE_GETREGS
>  #endif
>  #else
>  #if defined(PTRACE_GETREGS) || defined(PT_GETREGS)
> -----------------
>
>
> Thanks.
>
>
> (2010/12/02 1:41), Kevin Walls wrote:
>> Sorry, there was actually a typo in that diff, although it was good
>> enough to be a solution on my system.
>>
>> A webrev also:
>>
>> http://cr.openjdk.java.net/~kevinw/7003789/webrev.00/
>>
>> Thanks
>> Kevin
>>
>>
>> On 01/12/2010 16:01, Kevin Walls wrote:
>>> 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:
>>>
>>> [ke...@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.
>>>>
>>>>
>

Reply via email to