2012-10-17 05:41:58 +08:00
//===-- SWIG interface for SBExpressionOptions -----------------------------------------------*- C++ -*-===//
//
2019-01-19 16:50:56 +08:00
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2012-10-17 05:41:58 +08:00
//
//===----------------------------------------------------------------------===//
n a m e s p a c e l l d b {
% f e a t u r e ( "docstring" ,
"A container for options to use when evaluating expressions."
) S B E x p r e s s i o n O p t i o n s ;
class S B E x p r e s s i o n O p t i o n s
{
f r i e n d class S B F r a m e ;
f r i e n d class S B V a l u e ;
public :
S B E x p r e s s i o n O p t i o n s ( ) ;
S B E x p r e s s i o n O p t i o n s ( c o n s t l l d b : : S B E x p r e s s i o n O p t i o n s &rhs);
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
~ S B E x p r e s s i o n O p t i o n s ( ) ;
b o o l
2012-10-17 06:58:25 +08:00
G e t C o e r c e R e s u l t T o I d ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2012-10-17 06:58:25 +08:00
% f e a t u r e ( "docstring" , "Sets whether to coerce the expression result to ObjC id type after evaluation." ) S e t C o e r c e R e s u l t T o I d ;
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
void
2012-10-17 06:58:25 +08:00
S e t C o e r c e R e s u l t T o I d ( b o o l c o e r c e = true ) ;
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
b o o l
2012-10-17 06:58:25 +08:00
G e t U n w i n d O n E r r o r ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2012-10-17 06:58:25 +08:00
% f e a t u r e ( "docstring" , "Sets whether to unwind the expression stack on error." ) S e t U n w i n d O n E r r o r ;
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
void
2013-02-09 09:29:05 +08:00
S e t U n w i n d O n E r r o r ( b o o l u n w i n d = true ) ;
2019-04-19 00:23:33 +08:00
2013-01-15 10:47:48 +08:00
b o o l
G e t I g n o r e B r e a k p o i n t s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2013-01-15 10:47:48 +08:00
% f e a t u r e ( "docstring" , "Sets whether to ignore breakpoint hits while running expressions." ) S e t U n w i n d O n E r r o r ;
2019-04-19 00:23:33 +08:00
2013-01-15 10:47:48 +08:00
void
2013-02-09 09:29:05 +08:00
S e t I g n o r e B r e a k p o i n t s ( b o o l i g n o r e = true ) ;
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
l l d b : : D y n a m i c V a l u e T y p e
2012-10-17 06:58:25 +08:00
G e t F e t c h D y n a m i c V a l u e ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2012-10-17 06:58:25 +08:00
% f e a t u r e ( "docstring" , "Sets whether to cast the expression result to its dynamic type." ) S e t F e t c h D y n a m i c V a l u e ;
2019-04-19 00:23:33 +08:00
2012-10-17 06:58:25 +08:00
void
S e t F e t c h D y n a m i c V a l u e ( l l d b : : D y n a m i c V a l u e T y p e dynamic = l l d b : : e D y n a m i c C a n R u n T a r g e t ) ;
2012-10-17 05:41:58 +08:00
u i n t 32 _ t
2012-10-17 06:58:25 +08:00
G e t T i m e o u t I n M i c r o S e c o n d s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2020-04-07 00:06:02 +08:00
% f e a t u r e ( "docstring" , "Sets the timeout in microseconds to run the expression for. If try all threads is set to true and the expression doesn't complete within the specified timeout, all threads will be resumed for the same timeout to see if the expression will finish." ) S e t T i m e o u t I n M i c r o S e c o n d s ;
2012-10-17 05:41:58 +08:00
void
2012-10-17 06:58:25 +08:00
S e t T i m e o u t I n M i c r o S e c o n d s ( u i n t 32 _ t t i m e o u t = 0 ) ;
2019-04-19 00:23:33 +08:00
2014-03-29 05:58:28 +08:00
u i n t 32 _ t
G e t O n e T h r e a d T i m e o u t I n M i c r o S e c o n d s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2014-03-29 05:58:28 +08:00
% f e a t u r e ( "docstring" , "Sets the timeout in microseconds to run the expression on one thread before either timing out or trying all threads." ) S e t T i m e o u t I n M i c r o S e c o n d s ;
void
S e t O n e T h r e a d T i m e o u t I n M i c r o S e c o n d s ( u i n t 32 _ t t i m e o u t = 0 ) ;
2019-04-19 00:23:33 +08:00
2012-10-17 05:41:58 +08:00
b o o l
2012-10-17 06:58:25 +08:00
G e t T r y A l l T h r e a d s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2012-10-17 06:58:25 +08:00
% f e a t u r e ( "docstring" , "Sets whether to run all threads if the expression does not complete on one thread." ) S e t T r y A l l T h r e a d s ;
2012-10-17 05:41:58 +08:00
void
2012-10-17 06:58:25 +08:00
S e t T r y A l l T h r e a d s ( b o o l r u n _ o t h e r s = true ) ;
2019-04-19 00:23:33 +08:00
2014-02-28 10:52:06 +08:00
b o o l
G e t S t o p O t h e r s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2020-04-07 00:06:02 +08:00
% f e a t u r e ( "docstring" , "Sets whether to stop other threads at all while running expressions. If false, TryAllThreads does nothing." ) S e t T r y A l l T h r e a d s ;
2014-02-28 10:52:06 +08:00
void
S e t S t o p O t h e r s ( b o o l s t o p _ o t h e r s = true ) ;
2019-04-19 00:23:33 +08:00
2013-11-07 08:11:47 +08:00
b o o l
G e t T r a p E x c e p t i o n s ( ) c o n s t ;
2019-04-19 00:23:33 +08:00
2013-11-07 08:11:47 +08:00
% f e a t u r e ( "docstring" , "Sets whether to abort expression evaluation if an exception is thrown while executing. Don't set this to false unless you know the function you are calling traps all exceptions itself." ) S e t T r y A l l T h r e a d s ;
void
S e t T r a p E x c e p t i o n s ( b o o l t r a p _ e x c e p t i o n s = true ) ;
2019-04-19 00:23:33 +08:00
2014-06-13 10:37:02 +08:00
% f e a t u r e ( "docstring" , "Sets the language that LLDB should assume the expression is written in" ) S e t L a n g u a g e ;
void
S e t L a n g u a g e ( l l d b : : L a n g u a g e T y p e language ) ;
2014-07-11 09:03:57 +08:00
b o o l
G e t G e n e r a t e D e b u g I n f o ( ) ;
% f e a t u r e ( "docstring" , "Sets whether to generate debug information for the expression and also controls if a SBModule is generated." ) S e t G e n e r a t e D e b u g I n f o ;
void
S e t G e n e r a t e D e b u g I n f o ( b o o l b = true ) ;
2019-04-19 00:23:33 +08:00
2014-08-09 05:45:36 +08:00
b o o l
G e t S u p p r e s s P e r s i s t e n t R e s u l t ( ) ;
2019-04-19 00:23:33 +08:00
2014-08-09 05:45:36 +08:00
% f e a t u r e ( "docstring" , "Sets whether to produce a persistent result that can be used in future expressions." ) S e t S u p p r e s s P e r s i s t e n t R e s u l t ;
void
S e t S u p p r e s s P e r s i s t e n t R e s u l t ( b o o l b = false ) ;
Allow expresions to have unique expression prefixes:
expr_options = lldb.SBExpressionOptions()
expr_options.SetPrefix('''
struct Foo {
int a;
int b;
int c;
}
'''
expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options)
This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful.
<rdar://problem/21130675>
llvm-svn: 238365
2015-05-28 06:32:39 +08:00
% f e a t u r e ( "docstring" , "Gets the prefix to use for this expression." ) G e t P r e f i x ;
c o n s t char *
G e t P r e f i x ( ) c o n s t ;
% f e a t u r e ( "docstring" , "Sets the prefix to use for this expression. This prefix gets inserted after the 'target.expr-prefix' prefix contents, but before the wrapped expression function body." ) S e t P r e f i x ;
void
S e t P r e f i x ( c o n s t char * p r e f i x ) ;
2019-04-19 00:23:33 +08:00
2016-06-28 09:33:03 +08:00
% f e a t u r e ( "docstring" , "Sets whether to auto-apply fix-it hints to the expression being evaluated." ) S e t A u t o A p p l y F i x I t s ;
2016-03-25 09:57:14 +08:00
void
S e t A u t o A p p l y F i x I t s ( b o o l b = true ) ;
2019-04-19 00:23:33 +08:00
2016-06-28 09:33:03 +08:00
% f e a t u r e ( "docstring" , "Gets whether to auto-apply fix-it hints to an expression." ) G e t A u t o A p p l y F i x I t s ;
2016-03-25 09:57:14 +08:00
b o o l
G e t A u t o A p p l y F i x I t s ( ) ;
2020-04-06 17:08:12 +08:00
% f e a t u r e ( "docstring" , "Sets how often LLDB should retry applying fix-its to an expression." ) S e t R e t r i e s W i t h F i x I t s ;
void
S e t R e t r i e s W i t h F i x I t s ( u i n t 64 _ t r e t r i e s ) ;
% f e a t u r e ( "docstring" , "Gets how often LLDB will retry applying fix-its to an expression." ) G e t R e t r i e s W i t h F i x I t s ;
u i n t 64 _ t
G e t R e t r i e s W i t h F i x I t s ( ) ;
2016-03-29 18:41:40 +08:00
b o o l
G e t T o p L e v e l ( ) ;
void
S e t T o p L e v e l ( b o o l b = true ) ;
2019-04-19 00:23:33 +08:00
2018-11-03 07:42:40 +08:00
% f e a t u r e ( "docstring" , "Gets whether to JIT an expression if it cannot be interpreted." ) G e t A l l o w J I T ;
b o o l
G e t A l l o w J I T ( ) ;
2019-04-19 00:23:33 +08:00
2018-11-03 07:42:40 +08:00
% f e a t u r e ( "docstring" , "Sets whether to JIT an expression if it cannot be interpreted." ) S e t A l l o w J I T ;
void
S e t A l l o w J I T ( b o o l a l l o w ) ;
2014-07-11 09:03:57 +08:00
2012-10-17 05:41:58 +08:00
protected :
S B E x p r e s s i o n O p t i o n s ( l l d b _ p r i v a t e : : E v a l u a t e E x p r e s s i o n O p t i o n s &expression_options);
l l d b _ p r i v a t e : : E v a l u a t e E x p r e s s i o n O p t i o n s *
get ( ) c o n s t ;
l l d b _ p r i v a t e : : E v a l u a t e E x p r e s s i o n O p t i o n s &
r e f ( ) c o n s t ;
private :
// This auto_pointer is made in the constructor and is always valid.
2013-04-19 06:45:39 +08:00
m u t a b l e s t d : : u n i q u e _ p t r < l l d b _ p r i v a t e : : E v a l u a t e E x p r e s s i o n O p t i o n s > m _ o p a q u e _ a p ;
2012-10-17 05:41:58 +08:00
} ;
} // namespace lldb