From e1fb1654c801621930af3a1822147f220e2e2df9 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Sat, 9 Feb 2013 01:44:23 +0000 Subject: [PATCH] Quick fix for the libc++ std::map synthetic children provider If you try to access any child > 0 without having touched child 0, LLDB won't be able to reconstruct type information from the debug info. Previously, we would fail. Now, we simply go fetch child 0 and then come back. llvm-svn: 174795 --- lldb/examples/summaries/cocoa/Logger.py | 4 ++-- lldb/examples/synthetic/libcxx.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lldb/examples/summaries/cocoa/Logger.py b/lldb/examples/summaries/cocoa/Logger.py index 8044416..91d503c 100644 --- a/lldb/examples/summaries/cocoa/Logger.py +++ b/lldb/examples/summaries/cocoa/Logger.py @@ -58,10 +58,10 @@ class FileLogger: self.file = None # to enable logging: -# define Logger._lldb_formatters_debug_level to any number greater than 0 +# define lldb.formatters.Logger._lldb_formatters_debug_level to any number greater than 0 # if you define it to any value greater than 1, the log will be automatically flushed after each write (slower but should make sure most of the stuff makes it to the log even if we crash) # if you define it to any value greater than 2, the calling function's details will automatically be logged (even slower, but provides additional details) -# if you need the log to go to a file instead of on screen, define Logger._lldb_formatters_debug_filename to a valid filename +# if you need the log to go to a file instead of on screen, define lldb.formatters.Logger._lldb_formatters_debug_filename to a valid filename class Logger: def __init__(self,autoflush=False,logcaller=False): global _lldb_formatters_debug_level diff --git a/lldb/examples/synthetic/libcxx.py b/lldb/examples/synthetic/libcxx.py index 5037187..e1f0fa9 100644 --- a/lldb/examples/synthetic/libcxx.py +++ b/lldb/examples/synthetic/libcxx.py @@ -561,8 +561,12 @@ class stdmap_SynthProvider: else: # FIXME we need to have accessed item 0 before accessing any other item! if self.skip_size == None: - logger >> "You asked for item > 0 before asking for item == 0, too bad - I have no clue" - return None + logger >> "You asked for item > 0 before asking for item == 0, I will fetch 0 now then retry" + if self.get_child_at_index(0): + return self.get_child_at_index(index) + else: + logger >> "item == 0 could not be found. sorry, nothing can be done here." + return None return current.CreateChildAtOffset('[' + str(index) + ']',self.skip_size,self.data_type) else: logger >> "Unable to infer data-type - returning None (should mark tree as garbage here?)" -- 2.7.4