[Lldb-commits] [PATCH] lldb: deal with non-portable PTRACE-related constants

Paul Osmialowski pawelo at king.net.pl
Mon Jun 23 13:14:14 PDT 2014


Hi Todd,

These values looks ok. Although they cannot be found in sys/ headers 
shipped within Linaro's toolchain sysroot for AArch64, I could find them 
in AArch64-related headers that are part of Linux kernel source code:

arch/arm64/include/asm/ptrace.h:

/* AArch32-specific ptrace requests */
#define COMPAT_PTRACE_GETREGS           12
#define COMPAT_PTRACE_SETREGS           13
#define COMPAT_PTRACE_GET_THREAD_AREA   22
#define COMPAT_PTRACE_SET_SYSCALL       23
#define COMPAT_PTRACE_GETVFPREGS        27
#define COMPAT_PTRACE_SETVFPREGS        28
#define COMPAT_PTRACE_GETHBPREGS        29
#define COMPAT_PTRACE_SETHBPREGS        30
#define COMPAT_PSR_MODE_USR     0x00000010
#define COMPAT_PSR_T_BIT        0x00000020
#define COMPAT_PSR_IT_MASK      0x0600fc00      /* If-Then execution state mask */

I guess we're not going to require access to kernel headers for lldb 
cross-compilation, so your fix should be a better solution.

Is NativeProcessLinux.cpp intented to replace Linux/ProcessMonitor.cpp? 
I gave your branch a try and found that now, both are compiled.

On Mon, 23 Jun 2014, Todd Fiala wrote:

> FWIW on the NativeProcessLinux side (llgs branch) I'm solving this more like how the existing code did it:
> --- a/source/Plugins/Process/Linux/NativeProcessLinux.cpp
> +++ b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
> @@ -52,6 +52,12 @@
>  #define DEBUG_PTRACE_MAXBYTES 20
>  
>  // Support ptrace extensions even when compiled without required kernel support
> +#ifndef PTRACE_GETREGS
> +#define PTRACE_GETREGS 12
> +#endif
> +#ifndef PTRACE_SETREGS
> +  #define PTRACE_SETREGS 13
> +#endif
>  #ifndef PTRACE_GETREGSET
>    #define PTRACE_GETREGSET 0x4204
>  #endif
> 
> That approach should also clear up the cross compile issues.  More importantly, if it's really running this code on the target, where the ptrace support really does exist, then the code would still run
> properly.
> 
> 
> On Mon, Jun 23, 2014 at 9:07 AM, Todd Fiala <tfiala at google.com> wrote:
>       svn commit
>       Sending        source/Plugins/Process/Linux/ProcessMonitor.cpp
>       Transmitting file data .
>       Committed revision 211503.
>
>       http://reviews.llvm.org/D4091
> 
> 
> 
> 
> 
> --
> Todd Fiala |
>  Software Engineer |
>  tfiala at google.com |
>  650-943-3180
> 
>


More information about the lldb-commits mailing list