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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 13 11:17:38 PDT 2018


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*/
}                              

...



> On Mar 13, 2018, at 11:04 AM, Davide Italiano <dccitaliano at gmail.com> wrote:
> 
> On Tue, Mar 13, 2018 at 10:57 AM, Greg Clayton <clayborg at gmail.com> wrote:
>> 
>> 
>>> On Mar 13, 2018, at 10:37 AM, Davide Italiano via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>>> 
>>> An alternative proposed by Fred which is an OK middle ground IMHO is
>>> that of not inserting a decl for the unmangled name, but treat this
>>> symbol always as-it-is.
>>> i.e. if we have a symbol _Znwm in some object, we don't insert a decl
>>> for `operator new(unsigned long)` but for _Znwm itself.
>>> 
>>> Greg, Jason, would that work for you guys?
>> 
>> I would be ok with that.
>> 
> 
> I'm going to send a review for this soon.
> 
> Best,
> 
> --
> Davide



More information about the lldb-commits mailing list