[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/debugger
From:       Vladimir Prus <ghost () cs ! msu ! su>
Date:       2005-07-04 8:12:01
Message-ID: 1120464721.093352.24692.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 431395 by vprus:

Strip the type from pointer values before showing them in kdevelop.

When showing pointer values, gdb prepends the value itself with
type, and that's not necessary, and annoying in kdevelop variables view.
See discussion started at 
http://lists.kde.org/?l=kdevelop-devel&m=112021319924494&w=2


 M  +29 -0     gdbparser.cpp  


--- trunk/KDE/kdevelop/languages/cpp/debugger/gdbparser.cpp #431394:431395
@@ -141,6 +141,35 @@
     if (*start == '{')
         return QCString(start+1, *buf - start -1);
 
+    if (*start == '(')
+    {
+        // Strip the type of the pointer from the value.
+        //
+        // When printing values of pointers, gdb prints the pointer
+        // type as well. This is not necessary for kdevelop -- after
+        // all, there's separate column with value type. But that behaviour
+        // is not configurable. The only way to change it is to explicitly
+        // pass the 'x' format specifier to the 'print' command. 
+        //
+        // We probably can achieve that by sending an 'print in hex' request
+        // as soon as we know the type of variable, but that would be complex
+        // and probably conflict with 'toggle hex/decimal' command.
+        // So, address this problem as close to debugger as possible.
+
+        // We can't find the first ')', because type can contain '(' and ')'
+        // characters if its function pointer. So count opening and closing
+        // parentheses.
+
+        ++start;
+        for(unsigned count = 1; *start && count > 0; ++start)
+        {
+            if (*start == '(')
+                ++count;
+            else if (*start == ')')
+                --count;
+        }
+    }
+
     QCString value(start, *buf - start + 1);
 
     // QT2.x string handling
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic