blob: ac3d1231597668b2a449c8eb9640e84fd2b9ea3d [file] [log] [blame]
Johnny Chenba6f2522011-07-18 22:15:37 +00001//===-- SWIG Interface for SBFunction ---------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10namespace lldb {
11
12%feature("docstring",
13"Represents a generic function, which can be inlined or not.
14
15For example (from test/lldbutil.py, but slightly modified for doc purpose),
16
17 ...
18
19 frame = thread.GetFrameAtIndex(i)
20 addr = frame.GetPCAddress()
21 load_addr = addr.GetLoadAddress(target)
22 function = frame.GetFunction()
23 mod_name = frame.GetModule().GetFileSpec().GetFilename()
24
25 if not function:
26 # No debug info for 'function'.
27 symbol = frame.GetSymbol()
28 file_addr = addr.GetFileAddress()
29 start_addr = symbol.GetStartAddress().GetFileAddress()
30 symbol_name = symbol.GetName()
31 symbol_offset = file_addr - start_addr
32 print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
33 num=i, addr=load_addr, mod=mod_name, symbol=symbol_name, offset=symbol_offset)
34 else:
35 # Debug info is available for 'function'.
36 func_name = frame.GetFunctionName()
37 file_name = frame.GetLineEntry().GetFileSpec().GetFilename()
38 line_num = frame.GetLineEntry().GetLine()
39 print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
40 num=i, addr=load_addr, mod=mod_name,
41 func='%s [inlined]' % func_name] if frame.IsInlined() else func_name,
42 file=file_name, line=line_num, args=get_args_as_string(frame, showFuncName=False))
43
44 ...
45") SBFunction;
46class SBFunction
47{
48public:
49
50 SBFunction ();
51
52 SBFunction (const lldb::SBFunction &rhs);
53
54 ~SBFunction ();
55
56 bool
57 IsValid () const;
58
59 const char *
60 GetName() const;
61
62 const char *
63 GetMangledName () const;
64
65 lldb::SBInstructionList
66 GetInstructions (lldb::SBTarget target);
67
68 SBAddress
69 GetStartAddress ();
70
71 SBAddress
72 GetEndAddress ();
73
74 uint32_t
75 GetPrologueByteSize ();
76
77 bool
78 GetDescription (lldb::SBStream &description);
79};
80
81} // namespace lldb