blob: e14875b10d64519042006cb903d8916e567de308 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- ValueObject.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/Core/ValueObject.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
Chris Lattner30fdc8d2010-06-08 16:52:24 +000015#include "llvm/Support/raw_ostream.h"
16
17// Project includes
18#include "lldb/Core/DataBufferHeap.h"
19#include "lldb/Core/StreamString.h"
20#include "lldb/Core/ValueObjectChild.h"
21#include "lldb/Core/ValueObjectList.h"
22
Greg Claytone1a916a2010-07-21 22:12:05 +000023#include "lldb/Symbol/ClangASTType.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024#include "lldb/Symbol/ClangASTContext.h"
25#include "lldb/Symbol/Type.h"
26
27#include "lldb/Target/Process.h"
28#include "lldb/Target/RegisterContext.h"
29#include "lldb/Target/Thread.h"
Eli Friedman88966972010-06-09 08:50:27 +000030#include <stdlib.h>
Chris Lattner30fdc8d2010-06-08 16:52:24 +000031
32using namespace lldb;
33using namespace lldb_private;
34
35static lldb::user_id_t g_value_obj_uid = 0;
36
37//----------------------------------------------------------------------
38// ValueObject constructor
39//----------------------------------------------------------------------
40ValueObject::ValueObject () :
41 UserID (++g_value_obj_uid), // Unique identifier for every value object
42 m_update_id (0), // Value object lists always start at 1, value objects start at zero
43 m_name (),
44 m_data (),
45 m_value (),
46 m_error (),
Greg Clayton288bdf92010-09-02 02:59:18 +000047 m_value_str (),
48 m_old_value_str (),
49 m_location_str (),
50 m_summary_str (),
51 m_children (),
52 m_synthetic_children (),
53 m_value_is_valid (false),
54 m_value_did_change (false),
55 m_children_count_valid (false),
56 m_old_value_valid (false)
Chris Lattner30fdc8d2010-06-08 16:52:24 +000057{
58}
59
60//----------------------------------------------------------------------
61// Destructor
62//----------------------------------------------------------------------
63ValueObject::~ValueObject ()
64{
65}
66
67user_id_t
68ValueObject::GetUpdateID() const
69{
70 return m_update_id;
71}
72
73bool
74ValueObject::UpdateValueIfNeeded (ExecutionContextScope *exe_scope)
75{
76 if (exe_scope)
77 {
78 Process *process = exe_scope->CalculateProcess();
79 if (process)
80 {
81 const user_id_t stop_id = process->GetStopID();
82 if (m_update_id != stop_id)
83 {
Greg Clayton288bdf92010-09-02 02:59:18 +000084 bool first_update = m_update_id == 0;
Greg Clayton73b953b2010-08-28 00:08:07 +000085 // Save the old value using swap to avoid a string copy which
86 // also will clear our m_value_str
Greg Clayton288bdf92010-09-02 02:59:18 +000087 if (m_value_str.empty())
88 {
89 m_old_value_valid = false;
90 }
91 else
92 {
93 m_old_value_valid = true;
94 m_old_value_str.swap (m_value_str);
95 m_value_str.clear();
96 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000097 m_location_str.clear();
98 m_summary_str.clear();
99
Greg Clayton73b953b2010-08-28 00:08:07 +0000100 const bool value_was_valid = GetValueIsValid();
101 SetValueDidChange (false);
102
103 m_error.Clear();
104
105 // Call the pure virtual function to update the value
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000106 UpdateValue (exe_scope);
Greg Clayton73b953b2010-08-28 00:08:07 +0000107
108 // Update the fact that we tried to update the value for this
109 // value object wether or not we succeed
110 m_update_id = stop_id;
111 bool success = m_error.Success();
112 SetValueIsValid (success);
Greg Clayton288bdf92010-09-02 02:59:18 +0000113
114 if (first_update)
115 SetValueDidChange (false);
116 else if (!m_value_did_change && success == false)
Greg Clayton73b953b2010-08-28 00:08:07 +0000117 {
Greg Clayton288bdf92010-09-02 02:59:18 +0000118 // The value wasn't gotten successfully, so we mark this
119 // as changed if the value used to be valid and now isn't
120 SetValueDidChange (value_was_valid);
Greg Clayton73b953b2010-08-28 00:08:07 +0000121 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000122 }
123 }
124 }
125 return m_error.Success();
126}
127
128const DataExtractor &
129ValueObject::GetDataExtractor () const
130{
131 return m_data;
132}
133
134DataExtractor &
135ValueObject::GetDataExtractor ()
136{
137 return m_data;
138}
139
140const Error &
141ValueObject::GetError() const
142{
143 return m_error;
144}
145
146const ConstString &
147ValueObject::GetName() const
148{
149 return m_name;
150}
151
152const char *
153ValueObject::GetLocationAsCString (ExecutionContextScope *exe_scope)
154{
155 if (UpdateValueIfNeeded(exe_scope))
156 {
157 if (m_location_str.empty())
158 {
159 StreamString sstr;
160
161 switch (m_value.GetValueType())
162 {
163 default:
164 break;
165
166 case Value::eValueTypeScalar:
167 if (m_value.GetContextType() == Value::eContextTypeDCRegisterInfo)
168 {
169 RegisterInfo *reg_info = m_value.GetRegisterInfo();
170 if (reg_info)
171 {
172 if (reg_info->name)
173 m_location_str = reg_info->name;
174 else if (reg_info->alt_name)
175 m_location_str = reg_info->alt_name;
176 break;
177 }
178 }
179 m_location_str = "scalar";
180 break;
181
182 case Value::eValueTypeLoadAddress:
183 case Value::eValueTypeFileAddress:
184 case Value::eValueTypeHostAddress:
185 {
186 uint32_t addr_nibble_size = m_data.GetAddressByteSize() * 2;
187 sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size, m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
188 m_location_str.swap(sstr.GetString());
189 }
190 break;
191 }
192 }
193 }
194 return m_location_str.c_str();
195}
196
197Value &
198ValueObject::GetValue()
199{
200 return m_value;
201}
202
203const Value &
204ValueObject::GetValue() const
205{
206 return m_value;
207}
208
209bool
Greg Clayton288bdf92010-09-02 02:59:18 +0000210ValueObject::GetValueIsValid () const
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000211{
Greg Clayton288bdf92010-09-02 02:59:18 +0000212 return m_value_is_valid;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000213}
214
215
216void
217ValueObject::SetValueIsValid (bool b)
218{
Greg Clayton288bdf92010-09-02 02:59:18 +0000219 m_value_is_valid = b;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000220}
221
222bool
Greg Clayton288bdf92010-09-02 02:59:18 +0000223ValueObject::GetValueDidChange (ExecutionContextScope *exe_scope)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000224{
Greg Clayton288bdf92010-09-02 02:59:18 +0000225 GetValueAsCString (exe_scope);
226 return m_value_did_change;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000227}
228
229void
230ValueObject::SetValueDidChange (bool value_changed)
231{
Greg Clayton288bdf92010-09-02 02:59:18 +0000232 m_value_did_change = value_changed;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000233}
234
235ValueObjectSP
236ValueObject::GetChildAtIndex (uint32_t idx, bool can_create)
237{
238 ValueObjectSP child_sp;
239 if (idx < GetNumChildren())
240 {
241 // Check if we have already made the child value object?
242 if (can_create && m_children[idx].get() == NULL)
243 {
244 // No we haven't created the child at this index, so lets have our
245 // subclass do it and cache the result for quick future access.
246 m_children[idx] = CreateChildAtIndex (idx, false, 0);
247 }
248
249 child_sp = m_children[idx];
250 }
251 return child_sp;
252}
253
254uint32_t
255ValueObject::GetIndexOfChildWithName (const ConstString &name)
256{
257 bool omit_empty_base_classes = true;
258 return ClangASTContext::GetIndexOfChildWithName (GetClangAST(),
259 GetOpaqueClangQualType(),
260 name.AsCString(),
261 omit_empty_base_classes);
262}
263
264ValueObjectSP
265ValueObject::GetChildMemberWithName (const ConstString &name, bool can_create)
266{
267 // when getting a child by name, it could be burried inside some base
268 // classes (which really aren't part of the expression path), so we
269 // need a vector of indexes that can get us down to the correct child
270 std::vector<uint32_t> child_indexes;
271 clang::ASTContext *clang_ast = GetClangAST();
272 void *clang_type = GetOpaqueClangQualType();
273 bool omit_empty_base_classes = true;
274 const size_t num_child_indexes = ClangASTContext::GetIndexOfChildMemberWithName (clang_ast,
275 clang_type,
276 name.AsCString(),
277 omit_empty_base_classes,
278 child_indexes);
279 ValueObjectSP child_sp;
280 if (num_child_indexes > 0)
281 {
282 std::vector<uint32_t>::const_iterator pos = child_indexes.begin ();
283 std::vector<uint32_t>::const_iterator end = child_indexes.end ();
284
285 child_sp = GetChildAtIndex(*pos, can_create);
286 for (++pos; pos != end; ++pos)
287 {
288 if (child_sp)
289 {
290 ValueObjectSP new_child_sp(child_sp->GetChildAtIndex (*pos, can_create));
291 child_sp = new_child_sp;
292 }
293 else
294 {
295 child_sp.reset();
296 }
297
298 }
299 }
300 return child_sp;
301}
302
303
304uint32_t
305ValueObject::GetNumChildren ()
306{
Greg Clayton288bdf92010-09-02 02:59:18 +0000307 if (!m_children_count_valid)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000308 {
309 SetNumChildren (CalculateNumChildren());
310 }
311 return m_children.size();
312}
313void
314ValueObject::SetNumChildren (uint32_t num_children)
315{
Greg Clayton288bdf92010-09-02 02:59:18 +0000316 m_children_count_valid = true;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000317 m_children.resize(num_children);
318}
319
320void
321ValueObject::SetName (const char *name)
322{
323 m_name.SetCString(name);
324}
325
326void
327ValueObject::SetName (const ConstString &name)
328{
329 m_name = name;
330}
331
332ValueObjectSP
333ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index)
334{
335 ValueObjectSP valobj_sp;
336 bool omit_empty_base_classes = true;
337
338 std::string child_name_str;
339 uint32_t child_byte_size = 0;
340 int32_t child_byte_offset = 0;
341 uint32_t child_bitfield_bit_size = 0;
342 uint32_t child_bitfield_bit_offset = 0;
343 const bool transparent_pointers = synthetic_array_member == false;
344 clang::ASTContext *clang_ast = GetClangAST();
345 void *clang_type = GetOpaqueClangQualType();
346 void *child_clang_type;
347 child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (clang_ast,
348 GetName().AsCString(),
349 clang_type,
350 idx,
351 transparent_pointers,
352 omit_empty_base_classes,
353 child_name_str,
354 child_byte_size,
355 child_byte_offset,
356 child_bitfield_bit_size,
357 child_bitfield_bit_offset);
358 if (child_clang_type)
359 {
360 if (synthetic_index)
361 child_byte_offset += child_byte_size * synthetic_index;
362
363 ConstString child_name;
364 if (!child_name_str.empty())
365 child_name.SetCString (child_name_str.c_str());
366
367 valobj_sp.reset (new ValueObjectChild (this,
368 clang_ast,
369 child_clang_type,
370 child_name,
371 child_byte_size,
372 child_byte_offset,
373 child_bitfield_bit_size,
374 child_bitfield_bit_offset));
375 }
376 return valobj_sp;
377}
378
379const char *
380ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope)
381{
382 if (UpdateValueIfNeeded (exe_scope))
383 {
384 if (m_summary_str.empty())
385 {
386 void *clang_type = GetOpaqueClangQualType();
387
388 // See if this is a pointer to a C string?
389 uint32_t fixed_length = 0;
390 if (clang_type && ClangASTContext::IsCStringType (clang_type, fixed_length))
391 {
392 Process *process = exe_scope->CalculateProcess();
393 if (process != NULL)
394 {
395 StreamString sstr;
396 lldb::addr_t cstr_address = LLDB_INVALID_ADDRESS;
397 lldb::AddressType cstr_address_type = eAddressTypeInvalid;
398 switch (GetValue().GetValueType())
399 {
400 case Value::eValueTypeScalar:
401 cstr_address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
402 cstr_address_type = eAddressTypeLoad;
403 break;
404
405 case Value::eValueTypeLoadAddress:
406 case Value::eValueTypeFileAddress:
407 case Value::eValueTypeHostAddress:
408 {
409 uint32_t data_offset = 0;
410 cstr_address = m_data.GetPointer(&data_offset);
411 cstr_address_type = m_value.GetValueAddressType();
412 if (cstr_address_type == eAddressTypeInvalid)
413 cstr_address_type = eAddressTypeLoad;
414 }
415 break;
416 }
417
418 if (cstr_address != LLDB_INVALID_ADDRESS)
419 {
420 DataExtractor data;
421 size_t bytes_read = 0;
422 std::vector<char> data_buffer;
423 std::vector<char> cstr_buffer;
424 size_t cstr_length;
425 Error error;
426 if (fixed_length > 0)
427 {
428 data_buffer.resize(fixed_length);
429 // Resize the formatted buffer in case every character
430 // uses the "\xXX" format and one extra byte for a NULL
431 cstr_buffer.resize(data_buffer.size() * 4 + 1);
Greg Clayton471b31c2010-07-20 22:52:08 +0000432 data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost);
433 bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), fixed_length, error);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000434 if (bytes_read > 0)
435 {
436 sstr << '"';
437 cstr_length = data.Dump (&sstr,
438 0, // Start offset in "data"
439 eFormatChar, // Print as characters
440 1, // Size of item (1 byte for a char!)
441 bytes_read, // How many bytes to print?
442 UINT32_MAX, // num per line
443 LLDB_INVALID_ADDRESS,// base address
444 0, // bitfield bit size
445 0); // bitfield bit offset
446 sstr << '"';
447 }
448 }
449 else
450 {
451 const size_t k_max_buf_size = 256;
452 data_buffer.resize (k_max_buf_size + 1);
453 // NULL terminate in case we don't get the entire C string
454 data_buffer.back() = '\0';
455 // Make a formatted buffer that can contain take 4
456 // bytes per character in case each byte uses the
457 // "\xXX" format and one extra byte for a NULL
458 cstr_buffer.resize (k_max_buf_size * 4 + 1);
459
Greg Clayton471b31c2010-07-20 22:52:08 +0000460 data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000461 size_t total_cstr_len = 0;
Greg Clayton471b31c2010-07-20 22:52:08 +0000462 while ((bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), k_max_buf_size, error)) > 0)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000463 {
Greg Clayton471b31c2010-07-20 22:52:08 +0000464 size_t len = strlen(&data_buffer.front());
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000465 if (len == 0)
466 break;
467 if (len > bytes_read)
468 len = bytes_read;
469 if (sstr.GetSize() == 0)
470 sstr << '"';
471
472 cstr_length = data.Dump (&sstr,
473 0, // Start offset in "data"
474 eFormatChar, // Print as characters
475 1, // Size of item (1 byte for a char!)
476 len, // How many bytes to print?
477 UINT32_MAX, // num per line
478 LLDB_INVALID_ADDRESS,// base address
479 0, // bitfield bit size
480 0); // bitfield bit offset
481
482 if (len < k_max_buf_size)
483 break;
484 cstr_address += total_cstr_len;
485 }
486 if (sstr.GetSize() > 0)
487 sstr << '"';
488 }
489
490 if (sstr.GetSize() > 0)
491 m_summary_str.assign (sstr.GetData(), sstr.GetSize());
492 }
493 }
494 }
495 }
496 }
497 if (m_summary_str.empty())
498 return NULL;
499 return m_summary_str.c_str();
500}
501
502
503const char *
504ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
505{
506 // If our byte size is zero this is an aggregate type that has children
507 if (ClangASTContext::IsAggregateType (GetOpaqueClangQualType()) == false)
508 {
509 if (UpdateValueIfNeeded(exe_scope))
510 {
511 if (m_value_str.empty())
512 {
513 const Value::ContextType context_type = m_value.GetContextType();
514
515 switch (context_type)
516 {
517 case Value::eContextTypeOpaqueClangQualType:
518 case Value::eContextTypeDCType:
519 case Value::eContextTypeDCVariable:
520 {
521 void *clang_type = GetOpaqueClangQualType ();
522 if (clang_type)
523 {
524 StreamString sstr;
Greg Claytone1a916a2010-07-21 22:12:05 +0000525 lldb::Format format = ClangASTType::GetFormat(clang_type);
526 if (ClangASTType::DumpTypeValue(GetClangAST(), // The clang AST
527 clang_type, // The clang type to display
528 &sstr,
529 format, // Format to display this type with
530 m_data, // Data to extract from
531 0, // Byte offset into "m_data"
532 GetByteSize(), // Byte size of item in "m_data"
533 GetBitfieldBitSize(), // Bitfield bit size
534 GetBitfieldBitOffset())) // Bitfield bit offset
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000535 m_value_str.swap(sstr.GetString());
536 else
537 m_value_str.clear();
538 }
539 }
540 break;
541
542 case Value::eContextTypeDCRegisterInfo:
543 {
544 const RegisterInfo *reg_info = m_value.GetRegisterInfo();
545 if (reg_info)
546 {
547 StreamString reg_sstr;
548 m_data.Dump(&reg_sstr, 0, reg_info->format, reg_info->byte_size, 1, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0);
549 m_value_str.swap(reg_sstr.GetString());
550 }
551 }
552 break;
Greg Claytonc982c762010-07-09 20:39:50 +0000553
554 default:
555 break;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000556 }
557 }
Greg Clayton288bdf92010-09-02 02:59:18 +0000558
559 if (!m_value_did_change && m_old_value_valid)
560 {
561 // The value was gotten successfully, so we consider the
562 // value as changed if the value string differs
563 SetValueDidChange (m_old_value_str != m_value_str);
564 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000565 }
566 }
567 if (m_value_str.empty())
568 return NULL;
569 return m_value_str.c_str();
570}
571
572bool
573ValueObject::SetValueFromCString (ExecutionContextScope *exe_scope, const char *value_str)
574{
575 // Make sure our value is up to date first so that our location and location
576 // type is valid.
577 if (!UpdateValueIfNeeded(exe_scope))
578 return false;
579
580 uint32_t count = 0;
Greg Claytone1a916a2010-07-21 22:12:05 +0000581 lldb::Encoding encoding = ClangASTType::GetEncoding (GetOpaqueClangQualType(), count);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000582
583 char *end = NULL;
Greg Claytonb1320972010-07-14 00:18:15 +0000584 const size_t byte_size = GetByteSize();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000585 switch (encoding)
586 {
587 case eEncodingInvalid:
588 return false;
589
590 case eEncodingUint:
591 if (byte_size > sizeof(unsigned long long))
592 {
593 return false;
594 }
595 else
596 {
597 unsigned long long ull_val = strtoull(value_str, &end, 0);
598 if (end && *end != '\0')
599 return false;
600 m_value = ull_val;
601 // Limit the bytes in our m_data appropriately.
602 m_value.GetScalar().GetData (m_data, byte_size);
603 }
604 break;
605
606 case eEncodingSint:
607 if (byte_size > sizeof(long long))
608 {
609 return false;
610 }
611 else
612 {
613 long long sll_val = strtoll(value_str, &end, 0);
614 if (end && *end != '\0')
615 return false;
616 m_value = sll_val;
617 // Limit the bytes in our m_data appropriately.
618 m_value.GetScalar().GetData (m_data, byte_size);
619 }
620 break;
621
622 case eEncodingIEEE754:
623 {
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000624 const off_t byte_offset = GetByteOffset();
Greg Claytonc982c762010-07-09 20:39:50 +0000625 uint8_t *dst = const_cast<uint8_t *>(m_data.PeekData(byte_offset, byte_size));
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000626 if (dst != NULL)
627 {
628 // We are decoding a float into host byte order below, so make
629 // sure m_data knows what it contains.
630 m_data.SetByteOrder(eByteOrderHost);
631 const size_t converted_byte_size = ClangASTContext::ConvertStringToFloatValue (
632 GetClangAST(),
633 GetOpaqueClangQualType(),
634 value_str,
635 dst,
636 byte_size);
637
638 if (converted_byte_size == byte_size)
639 {
640 }
641 }
642 }
643 break;
644
645 case eEncodingVector:
646 return false;
647
648 default:
649 return false;
650 }
651
652 // If we have made it here the value is in m_data and we should write it
653 // out to the target
654 return Write ();
655}
656
657bool
658ValueObject::Write ()
659{
660 // Clear the update ID so the next time we try and read the value
661 // we try and read it again.
662 m_update_id = 0;
663
664 // TODO: when Value has a method to write a value back, call it from here.
665 return false;
666
667}
668
669void
670ValueObject::AddSyntheticChild (const ConstString &key, ValueObjectSP& valobj_sp)
671{
672 m_synthetic_children[key] = valobj_sp;
673}
674
675ValueObjectSP
676ValueObject::GetSyntheticChild (const ConstString &key) const
677{
678 ValueObjectSP synthetic_child_sp;
679 std::map<ConstString, ValueObjectSP>::const_iterator pos = m_synthetic_children.find (key);
680 if (pos != m_synthetic_children.end())
681 synthetic_child_sp = pos->second;
682 return synthetic_child_sp;
683}
684
685bool
686ValueObject::IsPointerType ()
687{
688 return ClangASTContext::IsPointerType (GetOpaqueClangQualType());
689}
690
691bool
692ValueObject::IsPointerOrReferenceType ()
693{
694 return ClangASTContext::IsPointerOrReferenceType(GetOpaqueClangQualType());
695}
696
697ValueObjectSP
698ValueObject::GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create)
699{
700 ValueObjectSP synthetic_child_sp;
701 if (IsPointerType ())
702 {
703 char index_str[64];
704 snprintf(index_str, sizeof(index_str), "[%i]", index);
705 ConstString index_const_str(index_str);
706 // Check if we have already created a synthetic array member in this
707 // valid object. If we have we will re-use it.
708 synthetic_child_sp = GetSyntheticChild (index_const_str);
709 if (!synthetic_child_sp)
710 {
711 // We haven't made a synthetic array member for INDEX yet, so
712 // lets make one and cache it for any future reference.
713 synthetic_child_sp = CreateChildAtIndex(0, true, index);
714
715 // Cache the value if we got one back...
716 if (synthetic_child_sp)
717 AddSyntheticChild(index_const_str, synthetic_child_sp);
718 }
719 }
720 return synthetic_child_sp;
721}