2011-07-19 06:11:53 +08:00
//===-- SWIG Interface for SBCompileUnit ------------------------*- 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
2011-07-19 06:11:53 +08:00
//
//===----------------------------------------------------------------------===//
n a m e s p a c e l l d b {
% f e a t u r e ( "docstring" ,
" R e p r e s e n t s a c o m p i l a t i o n u n i t , or c o m p i l e d source file .
2021-01-15 21:43:26 +08:00
S B C o m p i l e U n i t s u p p o r t s line entry i t e r a t i o n . For e x a m p l e , : :
2011-07-19 06:11:53 +08:00
2011-07-28 02:28:07 +08:00
# Now get t h e S B S y m b o l C o n t e x t from t h i s frame . W e w a n t e v e r y t h i n g . : - )
context = f r a m e 0 . G e t S y m b o l C o n t e x t ( l l d b . e S y m b o l C o n t e x t E v e r y t h i n g )
. . .
c o m p i l e U n i t = context . G e t C o m p i l e U n i t ( )
2011-07-19 06:11:53 +08:00
for l i n e E n t r y in c o m p i l e U n i t :
2015-10-17 01:52:32 +08:00
p r i n t ( 'line entry: %s:%d' % ( s t r ( l i n e E n t r y . G e t F i l e S p e c ( ) ) ,
l i n e E n t r y . G e t L i n e ( ) ) )
p r i n t ( 'start addr: %s' % s t r ( l i n e E n t r y . G e t S t a r t A d d r e s s ( ) ) )
p r i n t ( 'end addr: %s' % s t r ( l i n e E n t r y . G e t E n d A d d r e s s ( ) ) )
2011-07-19 06:11:53 +08:00
2021-01-15 21:43:26 +08:00
p r o d u c e s : : :
line entry : / V o l u m e s / d a t a / l l d b / s v n / t r u n k / t e s t / p y t h o n _ a p i / s y m b o l - c o n t e x t / m a i n . c : 20
start a d d r : a . o u t [ 0x100000d98 ]
end a d d r : a . o u t [ 0x100000da3 ]
line entry : / V o l u m e s / d a t a / l l d b / s v n / t r u n k / t e s t / p y t h o n _ a p i / s y m b o l - c o n t e x t / m a i n . c : 21
start a d d r : a . o u t [ 0x100000da3 ]
end a d d r : a . o u t [ 0x100000da9 ]
line entry : / V o l u m e s / d a t a / l l d b / s v n / t r u n k / t e s t / p y t h o n _ a p i / s y m b o l - c o n t e x t / m a i n . c : 22
start a d d r : a . o u t [ 0x100000da9 ]
end a d d r : a . o u t [ 0x100000db6 ]
line entry : / V o l u m e s / d a t a / l l d b / s v n / t r u n k / t e s t / p y t h o n _ a p i / s y m b o l - c o n t e x t / m a i n . c : 23
start a d d r : a . o u t [ 0x100000db6 ]
end a d d r : a . o u t [ 0x100000dbc ]
. . .
S e e a l s o : p y : class : ` S B S y m b o l C o n t e x t ` and : p y : class : ` S B L i n e E n t r y ` "
2011-07-28 02:28:07 +08:00
) S B C o m p i l e U n i t ;
2011-07-19 06:11:53 +08:00
class S B C o m p i l e U n i t
{
public :
S B C o m p i l e U n i t ( ) ;
S B C o m p i l e U n i t ( c o n s t l l d b : : S B C o m p i l e U n i t &rhs);
~ S B C o m p i l e U n i t ( ) ;
b o o l
I s V a l i d ( ) c o n s t ;
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
explicit o p e r a t o r b o o l ( ) c o n s t ;
2011-07-19 06:11:53 +08:00
l l d b : : S B F i l e S p e c
G e t F i l e S p e c ( ) c o n s t ;
u i n t 32 _ t
G e t N u m L i n e E n t r i e s ( ) c o n s t ;
l l d b : : S B L i n e E n t r y
G e t L i n e E n t r y A t I n d e x ( u i n t 32 _ t i d x ) c o n s t ;
2022-05-12 10:33:37 +08:00
% f e a t u r e ( "docstring" , "
Get t h e index for a p r o v i d e d line entry in t h i s compile u n i t .
@ param [ in ] l i n e _ e n t r y
T h e S B L i n e E n t r y o b j e c t for w h i c h w e a r e l o o k i n g for t h e index .
@ param [ in ] e x a c t
A n o p t i o n a l b o o l e a n d e f a u l t i n g to false t h a t e n s u r e s t h a t t h e p r o v i d e d
line entry h a s a p e r f e c t m a t c h in t h e compile u n i t .
@ return
T h e index of t h e u s e r - p r o v i d e d line entry . U I N T 32 _ M A X if t h e line entry
2022-05-14 07:50:52 +08:00
w a s not f o u n d in t h e compile u n i t . " ) F i n d L i n e E n t r y I n d e x ;
2022-05-12 10:33:37 +08:00
u i n t 32 _ t
2022-05-14 07:50:52 +08:00
F i n d L i n e E n t r y I n d e x ( l l d b : : S B L i n e E n t r y &line_entry, bool exact = false) const;
2022-05-12 10:33:37 +08:00
2011-07-19 06:11:53 +08:00
u i n t 32 _ t
F i n d L i n e E n t r y I n d e x ( u i n t 32 _ t s t a r t _ i d x ,
u i n t 32 _ t line ,
l l d b : : S B F i l e S p e c * i n l i n e _ f i l e _ s p e c ) c o n s t ;
2011-09-23 08:54:11 +08:00
u i n t 32 _ t
F i n d L i n e E n t r y I n d e x ( u i n t 32 _ t s t a r t _ i d x ,
u i n t 32 _ t line ,
l l d b : : S B F i l e S p e c * i n l i n e _ f i l e _ s p e c ,
b o o l e x a c t ) c o n s t ;
2012-03-17 05:55:42 +08:00
S B F i l e S p e c
G e t S u p p o r t F i l e A t I n d e x ( u i n t 32 _ t i d x ) c o n s t ;
u i n t 32 _ t
G e t N u m S u p p o r t F i l e s ( ) c o n s t ;
u i n t 32 _ t
F i n d S u p p o r t F i l e I n d e x ( u i n t 32 _ t s t a r t _ i d x , c o n s t S B F i l e S p e c &sb_file, bool full);
2013-06-19 06:51:05 +08:00
% f e a t u r e ( "docstring" , "
2019-04-23 18:04:22 +08:00
Get all t y p e s m a t c h i n g t y p e _ m a s k from debug info in t h i s
2019-04-19 00:23:33 +08:00
compile u n i t .
@ param [ in ] t y p e _ m a s k
A b i t f i e l d t h a t c o n s i s t s of o n e or m o r e b i t s l o g i c a l l y OR ' e d
t o g e t h e r from t h e l l d b : : T y p e C l a s s e n u m e r a t i o n . T h i s a l l o w s
y o u to request o n l y s t r u c t u r e t y p e s , or o n l y class , s t r u c t
and union t y p e s . P a s s i n g in l l d b : : e T y p e C l a s s A n y w i l l return
all t y p e s f o u n d in t h e debug information for t h i s compile
u n i t .
@ return
2019-04-23 18:04:22 +08:00
A l i s t of t y p e s in t h i s compile u n i t t h a t m a t c h t y p e _ m a s k " ) G e t T y p e s ;
2013-06-19 06:51:05 +08:00
l l d b : : S B T y p e L i s t
G e t T y p e s ( u i n t 32 _ t t y p e _ m a s k = l l d b : : e T y p e C l a s s A n y ) ;
2019-04-19 00:23:33 +08:00
2014-11-18 07:06:20 +08:00
l l d b : : L a n g u a g e T y p e
G e t L a n g u a g e ( ) ;
2019-04-19 00:23:33 +08:00
2011-07-19 06:11:53 +08:00
b o o l
G e t D e s c r i p t i o n ( l l d b : : S B S t r e a m &description);
2019-04-19 00:23:33 +08:00
2013-05-03 09:29:27 +08:00
b o o l
o p e r a t o r = = ( c o n s t l l d b : : S B C o m p i l e U n i t &rhs) const;
2019-04-19 00:23:33 +08:00
2013-05-03 09:29:27 +08:00
b o o l
o p e r a t o r ! = ( c o n s t l l d b : : S B C o m p i l e U n i t &rhs) const;
2019-04-19 00:23:33 +08:00
2020-01-09 08:13:03 +08:00
S T R I N G _ E X T E N S I O N ( S B C o m p i l e U n i t )
2019-12-09 06:46:48 +08:00
# i f def S W I G P Y T H O N
2012-01-29 14:07:39 +08:00
% p y t h o n c o d e % {
2019-04-03 19:48:38 +08:00
def _ _ i t e r _ _ ( self ) :
'''Iterate over all line entries in a lldb.SBCompileUnit object.'''
return l l d b _ i t e r ( self , 'GetNumLineEntries', 'GetLineEntryAtIndex' )
def _ _ l e n _ _ ( self ) :
''' Return t h e n u m b e r of line e n t r i e s in a l l d b . S B C o m p i l e U n i t
o b j e c t . '''
return self . G e t N u m L i n e E n t r i e s ( )
2019-07-03 02:04:55 +08:00
2019-07-03 06:18:35 +08:00
file = property ( G e t F i l e S p e c , None , d o c = '''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''' )
n u m _ l i n e _ e n t r i e s = property ( G e t N u m L i n e E n t r i e s , None , d o c = '''A read only property that returns the number of line entries in a compile unit as an integer.''' )
2012-01-29 14:07:39 +08:00
% }
2019-12-09 06:46:48 +08:00
# e n d i f
2011-07-19 06:11:53 +08:00
} ;
} // namespace lldb