Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SBAddress.cpp -------------------------------------------*- 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 | #include "lldb/API/SBAddress.h" |
| 11 | #include "lldb/API/SBProcess.h" |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 12 | #include "lldb/API/SBSection.h" |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 13 | #include "lldb/API/SBStream.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 14 | #include "lldb/Core/Address.h" |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 15 | #include "lldb/Core/Log.h" |
Greg Clayton | b0e68d9 | 2011-03-31 01:08:07 +0000 | [diff] [blame] | 16 | #include "lldb/Core/Module.h" |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 17 | #include "lldb/Host/Mutex.h" |
| 18 | #include "lldb/Target/Target.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 19 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 20 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 21 | using namespace lldb; |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 22 | using namespace lldb_private; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 23 | |
| 24 | |
| 25 | SBAddress::SBAddress () : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 26 | m_opaque_ap () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 27 | { |
| 28 | } |
| 29 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 30 | SBAddress::SBAddress (const Address *lldb_object_ptr) : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 31 | m_opaque_ap () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 32 | { |
| 33 | if (lldb_object_ptr) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 34 | ref() = *lldb_object_ptr; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | SBAddress::SBAddress (const SBAddress &rhs) : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 38 | m_opaque_ap () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 39 | { |
| 40 | if (rhs.IsValid()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 41 | ref() = rhs.ref(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 44 | |
| 45 | SBAddress::SBAddress (lldb::SBSection section, lldb::addr_t offset) : |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 46 | m_opaque_ap(new Address (section.GetSP(), offset)) |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 47 | { |
| 48 | } |
| 49 | |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 50 | // Create an address by resolving a load address using the supplied target |
| 51 | SBAddress::SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target) : |
| 52 | m_opaque_ap() |
| 53 | { |
| 54 | SetLoadAddress (load_addr, target); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 59 | SBAddress::~SBAddress () |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | const SBAddress & |
| 64 | SBAddress::operator = (const SBAddress &rhs) |
| 65 | { |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 66 | if (this != &rhs) |
| 67 | { |
| 68 | if (rhs.IsValid()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 69 | ref() = rhs.ref(); |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 70 | else |
| 71 | m_opaque_ap.reset(); |
| 72 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 73 | return *this; |
| 74 | } |
| 75 | |
| 76 | bool |
| 77 | SBAddress::IsValid () const |
| 78 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 79 | return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | void |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 83 | SBAddress::Clear () |
| 84 | { |
| 85 | m_opaque_ap.reset(); |
| 86 | } |
| 87 | |
| 88 | void |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 89 | SBAddress::SetAddress (lldb::SBSection section, lldb::addr_t offset) |
| 90 | { |
| 91 | Address &addr = ref(); |
Greg Clayton | 3508c38 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 92 | addr.SetSection (section.GetSP()); |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 93 | addr.SetOffset (offset); |
| 94 | } |
| 95 | |
| 96 | |
| 97 | void |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 98 | SBAddress::SetAddress (const Address *lldb_object_ptr) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 99 | { |
| 100 | if (lldb_object_ptr) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 101 | ref() = *lldb_object_ptr; |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 102 | else |
| 103 | m_opaque_ap.reset(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | lldb::addr_t |
| 107 | SBAddress::GetFileAddress () const |
| 108 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 109 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 110 | return m_opaque_ap->GetFileAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 111 | else |
| 112 | return LLDB_INVALID_ADDRESS; |
| 113 | } |
| 114 | |
| 115 | lldb::addr_t |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 116 | SBAddress::GetLoadAddress (const SBTarget &target) const |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 117 | { |
Greg Clayton | 952e9dc | 2013-03-27 23:08:40 +0000 | [diff] [blame] | 118 | Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 119 | |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 120 | lldb::addr_t addr = LLDB_INVALID_ADDRESS; |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 121 | TargetSP target_sp (target.GetSP()); |
Greg Clayton | 6837dfd | 2012-10-22 20:49:35 +0000 | [diff] [blame] | 122 | if (target_sp) |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 123 | { |
Greg Clayton | 6837dfd | 2012-10-22 20:49:35 +0000 | [diff] [blame] | 124 | if (m_opaque_ap.get()) |
| 125 | { |
| 126 | Mutex::Locker api_locker (target_sp->GetAPIMutex()); |
| 127 | addr = m_opaque_ap->GetLoadAddress (target_sp.get()); |
| 128 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 129 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 130 | |
| 131 | if (log) |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 132 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 133 | if (addr == LLDB_INVALID_ADDRESS) |
Greg Clayton | 334d33a | 2012-01-30 07:41:31 +0000 | [diff] [blame] | 134 | log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target_sp.get()); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 135 | else |
Daniel Malea | 5f35a4b | 2012-11-29 21:49:15 +0000 | [diff] [blame] | 136 | log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, target_sp.get(), addr); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 137 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 138 | |
| 139 | return addr; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 142 | void |
| 143 | SBAddress::SetLoadAddress (lldb::addr_t load_addr, lldb::SBTarget &target) |
| 144 | { |
| 145 | // Create the address object if we don't already have one |
| 146 | ref(); |
| 147 | if (target.IsValid()) |
| 148 | *this = target.ResolveLoadAddress(load_addr); |
| 149 | else |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 150 | m_opaque_ap->Clear(); |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 151 | |
| 152 | // Check if we weren't were able to resolve a section offset address. |
| 153 | // If we weren't it is ok, the load address might be a location on the |
| 154 | // stack or heap, so we should just have an address with no section and |
| 155 | // a valid offset |
| 156 | if (!m_opaque_ap->IsValid()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 157 | m_opaque_ap->SetOffset(load_addr); |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 160 | bool |
| 161 | SBAddress::OffsetAddress (addr_t offset) |
| 162 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 163 | if (m_opaque_ap.get()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 164 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 165 | addr_t addr_offset = m_opaque_ap->GetOffset(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 166 | if (addr_offset != LLDB_INVALID_ADDRESS) |
| 167 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 168 | m_opaque_ap->SetOffset(addr_offset + offset); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 169 | return true; |
| 170 | } |
| 171 | } |
| 172 | return false; |
| 173 | } |
| 174 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 175 | lldb::SBSection |
| 176 | SBAddress::GetSection () |
| 177 | { |
| 178 | lldb::SBSection sb_section; |
| 179 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 180 | sb_section.SetSP (m_opaque_ap->GetSection()); |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 181 | return sb_section; |
| 182 | } |
| 183 | |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 184 | lldb::addr_t |
| 185 | SBAddress::GetOffset () |
| 186 | { |
| 187 | if (m_opaque_ap.get()) |
Greg Clayton | aaf0088 | 2012-10-30 16:32:38 +0000 | [diff] [blame] | 188 | return m_opaque_ap->GetOffset(); |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 189 | return 0; |
| 190 | } |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 191 | |
| 192 | Address * |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 193 | SBAddress::operator->() |
| 194 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 195 | return m_opaque_ap.get(); |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 196 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 197 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 198 | const Address * |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 199 | SBAddress::operator->() const |
| 200 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 201 | return m_opaque_ap.get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 202 | } |
| 203 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 204 | Address & |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 205 | SBAddress::ref () |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 206 | { |
| 207 | if (m_opaque_ap.get() == NULL) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 208 | m_opaque_ap.reset (new Address()); |
| 209 | return *m_opaque_ap; |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 210 | } |
| 211 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 212 | const Address & |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 213 | SBAddress::ref () const |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 214 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 215 | // This object should already have checked with "IsValid()" |
Greg Clayton | a395506 | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 216 | // prior to calling this function. In case you didn't we will assert |
| 217 | // and die to let you know. |
Greg Clayton | 466f6c4 | 2010-09-10 18:31:35 +0000 | [diff] [blame] | 218 | assert (m_opaque_ap.get()); |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 219 | return *m_opaque_ap; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Greg Clayton | 3e8c25f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 222 | Address * |
Caroline Tice | 61ba7ec | 2010-10-26 23:49:36 +0000 | [diff] [blame] | 223 | SBAddress::get () |
| 224 | { |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 225 | return m_opaque_ap.get(); |
Caroline Tice | 61ba7ec | 2010-10-26 23:49:36 +0000 | [diff] [blame] | 226 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 227 | |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 228 | bool |
| 229 | SBAddress::GetDescription (SBStream &description) |
| 230 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 231 | // Call "ref()" on the stream to make sure it creates a backing stream in |
| 232 | // case there isn't one already... |
Greg Clayton | 96154be | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 233 | Stream &strm = description.ref(); |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 234 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 235 | { |
| 236 | m_opaque_ap->Dump (&strm, |
| 237 | NULL, |
| 238 | Address::DumpStyleResolvedDescription, |
| 239 | Address::DumpStyleModuleWithFileAddress, |
| 240 | 4); |
| 241 | StreamString sstrm; |
| 242 | // m_opaque_ap->Dump (&sstrm, NULL, Address::DumpStyleResolvedDescription, Address::DumpStyleInvalid, 4); |
| 243 | // if (sstrm.GetData()) |
| 244 | // strm.Printf (" (%s)", sstrm.GetData()); |
| 245 | } |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 246 | else |
Greg Clayton | 96154be | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 247 | strm.PutCString ("No value"); |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 248 | |
| 249 | return true; |
| 250 | } |
Greg Clayton | b0e68d9 | 2011-03-31 01:08:07 +0000 | [diff] [blame] | 251 | |
Greg Clayton | b0e68d9 | 2011-03-31 01:08:07 +0000 | [diff] [blame] | 252 | SBModule |
| 253 | SBAddress::GetModule () |
| 254 | { |
| 255 | SBModule sb_module; |
| 256 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 257 | sb_module.SetSP (m_opaque_ap->GetModule()); |
Greg Clayton | b0e68d9 | 2011-03-31 01:08:07 +0000 | [diff] [blame] | 258 | return sb_module; |
| 259 | } |
| 260 | |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 261 | SBSymbolContext |
| 262 | SBAddress::GetSymbolContext (uint32_t resolve_scope) |
| 263 | { |
| 264 | SBSymbolContext sb_sc; |
| 265 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 266 | m_opaque_ap->CalculateSymbolContext (&sb_sc.ref(), resolve_scope); |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 267 | return sb_sc; |
| 268 | } |
| 269 | |
| 270 | SBCompileUnit |
| 271 | SBAddress::GetCompileUnit () |
| 272 | { |
| 273 | SBCompileUnit sb_comp_unit; |
| 274 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 275 | sb_comp_unit.reset(m_opaque_ap->CalculateSymbolContextCompileUnit()); |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 276 | return sb_comp_unit; |
| 277 | } |
| 278 | |
| 279 | SBFunction |
| 280 | SBAddress::GetFunction () |
| 281 | { |
| 282 | SBFunction sb_function; |
| 283 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 284 | sb_function.reset(m_opaque_ap->CalculateSymbolContextFunction()); |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 285 | return sb_function; |
| 286 | } |
| 287 | |
| 288 | SBBlock |
| 289 | SBAddress::GetBlock () |
| 290 | { |
| 291 | SBBlock sb_block; |
| 292 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 293 | sb_block.SetPtr(m_opaque_ap->CalculateSymbolContextBlock()); |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 294 | return sb_block; |
| 295 | } |
| 296 | |
| 297 | SBSymbol |
| 298 | SBAddress::GetSymbol () |
| 299 | { |
| 300 | SBSymbol sb_symbol; |
| 301 | if (m_opaque_ap.get()) |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 302 | sb_symbol.reset(m_opaque_ap->CalculateSymbolContextSymbol()); |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 303 | return sb_symbol; |
| 304 | } |
| 305 | |
| 306 | SBLineEntry |
| 307 | SBAddress::GetLineEntry () |
| 308 | { |
| 309 | SBLineEntry sb_line_entry; |
| 310 | if (m_opaque_ap.get()) |
| 311 | { |
| 312 | LineEntry line_entry; |
Greg Clayton | 69c540d | 2012-04-04 20:36:48 +0000 | [diff] [blame] | 313 | if (m_opaque_ap->CalculateSymbolContextLineEntry (line_entry)) |
Greg Clayton | c51ffbf | 2011-08-12 21:40:01 +0000 | [diff] [blame] | 314 | sb_line_entry.SetLineEntry (line_entry); |
| 315 | } |
| 316 | return sb_line_entry; |
| 317 | } |
| 318 | |
Greg Clayton | 7fb1430 | 2012-04-13 00:07:34 +0000 | [diff] [blame] | 319 | AddressClass |
| 320 | SBAddress::GetAddressClass () |
| 321 | { |
| 322 | if (m_opaque_ap.get()) |
| 323 | return m_opaque_ap->GetAddressClass(); |
| 324 | return eAddressClassInvalid; |
| 325 | } |
Greg Clayton | b0e68d9 | 2011-03-31 01:08:07 +0000 | [diff] [blame] | 326 | |