Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SBValue.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 | |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 10 | #include "lldb/API/SBValue.h" |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 11 | #include "lldb/API/SBStream.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 12 | |
| 13 | #include "lldb/Core/DataExtractor.h" |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 14 | #include "lldb/Core/Log.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 15 | #include "lldb/Core/Module.h" |
Greg Clayton | 0fb0bcc | 2011-08-03 22:57:10 +0000 | [diff] [blame] | 16 | #include "lldb/Core/Scalar.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 17 | #include "lldb/Core/Stream.h" |
| 18 | #include "lldb/Core/StreamFile.h" |
| 19 | #include "lldb/Core/Value.h" |
| 20 | #include "lldb/Core/ValueObject.h" |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 21 | #include "lldb/Core/ValueObjectConstResult.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 22 | #include "lldb/Symbol/Block.h" |
| 23 | #include "lldb/Symbol/ObjectFile.h" |
| 24 | #include "lldb/Symbol/Variable.h" |
| 25 | #include "lldb/Target/ExecutionContext.h" |
| 26 | #include "lldb/Target/Process.h" |
| 27 | #include "lldb/Target/StackFrame.h" |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 28 | #include "lldb/Target/Target.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 29 | #include "lldb/Target/Thread.h" |
| 30 | |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame] | 31 | #include "lldb/API/SBProcess.h" |
| 32 | #include "lldb/API/SBTarget.h" |
| 33 | #include "lldb/API/SBThread.h" |
| 34 | #include "lldb/API/SBFrame.h" |
| 35 | #include "lldb/API/SBDebugger.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 36 | |
| 37 | using namespace lldb; |
| 38 | using namespace lldb_private; |
| 39 | |
| 40 | SBValue::SBValue () : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 41 | m_opaque_sp () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 42 | { |
| 43 | } |
| 44 | |
| 45 | SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 46 | m_opaque_sp (value_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 47 | { |
| 48 | } |
| 49 | |
Greg Clayton | 538eb82 | 2010-11-05 23:17:00 +0000 | [diff] [blame] | 50 | SBValue::SBValue(const SBValue &rhs) : |
| 51 | m_opaque_sp (rhs.m_opaque_sp) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | const SBValue & |
| 56 | SBValue::operator = (const SBValue &rhs) |
| 57 | { |
| 58 | if (this != &rhs) |
| 59 | m_opaque_sp = rhs.m_opaque_sp; |
| 60 | return *this; |
| 61 | } |
| 62 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 63 | SBValue::~SBValue() |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | bool |
| 68 | SBValue::IsValid () const |
| 69 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 70 | // If this function ever changes to anything that does more than just |
| 71 | // check if the opaque shared pointer is non NULL, then we need to update |
| 72 | // all "if (m_opaque_sp)" code in this file. |
| 73 | return m_opaque_sp.get() != NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Greg Clayton | c5f728c | 2010-10-06 22:10:17 +0000 | [diff] [blame] | 76 | SBError |
| 77 | SBValue::GetError() |
| 78 | { |
| 79 | SBError sb_error; |
| 80 | |
| 81 | if (m_opaque_sp.get()) |
| 82 | sb_error.SetError(m_opaque_sp->GetError()); |
| 83 | |
| 84 | return sb_error; |
| 85 | } |
| 86 | |
Johnny Chen | 968958c | 2011-07-07 20:46:23 +0000 | [diff] [blame] | 87 | user_id_t |
| 88 | SBValue::GetID() |
| 89 | { |
| 90 | if (m_opaque_sp) |
| 91 | return m_opaque_sp->GetID(); |
| 92 | return LLDB_INVALID_UID; |
| 93 | } |
| 94 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 95 | const char * |
| 96 | SBValue::GetName() |
| 97 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 98 | |
| 99 | const char *name = NULL; |
| 100 | if (m_opaque_sp) |
| 101 | name = m_opaque_sp->GetName().GetCString(); |
| 102 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 103 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 3f5ee7f | 2010-10-29 04:59:35 +0000 | [diff] [blame] | 104 | if (log) |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 105 | { |
| 106 | if (name) |
| 107 | log->Printf ("SBValue(%p)::GetName () => \"%s\"", m_opaque_sp.get(), name); |
| 108 | else |
| 109 | log->Printf ("SBValue(%p)::GetName () => NULL", m_opaque_sp.get(), name); |
| 110 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 111 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 112 | return name; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | const char * |
| 116 | SBValue::GetTypeName () |
| 117 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 118 | const char *name = NULL; |
| 119 | if (m_opaque_sp) |
| 120 | name = m_opaque_sp->GetTypeName().GetCString(); |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 121 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 122 | if (log) |
| 123 | { |
| 124 | if (name) |
| 125 | log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", m_opaque_sp.get(), name); |
| 126 | else |
| 127 | log->Printf ("SBValue(%p)::GetTypeName () => NULL", m_opaque_sp.get()); |
| 128 | } |
| 129 | |
| 130 | return name; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | size_t |
| 134 | SBValue::GetByteSize () |
| 135 | { |
| 136 | size_t result = 0; |
| 137 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 138 | if (m_opaque_sp) |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 139 | result = m_opaque_sp->GetByteSize(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 140 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 141 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 142 | if (log) |
| 143 | log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result); |
| 144 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 145 | return result; |
| 146 | } |
| 147 | |
| 148 | bool |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 149 | SBValue::IsInScope (const SBFrame &sb_frame) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 150 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 151 | return IsInScope(); |
| 152 | } |
| 153 | |
| 154 | bool |
| 155 | SBValue::IsInScope () |
| 156 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 157 | bool result = false; |
| 158 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 159 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 160 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 161 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 162 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 163 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 164 | result = m_opaque_sp->IsInScope (); |
| 165 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 166 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 167 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 168 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 169 | if (log) |
| 170 | log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result); |
| 171 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 172 | return result; |
| 173 | } |
| 174 | |
| 175 | const char * |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 176 | SBValue::GetValue (const SBFrame &sb_frame) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 177 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 178 | return GetValue(); |
| 179 | } |
| 180 | |
| 181 | const char * |
| 182 | SBValue::GetValue () |
| 183 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 184 | const char *cstr = NULL; |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 185 | if (m_opaque_sp) |
| 186 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 187 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 188 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 189 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 190 | cstr = m_opaque_sp->GetValueAsCString (); |
| 191 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 192 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 193 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 194 | if (log) |
| 195 | { |
| 196 | if (cstr) |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 197 | log->Printf ("SBValue(%p)::GetValue => \"%s\"", m_opaque_sp.get(), cstr); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 198 | else |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 199 | log->Printf ("SBValue(%p)::GetValue => NULL", m_opaque_sp.get()); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | return cstr; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 203 | } |
| 204 | |
Greg Clayton | f3d0b0c | 2010-10-27 03:32:59 +0000 | [diff] [blame] | 205 | ValueType |
| 206 | SBValue::GetValueType () |
| 207 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 208 | ValueType result = eValueTypeInvalid; |
Greg Clayton | f3d0b0c | 2010-10-27 03:32:59 +0000 | [diff] [blame] | 209 | if (m_opaque_sp) |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 210 | result = m_opaque_sp->GetValueType(); |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 211 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 212 | if (log) |
| 213 | { |
| 214 | switch (result) |
| 215 | { |
| 216 | case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", m_opaque_sp.get()); break; |
| 217 | case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", m_opaque_sp.get()); break; |
| 218 | case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", m_opaque_sp.get()); break; |
| 219 | case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", m_opaque_sp.get()); break; |
| 220 | case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", m_opaque_sp.get()); break; |
| 221 | case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", m_opaque_sp.get()); break; |
| 222 | case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", m_opaque_sp.get()); break; |
| 223 | case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", m_opaque_sp.get()); break; |
| 224 | default: log->Printf ("SBValue(%p)::GetValueType () => %i ???", m_opaque_sp.get(), result); break; |
| 225 | } |
| 226 | } |
| 227 | return result; |
Greg Clayton | f3d0b0c | 2010-10-27 03:32:59 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Jim Ingham | 4ae5196 | 2010-09-10 23:12:17 +0000 | [diff] [blame] | 230 | const char * |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 231 | SBValue::GetObjectDescription (const SBFrame &sb_frame) |
Jim Ingham | 4ae5196 | 2010-09-10 23:12:17 +0000 | [diff] [blame] | 232 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 233 | return GetObjectDescription (); |
| 234 | } |
| 235 | |
| 236 | const char * |
| 237 | SBValue::GetObjectDescription () |
| 238 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 239 | const char *cstr = NULL; |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 240 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 241 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 242 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 243 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 244 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 245 | cstr = m_opaque_sp->GetObjectDescription (); |
| 246 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 247 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 248 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 249 | if (log) |
| 250 | { |
| 251 | if (cstr) |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 252 | log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", m_opaque_sp.get(), cstr); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 253 | else |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 254 | log->Printf ("SBValue(%p)::GetObjectDescription => NULL", m_opaque_sp.get()); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 255 | } |
| 256 | return cstr; |
Jim Ingham | 4ae5196 | 2010-09-10 23:12:17 +0000 | [diff] [blame] | 257 | } |
| 258 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 259 | bool |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 260 | SBValue::GetValueDidChange (const SBFrame &sb_frame) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 261 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 262 | return GetValueDidChange (); |
| 263 | } |
| 264 | |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 265 | SBType |
| 266 | SBValue::GetType() |
| 267 | { |
| 268 | SBType result; |
| 269 | if (m_opaque_sp) |
| 270 | { |
| 271 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 272 | { |
| 273 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | 0fb0bcc | 2011-08-03 22:57:10 +0000 | [diff] [blame] | 274 | result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType())); |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 278 | if (log) |
| 279 | { |
| 280 | if (result.IsValid()) |
| 281 | log->Printf ("SBValue(%p)::GetType => %p", m_opaque_sp.get(), &result); |
| 282 | else |
| 283 | log->Printf ("SBValue(%p)::GetType => NULL", m_opaque_sp.get()); |
| 284 | } |
| 285 | return result; |
| 286 | } |
| 287 | |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 288 | bool |
| 289 | SBValue::GetValueDidChange () |
| 290 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 291 | bool result = false; |
| 292 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 293 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 294 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 295 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 296 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 297 | result = m_opaque_sp->GetValueDidChange (); |
| 298 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 299 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 300 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 301 | if (log) |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 302 | log->Printf ("SBValue(%p)::GetValueDidChange => %i", m_opaque_sp.get(), result); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 303 | |
| 304 | return result; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | const char * |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 308 | SBValue::GetSummary (const SBFrame &sb_frame) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 309 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 310 | return GetSummary (); |
| 311 | } |
| 312 | |
| 313 | const char * |
| 314 | SBValue::GetSummary () |
| 315 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 316 | const char *cstr = NULL; |
| 317 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 318 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 319 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 320 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 321 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 322 | cstr = m_opaque_sp->GetSummaryAsCString(); |
| 323 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 324 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 325 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 326 | if (log) |
| 327 | { |
| 328 | if (cstr) |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 329 | log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 330 | else |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 331 | log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get()); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 332 | } |
| 333 | return cstr; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | const char * |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 337 | SBValue::GetLocation (const SBFrame &sb_frame) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 338 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 339 | return GetLocation (); |
| 340 | } |
| 341 | |
| 342 | const char * |
| 343 | SBValue::GetLocation () |
| 344 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 345 | const char *cstr = NULL; |
| 346 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 347 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 348 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 349 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 350 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 351 | cstr = m_opaque_sp->GetLocationAsCString(); |
| 352 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 353 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 354 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 355 | if (log) |
| 356 | { |
| 357 | if (cstr) |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 358 | log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 359 | else |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 360 | log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get()); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 361 | } |
| 362 | return cstr; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | bool |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 366 | SBValue::SetValueFromCString (const SBFrame &sb_frame, const char *value_str) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 367 | { |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 368 | return SetValueFromCString (value_str); |
| 369 | } |
| 370 | |
| 371 | bool |
| 372 | SBValue::SetValueFromCString (const char *value_str) |
| 373 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 374 | bool success = false; |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 375 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 376 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 377 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 378 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 379 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 380 | success = m_opaque_sp->SetValueFromCString (value_str); |
| 381 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame] | 382 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 383 | return success; |
| 384 | } |
| 385 | |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 386 | lldb::SBValue |
| 387 | SBValue::CreateChildAtOffset (const char *name, uint32_t offset, const SBType& type) |
| 388 | { |
| 389 | lldb::SBValue result; |
| 390 | if (m_opaque_sp) |
| 391 | { |
| 392 | if (type.IsValid()) |
| 393 | { |
Greg Clayton | 0fb0bcc | 2011-08-03 22:57:10 +0000 | [diff] [blame] | 394 | result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true)); |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 395 | result.m_opaque_sp->SetName(ConstString(name)); |
| 396 | } |
| 397 | } |
| 398 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 399 | if (log) |
| 400 | { |
| 401 | if (result.IsValid()) |
| 402 | log->Printf ("SBValue(%p)::GetChildAtOffset => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp.get()); |
| 403 | else |
| 404 | log->Printf ("SBValue(%p)::GetChildAtOffset => NULL", m_opaque_sp.get()); |
| 405 | } |
| 406 | return result; |
| 407 | } |
| 408 | |
| 409 | lldb::SBValue |
| 410 | SBValue::Cast(const SBType& type) |
| 411 | { |
| 412 | return CreateChildAtOffset(m_opaque_sp->GetName().GetCString(), 0, type); |
| 413 | } |
| 414 | |
| 415 | lldb::SBValue |
| 416 | SBValue::CreateValueFromExpression (const char *name, const char* expression) |
| 417 | { |
| 418 | lldb::SBValue result; |
| 419 | if (m_opaque_sp) |
| 420 | { |
| 421 | ValueObjectSP result_valobj_sp; |
| 422 | m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression(expression, |
| 423 | m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame(), |
| 424 | true, true, eNoDynamicValues, |
| 425 | result_valobj_sp); |
| 426 | result_valobj_sp->SetName(ConstString(name)); |
| 427 | result = SBValue(result_valobj_sp); |
| 428 | } |
| 429 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 430 | if (log) |
| 431 | { |
| 432 | if (result.IsValid()) |
| 433 | log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp.get()); |
| 434 | else |
| 435 | log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get()); |
| 436 | } |
| 437 | return result; |
| 438 | } |
| 439 | |
| 440 | lldb::SBValue |
| 441 | SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, const SBType& type) |
| 442 | { |
| 443 | lldb::SBValue result; |
| 444 | if (m_opaque_sp) |
| 445 | { |
| 446 | |
| 447 | SBType real_type(type.GetPointerType()); |
| 448 | |
| 449 | lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); |
| 450 | |
Enrico Granata | c931030 | 2011-08-04 17:07:02 +0000 | [diff] [blame] | 451 | ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(), |
| 452 | real_type.m_opaque_sp->GetASTContext(), |
| 453 | real_type.m_opaque_sp->GetOpaqueQualType(), |
| 454 | ConstString(name), |
| 455 | buffer, |
| 456 | lldb::endian::InlHostByteOrder(), |
| 457 | GetTarget().GetProcess().GetAddressByteSize())); |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 458 | |
Enrico Granata | c931030 | 2011-08-04 17:07:02 +0000 | [diff] [blame] | 459 | ValueObjectSP result_valobj_sp; |
| 460 | |
| 461 | ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); |
| 462 | if (ptr_result_valobj_sp) |
| 463 | { |
| 464 | Error err; |
| 465 | result_valobj_sp = ptr_result_valobj_sp->Dereference(err); |
| 466 | if (result_valobj_sp) |
| 467 | result_valobj_sp->SetName(ConstString(name)); |
| 468 | } |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 469 | result = SBValue(result_valobj_sp); |
| 470 | } |
| 471 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 472 | if (log) |
| 473 | { |
| 474 | if (result.IsValid()) |
| 475 | log->Printf ("SBValue(%p)::GetChildFromAddress => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp.get()); |
Johnny Chen | a713b86 | 2011-08-09 22:38:07 +0000 | [diff] [blame] | 476 | else |
| 477 | log->Printf ("SBValue(%p)::GetChildFromAddress => NULL", m_opaque_sp.get()); |
| 478 | } |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 479 | return result; |
| 480 | } |
| 481 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 482 | SBValue |
| 483 | SBValue::GetChildAtIndex (uint32_t idx) |
| 484 | { |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 485 | const bool can_create_synthetic = false; |
| 486 | lldb::DynamicValueType use_dynamic = eNoDynamicValues; |
Johnny Chen | 446ccaa | 2011-06-29 21:19:39 +0000 | [diff] [blame] | 487 | if (m_opaque_sp) |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 488 | use_dynamic = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue(); |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 489 | return GetChildAtIndex (idx, use_dynamic, can_create_synthetic); |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | SBValue |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 493 | SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool can_create_synthetic) |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 494 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 495 | lldb::ValueObjectSP child_sp; |
| 496 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 497 | if (m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 498 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 499 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 500 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 501 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 502 | const bool can_create = true; |
| 503 | child_sp = m_opaque_sp->GetChildAtIndex (idx, can_create); |
| 504 | if (can_create_synthetic && !child_sp) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 505 | { |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 506 | if (m_opaque_sp->IsPointerType()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 507 | { |
Greg Clayton | 8f64c47 | 2011-07-15 19:31:49 +0000 | [diff] [blame] | 508 | child_sp = m_opaque_sp->GetSyntheticArrayMemberFromPointer(idx, can_create); |
| 509 | } |
| 510 | else if (m_opaque_sp->IsArrayType()) |
| 511 | { |
| 512 | child_sp = m_opaque_sp->GetSyntheticArrayMemberFromArray(idx, can_create); |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | if (child_sp) |
| 517 | { |
| 518 | if (use_dynamic != lldb::eNoDynamicValues) |
| 519 | { |
| 520 | lldb::ValueObjectSP dynamic_sp(child_sp->GetDynamicValue (use_dynamic)); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 521 | if (dynamic_sp) |
| 522 | child_sp = dynamic_sp; |
| 523 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 524 | } |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 525 | } |
| 526 | } |
| 527 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 528 | SBValue sb_value (child_sp); |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 529 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 530 | if (log) |
| 531 | log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get()); |
| 532 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 533 | return sb_value; |
| 534 | } |
| 535 | |
| 536 | uint32_t |
| 537 | SBValue::GetIndexOfChildWithName (const char *name) |
| 538 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 539 | uint32_t idx = UINT32_MAX; |
| 540 | if (m_opaque_sp) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 541 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 542 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 543 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 544 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 545 | |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 546 | idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name)); |
| 547 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 548 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 549 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 550 | if (log) |
| 551 | { |
| 552 | if (idx == UINT32_MAX) |
| 553 | log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", m_opaque_sp.get(), name, idx); |
| 554 | else |
| 555 | log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", m_opaque_sp.get(), name, idx); |
| 556 | } |
| 557 | return idx; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | SBValue |
| 561 | SBValue::GetChildMemberWithName (const char *name) |
| 562 | { |
Johnny Chen | 446ccaa | 2011-06-29 21:19:39 +0000 | [diff] [blame] | 563 | if (m_opaque_sp) |
| 564 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 565 | lldb::DynamicValueType use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue(); |
Johnny Chen | 446ccaa | 2011-06-29 21:19:39 +0000 | [diff] [blame] | 566 | return GetChildMemberWithName (name, use_dynamic_value); |
| 567 | } |
| 568 | else |
| 569 | return GetChildMemberWithName (name, eNoDynamicValues); |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | SBValue |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 573 | SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic_value) |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 574 | { |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 575 | lldb::ValueObjectSP child_sp; |
| 576 | const ConstString str_name (name); |
| 577 | |
Greg Clayton | 905acaf | 2011-05-20 22:07:17 +0000 | [diff] [blame] | 578 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 579 | if (m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 580 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 581 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 582 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 583 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 584 | child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true); |
| 585 | if (use_dynamic_value != lldb::eNoDynamicValues) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 586 | { |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 587 | if (child_sp) |
| 588 | { |
| 589 | lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value); |
| 590 | if (dynamic_sp) |
| 591 | child_sp = dynamic_sp; |
| 592 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 593 | } |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 594 | } |
| 595 | } |
| 596 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 597 | SBValue sb_value (child_sp); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 598 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 599 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 600 | if (log) |
| 601 | log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get()); |
| 602 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 603 | return sb_value; |
| 604 | } |
| 605 | |
Enrico Granata | f7a9b14 | 2011-07-15 02:26:42 +0000 | [diff] [blame] | 606 | lldb::SBValue |
| 607 | SBValue::GetValueForExpressionPath(const char* expr_path) |
| 608 | { |
| 609 | lldb::ValueObjectSP child_sp; |
| 610 | if (m_opaque_sp) |
| 611 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 612 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Enrico Granata | f7a9b14 | 2011-07-15 02:26:42 +0000 | [diff] [blame] | 613 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 614 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Enrico Granata | f7a9b14 | 2011-07-15 02:26:42 +0000 | [diff] [blame] | 615 | // using default values for all the fancy options, just do it if you can |
| 616 | child_sp = m_opaque_sp->GetValueForExpressionPath(expr_path); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | SBValue sb_value (child_sp); |
| 621 | |
| 622 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 623 | if (log) |
| 624 | log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr_path, sb_value.get()); |
| 625 | |
| 626 | return sb_value; |
| 627 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 628 | |
Greg Clayton | 0fb0bcc | 2011-08-03 22:57:10 +0000 | [diff] [blame] | 629 | int64_t |
Enrico Granata | c92eb40 | 2011-08-04 01:41:02 +0000 | [diff] [blame] | 630 | SBValue::GetValueAsSigned(SBError& error, int64_t fail_value) |
| 631 | { |
Jim Ingham | 574c3d6 | 2011-08-12 23:34:31 +0000 | [diff] [blame] | 632 | error.Clear(); |
Enrico Granata | c92eb40 | 2011-08-04 01:41:02 +0000 | [diff] [blame] | 633 | if (m_opaque_sp) |
| 634 | { |
| 635 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 636 | { |
| 637 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
| 638 | Scalar scalar; |
| 639 | if (m_opaque_sp->ResolveValue (scalar)) |
| 640 | return scalar.GetRawBits64(fail_value); |
| 641 | else |
| 642 | error.SetErrorString("could not get value"); |
| 643 | } |
| 644 | else |
| 645 | error.SetErrorString("could not get target"); |
| 646 | } |
| 647 | error.SetErrorString("invalid SBValue"); |
| 648 | return fail_value; |
| 649 | } |
| 650 | |
| 651 | uint64_t |
| 652 | SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value) |
| 653 | { |
Jim Ingham | 574c3d6 | 2011-08-12 23:34:31 +0000 | [diff] [blame] | 654 | error.Clear(); |
Enrico Granata | c92eb40 | 2011-08-04 01:41:02 +0000 | [diff] [blame] | 655 | if (m_opaque_sp) |
| 656 | { |
| 657 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 658 | { |
| 659 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
| 660 | Scalar scalar; |
| 661 | if (m_opaque_sp->ResolveValue (scalar)) |
| 662 | return scalar.GetRawBits64(fail_value); |
| 663 | else |
| 664 | error.SetErrorString("could not get value"); |
| 665 | } |
| 666 | else |
| 667 | error.SetErrorString("could not get target"); |
| 668 | } |
| 669 | error.SetErrorString("invalid SBValue"); |
| 670 | return fail_value; |
| 671 | } |
| 672 | |
| 673 | int64_t |
Greg Clayton | 0fb0bcc | 2011-08-03 22:57:10 +0000 | [diff] [blame] | 674 | SBValue::GetValueAsSigned(int64_t fail_value) |
| 675 | { |
| 676 | if (m_opaque_sp) |
| 677 | { |
| 678 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 679 | { |
| 680 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
| 681 | Scalar scalar; |
| 682 | if (m_opaque_sp->ResolveValue (scalar)) |
| 683 | return scalar.GetRawBits64(fail_value); |
| 684 | } |
| 685 | } |
| 686 | return fail_value; |
| 687 | } |
| 688 | |
| 689 | uint64_t |
| 690 | SBValue::GetValueAsUnsigned(uint64_t fail_value) |
| 691 | { |
| 692 | if (m_opaque_sp) |
| 693 | { |
| 694 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 695 | { |
| 696 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
| 697 | Scalar scalar; |
| 698 | if (m_opaque_sp->ResolveValue (scalar)) |
| 699 | return scalar.GetRawBits64(fail_value); |
| 700 | } |
| 701 | } |
| 702 | return fail_value; |
| 703 | } |
| 704 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 705 | uint32_t |
| 706 | SBValue::GetNumChildren () |
| 707 | { |
| 708 | uint32_t num_children = 0; |
| 709 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 710 | if (m_opaque_sp) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 711 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 712 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 713 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 714 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 715 | |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 716 | num_children = m_opaque_sp->GetNumChildren(); |
| 717 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 718 | } |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 719 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 720 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 721 | if (log) |
| 722 | log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 723 | |
| 724 | return num_children; |
| 725 | } |
| 726 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 727 | |
| 728 | SBValue |
| 729 | SBValue::Dereference () |
| 730 | { |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 731 | SBValue sb_value; |
| 732 | if (m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 733 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 734 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 735 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 736 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 737 | |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 738 | Error error; |
| 739 | sb_value = m_opaque_sp->Dereference (error); |
| 740 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 741 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 742 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 743 | if (log) |
| 744 | log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get()); |
| 745 | |
| 746 | return sb_value; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | bool |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 750 | SBValue::TypeIsPointerType () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 751 | { |
| 752 | bool is_ptr_type = false; |
| 753 | |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 754 | if (m_opaque_sp) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 755 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 756 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 757 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 758 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 759 | |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 760 | is_ptr_type = m_opaque_sp->IsPointerType(); |
| 761 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 762 | } |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 763 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 764 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 765 | if (log) |
| 766 | log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type); |
| 767 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 768 | |
| 769 | return is_ptr_type; |
| 770 | } |
| 771 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 772 | void * |
| 773 | SBValue::GetOpaqueType() |
| 774 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 775 | if (m_opaque_sp) |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 776 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 777 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 778 | { |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 779 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 780 | |
Greg Clayton | b9dcc51 | 2011-06-29 18:28:50 +0000 | [diff] [blame] | 781 | return m_opaque_sp->GetClangType(); |
| 782 | } |
Greg Clayton | fab305b | 2011-05-20 23:51:26 +0000 | [diff] [blame] | 783 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 784 | return NULL; |
| 785 | } |
| 786 | |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 787 | lldb::SBTarget |
| 788 | SBValue::GetTarget() |
| 789 | { |
| 790 | SBTarget result; |
| 791 | if (m_opaque_sp) |
| 792 | { |
| 793 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 794 | { |
| 795 | result = SBTarget(lldb::TargetSP(m_opaque_sp->GetUpdatePoint().GetTargetSP())); |
| 796 | } |
| 797 | } |
| 798 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 799 | if (log) |
| 800 | { |
| 801 | if (result.get() == NULL) |
| 802 | log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get()); |
| 803 | else |
| 804 | log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), result.get()); |
| 805 | } |
| 806 | return result; |
| 807 | } |
| 808 | |
| 809 | lldb::SBProcess |
| 810 | SBValue::GetProcess() |
| 811 | { |
| 812 | SBProcess result; |
| 813 | if (m_opaque_sp) |
| 814 | { |
| 815 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 816 | { |
| 817 | result = SBProcess(lldb::ProcessSP(m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetProcessSP())); |
| 818 | } |
| 819 | } |
| 820 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 821 | if (log) |
| 822 | { |
| 823 | if (result.get() == NULL) |
| 824 | log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get()); |
| 825 | else |
| 826 | log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), result.get()); |
| 827 | } |
| 828 | return result; |
| 829 | } |
| 830 | |
| 831 | lldb::SBThread |
| 832 | SBValue::GetThread() |
| 833 | { |
| 834 | SBThread result; |
| 835 | if (m_opaque_sp) |
| 836 | { |
| 837 | if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()) |
| 838 | { |
| 839 | result = SBThread(lldb::ThreadSP(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateThread())); |
| 840 | } |
| 841 | } |
| 842 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 843 | if (log) |
| 844 | { |
| 845 | if (result.get() == NULL) |
| 846 | log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get()); |
| 847 | else |
| 848 | log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), result.get()); |
| 849 | } |
| 850 | return result; |
| 851 | } |
| 852 | |
| 853 | lldb::SBFrame |
| 854 | SBValue::GetFrame() |
| 855 | { |
| 856 | SBFrame result; |
| 857 | if (m_opaque_sp) |
| 858 | { |
| 859 | if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()) |
| 860 | { |
| 861 | result = SBFrame(lldb::StackFrameSP(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame())); |
| 862 | } |
| 863 | } |
| 864 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 865 | if (log) |
| 866 | { |
| 867 | if (result.get() == NULL) |
| 868 | log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get()); |
| 869 | else |
| 870 | log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), result.get()); |
| 871 | } |
| 872 | return result; |
| 873 | } |
| 874 | |
| 875 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 876 | // Mimic shared pointer... |
| 877 | lldb_private::ValueObject * |
| 878 | SBValue::get() const |
| 879 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 880 | return m_opaque_sp.get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | lldb_private::ValueObject * |
| 884 | SBValue::operator->() const |
| 885 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 886 | return m_opaque_sp.get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 887 | } |
| 888 | |
| 889 | lldb::ValueObjectSP & |
| 890 | SBValue::operator*() |
| 891 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 892 | return m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 893 | } |
| 894 | |
| 895 | const lldb::ValueObjectSP & |
| 896 | SBValue::operator*() const |
| 897 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 898 | return m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 899 | } |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 900 | |
| 901 | bool |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 902 | SBValue::GetExpressionPath (SBStream &description) |
| 903 | { |
| 904 | if (m_opaque_sp) |
| 905 | { |
Greg Clayton | b01000f | 2011-01-17 03:46:26 +0000 | [diff] [blame] | 906 | m_opaque_sp->GetExpressionPath (description.ref(), false); |
| 907 | return true; |
| 908 | } |
| 909 | return false; |
| 910 | } |
| 911 | |
| 912 | bool |
| 913 | SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes) |
| 914 | { |
| 915 | if (m_opaque_sp) |
| 916 | { |
| 917 | m_opaque_sp->GetExpressionPath (description.ref(), qualify_cxx_base_classes); |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 918 | return true; |
| 919 | } |
| 920 | return false; |
| 921 | } |
| 922 | |
| 923 | bool |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 924 | SBValue::GetDescription (SBStream &description) |
| 925 | { |
| 926 | if (m_opaque_sp) |
| 927 | { |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame^] | 928 | /*uint32_t ptr_depth = 0; |
Greg Clayton | bafc86e | 2011-07-06 16:49:27 +0000 | [diff] [blame] | 929 | uint32_t curr_depth = 0; |
| 930 | uint32_t max_depth = UINT32_MAX; |
| 931 | bool show_types = false; |
| 932 | bool show_location = false; |
| 933 | bool use_objc = false; |
| 934 | lldb::DynamicValueType use_dynamic = eNoDynamicValues; |
| 935 | bool scope_already_checked = false; |
| 936 | bool flat_output = false; |
Enrico Granata | e4e3e2c | 2011-07-22 00:16:08 +0000 | [diff] [blame] | 937 | bool use_synthetic = true; |
| 938 | uint32_t no_summary_depth = 0; |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame^] | 939 | bool ignore_cap = false;*/ |
Greg Clayton | bafc86e | 2011-07-06 16:49:27 +0000 | [diff] [blame] | 940 | ValueObject::DumpValueObject (description.ref(), |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame^] | 941 | m_opaque_sp.get()); |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 942 | } |
| 943 | else |
| 944 | description.Printf ("No value"); |
| 945 | |
| 946 | return true; |
| 947 | } |
Greg Clayton | e179a58 | 2011-01-05 18:43:15 +0000 | [diff] [blame] | 948 | |
| 949 | lldb::Format |
| 950 | SBValue::GetFormat () const |
| 951 | { |
| 952 | if (m_opaque_sp) |
| 953 | return m_opaque_sp->GetFormat(); |
| 954 | return eFormatDefault; |
| 955 | } |
| 956 | |
| 957 | void |
| 958 | SBValue::SetFormat (lldb::Format format) |
| 959 | { |
| 960 | if (m_opaque_sp) |
| 961 | m_opaque_sp->SetFormat(format); |
| 962 | } |
| 963 | |
Enrico Granata | 979e20d | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 964 | lldb::SBValue |
| 965 | SBValue::AddressOf() |
| 966 | { |
| 967 | SBValue sb_value; |
| 968 | if (m_opaque_sp) |
| 969 | { |
| 970 | if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) |
| 971 | { |
| 972 | Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); |
| 973 | |
| 974 | Error error; |
| 975 | sb_value = m_opaque_sp->AddressOf (error); |
| 976 | } |
| 977 | } |
| 978 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
| 979 | if (log) |
| 980 | log->Printf ("SBValue(%p)::GetPointerToObject () => SBValue(%p)", m_opaque_sp.get(), sb_value.get()); |
| 981 | |
| 982 | return sb_value; |
Johnny Chen | a713b86 | 2011-08-09 22:38:07 +0000 | [diff] [blame] | 983 | } |