[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:       2008-04-19 11:36:44
Message-ID: 1208605004.812399.13639.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 798769 by vprus:

For watchpoints, show both original user location and real address.


 M  +27 -10    breakpointcontroller.cpp  
 M  +2 -0      breakpointcontroller.h  


--- trunk/KDE/kdevelop/languages/cpp/debugger/breakpointcontroller.cpp #798768:798769
@@ -63,7 +63,7 @@
                              const KConfigGroup& config)
 : TreeItem(model, parent), id_(-1), enabled_(true), 
   controller_(controller), deleted_(false), hitCount_(0),
-  pending_(false)
+  pending_(false), pleaseEnterLocation_(false)
 {
     QString kindString = config.readEntry("kind", "");
     int i;
@@ -102,14 +102,26 @@
     const char *code_breakpoints[] = {
         "breakpoint", "hw breakpoint", "until", "finish"};
 
-    QString location = "";
     if (b.hasField("original-location"))
-        location = b["original-location"].literal();
+    {
+        if (address_.isEmpty())
+        {
+            /* If the address is not empty, it means that the breakpoint
+               is set by KDevelop, not by the user, and that we want to
+               show the original expression, not the address, in the table.
+               TODO: this also means that if used added a watchpoint in gdb
+               like "watch foo", then we'll show it in the breakpoint table
+               just fine, but after KDevelop restart, we'll try to add the
+               breakpoint using basically "watch *&(foo)".  I'm not sure if 
+               that's a problem or not.  */
+            itemData[location_column] = b["original-location"].literal();
+        }
+    }
     else
     {
-        location = "Your GDB is too old";
+        itemData[location_column] = "Your GDB is too old";
     }
-    itemData[location_column] = location;
+    
 
     if (!dirty_.contains(condition_column)
         && !errors_.contains(condition_column))
@@ -276,8 +288,13 @@
         }
         return QVariant();
     }
-    else
-        return TreeItem::data(column, role);
+
+    if (column == location_column && role == Qt::DisplayRole
+        && !address_.isEmpty())
+        return QString("%1 (%2)").arg(itemData[location_column].toString())
+            .arg(address_);
+
+    return TreeItem::data(column, role);
 }
 
 void NewBreakpoint::setDeleted()
@@ -447,18 +464,18 @@
     }
     else
     {
+        address_ = r["value"].literal();
+
         QString opt;
         if (kind_ == read_breakpoint)
             opt = "-r ";
         else if (kind_ == access_breakpoint)
             opt = "-a ";
 
-        QString address = r["value"].literal();
-
         controller_->addCommand(
             new GDBCommand(
                 BreakWatch,
-                opt + QString("*%1").arg(address),
+                opt + QString("*%1").arg(address_),
                 this, &NewBreakpoint::handleInserted, true));
     }
 }
--- trunk/KDE/kdevelop/languages/cpp/debugger/breakpointcontroller.h #798768:798769
@@ -109,6 +109,8 @@
     kind_t kind_;
     /* The GDB 'pending' flag.  */
     bool pending_;
+    /* For watchpoints, the address it is set at.  */
+    QString address_;
     bool pleaseEnterLocation_;
 
     static const char *string_kinds[last_breakpoint_kind];
[prev in list] [next in list] [prev in thread] [next in thread] 

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