|
From: <sv...@va...> - 2010-01-08 09:19:06
|
Author: cerion
Date: 2010-01-08 09:18:57 +0000 (Fri, 08 Jan 2010)
New Revision: 463
Log:
moved 'core' dir to 'objects' - else confusion with core dumps etc.
Added:
branches/valkyrie_qt4port/objects/
branches/valkyrie_qt4port/objects/valgrind_object.cpp
branches/valkyrie_qt4port/objects/valgrind_object.h
branches/valkyrie_qt4port/objects/valkyrie_object.cpp
branches/valkyrie_qt4port/objects/valkyrie_object.h
branches/valkyrie_qt4port/objects/vk_objects.cpp
branches/valkyrie_qt4port/objects/vk_objects.h
Removed:
branches/valkyrie_qt4port/core/
branches/valkyrie_qt4port/objects/valgrind_object.cpp
branches/valkyrie_qt4port/objects/valgrind_object.h
branches/valkyrie_qt4port/objects/valkyrie_object.cpp
branches/valkyrie_qt4port/objects/valkyrie_object.h
branches/valkyrie_qt4port/objects/vk_objects.cpp
branches/valkyrie_qt4port/objects/vk_objects.h
Modified:
branches/valkyrie_qt4port/main.cpp
branches/valkyrie_qt4port/mainwindow.h
branches/valkyrie_qt4port/options/valgrind_options_page.cpp
branches/valkyrie_qt4port/options/valkyrie_options_page.cpp
branches/valkyrie_qt4port/options/vk_option.cpp
branches/valkyrie_qt4port/options/vk_options_dialog.cpp
branches/valkyrie_qt4port/options/vk_options_page.h
branches/valkyrie_qt4port/utils/vk_config.h
branches/valkyrie_qt4port/valkyrie.pro
Modified: branches/valkyrie_qt4port/main.cpp
===================================================================
--- branches/valkyrie_qt4port/main.cpp 2010-01-08 00:46:31 UTC (rev 462)
+++ branches/valkyrie_qt4port/main.cpp 2010-01-08 09:18:57 UTC (rev 463)
@@ -21,7 +21,7 @@
#include <QtGui/QApplication>
-#include "core/valkyrie_object.h"
+#include "objects/valkyrie_object.h"
#include "toolview/toolview.h"
#include "mainwindow.h"
Modified: branches/valkyrie_qt4port/mainwindow.h
===================================================================
--- branches/valkyrie_qt4port/mainwindow.h 2010-01-08 00:46:31 UTC (rev 462)
+++ branches/valkyrie_qt4port/mainwindow.h 2010-01-08 09:18:57 UTC (rev 463)
@@ -29,7 +29,7 @@
#include <QToolButton>
#include <QVBoxLayout>
-#include "core/valkyrie_object.h"
+#include "objects/valkyrie_object.h"
#include "options/vk_options_dialog.h"
#include "toolview/toolview.h"
Copied: branches/valkyrie_qt4port/objects (from rev 461, branches/valkyrie_qt4port/core)
Property changes on: branches/valkyrie_qt4port/objects
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: branches/valkyrie_qt4port/objects/valgrind_object.cpp
===================================================================
--- branches/valkyrie_qt4port/core/valgrind_object.cpp 2009-12-19 23:12:34 UTC (rev 461)
+++ branches/valkyrie_qt4port/objects/valgrind_object.cpp 2010-01-08 09:18:57 UTC (rev 463)
@@ -1,838 +0,0 @@
-/****************************************************************************
-** Valgrind implementation
-** - Valgrind-specific: options / flags / functionality
-** --------------------------------------------------------------------------
-**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
-** <in...@op...>
-**
-** This file is part of Valkyrie, a front-end for Valgrind.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 as published by the Free Software Foundation
-** and appearing in the file COPYING included in the packaging of
-** this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#include <QDir>
-
-#include "core/valgrind_object.h"
-#include "options/valgrind_options_page.h" // createVkOptionsPage()
-
-//#include "config.h" // VK_CFG_DIR, VK_SUPPS_DIR
-//#include "vk_config.h"
-//#include "html_urls.h"
-//#include "memcheck_object.h"
-//#include "cachegrind_object.h"
-//#include "massif_object.h"
-//#include "vk_option.h" // PERROR* and friends
-//#include "vk_utils.h" // vk_assert, VK_DEBUG, etc.
-
-
-//TODO: from config.h
-#define VK_CFG_DIR ".valkyrie"
-#define VK_SUPPS_DIR "suppressions/"
-
-//#include <ctype.h>
-//#include <stdlib.h>
-//#include <string.h>
-//#include <stdio.h>
-
-
-/***************************************************************************/
-/*!
- Constructs a Valkyrie object
-*/
-Valgrind::Valgrind()
- : VkObject( "valgrind" )
- // : VkObject( "Valgrind", "Valgrind", Qt::Key_unknown, VkObject::ID_VALGRIND )
-{
- // /* init tools */
- // initToolObjects();``
-
- setupOptions();
-}
-
-
-Valgrind::~Valgrind()
-{
- // m_toolObjList.setAutoDelete( true );
- // m_toolObjList.clear();
-}
-
-
-
-/*!
- Setup the options for this object.
-
- Note: These opts should be kept in exactly the same order as valgrind
- outputs them, as it makes keeping up-to-date a lot easier.
-*/
-void Valgrind::setupOptions()
-{
-
- // ------------------------------------------------------------
- // tool
- options.addOpt(
- VALGRIND::TOOL,
- this->objectName(),
- "tool",
- '\0',
- "<name>",
- "memcheck|cachegrind|massif",
- "memcheck",
- "Main tool:",
- "use the Valgrind tool named <name>. Available tools are: memcheck, cachegrind, massif",
- "",// TODO: urlVgCore::mainTool
- VkOPT::ARG_STRING,
- VkOPT::WDG_COMBO
- );
-
-
- // ------------------------------------------------------------
- // common options relevant to all tools
- options.addOpt(
- VALGRIND::VERBOSITY,
- this->objectName(),
- "verbosity",
- '\0',
- "<0..4>",
- "0|4",
- "1",
- "Verbosity level:",
- "Be more verbose, include counts of errors",
- "",// TODO: urlVgCore::verbosity
- VkOPT::ARG_UINT,
- VkOPT::WDG_SPINBOX
- );
-
- options.addOpt(
- VALGRIND::TRACE_CH,
- this->objectName(),
- "trace-children",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Trace child processes: ",
- "Valgrind-ise child processes (follow execve)?",
- "",// TODO: urlVgCore::traceChild
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::SILENT_CH,
- this->objectName(),
- "child-silent-after-fork",
- '\0',
- "<yes|no>",
- "yes|no",
- "yes", /* currently necessary for clean XML output */
- "Omit child output between fork and exec: ",
- "omit child output between fork & exec?",
- "",// TODO: urlVgCore::silentChild
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::TRACK_FDS,
- this->objectName(),
- "track-fds",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Track open file descriptors:",
- "track open file descriptors?",
- "",// TODO: urlVgCore::trackFds
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::TIME_STAMP,
- this->objectName(),
- "time-stamp",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Add timestamps to log messages:",
- "add timestamps to log messages?",
- "",// TODO: urlVgCore::timeStamp
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::LOG_FD,
- this->objectName(),
- "log-fd",
- '\0',
- "<1..1024>",
- "1|1023",
- "2",
- "Log to file descriptor:",
- "log messages to file descriptor (1=stdout, 2=stderr)",
- "",// TODO: urlVgCore::logToFd
- VkOPT::ARG_UINT,
- VkOPT::WDG_SPINBOX
- );
-
- options.addOpt(
- VALGRIND::LOG_FILE,
- this->objectName(),
- "log-file",
- '\0',
- "<file>",
- "",
- "",
- "Log to file:",
- "log messages to <file>",
- "",// TODO: urlVgCore::logToFile
- VkOPT::ARG_STRING,
- VkOPT::WDG_LEDIT
- );
-
- options.addOpt(
- VALGRIND::LOG_SOCKET,
- this->objectName(),
- "log-socket",
- '\0',
- "<ipaddr:port>",
- "",
- "",
- "Log to socket:",
- "log messages to socket ipaddr:port",
- "",// TODO: urlVgCore::logToSocket
- VkOPT::ARG_STRING,
- VkOPT::WDG_LEDIT
- );
-
-
- // ------------------------------------------------------------
- // uncommon options relevant to all tools
- options.addOpt(
- VALGRIND::RUN_LIBC,
- this->objectName(),
- "run-libc-freeres",
- '\0',
- "<yes|no>",
- "yes|no",
- "yes",
- "Free glibc memory at exit:",
- "Free up glibc memory at exit?",
- "",// TODO: urlVgCore::freeGlibc
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::SIM_HINTS,
- this->objectName(),
- "sim-hints",
- '\0',
- "<hint1,hint2,...>",
- "none|lax-ioctls|enable-outer",
- "none",
- "Simulation Hints:",
- "Slightly modify the simulated behaviour. Recognised hints are: lax-ioctls, enable-outer. Use with caution!",
- "",// TODO: urlVgCore::simHints
- VkOPT::ARG_STRING,
- VkOPT::WDG_COMBO
- );
-
- options.addOpt(
- VALGRIND::KERN_VAR,
- this->objectName(),
- "kernel-variant",
- '\0',
- "<variant1,...>",
- "none|bproc",
- "none",
- "Kernel Variants:",
- "Handle non-standard kernel variants. Recognised variants are: bproc. Use with caution!",
- "",// TODO: urlVgCore::kernelVariant
- VkOPT::ARG_STRING,
- VkOPT::WDG_COMBO
- );
-
- options.addOpt(
- VALGRIND::EM_WARNS,
- this->objectName(),
- "show-emwarns",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Show warnings about emulation limits:",
- "show warnings about emulation limits?",
- "",// TODO: urlVgCore::showEmWarns
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::SMC_CHECK,
- this->objectName(),
- "smc-check",
- '\0',
- "<none|stack|all>",
- "none|stack|all",
- "stack",
- "Where to check for self-modifying code",
- "checks for self-modifying code: none, only for code on the stack, or all",
- "",// TODO: urlVgCore::smcSupport
- VkOPT::ARG_STRING,
- VkOPT::WDG_COMBO
- );
-
-
- // ------------------------------------------------------------
- // options relevant to error-reporting tools
- options.addOpt(
- VALGRIND::XML_OUTPUT,
- this->objectName(),
- "xml",
- '\0',
- "<yes|no>",
- "yes|no",
- "yes",
- "Output in xml format:",
- "all output is in XML",
- "",// TODO: urlVgCore::xmlOutput
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::XML_COMMENT,
- this->objectName(),
- "xml-user-comment",
- '\0',
- "<str>",
- "",
- "",
- "Insert verbatim in xml output",
- "copy <str> verbatim to XML output",
- "",// TODO: urlVgCore::xmlComment
- VkOPT::ARG_STRING,
- VkOPT::WDG_NONE
- );
-
- options.addOpt(
- VALGRIND::DEMANGLE,
- this->objectName(),
- "demangle",
- '\0',
- "<yes|no>",
- "yes|no",
- "yes",
- "Automatically demangle C++ names",
- "automatically demangle C++ names?",
- "",// TODO: urlVgCore::autoDemangle
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::NUM_CALLERS,
- this->objectName(),
- "num-callers",
- '\0',
- "<1..50>",
- "1|50",
- "12",
- "Number of stack trace callers:",
- "show <num> callers in stack traces",
- "",// TODO: urlVgCore::numCallers
- VkOPT::ARG_UINT,
- VkOPT::WDG_SPINBOX
- );
-
- options.addOpt(
- VALGRIND::ERROR_LIMIT,
- this->objectName(),
- "error-limit",
- '\0',
- "<yes|no>",
- "yes|no",
- "yes",
- "Limit the number of errors shown",
- "Stop showing new errors if too many?",
- "",// TODO: urlVgCore::errorLimit
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::SHOW_BELOW,
- this->objectName(),
- "show-below-main",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Continue stack traces below main()",
- "continue stack traces below main()",
- "",// TODO: urlVgCore::stackTraces
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
-
- // ------------------------------------------------------------
- // Can't access vkConfig->suppDir(): config created after us!
- QString defSuppDir = QDir::homePath() + "/" + VK_CFG_DIR + VK_SUPPS_DIR;
- /* list of dirs holding suppression files */
- options.addOpt(
- VALGRIND::SUPPS_DIRS,
- this->objectName(),
- "supps-dirs",
- '\0',
- "",
- "",
- defSuppDir,
- "Suppression Dirs:",
- "",
- "",// TODO: urlValkyrie::suppsTab
- VkOPT::NOT_POPT,
- VkOPT::WDG_LISTBOX
- );
-
- /* list of all suppression files found in option SUPP_DIRS */
- options.addOpt(
- VALGRIND::SUPPS_AVAIL,
- this->objectName(),
- "supps-avail",
- '\0',
- "",
- "",
- "",
- "Available error-suppression file(s):",
- "",
- "",// TODO: urlValkyrie::suppsTab
- VkOPT::NOT_POPT,
- VkOPT::WDG_LISTBOX
- );
-
- /* list of selected suppression files */
- options.addOpt(
- VALGRIND::SUPPS_SEL,
- this->objectName(),
- "suppressions",
- '\0',
- "<file1,...>",
- "",
- "",
- "Selected error-suppression file(s):",
- "suppress errors described in suppressions file(s)",
- "",// TODO: urlValkyrie::suppsTab
- VkOPT::ARG_STRING,
- VkOPT::WDG_LISTBOX
- );
-
-
- // ------------------------------------------------------------
- // ...
- options.addOpt(
- VALGRIND::GEN_SUPP,
- this->objectName(),
- "gen-suppressions",
- '\0',
- "<yes|no|all>",
- "yes|no|all",
- "no",
- "Print suppressions for errors",
- "print suppressions for errors?",
- "",// TODO: urlVgCore::genSuppressions
- VkOPT::ARG_STRING,
- VkOPT::WDG_COMBO
- );
-
- options.addOpt(
- VALGRIND::DB_ATTACH,
- this->objectName(),
- "db-attach",
- '\0',
- "<yes|no>",
- "yes|no",
- "no",
- "Start debugger on error detection",
- "start debugger when errors detected?",
- "",// TODO: urlVgCore::startDebugger
- VkOPT::ARG_BOOL,
- VkOPT::WDG_CHECK
- );
-
- options.addOpt(
- VALGRIND::DB_COMMAND,
- this->objectName(),
- "db-command",
- '\0',
- "<command>",
- "",
- "/usr/bin/gdb -nw %f %p",
- "Debugger:",
- "command to start debugger",
- "",// TODO: urlVgCore::whichDebugger
- VkOPT::ARG_STRING,
- VkOPT::WDG_LEDIT
- );
-
- options.addOpt(
- VALGRIND::INPUT_FD,
- this->objectName(),
- "input-fd",
- '\0',
- "<0..1024>",
- "0|1023",
- "0",
- "Input file descriptor:",
-
- "File descriptor for (db) input (0=stdin, 1=stdout, 2=stderr)",
- "",// TODO: urlVgCore::inputFd
- VkOPT::ARG_UINT,
- VkOPT::WDG_SPINBOX
- );
-
- options.addOpt(
- VALGRIND::MAX_SFRAME,
- this->objectName(),
- "max-stackframe",
- '\0',
- "<number>",
- "0|2000000",
- "2000000",
- "Stack switch on SP changes at:",
- "assume stack switch for stack pointer changes larger than <number> bytes",
- "",// TODO: urlVgCore::maxSFrames
- VkOPT::ARG_UINT,
- VkOPT::WDG_SPINBOX
- );
-}
-
-
-/* check argval for this option, updating if necessary.
- called by parseCmdArgs() and gui option pages -------------------- */
-int Valgrind::checkOptArg( int optid, QString& argval )
-{
-optid = optid; argval = argval;
-// vk_assert( optid >= 0 && optid < NUM_OPTS );
-
- int errval = PARSED_OK;
-
-#if 0
- Option* opt = findOption( optid );
- QString sep = vkConfig->sepChar();
-
- switch ( (Valgrind::vgOpts)optid ) {
-
- case VALGRIND::TOOL:
- /* Note: gui option disabled, so only reaches here from cmdline */
- errval = PERROR_BADOPT;
- vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
- vkPrintErr(" - Valkyrie currently only supports Memcheck.");
- break;
-
- case VALGRIND::SIM_HINTS:
- case VALGRIND::RUN_LIBC:
- case VALGRIND::NUM_CALLERS:
- case VALGRIND::DEMANGLE:
- // case VALGRIND::INPUT_FD: // TODO
- case VALGRIND::SHOW_BELOW:
- case VALGRIND::MAX_SFRAME:
- case VALGRIND::SMC_CHECK:
- opt->isValidArg( &errval, argval );
- break;
-
- case VALGRIND::VERBOSITY:
- case VALGRIND::TRACK_FDS:
- case VALGRIND::TIME_STAMP:
- case VALGRIND::EM_WARNS:
- case VALGRIND::GEN_SUPP:
- case VALGRIND::ERROR_LIMIT:
- case VALGRIND::DB_COMMAND:
- case VALGRIND::DB_ATTACH:
- /* Note: gui option disabled, so only reaches here from cmdline */
- errval = PERROR_BADOPT;
- vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
- vkPrintErr(" - Valgrind presets these options for XML output.");
- vkPrintErr(" - See valgrind/docs/internals/xml_output.txt.");
- break;
-
- case VALGRIND::XML_COMMENT:
- /* don't wan't xml in comment: escape '<','&',etc */
- argval = escapeEntities( argval );
- break;
-
- case VALGRIND::SUPPS_DIRS: { /* not popt: only reaches here from gui */
- /* check all entries are valid dirs */
- QStringList dirs = QStringList::split(sep, argval);
- QStringList::iterator it = dirs.begin();
- for (; it != dirs.end(); ++it) {
- /* check dirs ok */
- *it = dirCheck( &errval, *it, true, false );
- if ( errval != PARSED_OK )
- break;
- }
- argval = dirs.join(sep);
- } break;
-
- case VALGRIND::SUPPS_AVAIL: /* not popt: only reaches here from gui */
- case VALGRIND::SUPPS_SEL: { /* is popt: --suppressions */
- QStringList files = QStringList::split(sep, argval);
- QStringList::iterator it = files.begin();
- for (; it != files.end(); ++it) {
- /* check files ok & readable */
- *it = fileCheck( &errval, *it, true, false );
- if ( errval != PARSED_OK )
- break;
- /* TODO: do we care if it doesn't end in .supp?
- - breaks the suppression widgets a little, as only lists those ending in .supp ... */
-
- /* TODO: ? check valid suppression files */
- }
- argval = files.join(sep);
- } break;
-
- case VALGRIND::TRACE_CH: {
-#if 0
- if ( opt->isValidArg( &errval, argval ) ) {
- if ( argval == "yes" ) {
- if ( vkConfig->rdBool( "db-attach", "valgrind" ) )
- errval = PERROR_DB_CONFLICT;
- }
- }
-#else
- /* Disabled for now - can't deal with the multiple xml files this generates */
- /* Note: Also disabled in ValgrindOptionsPage() */
- errval = PERROR_BADOPT;
-// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
-// vkPrintErr(" - Valkyrie can't yet handle the multiple xml files this generates.");
-#endif
- } break;
-
- case VALGRIND::SILENT_CH: {
- /* Disabled for now - output between fork and exec is confusing for the XML output */
- /* Note: Also disabled in ValgrindOptionsPage() */
- errval = PERROR_BADOPT;
-// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
-// vkPrintErr(" - Necessary, to get clean XML output from Valgrind.");
- } break;
-
- case VALGRIND::XML_OUTPUT:
- /* Note: gui option disabled, so only reaches here from cmdline */
- errval = PERROR_BADOPT;
-// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
-// vkPrintErr(" - Valkyrie always requires xml output from Valgrind.");
- break;
-
-
-#if 0 // TODO: Fix Valgrind to allow gdb attaching with XML output
- case VALGRIND::DB_COMMAND: { /* gdb -nw %f %p */
- int pos = argval.find( ' ' );
- QString tmp = argval.left( pos );
- argval = binaryCheck( &errval, tmp );
- argval += tmp.right( tmp.length() - pos+1 );
- // vkPrint("db_command: %s", argval.latin1() );
- } break;
-
- /* check for conflict with --trace-children */
- case VALGRIND::DB_ATTACH:
- if ( opt->isValidArg( &errval, argval ) ) {
- if ( argval == "yes" ) {
- if ( vkConfig->rdBool( "trace-children","valgrind" ) )
- errval = PERROR_DB_CONFLICT;
- }
- } break;
-#endif
-
- case VALGRIND::KERN_VAR:
- break;
-
- /* logging options */
- /* all tools use an internal logging option,
- all logging options are therefore ignored */
- case VALGRIND::LOG_FILE:
- case VALGRIND::LOG_FD:
- case VALGRIND::LOG_SOCKET:
- /* Note: gui options disabled, so only reaches here from cmdline */
- errval = PERROR_BADOPT;
- vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
- vkPrintErr(" - Valkyrie sets its own logging options to gather data from Valgrind.");
- break;
-
-
- /* Not yet implemented */
- case VALGRIND::INPUT_FD:
- /* Note: gui option disabled, so only reaches here from cmdline */
- errval = PERROR_BADOPT;
-// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
-// vkPrintErr(" - Not yet implemented.");
- break;
-
- default:
- assert( true );
-// vk_assert_never_reached();
- }
-#endif
-
- return errval;
-}
-
-
-#if 0
-/* valkyrie hijacks any log-to-file flags; these are not passed to
- valgrind, but are used after parsing has finished to save to. */
-QStringList Valgrind::modifiedVgFlags( const ToolObject* tool_obj )
-{
- QStringList modFlags;
- QString defVal, cfgVal, flag;
-
- for ( Option* opt = m_optList.first(); opt; opt = m_optList.next() ) {
- flag = opt->m_longFlag.isEmpty() ? opt->m_shortFlag
- : opt->m_longFlag;
- defVal = opt->m_defaultValue;
- cfgVal = vkConfig->rdEntry( opt->cfgKey(), name() );
-
- switch ( (Valgrind::vgOpts)opt->m_key ) {
-
- /* we never want these included */
- case VALGRIND::TOOL: /* tool set by valkyrie */
- case VALGRIND::SUPPS_DIRS: /* false option */
- case VALGRIND::SUPPS_AVAIL: /* false option */
- break;
-
- /* only error-reporting tools have suppressions */
- case VALGRIND::SUPPS_SEL: {
- if ( tool_obj->name() == "memcheck" ) {
- /* we need '--suppressions=' before each and every filename */
- QString optEntry = vkConfig->rdEntry( opt->cfgKey(), name() );
- QStringList files = QStringList::split( ",", optEntry );
- for ( unsigned int i=0; i<files.count(); i++ ) {
- modFlags << "--" + opt->cfgKey() + "=" + files[i];
- }
- }
- } break;
-
-
- /* for memcheck we always need xml=yes */
- case VALGRIND::XML_OUTPUT:
- if ( tool_obj->name() == "memcheck")
- modFlags << "--" + opt->cfgKey() + "=yes";
- else
- if ( defVal != cfgVal )
- modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
- break;
-
- /* for memcheck we needs this enabled to keep the xml clean */
- case VALGRIND::SILENT_CH:
- if ( tool_obj->name() == "memcheck")
- modFlags << "--" + opt->cfgKey() + "=yes";
- else
- if ( defVal != cfgVal )
- modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
- break;
-
- case VALGRIND::VERBOSITY:
- case VALGRIND::TRACK_FDS:
- case VALGRIND::TIME_STAMP:
- case VALGRIND::EM_WARNS:
- case VALGRIND::GEN_SUPP:
- case VALGRIND::ERROR_LIMIT:
- case VALGRIND::DB_ATTACH:
- case VALGRIND::DB_COMMAND:
- if ( defVal != cfgVal ) {
- // disabled for now: /* gui options not disabled: other tools use these options */
- if ( tool_obj->name() == "memcheck") {
- /* memcheck presets/ignores these options for xml output
- - ignore these opts
- - see valgrind/docs/internals/xml_output.txt */
- } else {
- modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
- }
- }
- break;
-
- /* all tools use an internal logging option,
- all logging options should therefore not be used */
- case VALGRIND::LOG_FILE:
- case VALGRIND::LOG_FD:
- case VALGRIND::LOG_SOCKET:
- /* ignore these opts */
- break;
-
- default:
- if ( defVal != cfgVal ) {
- modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
- }
- break;
- }
- }
-
- return modFlags;
-}
-
-
-
-/* Register tools */
-void Valgrind::initToolObjects()
-{
- int objId = VkObject::ID_TOOL0;
- m_toolObjList.append( new Memcheck ( objId++ ) );
-
- // TODO: I need another lifetime!
- // m_toolObjList.append( new Cachegrind( objId++ ) );
- // m_toolObjList.append( new Massif ( objId++ ) );
-}
-
-
-/* ToolObject access -------------------------------------------=---- */
-
-/* Returns a list of all ptrs to ToolObjects */
-ToolObjList Valgrind::toolObjList()
-{
- return m_toolObjList;
-}
-
-/* Returns a ToolObject's objectId based on its name */
-int Valgrind::toolObjId( const QString& name )
-{
- return toolObj(name)->objId();
-}
-
-/* Returns a ToolObject based on its objectId */
-ToolObject* Valgrind::toolObj( int tid )
-{
- // vkPrint("Valgrind::toolObj( int tid=%d )", tid);
- vk_assert( tid >= ID_TOOL0 );
- ToolObject* tool = m_toolObjList.at( tid - ID_TOOL0 );
- vk_assert( tool != 0 );
- vk_assert( tool->objId() == tid );
- return tool;
-}
-
-/* Returns a ToolObject based on its name */
-ToolObject* Valgrind::toolObj( const QString& name ) {
- ToolObject* tool;
- for ( tool = m_toolObjList.first(); tool; tool = m_toolObjList.next() ) {
- if ( tool->name() == name )
- return tool;
- }
- vk_assert_never_reached();
- return NULL;
-}
-#endif
-
-
-
-VkOptionsPage* Valgrind::createVkOptionsPage() {
- return (VkOptionsPage*)new ValgrindOptionsPage( this );
-}
Copied: branches/valkyrie_qt4port/objects/valgrind_object.cpp (from rev 462, branches/valkyrie_qt4port/core/valgrind_object.cpp)
===================================================================
--- branches/valkyrie_qt4port/objects/valgrind_object.cpp (rev 0)
+++ branches/valkyrie_qt4port/objects/valgrind_object.cpp 2010-01-08 09:18:57 UTC (rev 463)
@@ -0,0 +1,836 @@
+/****************************************************************************
+** Valgrind implementation
+** - Valgrind-specific: options / flags / functionality
+** --------------------------------------------------------------------------
+**
+** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** <in...@op...>
+**
+** This file is part of Valkyrie, a front-end for Valgrind.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file COPYING included in the packaging of
+** this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDir>
+
+#include "objects/valgrind_object.h"
+#include "options/valgrind_options_page.h" // createVkOptionsPage()
+
+#include "utils/vk_config.h"
+
+//#include "config.h"
+//#include "html_urls.h"
+//#include "memcheck_object.h"
+//#include "cachegrind_object.h"
+//#include "massif_object.h"
+//#include "vk_option.h" // PERROR* and friends
+//#include "vk_utils.h" // vk_assert, VK_DEBUG, etc.
+
+
+//#include <ctype.h>
+//#include <stdlib.h>
+//#include <string.h>
+//#include <stdio.h>
+
+
+/***************************************************************************/
+/*!
+ Constructs a Valkyrie object
+*/
+Valgrind::Valgrind()
+ : VkObject( "valgrind" )
+ // : VkObject( "Valgrind", "Valgrind", Qt::Key_unknown, VkObject::ID_VALGRIND )
+{
+ // /* init tools */
+ // initToolObjects();``
+
+ setupOptions();
+}
+
+
+Valgrind::~Valgrind()
+{
+ // m_toolObjList.setAutoDelete( true );
+ // m_toolObjList.clear();
+}
+
+
+
+/*!
+ Setup the options for this object.
+
+ Note: These opts should be kept in exactly the same order as valgrind
+ outputs them, as it makes keeping up-to-date a lot easier.
+*/
+void Valgrind::setupOptions()
+{
+
+ // ------------------------------------------------------------
+ // tool
+ options.addOpt(
+ VALGRIND::TOOL,
+ this->objectName(),
+ "tool",
+ '\0',
+ "<name>",
+ "memcheck|cachegrind|massif",
+ "memcheck",
+ "Main tool:",
+ "use the Valgrind tool named <name>. Available tools are: memcheck, cachegrind, massif",
+ "",// TODO: urlVgCore::mainTool
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_COMBO
+ );
+
+
+ // ------------------------------------------------------------
+ // common options relevant to all tools
+ options.addOpt(
+ VALGRIND::VERBOSITY,
+ this->objectName(),
+ "verbosity",
+ '\0',
+ "<0..4>",
+ "0|4",
+ "1",
+ "Verbosity level:",
+ "Be more verbose, include counts of errors",
+ "",// TODO: urlVgCore::verbosity
+ VkOPT::ARG_UINT,
+ VkOPT::WDG_SPINBOX
+ );
+
+ options.addOpt(
+ VALGRIND::TRACE_CH,
+ this->objectName(),
+ "trace-children",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Trace child processes: ",
+ "Valgrind-ise child processes (follow execve)?",
+ "",// TODO: urlVgCore::traceChild
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::SILENT_CH,
+ this->objectName(),
+ "child-silent-after-fork",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "yes", /* currently necessary for clean XML output */
+ "Omit child output between fork and exec: ",
+ "omit child output between fork & exec?",
+ "",// TODO: urlVgCore::silentChild
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::TRACK_FDS,
+ this->objectName(),
+ "track-fds",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Track open file descriptors:",
+ "track open file descriptors?",
+ "",// TODO: urlVgCore::trackFds
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::TIME_STAMP,
+ this->objectName(),
+ "time-stamp",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Add timestamps to log messages:",
+ "add timestamps to log messages?",
+ "",// TODO: urlVgCore::timeStamp
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::LOG_FD,
+ this->objectName(),
+ "log-fd",
+ '\0',
+ "<1..1024>",
+ "1|1023",
+ "2",
+ "Log to file descriptor:",
+ "log messages to file descriptor (1=stdout, 2=stderr)",
+ "",// TODO: urlVgCore::logToFd
+ VkOPT::ARG_UINT,
+ VkOPT::WDG_SPINBOX
+ );
+
+ options.addOpt(
+ VALGRIND::LOG_FILE,
+ this->objectName(),
+ "log-file",
+ '\0',
+ "<file>",
+ "",
+ "",
+ "Log to file:",
+ "log messages to <file>",
+ "",// TODO: urlVgCore::logToFile
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_LEDIT
+ );
+
+ options.addOpt(
+ VALGRIND::LOG_SOCKET,
+ this->objectName(),
+ "log-socket",
+ '\0',
+ "<ipaddr:port>",
+ "",
+ "",
+ "Log to socket:",
+ "log messages to socket ipaddr:port",
+ "",// TODO: urlVgCore::logToSocket
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_LEDIT
+ );
+
+
+ // ------------------------------------------------------------
+ // uncommon options relevant to all tools
+ options.addOpt(
+ VALGRIND::RUN_LIBC,
+ this->objectName(),
+ "run-libc-freeres",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "yes",
+ "Free glibc memory at exit:",
+ "Free up glibc memory at exit?",
+ "",// TODO: urlVgCore::freeGlibc
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::SIM_HINTS,
+ this->objectName(),
+ "sim-hints",
+ '\0',
+ "<hint1,hint2,...>",
+ "none|lax-ioctls|enable-outer",
+ "none",
+ "Simulation Hints:",
+ "Slightly modify the simulated behaviour. Recognised hints are: lax-ioctls, enable-outer. Use with caution!",
+ "",// TODO: urlVgCore::simHints
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_COMBO
+ );
+
+ options.addOpt(
+ VALGRIND::KERN_VAR,
+ this->objectName(),
+ "kernel-variant",
+ '\0',
+ "<variant1,...>",
+ "none|bproc",
+ "none",
+ "Kernel Variants:",
+ "Handle non-standard kernel variants. Recognised variants are: bproc. Use with caution!",
+ "",// TODO: urlVgCore::kernelVariant
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_COMBO
+ );
+
+ options.addOpt(
+ VALGRIND::EM_WARNS,
+ this->objectName(),
+ "show-emwarns",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Show warnings about emulation limits:",
+ "show warnings about emulation limits?",
+ "",// TODO: urlVgCore::showEmWarns
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::SMC_CHECK,
+ this->objectName(),
+ "smc-check",
+ '\0',
+ "<none|stack|all>",
+ "none|stack|all",
+ "stack",
+ "Where to check for self-modifying code",
+ "checks for self-modifying code: none, only for code on the stack, or all",
+ "",// TODO: urlVgCore::smcSupport
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_COMBO
+ );
+
+
+ // ------------------------------------------------------------
+ // options relevant to error-reporting tools
+ options.addOpt(
+ VALGRIND::XML_OUTPUT,
+ this->objectName(),
+ "xml",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "yes",
+ "Output in xml format:",
+ "all output is in XML",
+ "",// TODO: urlVgCore::xmlOutput
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::XML_COMMENT,
+ this->objectName(),
+ "xml-user-comment",
+ '\0',
+ "<str>",
+ "",
+ "",
+ "Insert verbatim in xml output",
+ "copy <str> verbatim to XML output",
+ "",// TODO: urlVgCore::xmlComment
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_NONE
+ );
+
+ options.addOpt(
+ VALGRIND::DEMANGLE,
+ this->objectName(),
+ "demangle",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "yes",
+ "Automatically demangle C++ names",
+ "automatically demangle C++ names?",
+ "",// TODO: urlVgCore::autoDemangle
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::NUM_CALLERS,
+ this->objectName(),
+ "num-callers",
+ '\0',
+ "<1..50>",
+ "1|50",
+ "12",
+ "Number of stack trace callers:",
+ "show <num> callers in stack traces",
+ "",// TODO: urlVgCore::numCallers
+ VkOPT::ARG_UINT,
+ VkOPT::WDG_SPINBOX
+ );
+
+ options.addOpt(
+ VALGRIND::ERROR_LIMIT,
+ this->objectName(),
+ "error-limit",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "yes",
+ "Limit the number of errors shown",
+ "Stop showing new errors if too many?",
+ "",// TODO: urlVgCore::errorLimit
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::SHOW_BELOW,
+ this->objectName(),
+ "show-below-main",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Continue stack traces below main()",
+ "continue stack traces below main()",
+ "",// TODO: urlVgCore::stackTraces
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+
+ // ------------------------------------------------------------
+ // Can't access vkConfig->suppDir(): config created after us!
+ QString defSuppDir = QDir::homePath() + "/" + QString(VK_CFG_GLBL_DIR) + VK_SUPPS_DIR;
+ /* list of dirs holding suppression files */
+ options.addOpt(
+ VALGRIND::SUPPS_DIRS,
+ this->objectName(),
+ "supps-dirs",
+ '\0',
+ "",
+ "",
+ defSuppDir,
+ "Suppression Dirs:",
+ "",
+ "",// TODO: urlValkyrie::suppsTab
+ VkOPT::NOT_POPT,
+ VkOPT::WDG_LISTBOX
+ );
+
+ /* list of all suppression files found in option SUPP_DIRS */
+ options.addOpt(
+ VALGRIND::SUPPS_AVAIL,
+ this->objectName(),
+ "supps-avail",
+ '\0',
+ "",
+ "",
+ "",
+ "Available error-suppression file(s):",
+ "",
+ "",// TODO: urlValkyrie::suppsTab
+ VkOPT::NOT_POPT,
+ VkOPT::WDG_LISTBOX
+ );
+
+ /* list of selected suppression files */
+ options.addOpt(
+ VALGRIND::SUPPS_SEL,
+ this->objectName(),
+ "suppressions",
+ '\0',
+ "<file1,...>",
+ "",
+ "",
+ "Selected error-suppression file(s):",
+ "suppress errors described in suppressions file(s)",
+ "",// TODO: urlValkyrie::suppsTab
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_LISTBOX
+ );
+
+
+ // ------------------------------------------------------------
+ // ...
+ options.addOpt(
+ VALGRIND::GEN_SUPP,
+ this->objectName(),
+ "gen-suppressions",
+ '\0',
+ "<yes|no|all>",
+ "yes|no|all",
+ "no",
+ "Print suppressions for errors",
+ "print suppressions for errors?",
+ "",// TODO: urlVgCore::genSuppressions
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_COMBO
+ );
+
+ options.addOpt(
+ VALGRIND::DB_ATTACH,
+ this->objectName(),
+ "db-attach",
+ '\0',
+ "<yes|no>",
+ "yes|no",
+ "no",
+ "Start debugger on error detection",
+ "start debugger when errors detected?",
+ "",// TODO: urlVgCore::startDebugger
+ VkOPT::ARG_BOOL,
+ VkOPT::WDG_CHECK
+ );
+
+ options.addOpt(
+ VALGRIND::DB_COMMAND,
+ this->objectName(),
+ "db-command",
+ '\0',
+ "<command>",
+ "",
+ "/usr/bin/gdb -nw %f %p",
+ "Debugger:",
+ "command to start debugger",
+ "",// TODO: urlVgCore::whichDebugger
+ VkOPT::ARG_STRING,
+ VkOPT::WDG_LEDIT
+ );
+
+ options.addOpt(
+ VALGRIND::INPUT_FD,
+ this->objectName(),
+ "input-fd",
+ '\0',
+ "<0..1024>",
+ "0|1023",
+ "0",
+ "Input file descriptor:",
+
+ "File descriptor for (db) input (0=stdin, 1=stdout, 2=stderr)",
+ "",// TODO: urlVgCore::inputFd
+ VkOPT::ARG_UINT,
+ VkOPT::WDG_SPINBOX
+ );
+
+ options.addOpt(
+ VALGRIND::MAX_SFRAME,
+ this->objectName(),
+ "max-stackframe",
+ '\0',
+ "<number>",
+ "0|2000000",
+ "2000000",
+ "Stack switch on SP changes at:",
+ "assume stack switch for stack pointer changes larger than <number> bytes",
+ "",// TODO: urlVgCore::maxSFrames
+ VkOPT::ARG_UINT,
+ VkOPT::WDG_SPINBOX
+ );
+}
+
+
+
+/* check argval for this option, updating if necessary.
+ called by parseCmdArgs() and gui option pages -------------------- */
+int Valgrind::checkOptArg( int optid, QString& argval )
+{
+optid = optid; argval = argval;
+// vk_assert( optid >= 0 && optid < NUM_OPTS );
+
+ int errval = PARSED_OK;
+
+#if 0
+ Option* opt = findOption( optid );
+ QString sep = vkConfig->sepChar();
+
+ switch ( (Valgrind::vgOpts)optid ) {
+
+ case VALGRIND::TOOL:
+ /* Note: gui option disabled, so only reaches here from cmdline */
+ errval = PERROR_BADOPT;
+ vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+ vkPrintErr(" - Valkyrie currently only supports Memcheck.");
+ break;
+
+ case VALGRIND::SIM_HINTS:
+ case VALGRIND::RUN_LIBC:
+ case VALGRIND::NUM_CALLERS:
+ case VALGRIND::DEMANGLE:
+ // case VALGRIND::INPUT_FD: // TODO
+ case VALGRIND::SHOW_BELOW:
+ case VALGRIND::MAX_SFRAME:
+ case VALGRIND::SMC_CHECK:
+ opt->isValidArg( &errval, argval );
+ break;
+
+ case VALGRIND::VERBOSITY:
+ case VALGRIND::TRACK_FDS:
+ case VALGRIND::TIME_STAMP:
+ case VALGRIND::EM_WARNS:
+ case VALGRIND::GEN_SUPP:
+ case VALGRIND::ERROR_LIMIT:
+ case VALGRIND::DB_COMMAND:
+ case VALGRIND::DB_ATTACH:
+ /* Note: gui option disabled, so only reaches here from cmdline */
+ errval = PERROR_BADOPT;
+ vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+ vkPrintErr(" - Valgrind presets these options for XML output.");
+ vkPrintErr(" - See valgrind/docs/internals/xml_output.txt.");
+ break;
+
+ case VALGRIND::XML_COMMENT:
+ /* don't wan't xml in comment: escape '<','&',etc */
+ argval = escapeEntities( argval );
+ break;
+
+ case VALGRIND::SUPPS_DIRS: { /* not popt: only reaches here from gui */
+ /* check all entries are valid dirs */
+ QStringList dirs = QStringList::split(sep, argval);
+ QStringList::iterator it = dirs.begin();
+ for (; it != dirs.end(); ++it) {
+ /* check dirs ok */
+ *it = dirCheck( &errval, *it, true, false );
+ if ( errval != PARSED_OK )
+ break;
+ }
+ argval = dirs.join(sep);
+ } break;
+
+ case VALGRIND::SUPPS_AVAIL: /* not popt: only reaches here from gui */
+ case VALGRIND::SUPPS_SEL: { /* is popt: --suppressions */
+ QStringList files = QStringList::split(sep, argval);
+ QStringList::iterator it = files.begin();
+ for (; it != files.end(); ++it) {
+ /* check files ok & readable */
+ *it = fileCheck( &errval, *it, true, false );
+ if ( errval != PARSED_OK )
+ break;
+ /* TODO: do we care if it doesn't end in .supp?
+ - breaks the suppression widgets a little, as only lists those ending in .supp ... */
+
+ /* TODO: ? check valid suppression files */
+ }
+ argval = files.join(sep);
+ } break;
+
+ case VALGRIND::TRACE_CH: {
+#if 0
+ if ( opt->isValidArg( &errval, argval ) ) {
+ if ( argval == "yes" ) {
+ if ( vkConfig->rdBool( "db-attach", "valgrind" ) )
+ errval = PERROR_DB_CONFLICT;
+ }
+ }
+#else
+ /* Disabled for now - can't deal with the multiple xml files this generates */
+ /* Note: Also disabled in ValgrindOptionsPage() */
+ errval = PERROR_BADOPT;
+// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+// vkPrintErr(" - Valkyrie can't yet handle the multiple xml files this generates.");
+#endif
+ } break;
+
+ case VALGRIND::SILENT_CH: {
+ /* Disabled for now - output between fork and exec is confusing for the XML output */
+ /* Note: Also disabled in ValgrindOptionsPage() */
+ errval = PERROR_BADOPT;
+// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+// vkPrintErr(" - Necessary, to get clean XML output from Valgrind.");
+ } break;
+
+ case VALGRIND::XML_OUTPUT:
+ /* Note: gui option disabled, so only reaches here from cmdline */
+ errval = PERROR_BADOPT;
+// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+// vkPrintErr(" - Valkyrie always requires xml output from Valgrind.");
+ break;
+
+
+#if 0 // TODO: Fix Valgrind to allow gdb attaching with XML output
+ case VALGRIND::DB_COMMAND: { /* gdb -nw %f %p */
+ int pos = argval.find( ' ' );
+ QString tmp = argval.left( pos );
+ argval = binaryCheck( &errval, tmp );
+ argval += tmp.right( tmp.length() - pos+1 );
+ // vkPrint("db_command: %s", argval.latin1() );
+ } break;
+
+ /* check for conflict with --trace-children */
+ case VALGRIND::DB_ATTACH:
+ if ( opt->isValidArg( &errval, argval ) ) {
+ if ( argval == "yes" ) {
+ if ( vkConfig->rdBool( "trace-children","valgrind" ) )
+ errval = PERROR_DB_CONFLICT;
+ }
+ } break;
+#endif
+
+ case VALGRIND::KERN_VAR:
+ break;
+
+ /* logging options */
+ /* all tools use an internal logging option,
+ all logging options are therefore ignored */
+ case VALGRIND::LOG_FILE:
+ case VALGRIND::LOG_FD:
+ case VALGRIND::LOG_SOCKET:
+ /* Note: gui options disabled, so only reaches here from cmdline */
+ errval = PERROR_BADOPT;
+ vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+ vkPrintErr(" - Valkyrie sets its own logging options to gather data from Valgrind.");
+ break;
+
+
+ /* Not yet implemented */
+ case VALGRIND::INPUT_FD:
+ /* Note: gui option disabled, so only reaches here from cmdline */
+ errval = PERROR_BADOPT;
+// vkPrintErr("Option disabled '--%s'", opt->m_longFlag.latin1());
+// vkPrintErr(" - Not yet implemented.");
+ break;
+
+ default:
+ assert( true );
+// vk_assert_never_reached();
+ }
+#endif
+
+ return errval;
+}
+
+
+#if 0
+/* valkyrie hijacks any log-to-file flags; these are not passed to
+ valgrind, but are used after parsing has finished to save to. */
+QStringList Valgrind::modifiedVgFlags( const ToolObject* tool_obj )
+{
+ QStringList modFlags;
+ QString defVal, cfgVal, flag;
+
+ for ( Option* opt = m_optList.first(); opt; opt = m_optList.next() ) {
+ flag = opt->m_longFlag.isEmpty() ? opt->m_shortFlag
+ : opt->m_longFlag;
+ defVal = opt->m_defaultValue;
+ cfgVal = vkConfig->rdEntry( opt->cfgKey(), name() );
+
+ switch ( (Valgrind::vgOpts)opt->m_key ) {
+
+ /* we never want these included */
+ case VALGRIND::TOOL: /* tool set by valkyrie */
+ case VALGRIND::SUPPS_DIRS: /* false option */
+ case VALGRIND::SUPPS_AVAIL: /* false option */
+ break;
+
+ /* only error-reporting tools have suppressions */
+ case VALGRIND::SUPPS_SEL: {
+ if ( tool_obj->name() == "memcheck" ) {
+ /* we need '--suppressions=' before each and every filename */
+ QString optEntry = vkConfig->rdEntry( opt->cfgKey(), name() );
+ QStringList files = QStringList::split( ",", optEntry );
+ for ( unsigned int i=0; i<files.count(); i++ ) {
+ modFlags << "--" + opt->cfgKey() + "=" + files[i];
+ }
+ }
+ } break;
+
+
+ /* for memcheck we always need xml=yes */
+ case VALGRIND::XML_OUTPUT:
+ if ( tool_obj->name() == "memcheck")
+ modFlags << "--" + opt->cfgKey() + "=yes";
+ else
+ if ( defVal != cfgVal )
+ modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
+ break;
+
+ /* for memcheck we needs this enabled to keep the xml clean */
+ case VALGRIND::SILENT_CH:
+ if ( tool_obj->name() == "memcheck")
+ modFlags << "--" + opt->cfgKey() + "=yes";
+ else
+ if ( defVal != cfgVal )
+ modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
+ break;
+
+ case VALGRIND::VERBOSITY:
+ case VALGRIND::TRACK_FDS:
+ case VALGRIND::TIME_STAMP:
+ case VALGRIND::EM_WARNS:
+ case VALGRIND::GEN_SUPP:
+ case VALGRIND::ERROR_LIMIT:
+ case VALGRIND::DB_ATTACH:
+ case VALGRIND::DB_COMMAND:
+ if ( defVal != cfgVal ) {
+ // disabled for now: /* gui options not disabled: other tools use these options */
+ if ( tool_obj->name() == "memcheck") {
+ /* memcheck presets/ignores these options for xml output
+ - ignore these opts
+ - see valgrind/docs/internals/xml_output.txt */
+ } else {
+ modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
+ }
+ }
+ break;
+
+ /* all tools use an internal logging option,
+ all logging options should therefore not be used */
+ case VALGRIND::LOG_FILE:
+ case VALGRIND::LOG_FD:
+ case VALGRIND::LOG_SOCKET:
+ /* ignore these opts */
+ break;
+
+ default:
+ if ( defVal != cfgVal ) {
+ modFlags << "--" + opt->cfgKey() + "=" + cfgVal;
+ }
+ break;
+ }
+ }
+
+ return modFlags;
+}
+
+
+
+/* Register tools */
+void Valgrind::initToolObjects()
+{
+ int objId = VkObject::ID_TOOL0;
+ m_toolObjList.append( new Memcheck ( objId++ ) );
+
+ // TODO: I need another lifetime!
+ // m_toolObjList.append( new Cachegrind( objId++ ) );
+ // m_toolObjList.append( new Massif ( objId++ ) );
+}
+
+
+/* ToolObject access -------------------------------------------=---- */
+
+/* Returns a list of all ptrs to ToolObjects */
+ToolObjList Valgrind::toolObjList()
+{
+ return m_toolObjList;
+}
+
+/* Returns a ToolObject's objectId based on its name */
+int Valgrind::toolObjId( const QString& name )
+{
+ return toolObj(name)->objId();
+}
+
+/* Returns a ToolObject based on its objectId */
+ToolObject* Valgrind::toolObj( int tid )
+{
+ // vkPrint("Valgrind::toolObj( int tid=%d )", tid);
+ vk_assert( tid >= ID_TOOL0 );
+ ToolObject* tool = m_toolObjList.at( tid - ID_TOOL0 );
+ vk_assert( tool != 0 );
+ vk_assert( tool->objId() == tid );
+ return tool;
+}
+
+/* Returns a ToolObject based on its name */
+ToolObject* Valgrind::toolObj( const QString& name ) {
+ ToolObject* tool;
+ for ( tool = m_toolObjList.first(); tool; tool = m_toolObjList.next() ) {
+ if ( tool->name() == name )
+ return tool;
+ }
+ vk_assert_never_reached();
+ return NULL;
+}
+#endif
+
+
+
+VkOptionsPage* Valgrind::createVkOptionsPage() {
+ return (VkOptionsPage*)new ValgrindOptionsPage( this );
+}
Deleted: branches/valkyrie_qt4port/objects/valgrind_object.h
===================================================================
--- branches/valkyrie_qt4port/core/valgrind_object.h 2009-12-19 23:12:34 UTC (rev 461)
+++ branches/valkyrie_qt4port/objects/valgrind_object.h 2010-01-08 09:18:57 UTC (rev 463)
@@ -1,115 +0,0 @@
-/****************************************************************************
-** Valgrind object class definition
-** - Valgrind-specific: options / flags / functionality
-** --------------------------------------------------------------------------
-**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
-** <in...@op...>
-**
-** This file is part of Valkyrie, a front-end for Valgrind.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 as published by the Free Software Foundation
-** and appearing in the file COPYING included in the packaging of
-** this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#ifndef __VALGRIND_OBJECT_H
-#define __VALGRIND_OBJECT_H
-
-#include "core/vk_objects.h"
-//#include "tool_object.h"
-
-
-// ============================================================
-namespace VALGRIND {
-/*!
- enum identification of all options for this object
-*/
- enum vgOptId {
- TOOL, // --tool
- /* common options relevant to all tools */
- VERBOSITY, // --verbosity
- TRACE_CH, // --trace-children
- SILENT_CH, // --child-silent-after-fork
- TRACK_FDS, // --track-fds
- TIME_STAMP, // --time-stamp
- LOG_FD, // --log-fd
- LOG_FILE, // --log-file
- LOG_SOCKET, // --log-socket
-
- /* uncommon options relevant to all tools */
- RUN_LIBC, // --run-libc-freeres
- SIM_HINTS, // --sim-hints
- KERN_VAR, // --kernel-variant
- EM_WARNS, // --show-emwarns
- SMC_CHECK, // --smc-check
-
- /* options relevant to error-reporting tools */
- XML_OUTPUT, // --xml
- XML_COMMENT, // -- xml-user-comment
- DEMANGLE, // --demangle
- NUM_CALLERS, // --num-callers
- ERROR_LIMIT, // --error-limit
- SHOW_BELOW, // --show-below-main
-
- /* suppressions hackery */
- SUPPS_DIRS, /* list of suppfile dirs - feeds SUPPS_AVAIL list */
- SUPPS_AVAIL, /* fake opt: dyname list of available supp files */
- SUPPS_SEL, /* the currently selected suppression(s) */
-
- /* misc */
- GEN_SUPP, // --gen-suppressions
- DB_ATTACH, // --db-attach
- DB_COMMAND, // --db-command
- INPUT_FD, // --input-fd
- MAX_SFRAME, // --max-stackframe
- NUM_OPTS
- };
-}
-
-
-// ============================================================
-class Valgrind : public VkObject
-{
-public:
- Valgrind();
- ~Valgrind();
-
-#if 0
- /* returns a list of non-default flags to pass to valgrind */
- QStringList modifiedVgFlags( const ToolObject* tool_obj );
- unsigned int maxOptId() { return NUM_OPTS; }
-#endif
-
- int checkOptArg( int optid, QString& argval );
-
- VkOptionsPage* createVkOptionsPage();
-
-#if 0
-public:
- /* ToolObject access */
- ToolObjList toolObjList();
- int toolObjId( const QString& name );
- ToolObject* toolObj( int tid );
- ToolObject* toolObj( const QString& name );
-#endif
-
-private:
-#if 0
- /* creates the various VkObjects and initialises their options,
- ready for cmd-line parsing (if any). */
- void initToolObjects();
-
- ToolObjList m_toolObjList; /* Tools */
-#endif
-
-private:
- void setupOptions();
-};
-
-#endif
Copied: branches/valkyrie_qt4port/objects/valgrind_object.h (from rev 462, branches/valkyrie_qt4port/core/valgrind_object.h)
===================================================================
--- branches/valkyrie_qt4port/objects/valgrind_object.h (rev 0)
+++ branches/valkyrie_qt4port/objects/valgrind_object.h 2010-01-08 09:18:57 UTC (rev 463)
@@ -0,0 +1,115 @@
+/****************************************************************************
+** Valgrind object class definition
+** - Valgrind-specific: options / flags / functionality
+** --------------------------------------------------------------------------
+**
+** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** <in...@op...>
+**
+** This file is part of Valkyrie, a front-end for Valgrind.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file COPYING included in the packaging of
+** this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef __VALGRIND_OBJECT_H
+#define __VALGRIND_OBJECT_H
+
+#include "objects/vk_objects.h"
+//#include "tool_object.h"
+
+
+// ============================================================
+namespace VALGRIND {
+/*!
+ enum identification of all options for this object
+*/
+ enum vgOptId {
+ TOOL, // --tool
+ /* common options relevant to all tools */
+ VERBOSITY, // --verbosity
+ TRACE_CH, // --trace-children
+ SILENT_CH, // --child-silent-after-fork
+ TRACK_FDS, // --track-fds
+ TIME_STAMP, // --time-stamp
+ LOG_FD, // --log-fd
+ LOG_FILE, // --log-file
+ LOG_SOCKET, // --log-socket
+
+ /* uncommon options relevant to all tools */
+ RUN_LIBC, // --run-libc-freeres
+ SIM_HINTS, // --sim-hints
+ KERN_VAR, // --kernel-variant
+ EM_WARNS, // --show-emwarns
+ SMC_CHECK, // --smc-check
+
+ /* options relevant to error-reporting tools */
+ XML_OUTPUT, // --xml
+ XML_COMMENT, // -- xml-user-comment
+ DEMANGLE, // --demangle
+ NUM_CALLERS, // --num-callers
+ ERROR_LIMIT, // --error-limit
+ SHOW_BELOW, // --show-below-main
+
+ /* suppressions hackery */
+ SUPPS_DIRS, /* list of suppfile dirs - feeds SUPPS_AVAIL list */
+ SUPPS_AVAIL, /* fake opt: dyname list of available supp files */
+ SUPPS_SEL, /* the currently selected suppression(s) */
+
+ /* misc */
+ GEN_SUPP, // --gen-suppressions
+ DB_ATTACH, // --db-attach
+ DB_COMMAND, // --db-command
+ INPUT_FD, // --input-fd
+ MAX_SFRAME, // --max-stackframe
+ NUM_OPTS
+ };
+}
+
+
+// ============================================================
+class Valgrind : public VkObject
+{
+public:
+ Valgrind();
+ ~Valgrind();
+
+#if 0
+ /* returns a list of non-default flags to pass to valgrind */
+ QStringList modifiedVgFlags( const ToolObject* tool_obj );
+#endif
+ unsigned int maxOptId() { return VALGRIND::NUM_OPTS; }
+
+ int checkOptArg( int optid, QString& argval );
+
+ VkOptionsPage* createVkOptionsPage();
+
+#if 0
+public:
+ /* ToolObject access */
+ ToolObjList toolObjList();
+ int toolObjId( const QString& name );
+ ToolObject* toolObj( int tid );
+ ToolObject* toolObj( const QString& name );
+#endif
+
+private:
+#if 0
+ /* creates the various VkObjects and initialises their options,
+ ...
[truncated message content] |