Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 1 | //===-- SWIG Interface for SBAddress ----------------------------*- 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 | |
| 10 | namespace lldb { |
| 11 | |
| 12 | %feature("docstring", |
| 13 | "A section + offset based address class. |
| 14 | |
| 15 | The SBAddress class allows addresses to be relative to a section |
| 16 | that can move during runtime due to images (executables, shared |
| 17 | libraries, bundles, frameworks) being loaded at different |
| 18 | addresses than the addresses found in the object file that |
| 19 | represents them on disk. There are currently two types of addresses |
| 20 | for a section: |
| 21 | o file addresses |
| 22 | o load addresses |
| 23 | |
| 24 | File addresses represents the virtual addresses that are in the 'on |
| 25 | disk' object files. These virtual addresses are converted to be |
| 26 | relative to unique sections scoped to the object file so that |
| 27 | when/if the addresses slide when the images are loaded/unloaded |
| 28 | in memory, we can easily track these changes without having to |
| 29 | update every object (compile unit ranges, line tables, function |
| 30 | address ranges, lexical block and inlined subroutine address |
| 31 | ranges, global and static variables) each time an image is loaded or |
| 32 | unloaded. |
| 33 | |
| 34 | Load addresses represents the virtual addresses where each section |
| 35 | ends up getting loaded at runtime. Before executing a program, it |
| 36 | is common for all of the load addresses to be unresolved. When a |
| 37 | DynamicLoader plug-in receives notification that shared libraries |
| 38 | have been loaded/unloaded, the load addresses of the main executable |
| 39 | and any images (shared libraries) will be resolved/unresolved. When |
| 40 | this happens, breakpoints that are in one of these sections can be |
| 41 | set/cleared. |
| 42 | |
| 43 | See docstring of SBFunction for example usage of SBAddress." |
| 44 | ) SBAddress; |
| 45 | class SBAddress |
| 46 | { |
| 47 | public: |
| 48 | |
| 49 | SBAddress (); |
| 50 | |
| 51 | SBAddress (const lldb::SBAddress &rhs); |
| 52 | |
Johnny Chen | c4f3ade | 2011-07-26 23:42:01 +0000 | [diff] [blame] | 53 | %feature("docstring", " |
| 54 | Create an address by resolving a load address using the supplied target. |
| 55 | ") SBAddress; |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 56 | SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target); |
| 57 | |
Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 58 | ~SBAddress (); |
| 59 | |
| 60 | bool |
| 61 | IsValid () const; |
| 62 | |
| 63 | void |
| 64 | Clear (); |
| 65 | |
| 66 | addr_t |
| 67 | GetFileAddress () const; |
| 68 | |
| 69 | addr_t |
| 70 | GetLoadAddress (const lldb::SBTarget &target) const; |
| 71 | |
Johnny Chen | c4f3ade | 2011-07-26 23:42:01 +0000 | [diff] [blame] | 72 | void |
| 73 | SetLoadAddress (lldb::addr_t load_addr, |
| 74 | lldb::SBTarget &target); |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 75 | |
Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 76 | bool |
| 77 | OffsetAddress (addr_t offset); |
| 78 | |
| 79 | bool |
| 80 | GetDescription (lldb::SBStream &description); |
| 81 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame^] | 82 | lldb::SBSection |
| 83 | GetSection (); |
Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 84 | |
Johnny Chen | e4fd440 | 2011-08-12 22:52:11 +0000 | [diff] [blame] | 85 | %feature("docstring", " |
| 86 | //------------------------------------------------------------------ |
| 87 | /// GetSymbolContext() and the following can lookup symbol information for a given address. |
| 88 | /// An address might refer to code or data from an existing module, or it |
| 89 | /// might refer to something on the stack or heap. The following functions |
| 90 | /// will only return valid values if the address has been resolved to a code |
| 91 | /// or data address using 'void SBAddress::SetLoadAddress(...)' or |
| 92 | /// 'lldb::SBAddress SBTarget::ResolveLoadAddress (...)'. |
| 93 | //------------------------------------------------------------------ |
| 94 | ") GetSymbolContext; |
| 95 | lldb::SBSymbolContext |
| 96 | GetSymbolContext (uint32_t resolve_scope); |
| 97 | |
| 98 | %feature("docstring", " |
| 99 | //------------------------------------------------------------------ |
| 100 | /// GetModule() and the following grab individual objects for a given address and |
| 101 | /// are less efficient if you want more than one symbol related objects. |
| 102 | /// Use one of the following when you want multiple debug symbol related |
| 103 | /// objects for an address: |
| 104 | /// lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope); |
| 105 | /// lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope); |
| 106 | /// One or more bits from the SymbolContextItem enumerations can be logically |
| 107 | /// OR'ed together to more efficiently retrieve multiple symbol objects. |
| 108 | //------------------------------------------------------------------ |
| 109 | ") GetModule; |
Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 110 | lldb::SBModule |
| 111 | GetModule (); |
Johnny Chen | e4fd440 | 2011-08-12 22:52:11 +0000 | [diff] [blame] | 112 | |
| 113 | lldb::SBCompileUnit |
| 114 | GetCompileUnit (); |
| 115 | |
| 116 | lldb::SBFunction |
| 117 | GetFunction (); |
| 118 | |
| 119 | lldb::SBBlock |
| 120 | GetBlock (); |
| 121 | |
| 122 | lldb::SBSymbol |
| 123 | GetSymbol (); |
| 124 | |
| 125 | lldb::SBLineEntry |
| 126 | GetLineEntry (); |
Johnny Chen | 3cfd5e8 | 2011-07-18 21:30:21 +0000 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | } // namespace lldb |