|
From: <sv...@va...> - 2009-01-06 22:16:55
|
Author: sewardj
Date: 2009-01-06 22:16:52 +0000 (Tue, 06 Jan 2009)
New Revision: 451
Log:
Initial changes to support Valgrind 3.4.x:
* configure.in: require Valgrind version 3.4.x, and fix a couple of
quoting problems
* support option --track-origins=yes|no [no]
* remove option --undef-value-errors=yes|no [yes]
* Memcheck::saveParsedOutput: don't use QDir::rename to move the
logfile to its final destination, since that fails when src and dst
are not in the same partition. Copy and delete the original
instead.
* Support XML Protocol 3 (Memcheck 3.4.x output).
* New function VgElement::getNextSibling.
* Allow arbitrary numbers of <logfilequalifier>s, not just one or zero
(a Protocol 3 change)
* Allow <origin> sections in error messages (a Protocol 3 change)
Modified:
trunk/valkyrie/core/memcheck_object.cpp
trunk/valkyrie/core/memcheck_object.h
trunk/valkyrie/help/html_urls.cpp
trunk/valkyrie/help/html_urls.h
trunk/valkyrie/options/memcheck_options_page.cpp
trunk/valkyrie/tool_utils/vglog.cpp
trunk/valkyrie/tool_utils/vglog.h
trunk/valkyrie/tool_views/vglogview.cpp
Modified: trunk/valkyrie/core/memcheck_object.cpp
===================================================================
--- trunk/valkyrie/core/memcheck_object.cpp 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/core/memcheck_object.cpp 2009-01-06 22:16:52 UTC (rev 451)
@@ -77,12 +77,18 @@
"Show reachable blocks in leak check",
"show reachable blocks in leak check?",
urlMemcheck::Showreach );
- addOpt( UNDEF_VAL, VkOPTION::ARG_BOOL, VkOPTION::WDG_CHECK,
- "memcheck", '\0', "undef-value-errors",
- "<yes|no>", "yes|no", "yes",
- "Check for undefined value errors",
- "check for undefined value errors?",
- urlMemcheck::UndefVal );
+ //addOpt( UNDEF_VAL, VkOPTION::ARG_BOOL, VkOPTION::WDG_CHECK,
+ // "memcheck", '\0', "undef-value-errors",
+ // "<yes|no>", "yes|no", "yes",
+ // "Check for undefined value errors",
+ // "check for undefined value errors?",
+ // urlMemcheck::UndefVal );
+ addOpt( TRACK_ORI, VkOPTION::ARG_BOOL, VkOPTION::WDG_CHECK,
+ "memcheck", '\0', "track-origins",
+ "<yes|no>", "yes|no", "no",
+ "Show the origins of uninitialised values",
+ "show the origins of uninitialised values?",
+ urlMemcheck::TrackOri );
addOpt( PARTIAL, VkOPTION::ARG_BOOL, VkOPTION::WDG_CHECK,
"memcheck", '\0', "partial-loads-ok",
"<yes|no>", "yes|no", "no",
@@ -91,7 +97,7 @@
urlMemcheck::Partial );
addOpt( FREELIST, VkOPTION::ARG_UINT, VkOPTION::WDG_LEDIT,
"memcheck", '\0', "freelist-vol",
- "<number>", "0|1000000000", "5000000",
+ "<number>", "0|1000000000", "10000000",
"Volume of freed blocks queue:",
"volume of freed blocks queue",
urlMemcheck::Freelist );
@@ -124,7 +130,8 @@
case FREELIST:
case LEAK_RES:
case SHOW_REACH:
- case UNDEF_VAL:
+ //case UNDEF_VAL:
+ case TRACK_ORI:
case GCC_296:
case ALIGNMENT:
opt->isValidArg( &errval, argval );
@@ -704,11 +711,25 @@
bool ok;
if (!m_fileSaved) {
/* first save after a run, so just rename m_saveFname => fname */
- //vkPrint("renaming: '%s' -> '%s'", m_saveFname.latin1(), fname.latin1() );
- ok = QDir().rename( m_saveFname, fname );
+ if (0) vkPrint("renaming: '%s' -> '%s'",
+ m_saveFname.latin1(), fname.latin1() );
+ if (m_saveFname != fname) {
+ ok = FileCopy( m_saveFname, fname );
+ if (ok)
+ ok = QDir().remove( m_saveFname );
+ } else {
+ ok = true; // no need to do anything
+ }
+ // OLD:
+ //ok = QDir().rename( m_saveFname, fname );
+ // but we can't just rename, because that fails when the src
+ // and dst files are in different partitions. The longwinded
+ // but more reliable solution is to copy and then delete the
+ // original.
} else {
/* we've saved once already: must now copy m_saveFname => fname */
- //vkPrint("copying: '%s' -> '%s'", m_saveFname.latin1(), fname.latin1() );
+ if (0) vkPrint("copying: '%s' -> '%s'",
+ m_saveFname.latin1(), fname.latin1() );
ok = FileCopy( m_saveFname, fname );
}
if (ok) {
Modified: trunk/valkyrie/core/memcheck_object.h
===================================================================
--- trunk/valkyrie/core/memcheck_object.h 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/core/memcheck_object.h 2009-01-06 22:16:52 UTC (rev 451)
@@ -46,7 +46,8 @@
LEAK_CHECK,
LEAK_RES,
SHOW_REACH,
- UNDEF_VAL,
+ //UNDEF_VAL,
+ TRACK_ORI,
PARTIAL,
FREELIST,
GCC_296,
Modified: trunk/valkyrie/help/html_urls.cpp
===================================================================
--- trunk/valkyrie/help/html_urls.cpp 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/help/html_urls.cpp 2009-01-06 22:16:52 UTC (rev 451)
@@ -49,7 +49,7 @@
const char* binFlags = "options_dialog.html#bin_flags";
const char* vgDir = "options_dialog.html#valgrind";
- /* valgrind`s options page: tab Suppressions */
+ /* valgrind's options page: tab Suppressions */
const char* coreTab = "options_valgrind.html#core_tab";
const char* errorTab = "options_valgrind.html#error_tab";
const char* suppsTab = "options_valgrind.html#supps_tab";
@@ -106,7 +106,8 @@
const char* optsMC = "vg-manual-mc.html";
const char* Leakcheck = "vg-manual-mc.html#leakcheck";
const char* Showreach = "vg-manual-mc.html#showreach";
- const char* UndefVal = "vg-manual-mc.html#undefvalerrs";
+ //const char* UndefVal = "vg-manual-mc.html#undefvalerrs";
+ const char* TrackOri = "vg-manual-mc.html#undefvalerrs";
const char* Leakres = "vg-manual-mc.html#leakres";
const char* Freelist = "vg-manual-mc.html#freelist";
const char* gcc296 = "vg-manual-mc.html#gcc296";
Modified: trunk/valkyrie/help/html_urls.h
===================================================================
--- trunk/valkyrie/help/html_urls.h 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/help/html_urls.h 2009-01-06 22:16:52 UTC (rev 451)
@@ -103,7 +103,8 @@
extern const char* Leakcheck;
extern const char* Leakres;
extern const char* Showreach;
- extern const char* UndefVal;
+ //extern const char* UndefVal;
+ extern const char* TrackOri;
extern const char* gcc296;
}
Modified: trunk/valkyrie/options/memcheck_options_page.cpp
===================================================================
--- trunk/valkyrie/options/memcheck_options_page.cpp 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/options/memcheck_options_page.cpp 2009-01-06 22:16:52 UTC (rev 451)
@@ -37,8 +37,10 @@
optionWidget( Memcheck::LEAK_CHECK, group1, true ) );
m_itemList.insert( Memcheck::SHOW_REACH, /* checkbox */
optionWidget( Memcheck::SHOW_REACH, group1, false ) );
- m_itemList.insert( Memcheck::UNDEF_VAL, /* checkbox */
- optionWidget( Memcheck::UNDEF_VAL, group1, false ) );
+ //m_itemList.insert( Memcheck::UNDEF_VAL, /* checkbox */
+ // optionWidget( Memcheck::UNDEF_VAL, group1, false ) );
+ m_itemList.insert( Memcheck::TRACK_ORI, /* checkbox */
+ optionWidget( Memcheck::TRACK_ORI, group1, false ) );
m_itemList.insert( Memcheck::PARTIAL, /* checkbox */
optionWidget( Memcheck::PARTIAL, group1, false ) );
@@ -66,7 +68,7 @@
grid1->addLayout( m_itemList[Memcheck::LEAK_CHECK]->hlayout(), row++, 0 );
grid1->addWidget( m_itemList[Memcheck::SHOW_REACH]->widget(), row++, 0 );
- grid1->addWidget( m_itemList[Memcheck::UNDEF_VAL]->widget(), row++, 0 );
+ //grid1->addWidget( m_itemList[Memcheck::UNDEF_VAL]->widget(), row++, 0 );
grid1->addMultiCellWidget( sep(group1,"sep1"), row,row, 0,1 );
#if (QT_VERSION-0 >= 0x030200)
@@ -75,6 +77,7 @@
grid1->addRowSpacing( row++, m_topSpace ); /* add a bit more space here */
#endif
+ grid1->addWidget( m_itemList[Memcheck::TRACK_ORI]->widget(), row++, 0 );
grid1->addWidget( m_itemList[Memcheck::PARTIAL]->widget(), row++, 0 );
grid1->addWidget( m_itemList[Memcheck::GCC_296]->widget(), row++, 0 );
Modified: trunk/valkyrie/tool_utils/vglog.cpp
===================================================================
--- trunk/valkyrie/tool_utils/vglog.cpp 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/tool_utils/vglog.cpp 2009-01-06 22:16:52 UTC (rev 451)
@@ -112,6 +112,11 @@
return VgElement();
}
+VgElement VgElement::getNextSibling() const
+{
+ QDomElement e = nextSibling().toElement();
+ return (VgElement&)e;
+}
VgElement::ElemType VgElement::elemType()
{
@@ -574,7 +579,8 @@
switch ( type ) {
case VgElement::PROTOCOL:
- if ( elem.text() != "1" && elem.text() != "2" ) {
+ if ( elem.text() != "1"
+ && elem.text() != "2" && elem.text() != "3" ) {
vklmPrintErr("VgLog::appendNode(): bad xml protocol version");
return false;
}
@@ -626,8 +632,18 @@
VgElement VgLog::tool()
{ return docroot().getFirstElem("tool"); }
-VgElement VgLog::logqual()
-{ return docroot().getFirstElem("logfilequalifier"); }
+VgLogQualList VgLog::logquals()
+{
+ VgLogQualList list;
+ QDomElement e = docroot().firstChild().toElement();
+ for ( ; !e.isNull(); e=e.nextSibling().toElement() ) {
+ if (e.tagName() == "logfilequalifier") {
+ VgLogQual lq = (VgLogQual&)e;
+ list.append( lq );
+ }
+ }
+ return list;
+}
VgElement VgLog::comment()
{ return docroot().getFirstElem("usercomment"); }
Modified: trunk/valkyrie/tool_utils/vglog.h
===================================================================
--- trunk/valkyrie/tool_utils/vglog.h 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/tool_utils/vglog.h 2009-01-06 22:16:52 UTC (rev 451)
@@ -27,8 +27,11 @@
class VgElement : public QDomElement
{
public:
+ // shouldn't the following two really be called
+ // getFirstChild and getLastChild?
VgElement getFirstElem( QString tagname ) const;
VgElement getLastElem( QString tagname ) const;
+ VgElement getNextSibling() const;
bool isLeaf();
/* leaf functions */
@@ -70,6 +73,14 @@
};
/**********************************************************************/
+class VgLogQual : public VgElement
+{
+public:
+};
+
+typedef QValueList<VgLogQual> VgLogQualList;
+
+/**********************************************************************/
class VgFrame : public VgElement
{
public:
@@ -187,21 +198,21 @@
bool mergeLeakErrors( VgErrorList sLeakErrors );
public:
- VgElement docroot(); /* document element: <valgrindoutput/> */
- VgElement protocol();
- VgPreamble preamble();
- VgElement pid();
- VgElement ppid();
- VgElement tool();
- VgElement logqual();
- VgElement comment();
- VgElement args();
- VgStatus status_beg();
- VgErrorList errors(); /* errors (non-leak) before status_end */
- VgErrCounts errorcounts(); /* last errcounts element */
- VgStatus status_end();
- VgSuppCounts suppcounts();
- VgErrorList leaks(); /* leak errors after status_end */
+ VgElement docroot(); /* document element: <valgrindoutput/> */
+ VgElement protocol();
+ VgPreamble preamble();
+ VgElement pid();
+ VgElement ppid();
+ VgElement tool();
+ VgLogQualList logquals();
+ VgElement comment();
+ VgElement args();
+ VgStatus status_beg();
+ VgErrorList errors(); /* errors (non-leak) before status_end */
+ VgErrCounts errorcounts(); /* last errcounts element */
+ VgStatus status_end();
+ VgSuppCounts suppcounts();
+ VgErrorList leaks(); /* leak errors after status_end */
private:
QDomDocument log;
Modified: trunk/valkyrie/tool_views/vglogview.cpp
===================================================================
--- trunk/valkyrie/tool_views/vglogview.cpp 2009-01-06 22:04:20 UTC (rev 450)
+++ trunk/valkyrie/tool_views/vglogview.cpp 2009-01-06 22:16:52 UTC (rev 451)
@@ -179,7 +179,7 @@
VK_DEBUG("can't read start-time string\n");
}
}
- else if (protocol == "2") {
+ else if (protocol == "2" || protocol == "3") {
// Valgrind >= v3.1 outputs a count only
/* start count */
ret = sscanf( stime.ascii(), "%d:%d:%d:%d.%4d",
@@ -322,11 +322,13 @@
{
if ( open && childCount() == 0 ) {
VgOutputItem* after = 0;
+
+ /* handle any number of log-file-qualifiers */
VgElement logqual = elem.getFirstElem("logfilequalifier");
- /* may / may not have log-file-qualifier */
- if ( ! logqual.isNull() ) {
+ while (!logqual.isNull() && logqual.tagName() == "logfilequalifier") {
after = new LogQualItem( this, logqual );
after->setOpen( true );
+ logqual = logqual.getNextSibling();
}
VgElement comment = elem.getFirstElem("usercomment");
@@ -518,6 +520,24 @@
new StackItem( this, after, auxstack );
}
+ /* origin */
+ VgElement origin = elem.getFirstElem( "origin" );
+ if ( ! origin.isNull() ) {
+ VgElement ori_what = origin.getFirstElem( "what" );
+ VgElement ori_stack = ori_what.getNextSibling();
+
+ VgOutputItem* zzz_aux_item = new VgOutputItem( this, after, ori_what );
+ zzz_aux_item->setText( ori_what.text() );
+ after = zzz_aux_item;
+
+ // }
+ // /* aux stack */
+ // QDomElement aux_stack = aux_what.nextSibling().toElement();
+ // if ( ! aux_stack.isNull() ) {
+ StackItem* si = new StackItem( this, after, ori_stack );
+ si->setOpen(true);
+ }
+
/* J sez there may be more than two stacks in the future .. */
vk_assert( aux_stack.nextSibling().isNull() );
}
|