[Lldb-commits] [lldb] r327356 - [ExpressionParser] Fix crash when evaluating invalid expresssions.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 13 11:47:45 PDT 2018


On Tue, Mar 13, 2018 at 11:17 AM, Greg Clayton <clayborg at gmail.com> wrote:
> If you check the expression log, you will see the printf() function declaration and any others we add:
>
> (lldb) log enable lldb expr
> (lldb) 2+3
>
> ...
> #ifndef NULL
> #define NULL (__null)
> #endif
> #ifndef Nil
> #define Nil (__null)
> #endif
> #ifndef nil
> #define nil (__null)
> #endif
> #ifndef YES
> #define YES ((BOOL)1)
> #endif
> #ifndef NO
> #define NO ((BOOL)0)
> #endif
> typedef __INT8_TYPE__ int8_t;
> typedef __UINT8_TYPE__ uint8_t;
> typedef __INT16_TYPE__ int16_t;
> typedef __UINT16_TYPE__ uint16_t;
> typedef __INT32_TYPE__ int32_t;
> typedef __UINT32_TYPE__ uint32_t;
> typedef __INT64_TYPE__ int64_t;
> typedef __UINT64_TYPE__ uint64_t;
> typedef __INTPTR_TYPE__ intptr_t;
> typedef __UINTPTR_TYPE__ uintptr_t;
> typedef __SIZE_TYPE__ size_t;
> typedef __PTRDIFF_TYPE__ ptrdiff_t;
> typedef unsigned short unichar;
> extern "C"
> {
>     int printf(const char * __restrict, ...);
> }
>
> typedef signed char BOOL;
>
>
> void
> $__lldb_expr(void *$__lldb_arg)
> {
>     ;
>     /*LLDB_BODY_START*/
>     2+3;
>     /*LLDB_BODY_END*/
> }
>
> ...
>

I checked it works also for strtok(), which I don't think we add.

Best,

--
Davide


More information about the lldb-commits mailing list