[Lldb-commits] [PATCH] lldb - problem with some PTRACE_* constants in NativeProcessLinux.cpp file

Todd Fiala tfiala at google.com
Wed Jul 2 14:24:43 PDT 2014


I think per a previous discussion, we can actually remove a few of these
lines, too (see bolded blow, the #ifdef checks on the PTRACE_* are really
not valid, they should have always been the PT_* values from all the header
code I've looked at):

+#ifndef PT_GETREGS
* #ifndef PTRACE_GETREGS*
-#define PTRACE_GETREGS 12
+  #define PTRACE_GETREGS 12
* #endif*
+#endif
+#ifndef PT_SETREGS
* #ifndef PTRACE_SETREGS*
   #define PTRACE_SETREGS 13
* #endif*
+#endif
+#ifndef PT_GETFPREGS
*+#ifndef PTRACE_GETFPREGS*
+  #define PTRACE_GETFPREGS 14
*+#endif*
+#endif
+#ifndef PT_SETFPREGS
*+#ifndef PTRACE_SETFPREGS*
+  #define PTRACE_SETFPREGS 15
*+#endif*
+#endif
 #ifndef PTRACE_GETREGSET
   #define PTRACE_GETREGSET 0x4204
 #endif

Paul, unless you know that will break your scenario, I'd like to pull those
out as part of this patch.


On Wed, Jul 2, 2014 at 2:19 PM, Todd Fiala <tfiala at google.com> wrote:

> Hey Paul,
>
> It looks fine.  Let me give it a build/test and then I'll check it in.
>
> Thanks!  I had thought I got most of those in the llgs branch but looks
> like I missed a few.
>
> -Todd
>
>
> On Wed, Jul 2, 2014 at 2:09 PM, Greg Clayton <gclayton at apple.com> wrote:
>
>> Looks ok to me if Todd Fiala gives the ok as well.
>>
>> > On Jul 2, 2014, at 1:46 PM, Paul Osmialowski <pawelo at king.net.pl>
>> wrote:
>> >
>> > Today this is the only problem that I'm facing trying to cross-compile
>> lldb for AArch64 using Linaro's toolchain.
>> > - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS
>> are not defined for AArch64
>> > - These things can be defined different ways for other architectures,
>> e.g. for x86_64 Linux, asm/ptrace-abi.h defines them as preprocessor
>> constants while sys/ptrace.h defines them in enum along with corresponding
>> PT_* preprocessor constants
>> > - NativeProcessLinux.cpp includes sys/ptrace.h
>> > - To avoid accidental redefinition of enums with preprocessor
>> constants, I'm proposing this patch which first checks for PT_*
>> preprocessor constants then checks for PTRACE_* constants then when it
>> still can not find them, it defines preprocessor constants.
>> > - Similar approach was already used for PTRACE_GETREGSET and
>> PTRACE_SETREGSET constants; in this case however it was easier, since enum
>> values in sys/ptrace.h and preprocessor constants shared all exactly the
>> same names (e.g. there's no additional PT_GETREGSET name defined).
>> >
>> > http://reviews.llvm.org/D4366
>> >
>> > Files:
>> >  source/Plugins/Process/Linux/NativeProcessLinux.cpp
>> >
>> > Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
>> > ===================================================================
>> > --- source/Plugins/Process/Linux/NativeProcessLinux.cpp
>> > +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
>> > @@ -53,12 +53,26 @@
>> > #define DEBUG_PTRACE_MAXBYTES 20
>> >
>> > // Support ptrace extensions even when compiled without required kernel
>> support
>> > +#ifndef PT_GETREGS
>> > #ifndef PTRACE_GETREGS
>> > -#define PTRACE_GETREGS 12
>> > +  #define PTRACE_GETREGS 12
>> > #endif
>> > +#endif
>> > +#ifndef PT_SETREGS
>> > #ifndef PTRACE_SETREGS
>> >   #define PTRACE_SETREGS 13
>> > #endif
>> > +#endif
>> > +#ifndef PT_GETFPREGS
>> > +#ifndef PTRACE_GETFPREGS
>> > +  #define PTRACE_GETFPREGS 14
>> > +#endif
>> > +#endif
>> > +#ifndef PT_SETFPREGS
>> > +#ifndef PTRACE_SETFPREGS
>> > +  #define PTRACE_SETFPREGS 15
>> > +#endif
>> > +#endif
>> > #ifndef PTRACE_GETREGSET
>> >   #define PTRACE_GETREGSET 0x4204
>> > #endif
>> > <D4366.11033.patch>_______________________________________________
>> > lldb-commits mailing list
>> > lldb-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>
>
>
> --
> Todd Fiala | Software Engineer |  tfiala at google.com |  650-943-3180
>



-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140702/e6b95173/attachment.html>


More information about the lldb-commits mailing list