Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 1 | //===-- ValueObjectDynamicValue.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 | |
| 11 | #include "lldb/Core/ValueObjectDynamicValue.h" |
| 12 | |
| 13 | // C Includes |
| 14 | // C++ Includes |
| 15 | // Other libraries and framework includes |
| 16 | // Project includes |
Enrico Granata | d228483 | 2012-10-17 22:23:56 +0000 | [diff] [blame] | 17 | #include "lldb/Core/Log.h" |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 18 | #include "lldb/Core/Module.h" |
| 19 | #include "lldb/Core/ValueObjectList.h" |
| 20 | #include "lldb/Core/Value.h" |
| 21 | #include "lldb/Core/ValueObject.h" |
| 22 | |
Enrico Granata | 21fd13f | 2012-10-27 02:05:48 +0000 | [diff] [blame] | 23 | #include "lldb/Symbol/ClangASTType.h" |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 24 | #include "lldb/Symbol/ObjectFile.h" |
| 25 | #include "lldb/Symbol/SymbolContext.h" |
| 26 | #include "lldb/Symbol/Type.h" |
| 27 | #include "lldb/Symbol/Variable.h" |
| 28 | |
| 29 | #include "lldb/Target/ExecutionContext.h" |
| 30 | #include "lldb/Target/LanguageRuntime.h" |
| 31 | #include "lldb/Target/Process.h" |
| 32 | #include "lldb/Target/RegisterContext.h" |
| 33 | #include "lldb/Target/Target.h" |
| 34 | #include "lldb/Target/Thread.h" |
| 35 | |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 36 | using namespace lldb_private; |
| 37 | |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 38 | ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic) : |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 39 | ValueObject(parent), |
| 40 | m_address (), |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 41 | m_dynamic_type_info(), |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 42 | m_use_dynamic (use_dynamic) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 43 | { |
Enrico Granata | 6f3533f | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 44 | SetName (parent.GetName()); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | ValueObjectDynamicValue::~ValueObjectDynamicValue() |
| 48 | { |
| 49 | m_owning_valobj_sp.reset(); |
| 50 | } |
| 51 | |
| 52 | lldb::clang_type_t |
Sean Callanan | 7277284 | 2012-02-22 23:57:45 +0000 | [diff] [blame] | 53 | ValueObjectDynamicValue::GetClangTypeImpl () |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 54 | { |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 55 | if (m_dynamic_type_info.HasTypeSP()) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 56 | return m_value.GetClangType(); |
| 57 | else |
| 58 | return m_parent->GetClangType(); |
| 59 | } |
| 60 | |
| 61 | ConstString |
| 62 | ValueObjectDynamicValue::GetTypeName() |
| 63 | { |
Enrico Granata | c3e320a | 2011-08-02 17:27:39 +0000 | [diff] [blame] | 64 | const bool success = UpdateValueIfNeeded(false); |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 65 | if (success) |
| 66 | { |
| 67 | if (m_dynamic_type_info.HasTypeSP()) |
| 68 | return ClangASTType::GetConstTypeName (GetClangAST(), GetClangType()); |
| 69 | if (m_dynamic_type_info.HasName()) |
| 70 | return m_dynamic_type_info.GetName(); |
| 71 | } |
| 72 | return m_parent->GetTypeName(); |
| 73 | } |
| 74 | |
| 75 | ConstString |
| 76 | ValueObjectDynamicValue::GetQualifiedTypeName() |
| 77 | { |
| 78 | const bool success = UpdateValueIfNeeded(false); |
| 79 | if (success) |
| 80 | { |
| 81 | if (m_dynamic_type_info.HasTypeSP()) |
| 82 | return ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType()); |
| 83 | if (m_dynamic_type_info.HasName()) |
| 84 | return m_dynamic_type_info.GetName(); |
| 85 | } |
| 86 | return m_parent->GetTypeName(); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Greg Clayton | c7bece56 | 2013-01-25 18:06:21 +0000 | [diff] [blame] | 89 | size_t |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 90 | ValueObjectDynamicValue::CalculateNumChildren() |
| 91 | { |
Enrico Granata | c3e320a | 2011-08-02 17:27:39 +0000 | [diff] [blame] | 92 | const bool success = UpdateValueIfNeeded(false); |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 93 | if (success && m_dynamic_type_info.HasTypeSP()) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 94 | return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true); |
| 95 | else |
| 96 | return m_parent->GetNumChildren(); |
| 97 | } |
| 98 | |
| 99 | clang::ASTContext * |
Sean Callanan | 7277284 | 2012-02-22 23:57:45 +0000 | [diff] [blame] | 100 | ValueObjectDynamicValue::GetClangASTImpl () |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 101 | { |
Enrico Granata | 0a3958e | 2011-07-02 00:25:22 +0000 | [diff] [blame] | 102 | const bool success = UpdateValueIfNeeded(false); |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 103 | if (success && m_dynamic_type_info.HasTypeSP()) |
| 104 | return m_dynamic_type_info.GetTypeSP()->GetClangAST(); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 105 | else |
| 106 | return m_parent->GetClangAST (); |
| 107 | } |
| 108 | |
Greg Clayton | faac111 | 2013-03-14 18:31:44 +0000 | [diff] [blame] | 109 | uint64_t |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 110 | ValueObjectDynamicValue::GetByteSize() |
| 111 | { |
Enrico Granata | c3e320a | 2011-08-02 17:27:39 +0000 | [diff] [blame] | 112 | const bool success = UpdateValueIfNeeded(false); |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 113 | if (success && m_dynamic_type_info.HasTypeSP()) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 114 | return m_value.GetValueByteSize(GetClangAST(), NULL); |
| 115 | else |
| 116 | return m_parent->GetByteSize(); |
| 117 | } |
| 118 | |
| 119 | lldb::ValueType |
| 120 | ValueObjectDynamicValue::GetValueType() const |
| 121 | { |
| 122 | return m_parent->GetValueType(); |
| 123 | } |
| 124 | |
| 125 | bool |
| 126 | ValueObjectDynamicValue::UpdateValue () |
| 127 | { |
| 128 | SetValueIsValid (false); |
| 129 | m_error.Clear(); |
| 130 | |
Enrico Granata | c3e320a | 2011-08-02 17:27:39 +0000 | [diff] [blame] | 131 | if (!m_parent->UpdateValueIfNeeded(false)) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 132 | { |
Greg Clayton | 007d5be | 2011-05-30 00:49:24 +0000 | [diff] [blame] | 133 | // The dynamic value failed to get an error, pass the error along |
| 134 | if (m_error.Success() && m_parent->GetError().Fail()) |
| 135 | m_error = m_parent->GetError(); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 136 | return false; |
| 137 | } |
| 138 | |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 139 | // Setting our type_sp to NULL will route everything back through our |
| 140 | // parent which is equivalent to not using dynamic values. |
| 141 | if (m_use_dynamic == lldb::eNoDynamicValues) |
| 142 | { |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 143 | m_dynamic_type_info.Clear(); |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 144 | return true; |
| 145 | } |
| 146 | |
Greg Clayton | cc4d014 | 2012-02-17 07:49:44 +0000 | [diff] [blame] | 147 | ExecutionContext exe_ctx (GetExecutionContextRef()); |
Greg Clayton | c14ee32 | 2011-09-22 04:58:26 +0000 | [diff] [blame] | 148 | Target *target = exe_ctx.GetTargetPtr(); |
| 149 | if (target) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 150 | { |
Greg Clayton | c14ee32 | 2011-09-22 04:58:26 +0000 | [diff] [blame] | 151 | m_data.SetByteOrder(target->GetArchitecture().GetByteOrder()); |
| 152 | m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize()); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | // First make sure our Type and/or Address haven't changed: |
Greg Clayton | cc4d014 | 2012-02-17 07:49:44 +0000 | [diff] [blame] | 156 | Process *process = exe_ctx.GetProcessPtr(); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 157 | if (!process) |
| 158 | return false; |
| 159 | |
Jim Ingham | 61be090 | 2011-05-02 18:13:59 +0000 | [diff] [blame] | 160 | TypeAndOrName class_type_or_name; |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 161 | Address dynamic_address; |
| 162 | bool found_dynamic_type = false; |
| 163 | |
| 164 | lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage(); |
| 165 | if (known_type != lldb::eLanguageTypeUnknown && known_type != lldb::eLanguageTypeC) |
| 166 | { |
| 167 | LanguageRuntime *runtime = process->GetLanguageRuntime (known_type); |
| 168 | if (runtime) |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 169 | found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 170 | } |
| 171 | else |
| 172 | { |
| 173 | LanguageRuntime *cpp_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus); |
| 174 | if (cpp_runtime) |
Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 175 | found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 176 | |
| 177 | if (!found_dynamic_type) |
| 178 | { |
| 179 | LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC); |
| 180 | if (objc_runtime) |
Enrico Granata | 9910bc8 | 2011-08-03 02:18:51 +0000 | [diff] [blame] | 181 | found_dynamic_type = objc_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 182 | } |
| 183 | } |
| 184 | |
Jim Ingham | 61be090 | 2011-05-02 18:13:59 +0000 | [diff] [blame] | 185 | // Getting the dynamic value may have run the program a bit, and so marked us as needing updating, but we really |
| 186 | // don't... |
| 187 | |
| 188 | m_update_point.SetUpdated(); |
| 189 | |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 190 | // If we don't have a dynamic type, then make ourselves just a echo of our parent. |
| 191 | // Or we could return false, and make ourselves an echo of our parent? |
| 192 | if (!found_dynamic_type) |
| 193 | { |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 194 | if (m_dynamic_type_info) |
Enrico Granata | 75badc4 | 2012-11-27 23:50:00 +0000 | [diff] [blame] | 195 | SetValueDidChange(true); |
Enrico Granata | bd83b87 | 2012-11-27 23:28:32 +0000 | [diff] [blame] | 196 | ClearDynamicTypeInformation(); |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 197 | m_dynamic_type_info.Clear(); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 198 | m_value = m_parent->GetValue(); |
Greg Clayton | e72dfb3 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 199 | m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get()); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 200 | return m_error.Success(); |
| 201 | } |
| 202 | |
| 203 | Value old_value(m_value); |
| 204 | |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 +0000 | [diff] [blame^] | 205 | Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)); |
Enrico Granata | d228483 | 2012-10-17 22:23:56 +0000 | [diff] [blame] | 206 | |
Enrico Granata | e3e9151 | 2012-10-22 18:18:36 +0000 | [diff] [blame] | 207 | bool has_changed_type = false; |
| 208 | |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 209 | if (!m_dynamic_type_info) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 210 | { |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 211 | m_dynamic_type_info = class_type_or_name; |
Enrico Granata | e3e9151 | 2012-10-22 18:18:36 +0000 | [diff] [blame] | 212 | has_changed_type = true; |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 213 | } |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 214 | else if (class_type_or_name != m_dynamic_type_info) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 215 | { |
| 216 | // We are another type, we need to tear down our children... |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 217 | m_dynamic_type_info = class_type_or_name; |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 218 | SetValueDidChange (true); |
Enrico Granata | e3e9151 | 2012-10-22 18:18:36 +0000 | [diff] [blame] | 219 | has_changed_type = true; |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Enrico Granata | e3e9151 | 2012-10-22 18:18:36 +0000 | [diff] [blame] | 222 | if (has_changed_type) |
| 223 | ClearDynamicTypeInformation (); |
| 224 | |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 225 | if (!m_address.IsValid() || m_address != dynamic_address) |
| 226 | { |
| 227 | if (m_address.IsValid()) |
| 228 | SetValueDidChange (true); |
| 229 | |
| 230 | // We've moved, so we should be fine... |
| 231 | m_address = dynamic_address; |
Greg Clayton | cc4d014 | 2012-02-17 07:49:44 +0000 | [diff] [blame] | 232 | lldb::TargetSP target_sp (GetTargetSP()); |
| 233 | lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get()); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 234 | m_value.GetScalar() = load_address; |
| 235 | } |
| 236 | |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 237 | lldb::clang_type_t corrected_type; |
| 238 | if (m_dynamic_type_info.HasTypeSP()) |
| 239 | { |
| 240 | // The type will always be the type of the dynamic object. If our parent's type was a pointer, |
| 241 | // then our type should be a pointer to the type of the dynamic object. If a reference, then the original type |
| 242 | // should be okay... |
| 243 | lldb::clang_type_t orig_type; |
| 244 | clang::ASTContext* ast; |
| 245 | orig_type = m_dynamic_type_info.GetTypeSP()->GetClangForwardType(); |
| 246 | ast = m_dynamic_type_info.GetTypeSP()->GetClangAST(); |
| 247 | corrected_type = orig_type; |
| 248 | if (m_parent->IsPointerType()) |
| 249 | corrected_type = ClangASTContext::CreatePointerType (ast, orig_type); |
| 250 | else if (m_parent->IsPointerOrReferenceType()) |
| 251 | corrected_type = ClangASTContext::CreateLValueReferenceType (ast, orig_type); |
| 252 | } |
| 253 | else /*if (m_dynamic_type_info.HasName())*/ |
| 254 | { |
| 255 | // If we are here we need to adjust our dynamic type name to include the correct & or * symbol |
| 256 | std::string type_name_buf (m_dynamic_type_info.GetName().GetCString()); |
| 257 | if (m_parent->IsPointerType()) |
| 258 | type_name_buf.append(" *"); |
| 259 | else if (m_parent->IsPointerOrReferenceType()) |
| 260 | type_name_buf.append(" &"); |
| 261 | corrected_type = m_parent->GetClangType(); |
| 262 | m_dynamic_type_info.SetName(type_name_buf.c_str()); |
| 263 | } |
| 264 | |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 265 | m_value.SetContext (Value::eContextTypeClangType, corrected_type); |
| 266 | |
| 267 | // Our address is the location of the dynamic type stored in memory. It isn't a load address, |
| 268 | // because we aren't pointing to the LOCATION that stores the pointer to us, we're pointing to us... |
| 269 | m_value.SetValueType(Value::eValueTypeScalar); |
| 270 | |
Enrico Granata | e3e9151 | 2012-10-22 18:18:36 +0000 | [diff] [blame] | 271 | if (has_changed_type && log) |
| 272 | log->Printf("[%s %p] has a new dynamic type %s", |
| 273 | GetName().GetCString(), |
| 274 | this, |
| 275 | GetTypeName().GetCString()); |
| 276 | |
Enrico Granata | f7b1a34 | 2013-01-23 01:17:27 +0000 | [diff] [blame] | 277 | if (m_address.IsValid() && m_dynamic_type_info) |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 278 | { |
| 279 | // The variable value is in the Scalar value inside the m_value. |
| 280 | // We can point our m_data right to it. |
Greg Clayton | e72dfb3 | 2012-02-24 01:59:29 +0000 | [diff] [blame] | 281 | m_error = m_value.GetValueAsData (&exe_ctx, GetClangAST(), m_data, 0, GetModule().get()); |
Jim Ingham | 78a685a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 282 | if (m_error.Success()) |
| 283 | { |
| 284 | if (ClangASTContext::IsAggregateType (GetClangType())) |
| 285 | { |
| 286 | // this value object represents an aggregate type whose |
| 287 | // children have values, but this object does not. So we |
| 288 | // say we are changed if our location has changed. |
| 289 | SetValueDidChange (m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); |
| 290 | } |
| 291 | |
| 292 | SetValueIsValid (true); |
| 293 | return true; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | // We get here if we've failed above... |
| 298 | SetValueIsValid (false); |
| 299 | return false; |
| 300 | } |
| 301 | |
| 302 | |
| 303 | |
| 304 | bool |
| 305 | ValueObjectDynamicValue::IsInScope () |
| 306 | { |
| 307 | return m_parent->IsInScope(); |
| 308 | } |
| 309 | |
Enrico Granata | 07a4ac2 | 2012-05-08 21:25:06 +0000 | [diff] [blame] | 310 | bool |
| 311 | ValueObjectDynamicValue::SetValueFromCString (const char *value_str, Error& error) |
| 312 | { |
| 313 | if (!UpdateValueIfNeeded(false)) |
| 314 | { |
| 315 | error.SetErrorString("unable to read value"); |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | uint64_t my_value = GetValueAsUnsigned(UINT64_MAX); |
| 320 | uint64_t parent_value = m_parent->GetValueAsUnsigned(UINT64_MAX); |
| 321 | |
| 322 | if (my_value == UINT64_MAX || parent_value == UINT64_MAX) |
| 323 | { |
| 324 | error.SetErrorString("unable to read value"); |
| 325 | return false; |
| 326 | } |
| 327 | |
| 328 | // if we are at an offset from our parent, in order to set ourselves correctly we would need |
| 329 | // to change the new value so that it refers to the correct dynamic type. we choose not to deal |
| 330 | // with that - if anything more than a value overwrite is required, you should be using the |
| 331 | // expression parser instead of the value editing facility |
| 332 | if (my_value != parent_value) |
| 333 | { |
| 334 | // but NULL'ing out a value should always be allowed |
| 335 | if (strcmp(value_str,"0")) |
| 336 | { |
| 337 | error.SetErrorString("unable to modify dynamic value, use 'expression' command"); |
| 338 | return false; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | bool ret_val = m_parent->SetValueFromCString(value_str,error); |
| 343 | SetNeedsUpdate(); |
| 344 | return ret_val; |
| 345 | } |