1*fe013be4SDimitry Andric %feature("docstring", 2*fe013be4SDimitry Andric "Represents a generic function, which can be inlined or not. 3*fe013be4SDimitry Andric 4*fe013be4SDimitry Andric For example (from test/lldbutil.py, but slightly modified for doc purpose),:: 5*fe013be4SDimitry Andric 6*fe013be4SDimitry Andric ... 7*fe013be4SDimitry Andric 8*fe013be4SDimitry Andric frame = thread.GetFrameAtIndex(i) 9*fe013be4SDimitry Andric addr = frame.GetPCAddress() 10*fe013be4SDimitry Andric load_addr = addr.GetLoadAddress(target) 11*fe013be4SDimitry Andric function = frame.GetFunction() 12*fe013be4SDimitry Andric mod_name = frame.GetModule().GetFileSpec().GetFilename() 13*fe013be4SDimitry Andric 14*fe013be4SDimitry Andric if not function: 15*fe013be4SDimitry Andric # No debug info for 'function'. 16*fe013be4SDimitry Andric symbol = frame.GetSymbol() 17*fe013be4SDimitry Andric file_addr = addr.GetFileAddress() 18*fe013be4SDimitry Andric start_addr = symbol.GetStartAddress().GetFileAddress() 19*fe013be4SDimitry Andric symbol_name = symbol.GetName() 20*fe013be4SDimitry Andric symbol_offset = file_addr - start_addr 21*fe013be4SDimitry Andric print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format( 22*fe013be4SDimitry Andric num=i, addr=load_addr, mod=mod_name, symbol=symbol_name, offset=symbol_offset) 23*fe013be4SDimitry Andric else: 24*fe013be4SDimitry Andric # Debug info is available for 'function'. 25*fe013be4SDimitry Andric func_name = frame.GetFunctionName() 26*fe013be4SDimitry Andric file_name = frame.GetLineEntry().GetFileSpec().GetFilename() 27*fe013be4SDimitry Andric line_num = frame.GetLineEntry().GetLine() 28*fe013be4SDimitry Andric print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format( 29*fe013be4SDimitry Andric num=i, addr=load_addr, mod=mod_name, 30*fe013be4SDimitry Andric func='%s [inlined]' % func_name] if frame.IsInlined() else func_name, 31*fe013be4SDimitry Andric file=file_name, line=line_num, args=get_args_as_string(frame, showFuncName=False)) 32*fe013be4SDimitry Andric 33*fe013be4SDimitry Andric ..." 34*fe013be4SDimitry Andric ) lldb::SBFunction; 35*fe013be4SDimitry Andric 36*fe013be4SDimitry Andric %feature("docstring", " 37*fe013be4SDimitry Andric Returns true if the function was compiled with optimization. 38*fe013be4SDimitry Andric Optimization, in this case, is meant to indicate that the debugger 39*fe013be4SDimitry Andric experience may be confusing for the user -- variables optimized away, 40*fe013be4SDimitry Andric stepping jumping between source lines -- and the driver may want to 41*fe013be4SDimitry Andric provide some guidance to the user about this. 42*fe013be4SDimitry Andric Returns false if unoptimized, or unknown." 43*fe013be4SDimitry Andric ) lldb::SBFunction::GetIsOptimized; 44