[Lldb-commits] [lldb] r215800 - When attempting to print function names with arguments in frame formatting, attempt to detect templated functions, and replace the argument list with values outside the template marking. Turns C::f<(this=0x00007fff5fbffb70, x=2, y=1)0>(int, int) into C::f<(C::V)0>(this=0x00007fff5fbffb70, x=2, y=1), which definitely looks more like the real thing. Fixes rdar://14882237

Enrico Granata egranata at apple.com
Fri Aug 15 17:56:04 PDT 2014


Author: enrico
Date: Fri Aug 15 19:56:04 2014
New Revision: 215800

URL: http://llvm.org/viewvc/llvm-project?rev=215800&view=rev
Log:
When attempting to print function names with arguments in frame formatting, attempt to detect templated functions, and replace the argument list with values outside the template marking. Turns C::f<(this=0x00007fff5fbffb70, x=2, y=1)0>(int, int) into C::f<(C::V)0>(this=0x00007fff5fbffb70, x=2, y=1), which definitely looks more like the real thing. Fixes rdar://14882237

Modified:
    lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=215800&r1=215799&r2=215800&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Aug 15 19:56:04 2014
@@ -2358,7 +2358,29 @@ FormatPromptRecurse
                                                 if (args.GetSize() > 0)
                                                 {
                                                     const char *open_paren = strchr (cstr, '(');
-                                                    const char *close_paren = NULL;
+                                                    const char *close_paren = nullptr;
+                                                    const char *generic = strchr(cstr, '<');
+                                                    // if before the arguments list begins there is a template sign
+                                                    // then scan to the end of the generic args before you try to find
+                                                    // the arguments list
+                                                    if (generic && open_paren && generic < open_paren)
+                                                    {
+                                                        int generic_depth = 1;
+                                                        ++generic;
+                                                        for (;
+                                                             *generic && generic_depth > 0;
+                                                             generic++)
+                                                        {
+                                                            if (*generic == '<')
+                                                                generic_depth++;
+                                                            if (*generic == '>')
+                                                                generic_depth--;
+                                                        }
+                                                        if (*generic)
+                                                            open_paren = strchr(generic, '(');
+                                                        else
+                                                            open_paren = nullptr;
+                                                    }
                                                     if (open_paren)
                                                     {
                                                         if (IsToken (open_paren, "(anonymous namespace)"))





More information about the lldb-commits mailing list