In thread and frame format strings, it is now allowed to use Python functions to generate part or all of the output text
Specifically, the ${target ${process ${thread and ${frame specifiers have been extended to allow a subkeyword .script:<fctName> (e.g. ${frame.script:FooFunction})
The functions are prototyped as

def FooFunction(Object,unused)

where object is of the respective SB-type (SBTarget for target.script, ... and so on)

This has not been implemented for ${var because it would be akin to a Python summary which is already well-defined in LLDB

llvm-svn: 184500
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 45c2b05..2be1dbb 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1801,6 +1801,24 @@
                                                 }
                                             }
                                         }
+                                        else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+                                        {
+                                            var_name_begin += ::strlen("script:");
+                                            std::string script_name(var_name_begin,var_name_end);
+                                            ScriptInterpreter* script_interpreter = process->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+                                            if (script_interpreter)
+                                            {
+                                                std::string script_output;
+                                                Error script_error;
+                                                if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), process,script_output,script_error) && script_error.Success())
+                                                {
+                                                    s.Printf("%s", script_output.c_str());
+                                                    var_success = true;
+                                                }
+                                                else
+                                                    s.Printf("<error: %s>",script_error.AsCString());
+                                            }
+                                        }
                                     }
                                 }
                             }
@@ -1870,6 +1888,24 @@
                                                 }
                                             }
                                         }
+                                        else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+                                        {
+                                            var_name_begin += ::strlen("script:");
+                                            std::string script_name(var_name_begin,var_name_end);
+                                            ScriptInterpreter* script_interpreter = thread->GetProcess()->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+                                            if (script_interpreter)
+                                            {
+                                                std::string script_output;
+                                                Error script_error;
+                                                if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), thread,script_output,script_error) && script_error.Success())
+                                                {
+                                                    s.Printf("%s", script_output.c_str());
+                                                    var_success = true;
+                                                }
+                                                else
+                                                    s.Printf("<error: %s>",script_error.AsCString());
+                                            }
+                                        }
                                     }
                                 }
                             }
@@ -1911,6 +1947,24 @@
                                             var_success = true;
                                         }
                                     }
+                                    else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+                                    {
+                                        var_name_begin += ::strlen("script:");
+                                        std::string script_name(var_name_begin,var_name_end);
+                                        ScriptInterpreter* script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+                                        if (script_interpreter)
+                                        {
+                                            std::string script_output;
+                                            Error script_error;
+                                            if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), target,script_output,script_error) && script_error.Success())
+                                            {
+                                                s.Printf("%s", script_output.c_str());
+                                                var_success = true;
+                                            }
+                                            else
+                                                s.Printf("<error: %s>",script_error.AsCString());
+                                        }
+                                    }
                                 }
                             }
                             break;
@@ -2018,6 +2072,24 @@
                                                 }
                                             }
                                         }
+                                        else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+                                        {
+                                            var_name_begin += ::strlen("script:");
+                                            std::string script_name(var_name_begin,var_name_end);
+                                            ScriptInterpreter* script_interpreter = frame->GetThread()->GetProcess()->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+                                            if (script_interpreter)
+                                            {
+                                                std::string script_output;
+                                                Error script_error;
+                                                if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), frame,script_output,script_error) && script_error.Success())
+                                                {
+                                                    s.Printf("%s", script_output.c_str());
+                                                    var_success = true;
+                                                }
+                                                else
+                                                    s.Printf("<error: %s>",script_error.AsCString());
+                                            }
+                                        }
                                     }
                                 }
                             }