[insight-vmi] r1158 committed - - Refactored MemoryRangeTree such that it can store pointer types or o...

0 views
Skip to first unread message

insig...@googlecode.com

unread,
May 7, 2012, 2:47:27 PM5/7/12
to insight-v...@googlegroups.com
Revision: 1158
Author: chrsc...@googlemail.com
Date: Mon May 7 11:46:48 2012
Log: - Refactored MemoryRangeTree such that it can store pointer types
or objects equally well.
- Fixed a bug in the tree that lead to missing items in the tree when
splitting.

http://code.google.com/p/insight-vmi/source/detail?r=1158

Modified:
/trunk/insightd/memorydifftree.h
/trunk/insightd/memorymap.cpp
/trunk/insightd/memorymap.h
/trunk/insightd/memorymapbuilder.cpp
/trunk/insightd/memorymapnode.h
/trunk/insightd/memorymaprangetree.cpp
/trunk/insightd/memorymaprangetree.h
/trunk/insightd/memoryrangetree.h
/trunk/insightd/shell.cpp
/trunk/insightd/shell.h

=======================================
--- /trunk/insightd/memorydifftree.h Tue Dec 21 07:38:29 2010
+++ /trunk/insightd/memorydifftree.h Mon May 7 11:46:48 2012
@@ -9,7 +9,8 @@
#define MEMORYDIFFTREE_H_

// Forward declarations
-template<class T, class P> class MemoryRangeTree;
+template<class value_type, class value_accessor, class property_type>
+class MemoryRangeTree;

#include "memorymapnode.h"
#include "memoryrangetree.h"
@@ -72,8 +73,25 @@
DiffProperties& unite(const DiffProperties& other);
};

-
-typedef MemoryRangeTree<Difference, DiffProperties> MemoryDiffTree;
+/**
+ * Accessor class for Difference objects used by MemoryDiffTree.
+ */
+class DiffAccessor
+{
+public:
+ static inline quint64 address(const Difference& diff)
+ {
+ return diff.startAddr;
+ }
+
+ static inline quint64 endAddress(const Difference& diff)
+ {
+ return diff.startAddr + diff.runLength - 1;
+ }
+};
+
+
+typedef MemoryRangeTree<Difference, DiffAccessor, DiffProperties>
MemoryDiffTree;
typedef MemoryDiffTree::ItemSet DiffSet;


=======================================
--- /trunk/insightd/memorymap.cpp Thu May 3 09:57:38 2012
+++ /trunk/insightd/memorymap.cpp Mon May 7 11:46:48 2012
@@ -863,9 +863,7 @@
if (equal) {
// Add difference to tree
if (!wasEqual)
- _pmemDiff.insert(Difference(startAddr, length),
- startAddr,
- startAddr + length - 1);
+ _pmemDiff.insert(Difference(startAddr, length));
}
// Memory differs
else {
@@ -894,9 +892,7 @@

// Add last difference, if any
if (!wasEqual)
- _pmemDiff.insert(Difference(startAddr, length),
- startAddr,
- startAddr + length - 1);
+ _pmemDiff.insert(Difference(startAddr, length));

shell->out() << "\rComparing memory dumps finished." << endl;

=======================================
--- /trunk/insightd/memorymap.h Thu May 3 09:57:38 2012
+++ /trunk/insightd/memorymap.h Mon May 7 11:46:48 2012
@@ -201,7 +201,7 @@
* in this mapping.
* @return the map of allocated kernel objects in physical memory
*/
- const MemoryMapRangeTree& pmemMap() const;
+ const PhysMemoryMapRangeTree& pmemMap() const;

/**
* Gives access to the difference map that was built using diffWith()
@@ -309,7 +309,7 @@
PointerNodeHash _pointersTo; ///< holds all pointers that point to a
certain address
IntNodeHash _typeInstances; ///< holds all instances of a given type
ID
MemoryMapRangeTree _vmemMap; ///< map of all used kernel-space virtual
memory
- MemoryMapRangeTree _pmemMap; ///< map of all used physical memory
+ PhysMemoryMapRangeTree _pmemMap; ///< map of all used physical memory
MemoryDiffTree _pmemDiff; ///< differences between this and another
map
ULongSet _vmemAddresses; ///< holds all virtual addresses
bool _isBuilding; ///< indicates if the memory map is
currently being built
@@ -342,7 +342,7 @@
}


-inline const MemoryMapRangeTree& MemoryMap::pmemMap() const
+inline const PhysMemoryMapRangeTree& MemoryMap::pmemMap() const
{
return _pmemMap;
}
=======================================
--- /trunk/insightd/memorymapbuilder.cpp Thu May 3 09:59:20 2012
+++ /trunk/insightd/memorymapbuilder.cpp Mon May 7 11:46:48 2012
@@ -72,9 +72,12 @@
quint64 physAddr =
_map->_vmem->virtualToPhysical(node->address(), &pageSize);
// Linear memory region or paged memory?
if (pageSize < 0) {
+ PhysMemoryMapNode pNode(
+ physAddr,
+ node->size() > 0 ? physAddr + node->size() -
1 : physAddr,
+ node);
shared->pmemMapLock.lock();
- _map->_pmemMap.insert(node, physAddr,
- node->size() > 0 ? physAddr + node->size() - 1 :
physAddr);
+ _map->_pmemMap.insert(pNode);
shared->pmemMapLock.unlock();
}
else {
@@ -89,9 +92,12 @@
quint32 sizeOnPage = pageSize - (virtAddr & ~pageMask);
if (sizeOnPage > size)
sizeOnPage = size;
+ PhysMemoryMapNode pNode(
+ physAddr, physAddr + sizeOnPage - 1, node);
+
// Add a memory mapping
shared->pmemMapLock.lock();
- _map->_pmemMap.insert(node, physAddr, physAddr +
sizeOnPage - 1);
+ _map->_pmemMap.insert(pNode);
shared->pmemMapLock.unlock();
// Subtract the available space from left-over size
size -= sizeOnPage;
=======================================
--- /trunk/insightd/memorymapnode.h Tue Nov 30 09:07:23 2010
+++ /trunk/insightd/memorymapnode.h Mon May 7 11:46:48 2012
@@ -177,6 +177,51 @@
int _id; ///< ID of this node, if based on a variable
float _probability; ///< probability of "correctness" of this node
};
+
+
+class PhysMemoryMapNode
+{
+public:
+ PhysMemoryMapNode()
+ : _memoryMapNode(0), _physAddrStart(0), _physAddrEnd(0) {}
+ PhysMemoryMapNode(quint64 physAddrStart, quint64 physAddrEnd,
+ const MemoryMapNode* memoryMapNode)
+ : _memoryMapNode(memoryMapNode), _physAddrStart(physAddrStart),
+ _physAddrEnd(physAddrEnd) {}
+
+ inline const MemoryMapNode* memoryMapNode() const
+ {
+ return _memoryMapNode;
+ }
+
+ inline quint64 address() const
+ {
+ return _physAddrStart;
+ }
+
+ inline quint64 endAddress() const
+ {
+ return _physAddrEnd;
+ }
+
+ bool operator==(const PhysMemoryMapNode& other) const
+ {
+ return _memoryMapNode == other._memoryMapNode &&
+ _physAddrEnd == other._physAddrEnd &&
+ _physAddrStart == other._physAddrStart;
+ }
+
+private:
+ const MemoryMapNode* _memoryMapNode;
+ quint64 _physAddrStart;
+ quint64 _physAddrEnd;
+};
+
+
+inline uint qHash(const PhysMemoryMapNode& pmmNode)
+{
+ return qHash(pmmNode.memoryMapNode());
+}


inline quint64 MemoryMapNode::address() const
=======================================
--- /trunk/insightd/memorymaprangetree.cpp Wed Dec 15 08:03:41 2010
+++ /trunk/insightd/memorymaprangetree.cpp Mon May 7 11:46:48 2012
@@ -40,3 +40,9 @@
baseTypes |= other.baseTypes;
return *this;
}
+
+
+void PhysMemMapProperties::update(const PhysMemoryMapNode &mmnode)
+{
+ MemMapProperties::update(mmnode.memoryMapNode());
+}
=======================================
--- /trunk/insightd/memorymaprangetree.h Wed Dec 15 08:03:41 2010
+++ /trunk/insightd/memorymaprangetree.h Mon May 7 11:46:48 2012
@@ -9,8 +9,8 @@
#define MEMORYMAPRANGETREE_H_

// Forward declarations
-class MemoryMapNode;
-template<class T, class P> class MemoryRangeTree;
+template<class value_type, class value_accessor, class property_type>
+class MemoryRangeTree;

#include "memorymapnode.h"
#include "memoryrangetree.h"
@@ -55,8 +55,16 @@
MemMapProperties& unite(const MemMapProperties& other);
};

-
-typedef MemoryRangeTree<const MemoryMapNode*, MemMapProperties>
MemoryMapRangeTree;
+struct PhysMemMapProperties: public MemMapProperties
+{
+ void update(const PhysMemoryMapNode& mmnode);
+};
+
+
+typedef MemoryRangeTree<const MemoryMapNode*, PtrAccessor<MemoryMapNode>,
MemMapProperties> MemoryMapRangeTree;
typedef MemoryMapRangeTree::ItemSet MemMapSet;

+typedef MemoryRangeTree<PhysMemoryMapNode, RefAccessor<PhysMemoryMapNode>,
PhysMemMapProperties> PhysMemoryMapRangeTree;
+typedef PhysMemoryMapRangeTree::ItemSet PhysMemMapSet;
+
#endif /* MEMORYMAPRANGETREE_H_ */
=======================================
--- /trunk/insightd/memoryrangetree.h Fri Mar 23 06:09:00 2012
+++ /trunk/insightd/memoryrangetree.h Mon May 7 11:46:48 2012
@@ -10,13 +10,12 @@

#include <QSet>

-//#define ENABLE_DOT_CODE 1
+#define ENABLE_DOT_CODE 1

#ifdef ENABLE_DOT_CODE
#include <QTextStream>
#include <QDateTime>
#include <QFile>
-#include "shell.h"
#endif

#ifndef QT_NO_STL
@@ -26,18 +25,58 @@

#include <debug.h>

+/**
+ * Generic accessor template class for pointers of objects stored in a
+ * MemoryRangeTree.
+ */
+template<class value_type>
+class PtrAccessor
+{
+public:
+ static inline quint64 address(const value_type* item)
+ {
+ return item->address();
+ }
+
+ static inline quint64 endAddress(const value_type* item)
+ {
+ return item->endAddress();
+ }
+};
+
+/**
+ * Generic accessor template class for references to objects stored in a
+ * MemoryRangeTree.
+ */
+template<class value_type>
+class RefAccessor
+{
+public:
+ static inline quint64 address(const value_type& item)
+ {
+ return item.address();
+ }
+
+ static inline quint64 endAddress(const value_type& item)
+ {
+ return item.endAddress();
+ }
+};
+
+
// Forward declarations
-template<class T, class P> class MemoryRangeTree;
+template<class value_type, class value_accessor, class property_type>
+class MemoryRangeTree;


/**
* A node in a MemoryRangeTree.
*/
-template<class T, class P>
+template<class value_type, class value_accessor, class property_type>
struct MemoryRangeTreeNode
{
- typedef MemoryRangeTree<T, P> Tree;
- typedef P Properties;
+ typedef MemoryRangeTree<value_type, value_accessor, property_type>
Tree;
+ typedef property_type Properties;
typedef typename Tree::ItemSet ItemSet;

/**
@@ -71,18 +110,15 @@
* \a mmAddrStart to \a mmAddrEnd. This function may call split()
internally
* to split up this node.
* @param item item to insert
- * @param mmAddrStart start address of mapping
- * @param mmAddrEnd end address of mapping
*/
- void insert(T item, quint64 mmAddrStart, quint64 mmAddrEnd);
+ void insert(value_type item);

/**
* Splits this node into two children and moves all MemoryMapNode's in
* nodes to one or both of them
- * @param mmAddrStart start address of mapping
- * @param mmAddrEnd end address of mapping
*/
- void split(quint64 mmAddrStart, quint64 mmAddrEnd);
+ void split();
+

/**
* @return the end address of the left child
@@ -124,20 +160,18 @@
* start address, which allows fast queries of MemoryMapNode's and their
* properties within a memory range.
*/
-template<class T, class P>
+template<class value_type, class value_accessor, class property_type>
class MemoryRangeTree
{
- friend struct MemoryRangeTreeNode<T, P>;
+ friend struct MemoryRangeTreeNode<value_type, value_accessor,
property_type>;

public:
- typedef P Properties;
- typedef T Item;
-
- typedef MemoryRangeTreeNode<T, P> Node;
-// // definitions to make the iterator's code compatible with this class
-// typedef const MemoryMapNode* T;
+ typedef property_type Properties;
+ typedef value_type Item;
+
+ typedef MemoryRangeTreeNode<value_type, value_accessor, property_type>
Node;
/// This type is returned by certain functions of this class
- typedef QSet<T> ItemSet;
+ typedef QSet<value_type> ItemSet;

// Forward declaration
class const_iterator;
@@ -150,9 +184,8 @@
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef qptrdiff difference_type;
- typedef T value_type;
- typedef T *pointer;
- typedef T &reference;
+ typedef value_type *pointer;
+ typedef value_type &reference;
Node *i;
typename ItemSet::iterator it;
inline iterator() : i(0) {}
@@ -160,8 +193,8 @@
inline iterator(Node *n, typename ItemSet::iterator it) : i(n),
it(it) {}
inline iterator(const iterator &o) : i(o.i), it(o.it) {}
inline iterator &operator=(const iterator &o) { i = o.i; it =
o.it; return *this; }
- inline const T &operator*() const { return it.operator*(); }
- inline const T *operator->() const { return it.operator->(); }
+ inline const value_type &operator*() const { return
it.operator*(); }
+ inline const value_type *operator->() const { return
it.operator->(); }
inline bool operator==(const iterator &o) const { return i == o.i
&& it == o.it; }
inline bool operator!=(const iterator &o) const { return i != o.i |
| it != o.it; }
inline bool operator==(const const_iterator &o) const { return i
== o.i && it == o.it; }
@@ -204,9 +237,8 @@
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef qptrdiff difference_type;
- typedef T value_type;
- typedef const T *pointer;
- typedef const T &reference;
+ typedef const value_type *pointer;
+ typedef const value_type &reference;
Node *i;
typename ItemSet::const_iterator it;
inline const_iterator() : i(0) {}
@@ -215,8 +247,8 @@
inline const_iterator(const const_iterator &o) : i(o.i), it(o.it)
{}
inline const_iterator(iterator ci) : i(ci.i), it(ci.it) {}
inline const_iterator &operator=(const const_iterator &o) { i =
o.i; it = o.it; return *this; }
- inline const T &operator*() const { return it.operator*(); }
- inline const T *operator->() const { return it.operator->(); }
+ inline const value_type &operator*() const { return
it.operator*(); }
+ inline const value_type *operator->() const { return
it.operator->(); }
inline bool operator==(const const_iterator &o) const { return i
== o.i && it == o.it; }
inline bool operator!=(const const_iterator &o) const { return
i != o.i || it != o.it; }
inline const_iterator &operator++() { if (++it == i->items.end())
goNext(false); return *this; }
@@ -298,16 +330,7 @@
* range into the tree.
* @param item the object to insert
*/
- void insert(T item);
-
- /**
- * Inserts the given MemoryMapNode object within the range \a
mmAddrStart to
- * \a mmAddrEnd into the tree.
- * @param item the object to insert
- * @param mmAddrStart start address of mapping
- * @param mmAddrEnd end address of mapping
- */
- void insert(T item, quint64 mmAddrStart, quint64 mmAddrEnd);
+ void insert(value_type item);

/**
* Finds all objects at a given memory address.
@@ -382,8 +405,8 @@


//------------------------------------------------------------------------------

-template<class T, class P>
-MemoryRangeTreeNode<T, P>::MemoryRangeTreeNode(Tree* tree,
+template<class value_type, class value_accessor, class property_type>
+MemoryRangeTreeNode<value_type, value_accessor,
property_type>::MemoryRangeTreeNode(Tree* tree,
quint64 addrStart, quint64 addrEnd, MemoryRangeTreeNode* parent)
: tree(tree), parent(parent), lChild(0), rChild(0), next(0), prev(0),
addrStart(addrStart), addrEnd(addrEnd)
@@ -395,15 +418,15 @@
}


-template<class T, class P>
-MemoryRangeTreeNode<T, P>::~MemoryRangeTreeNode()
+template<class value_type, class value_accessor, class property_type>
+MemoryRangeTreeNode<value_type, value_accessor,
property_type>::~MemoryRangeTreeNode()
{
--tree->_size;
}


-template<class T, class P>
-void MemoryRangeTreeNode<T, P>::deleteChildren()
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTreeNode<value_type, value_accessor,
property_type>::deleteChildren()
{
if (lChild) {
lChild->deleteChildren();
@@ -418,31 +441,33 @@
}


-template<class T, class P>
-void MemoryRangeTreeNode<T, P>::insert(T item,
- quint64 mmAddrStart, quint64 mmAddrEnd)
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTreeNode<value_type, value_accessor,
property_type>::insert(
+ value_type item /*,
+ quint64 mmAddrStart, quint64 mmAddrEnd*/)
{
properties.update(item);

if (isLeaf()) {
- if (item)
- items.insert(item);
+ items.insert(item);
// If the MemoryMapNode doesn't stretch over this node's entire
// region, then split split up this MemoryRangeTreeNode
- if (mmAddrStart > addrStart || mmAddrEnd < addrEnd)
- split(mmAddrStart, mmAddrEnd);
+ if (value_accessor::address(item) > addrStart ||
+ value_accessor::endAddress(item) < addrEnd)
+ split();
}
else {
- if (mmAddrStart <= lChild->addrEnd)
- lChild->insert(item, mmAddrStart, mmAddrEnd);
- if (mmAddrEnd >= rChild->addrStart)
- rChild->insert(item, mmAddrStart, mmAddrEnd);
+ if (value_accessor::address(item) <= lChild->addrEnd)
+ lChild->insert(item);
+ if (value_accessor::endAddress(item) >= rChild->addrStart)
+ rChild->insert(item);
}
}


-template<class T, class P>
-inline void MemoryRangeTreeNode<T, P>::split(quint64 mmAddrStart, quint64
mmAddrEnd)
+template<class value_type, class value_accessor, class property_type>
+inline void MemoryRangeTreeNode<value_type, value_accessor,
property_type>::split()
+// quint64 mmAddrStart, quint64 mmAddrEnd)
{
assert(lChild == 0 && rChild == 0);
assert(addrEnd > addrStart);
@@ -476,11 +501,10 @@
for (typename ItemSet::iterator it = items.begin(); it != items.end();
++it)
{
- T item = *it;
- if (mmAddrStart <= lAddrEnd)
- lChild->insert(item, mmAddrStart, mmAddrEnd);
- if (mmAddrEnd >= rAddrStart)
- rChild->insert(item, mmAddrStart, mmAddrEnd);
+ if (value_accessor::address(*it) <= lAddrEnd)
+ lChild->insert(*it);
+ if (value_accessor::endAddress(*it) >= rAddrStart)
+ rChild->insert(*it);
}

items.clear();
@@ -488,9 +512,9 @@


#ifdef ENABLE_DOT_CODE
-template<class T, class P>
-void MemoryRangeTreeNode<T, P>::outputDotCode(quint64 addrRangeStart,
- quint64 addrRangeEnd, QTextStream& out) const
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTreeNode<value_type, value_accessor,
property_type>::outputDotCode(
+ quint64 addrRangeStart, quint64 addrRangeEnd, QTextStream& out)
const
{
int width = tree->addrSpaceEnd() > (1ULL << 32) ? 16 : 8;

@@ -507,7 +531,7 @@
// Move all items to one or both of the children
for (typename ItemSet::const_iterator it = items.begin(); it !=
items.end(); ++it)
{
- T item = *it;
+ value_type item = *it;
if (!s.isEmpty())
s += "\\n";
s += QString("%1: 0x%2 - 0x%3 (%4 byte)")
@@ -581,37 +605,37 @@
}

// Instance of static variable
-template<class T, class P>
-int MemoryRangeTreeNode<T, P>::nodeId = 0;
+template<class value_type, class value_accessor, class property_type>
+int MemoryRangeTreeNode<value_type, value_accessor, property_type>::nodeId
= 0;
#endif


//------------------------------------------------------------------------------

// Instances of static variables
-template<class T, class P>
-typename MemoryRangeTree<T, P>::ItemSet MemoryRangeTree<T,
P>::_emptyNodeSet;
-
-template<class T, class P>
-typename MemoryRangeTree<T, P>::Properties MemoryRangeTree<T,
P>::_emptyProperties;
+template<class value_type, class value_accessor, class property_type>
+typename MemoryRangeTree<value_type, value_accessor,
property_type>::ItemSet MemoryRangeTree<value_type, value_accessor,
property_type>::_emptyNodeSet;
+
+template<class value_type, class value_accessor, class property_type>
+typename MemoryRangeTree<value_type, value_accessor,
property_type>::Properties MemoryRangeTree<value_type, value_accessor,
property_type>::_emptyProperties;


-template<class T, class P>
-MemoryRangeTree<T, P>::MemoryRangeTree(quint64 addrSpaceEnd)
+template<class value_type, class value_accessor, class property_type>
+MemoryRangeTree<value_type, value_accessor,
property_type>::MemoryRangeTree(quint64 addrSpaceEnd)
: _root(0), _first(0), _last(0), _size(0), _addrSpaceEnd(addrSpaceEnd),
_objectCount(0)
{
}


-template<class T, class P>
-MemoryRangeTree<T, P>::~MemoryRangeTree()
+template<class value_type, class value_accessor, class property_type>
+MemoryRangeTree<value_type, value_accessor,
property_type>::~MemoryRangeTree()
{
clear();
}


-template<class T, class P>
-void MemoryRangeTree<T, P>::clear()
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTree<value_type, value_accessor, property_type>::clear()
{
if (!_root)
return;
@@ -629,35 +653,29 @@
}


-template<class T, class P>
-void MemoryRangeTree<T, P>::insert(T item)
-{
- insert(item, item->address(), item->endAddress());
-}
-
-
-template<class T, class P>
-void MemoryRangeTree<T, P>::insert(T item, quint64 mmAddrStart,
- quint64 mmAddrEnd)
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTree<value_type, value_accessor,
property_type>::insert(value_type item)
{
// Insert the first node
if (!_root)
_root = _first = _last =
new Node(this, 0, _addrSpaceEnd);
- _root->insert(item, mmAddrStart, mmAddrEnd);
+ _root->insert(item);
++_objectCount;
}
+
+

#ifdef ENABLE_DOT_CODE
-template<class T, class P>
-void MemoryRangeTree<T, P>::outputDotFile(const QString& filename) const
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTree<value_type, value_accessor,
property_type>::outputDotFile(const QString& filename) const
{
outputSubtreeDotFile(0, _addrSpaceEnd, filename);
}


-template<class T, class P>
-void MemoryRangeTree<T, P>::outputSubtreeDotFile(quint64 addrStart,
quint64 addrEnd,
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTree<value_type, value_accessor,
property_type>::outputSubtreeDotFile(quint64 addrStart, quint64 addrEnd,
const QString& filename) const
{
normalizeInterval(addrStart, addrEnd);
@@ -665,14 +683,9 @@
QFile outFile;
QTextStream out;

- // Write to the console, if no file name given
- if (filename.isEmpty())
- out.setDevice(shell->out().device());
- else {
- outFile.setFileName(filename);
- assert(outFile.open(QIODevice::WriteOnly));
- out.setDevice(&outFile);
- }
+ outFile.setFileName(filename);
+ assert(outFile.open(QIODevice::WriteOnly));
+ out.setDevice(&outFile);

// Write header, data and footer
out << "/* Generated " << QDateTime::currentDateTime().toString() << "
*/"
@@ -685,9 +698,9 @@
}
#endif

-template<class T, class P>
-const typename MemoryRangeTree<T, P>::ItemSet&
-MemoryRangeTree<T, P>::objectsAt(quint64 address) const
+template<class value_type, class value_accessor, class property_type>
+const typename MemoryRangeTree<value_type, value_accessor,
property_type>::ItemSet&
+MemoryRangeTree<value_type, value_accessor,
property_type>::objectsAt(quint64 address) const
{
// Make sure the tree isn't empty and the address is in range
if (!_root || address > _addrSpaceEnd)
@@ -705,8 +718,8 @@
}


-template<class T, class P>
-void MemoryRangeTree<T, P>::normalizeInterval(quint64 &addrStart, quint64
&addrEnd) const
+template<class value_type, class value_accessor, class property_type>
+void MemoryRangeTree<value_type, value_accessor,
property_type>::normalizeInterval(quint64 &addrStart, quint64 &addrEnd)
const
{
if (addrEnd > _addrSpaceEnd)
addrEnd = _addrSpaceEnd;
@@ -719,9 +732,9 @@
}


-template<class T, class P>
-typename MemoryRangeTree<T, P>::ItemSet
-MemoryRangeTree<T, P>::objectsInRange(quint64 addrStart, quint64 addrEnd)
const
+template<class value_type, class value_accessor, class property_type>
+typename MemoryRangeTree<value_type, value_accessor,
property_type>::ItemSet
+MemoryRangeTree<value_type, value_accessor,
property_type>::objectsInRange(quint64 addrStart, quint64 addrEnd) const
{
normalizeInterval(addrStart, addrEnd);
// Make sure the tree isn't empty and the address is in range
@@ -748,9 +761,9 @@
}


-template<class T, class P>
-const typename MemoryRangeTree<T, P>::Properties&
-MemoryRangeTree<T, P>::propertiesAt(quint64 address) const
+template<class value_type, class value_accessor, class property_type>
+const typename MemoryRangeTree<value_type, value_accessor,
property_type>::Properties&
+MemoryRangeTree<value_type, value_accessor,
property_type>::propertiesAt(quint64 address) const
{
// Make sure the tree isn't empty and the address is in range
if (!_root || address > _addrSpaceEnd)
@@ -768,9 +781,9 @@
}


-template<class T, class P>
-typename MemoryRangeTree<T, P>::Properties
-MemoryRangeTree<T, P>::propertiesOfRange(quint64 addrStart,
+template<class value_type, class value_accessor, class property_type>
+typename MemoryRangeTree<value_type, value_accessor,
property_type>::Properties
+MemoryRangeTree<value_type, value_accessor,
property_type>::propertiesOfRange(quint64 addrStart,
quint64 addrEnd) const
{
normalizeInterval(addrStart, addrEnd);
=======================================
--- /trunk/insightd/shell.cpp Thu May 3 09:57:38 2012
+++ /trunk/insightd/shell.cpp Mon May 7 11:46:48 2012
@@ -103,6 +103,7 @@
qRegisterMetaType<QAbstractSocket::SocketError>();

// Register all commands
+/*
#ifdef CONFIG_MEMORY_MAP
_commands.insert("diff",
Command(
@@ -113,6 +114,7 @@
"be specified by a shell file glob pattern or by explicit
file names.\n"
" diff [min. probability] <file pattern 1> [<file pattern
2> ...]"));
#endif
+*/

_commands.insert("exit",
Command(
@@ -1878,10 +1880,10 @@
}

int ret = 0;
- if (QString("physical").startsWith(type) ||
QString("pmem").startsWith(type))
+ /*if (QString("physical").startsWith(type) ||
QString("pmem").startsWith(type))

memMapWindow->mapWidget()->setMap(&_memDumps[index]->map()->pmemMap(),
_memDumps[index]->memSpecs());
- else if (QString("virtual").startsWith(type) ||
QString("vmem").startsWith(type))
+ else*/ if (QString("virtual").startsWith(type) ||
QString("vmem").startsWith(type))

memMapWindow->mapWidget()->setMap(&_memDumps[index]->map()->vmemMap(),
_memDumps[index]->memSpecs());
else {
@@ -2782,6 +2784,7 @@
return ecOk;
}

+/*
#ifdef CONFIG_MEMORY_MAP

int Shell::cmdDiffVectors(QStringList args)
@@ -2918,20 +2921,20 @@

// Iterate over all changes
const MemoryDiffTree& diff = _memDumps[j]->map()->pmemDiff();
- const MemoryMapRangeTree& currPMemMap =
_memDumps[j]->map()->pmemMap();
+ const PhysMemoryMapRangeTree& currPMemMap =
_memDumps[j]->map()->pmemMap();
const MemoryMapRangeTree& prevVMemMap =
_memDumps[prevj]->map()->vmemMap();
for (MemoryDiffTree::const_iterator it = diff.constBegin();
it != diff.constEnd() && !_interrupted; ++it)
{
- MemoryMapRangeTree::ItemSet curr =
currPMemMap.objectsInRange(
+ PhysMemoryMapRangeTree::ItemSet curr =
currPMemMap.objectsInRange(
it->startAddr, it->startAddr + it->runLength - 1);

- for (MemoryMapRangeTree::ItemSet::const_iterator cit =
+ for (PhysMemoryMapRangeTree::ItemSet::const_iterator cit =
curr.constBegin();
cit != curr.constEnd() && !_interrupted;
++cit)
{
- const MemoryMapNode* cnode = *cit;
+ const PhysMemoryMapNode& cnode = *cit;

// Try to find the object in the previous dump
const MemoryMapRangeTree::ItemSet& prev =
prevVMemMap.objectsAt(cnode->address());
@@ -2979,6 +2982,7 @@
}

#endif
+*/

void Shell::printTimeStamp(const QTime& time)
{
=======================================
--- /trunk/insightd/shell.h Thu May 3 09:57:38 2012
+++ /trunk/insightd/shell.h Mon May 7 11:46:48 2012
@@ -269,7 +269,7 @@
void hline(int width = 60);
int parseMemDumpIndex(QStringList &args, int skip = 0, bool quiet =
false);
//---------------------------------
- int cmdDiffVectors(QStringList args);
+// int cmdDiffVectors(QStringList args);
int cmdExit(QStringList args);
int cmdHelp(QStringList args);
int cmdColor(QStringList args);
Reply all
Reply to author
Forward
0 new messages