From: <sv...@va...> - 2008-06-10 20:14:11
|
Author: cerion Date: 2008-06-09 23:52:09 +0100 (Mon, 09 Jun 2008) New Revision: 431 Log: Added option to set working directory (via cmdline and vk config) Modified: trunk/configure.in trunk/valkyrie/core/memcheck_object.cpp trunk/valkyrie/core/valgrind_object.cpp trunk/valkyrie/core/valkyrie_object.cpp trunk/valkyrie/core/valkyrie_object.h trunk/valkyrie/options/valkyrie_options_page.cpp trunk/valkyrie/options/valkyrie_options_page.h Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/configure.in 2008-06-09 22:52:09 UTC (rev 431) @@ -2,7 +2,7 @@ ######################################################################## # ? AC_PREREQ(2.59) -AC_INIT(Valkyrie, 1.2.1, in...@op...) +AC_INIT(Valkyrie, 1.2.2, in...@op...) AC_CONFIG_SRCDIR([valkyrie/main.cpp]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR(m4) Modified: trunk/valkyrie/core/memcheck_object.cpp =================================================================== --- trunk/valkyrie/core/memcheck_object.cpp 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/core/memcheck_object.cpp 2008-06-09 22:52:09 UTC (rev 431) @@ -496,6 +496,10 @@ so don't let it hijack stdin/out/err for socket fd's */ m_vgproc->setCommunication( 0 ); + /* set working directory */ + m_vgproc->setWorkingDirectory( + QDir( vkConfig->rdEntry( "working-dir", "valkyrie" ) ) ); + if ( !m_vgproc->start() ) { VK_DEBUG("process failed to start"); QString path_errmsg = (runState() == VkRunState::VALGRIND) Modified: trunk/valkyrie/core/valgrind_object.cpp =================================================================== --- trunk/valkyrie/core/valgrind_object.cpp 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/core/valgrind_object.cpp 2008-06-09 22:52:09 UTC (rev 431) @@ -116,7 +116,7 @@ urlVgCore::simHints ); addOpt( KERN_VAR, VkOPTION::ARG_STRING, VkOPTION::WDG_COMBO, "valgrind", '\0', "kernel-variant", - "<variant1,variant2,...>", "none|bproc", "none", + "<variant1,...>", "none|bproc", "none", "Kernel Variants:", "Handle non-standard kernel variants. Recognised variants are: bproc. Use with caution!", urlVgCore::kernelVariant ); Modified: trunk/valkyrie/core/valkyrie_object.cpp =================================================================== --- trunk/valkyrie/core/valkyrie_object.cpp 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/core/valkyrie_object.cpp 2008-06-09 22:52:09 UTC (rev 431) @@ -59,7 +59,7 @@ addOpt( VGHELP, VkOPTION::ARG_NONE, VkOPTION::WDG_NONE, "valkyrie", 'V', "valgrind-opts", "", "", "", - "", "Show valgrind options too, and exit", urlNone ); + "", "show valgrind options too, and exit", urlNone ); addOpt( TOOLTIP, VkOPTION::NOT_POPT, VkOPTION::WDG_CHECK, "valkyrie", '\0', "show-tooltips", "", "true|false", "true", @@ -101,6 +101,10 @@ "valkyrie", '\0', "default-logdir", "", "", VK_LOGS_DIR, "Log Dir:", "", "" ); + addOpt( WORKING_DIR, VkOPTION::ARG_STRING, VkOPTION::WDG_LEDIT, + "valkyrie", '\0', "working-dir", + "<dir>", "", "./", + "Working Dir:", "dir under which to run valgrind", "" ); /* path to valgrind executable (maybe found by configure) */ addOpt( VG_EXEC, VkOPTION::NOT_POPT, VkOPTION::WDG_LEDIT, @@ -159,7 +163,8 @@ return errval; break; - case DFLT_LOGDIR: { + case DFLT_LOGDIR: + case WORKING_DIR: { /* see if we have an dir with rx permissions */ (void) dirCheck( &errval, argval, true, true ); } break; Modified: trunk/valkyrie/core/valkyrie_object.h =================================================================== --- trunk/valkyrie/core/valkyrie_object.h 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/core/valkyrie_object.h 2008-06-09 22:52:09 UTC (rev 431) @@ -49,7 +49,7 @@ TOOLTIP, PALETTE, ICONTXT, FNT_GEN_SYS, FNT_GEN_USR, FNT_TOOL_USR, SRC_EDITOR, SRC_LINES, BROWSER, - DFLT_LOGDIR, + DFLT_LOGDIR, WORKING_DIR, VG_EXEC, /* path to valgrind executable */ /* FIRST_CMD_OPT */ BINARY, BIN_FLAGS, VIEW_LOG, MERGE_EXEC, MERGE_LOGS, Modified: trunk/valkyrie/options/valkyrie_options_page.cpp =================================================================== --- trunk/valkyrie/options/valkyrie_options_page.cpp 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/options/valkyrie_options_page.cpp 2008-06-09 22:52:09 UTC (rev 431) @@ -24,7 +24,7 @@ : OptionsPage( parent, obj, "valkyrie_options_page" ) { /* init the QIntDict list, resizing if necessary */ - unsigned int numItems = 13; + unsigned int numItems = 14; m_itemList.resize( numItems ); QVBoxLayout* vbox = new QVBoxLayout( this, m_margin, -1, "vbox" ); @@ -55,6 +55,12 @@ dirLogSave->addButton( group1, this, SLOT(getDfltLogDir()) ); connect(dirLogSave, SIGNAL(returnPressed()), this, SIGNAL(apply())); + m_itemList.insert( Valkyrie::WORKING_DIR, /* ledit + button */ + optionWidget(Valkyrie::WORKING_DIR, group1, false ) ); + LeWidget* dirWorking = ((LeWidget*)m_itemList[Valkyrie::WORKING_DIR]); + dirWorking->addButton( group1, this, SLOT(getWorkingDir()) ); + connect(dirWorking, SIGNAL(returnPressed()), this, SIGNAL(apply())); + /* fonts --------------------------------------------------------- */ m_itemList.insert( Valkyrie::FNT_GEN_SYS, /* checkbox */ optionWidget( Valkyrie::FNT_GEN_SYS, group1, false )); @@ -129,6 +135,10 @@ grid->addMultiCellWidget( dirLogSave->widget(), i,i, 1,3 ); i++; + grid->addWidget( dirWorking->button(), i, 0 ); + grid->addMultiCellWidget( dirWorking->widget(), i,i, 1,3 ); + i++; + grid->addMultiCellWidget( sep(group1,"sep0"), i,i, 0,3 ); #if (QT_VERSION-0 >= 0x030200) grid->setRowSpacing( i++, 8 ); @@ -372,8 +382,7 @@ } -/* RM: allows user to specify which valgrind version to use. the guts - of this fn are essentially the same as the one in config.tests/valgrind.test */ +/* RM: allows user to specify which default log dir to use */ void ValkyrieOptionsPage::getDfltLogDir() { QString currdir = m_itemList[Valkyrie::DFLT_LOGDIR]->currValue(); @@ -386,3 +395,17 @@ checkOption( Valkyrie::DFLT_LOGDIR ); } } + +/* RM: allows user to specify which default log dir to use */ +void ValkyrieOptionsPage::getWorkingDir() +{ + QString currdir = m_itemList[Valkyrie::WORKING_DIR]->currValue(); + QString dir_working = + QFileDialog::getExistingDirectory( currdir, this, + "get default working dir", + "Choose a directory", TRUE ); + if ( !dir_working.isEmpty() ) { /* user might have clicked Cancel */ + ((LeWidget*)m_itemList[Valkyrie::WORKING_DIR])->setCurrValue( dir_working ); + checkOption( Valkyrie::WORKING_DIR ); + } +} Modified: trunk/valkyrie/options/valkyrie_options_page.h =================================================================== --- trunk/valkyrie/options/valkyrie_options_page.h 2008-06-09 22:01:23 UTC (rev 430) +++ trunk/valkyrie/options/valkyrie_options_page.h 2008-06-09 22:52:09 UTC (rev 431) @@ -28,6 +28,7 @@ void getBinary(); void getBrowser(); void getDfltLogDir(); + void getWorkingDir(); void getVgExec(); }; |