[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop-devel
Subject: Re: Handling of external debugger usage...
From: "W. Tasin" <tasin () fhm ! edu>
Date: 2002-03-23 15:09:17
[Download RAW message or body]
The following patch was applied by me, after some long testings.
It handles a crash if external debugging is enabled and we try to debug
an app with arguments.
I also changed the patch of Harry (as mentioned before).
Please check. If there are objections I will revert the changings.
Ciao
Walter
jbb wrote:
> - There are some ASSERTS in the code especially on starting the
> debugger, while the extern debugger is in use.
> I think, we should remove the ASSERTS (because they can cause a crash)
> and the slotMethods for debugging should all check first for the
> variable dbgInternal (AFAICS debugging with arguments doesn't check it,
> maybe there are some others)
>
.....
>
> I know this is not what you wanted, but those ASSERTS should be okay. They
> shouldn't be triggered with this patch. If they are then somethings wrong. If
> you still feel they should be removed then I'll not object to doing it. Just
> let me know
>
They are ok... so I left them inside.
It's only that from time to time we would fall into it if some patches
were made which don't consider certain conditions.
>
>
> jbb
>
>
> ------------------------------------------------------------------------
>
> ? build_configured
> ? build_initialised
> ? config.hlp
> ? stamp-h1
> Index: kdevelop/ckdevelop.cpp
> ===================================================================
> RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop.cpp,v
> retrieving revision 1.158.2.114.2.140.2.36
> diff -u -r1.158.2.114.2.140.2.36 ckdevelop.cpp
> --- kdevelop/ckdevelop.cpp 2002/03/09 13:35:52 1.158.2.114.2.140.2.36
> +++ kdevelop/ckdevelop.cpp 2002/03/16 04:23:39
> @@ -1604,17 +1604,22 @@
>
> void CKDevelop::slotStartDebugRunWithArgs()
> {
> - KComboBox* compile_combo = \
> toolBar(ID_BROWSER_TOOLBAR)->getCombo(ID_CV_TOOLBAR_COMPILE_CHOICE);
>
> - QString conf=compile_combo->currentText();
> + // This "fixes" crash when external debugger is being used. We cannot pass
> + // arguments to an external debugger without quite a bit more work being done
> + if (!dbgInternal)
> + return;
> +
> + KComboBox* compile_combo = \
> toolBar(ID_BROWSER_TOOLBAR)->getCombo(ID_CV_TOOLBAR_COMPILE_CHOICE); + QString \
> conf=compile_combo->currentText(); QString runFromDir;
> if(conf==i18n("(Default)"))
> - runFromDir = prj->getRunFromDir();
> - else{
> - runFromDir = m_pKDevSession->getVPATHSubdir(conf);
> - if(runFromDir.right(1)!="/")
> - runFromDir+="/";
> - runFromDir+=prj->getSubDir();
> - }
> + runFromDir = prj->getRunFromDir();
> + else{
> + runFromDir = m_pKDevSession->getVPATHSubdir(conf);
> + if(runFromDir.right(1)!="/")
> + runFromDir+="/";
> + runFromDir+=prj->getSubDir();
> + }
> QDir::setCurrent(runFromDir);
> QString libtool = prj->getLibtool();;
> QString binProgram = prj->getExecutable();
> Index: kdevelop/ckdevelop.h
> ===================================================================
> RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop.h,v
> retrieving revision 1.105.2.37.2.88.2.10
> diff -u -r1.105.2.37.2.88.2.10 ckdevelop.h
> --- kdevelop/ckdevelop.h 2002/03/09 13:35:52 1.105.2.37.2.88.2.10
> +++ kdevelop/ckdevelop.h 2002/03/16 04:23:45
> @@ -940,9 +940,10 @@
> QPopupMenu* build_menu;
> QPopupMenu* debug_menu;
> QPopupMenu* debugPopup;
> + QPopupMenu* debugToolPopup;
> QPopupMenu* tools_menu;
> QPopupMenu* options_menu;
> - KHelpMenu* help_menu;
> + KHelpMenu* help_menu;
> QWhatsThis* whats_this;
>
> QPopupMenu* history_prev;
> Index: kdevelop/ckdevelop_init.cpp
> ===================================================================
> RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop_init.cpp,v
> retrieving revision 1.131.2.63.2.125.2.14
> diff -u -r1.131.2.63.2.125.2.14 ckdevelop_init.cpp
> --- kdevelop/ckdevelop_init.cpp 2002/03/07 21:25:27 1.131.2.63.2.125.2.14
> +++ kdevelop/ckdevelop_init.cpp 2002/03/16 04:23:57
> @@ -787,7 +787,7 @@
> toolBar()->insertButton("rebuild",ID_BUILD_REBUILD_ALL, false,i18n("Rebuild"));
> // toolBar()->insertSeparator();
> toolBar()->insertButton("debugger",ID_DEBUG_START, false, i18n("Debug"));
> - QPopupMenu* debugToolPopup = new QPopupMenu();
> + debugToolPopup = new QPopupMenu();
> debugToolPopup->insertItem(SmallIconSet("core"),i18n("Examine core \
> file"),this,SLOT(slotDebugExamineCore()),0,ID_DEBUG_CORE); \
> debugToolPopup->insertItem(SmallIconSet("exec"),i18n("Debug another \
> executable"),this,SLOT(slotDebugNamedFile()),0,ID_DEBUG_NAMED_FILE); \
> debugToolPopup->insertItem(SmallIconSet("connect_creating"),i18n("Attach to \
> process"),this,SLOT(slotDebugAttach()),0,ID_DEBUG_ATTACH);
> Index: kdevelop/ckdevelop_noslot.cpp
> ===================================================================
> RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop_noslot.cpp,v
> retrieving revision 1.72.2.41.2.89.2.9
> diff -u -r1.72.2.41.2.89.2.9 ckdevelop_noslot.cpp
> --- kdevelop/ckdevelop_noslot.cpp 2002/02/28 12:25:15 1.72.2.41.2.89.2.9
> +++ kdevelop/ckdevelop_noslot.cpp 2002/03/16 04:24:03
> @@ -657,11 +657,26 @@
> if (m_docViewManager->curDocIsCppFile()){
> enableCommand(ID_BUILD_COMPILE_FILE);
> }
> - enableCommand(ID_CV_TOOLBAR_COMPILE_CHOICE); // enable switching project \
> configs + enableCommand(ID_CV_TOOLBAR_COMPILE_CHOICE); // enable switching \
> project configs enableCommand(ID_BUILD_RUN);
> enableCommand(ID_BUILD_RUN_WITH_ARGS);
> enableCommand(ID_DEBUG_START);
> - enableCommand(ID_DEBUG_START_OTHER);
> + if (dbgInternal)
> + {
> + enableCommand(ID_DEBUG_START_OTHER);
> + debugToolPopup->setItemEnabled(ID_DEBUG_CORE, true);
> + debugToolPopup->setItemEnabled(ID_DEBUG_NAMED_FILE, true);
> + debugToolPopup->setItemEnabled(ID_DEBUG_ATTACH, true);
> + debugToolPopup->setItemEnabled(ID_DEBUG_SET_ARGS, true);
> + }
> + else
> + {
> + disableCommand(ID_DEBUG_START_OTHER);
> + debugToolPopup->setItemEnabled(ID_DEBUG_CORE, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_NAMED_FILE, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_ATTACH, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_SET_ARGS, false);
> + }
> enableCommand(ID_BUILD_MAKE);
> enableCommand(ID_BUILD_REBUILD_ALL);
> enableCommand(ID_BUILD_CLEAN_REBUILD_ALL);
> @@ -700,12 +715,16 @@
> // if (!enable)
> {
> // set the popupmenus enable or disable
> - disableCommand(ID_CV_TOOLBAR_COMPILE_CHOICE); // disable switching project \
> configs during an operation + disableCommand(ID_CV_TOOLBAR_COMPILE_CHOICE); // \
> disable switching project configs during an operation \
> disableCommand(ID_BUILD_COMPILE_FILE); disableCommand(ID_BUILD_RUN_WITH_ARGS);
> disableCommand(ID_BUILD_RUN);
> disableCommand(ID_DEBUG_START);
> disableCommand(ID_DEBUG_START_OTHER);
> + debugToolPopup->setItemEnabled(ID_DEBUG_CORE, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_NAMED_FILE, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_ATTACH, false);
> + debugToolPopup->setItemEnabled(ID_DEBUG_SET_ARGS, false);
> disableCommand(ID_BUILD_MAKE);
> disableCommand(ID_BUILD_REBUILD_ALL);
> disableCommand(ID_BUILD_CLEAN_REBUILD_ALL);
>
--------------
Here's the patch for Harry's commitment:
diff -u -r1.26.2.21.2.22.2.16 -r1.26.2.21.2.22.2.17
--- cprjoptionsdlg.cpp 2002/03/22 20:16:47 1.26.2.21.2.22.2.16
+++ cprjoptionsdlg.cpp 2002/03/23 13:08:53 1.26.2.21.2.22.2.17
@@ -229,15 +229,32 @@
// stupid littly helper function to find out whether a desired lib
// is in the StringList. Returns true if lib1 or lib2 has been found
// and also removes them from the list.
-bool removeLibFromList( QStringList& libs, const QString& lib1, const
QString& lib2 = QString::null )
+// This also checks multiple occurrence of the same libname
+bool CPrjOptionsDlg::removeLibFromList( QStringList& libs, const
QString& lib1,
+ const QString& lib2)
{
bool fnd = false;
- if ( !lib1.isEmpty() && ( libs.remove( lib1 ) > 0 ) ) {
- fnd = true;
- }
- if ( !lib2.isEmpty() && ( libs.remove( lib2 ) > 0 ) ) {
- fnd = true;
+ QStringList::Iterator it;
+
+ for (it=libs.begin(); it!=libs.end();)
+ {
+ if (!lib1.isEmpty() && (*it)==lib1)
+ {
+ it=libs.remove(it);
+ fnd=true;
+ }
+ else
+ {
+ if (!lib2.isEmpty() && (*it)==lib2)
+ {
+ it=libs.remove(it);
+ fnd=true;
+ }
+ else
+ ++it;
+ }
}
+
return fnd;
}
@@ -385,8 +402,10 @@
l_math=new QCheckBox(libs_group,"l_math");
grid4->addWidget (l_math,0,3);
l_math->setText("math");
- l_math->setChecked(l_khtml->isChecked() ||
- removeLibFromList(ldAdds, "-lm"));
+ /* The order here is important... first remove any additional "-lm"
string, then test
+ if l_khtml is checked
+ */
+ l_math->setChecked(removeLibFromList(ldAdds, "-lm") ||
l_khtml->isChecked()); QWhatsThis::add(l_math, i18n("Math library"));
QLabel* addit_ldadd_label;
----
diff -u -r1.11.2.5.2.5.2.6 -r1.11.2.5.2.5.2.7
--- cprjoptionsdlg.h 2002/02/27 12:52:03 1.11.2.5.2.5.2.6
+++ cprjoptionsdlg.h 2002/03/23 13:08:53 1.11.2.5.2.5.2.7
@@ -32,6 +32,8 @@
class CPrjAddOpts;
class KDevSession;
+#include <qstring.h>
+#include <qstringlist.h>
#include <kdialogbase.h>
#include "cprjconfchange.h"
@@ -57,6 +59,9 @@
void addLinkerPage();
void addMakePage();
void addBinPage();
+ bool removeLibFromList(QStringList& libs, const QString& lib1,
+ const QString& lib2 = QString::null);
+
protected:
CPrjCompOpts* compdlg;
--
The KDevelop project: tasin@kdevelop.de [www.kdevelop.org]
--
oohhh sveglia.... il mondo e' ammalato, ma x colpa di chi.........
(Zucchero)
> -------W. Tasin, FB 04,FHM-------------------PGP-KeyID:0x7961A645----------:
<Key-Fingerprint: 1610 835F 0080 32F4 6140 6CF7 A7D0 44CD 7961A645>
_______________________________________________
Kdevelop-devel mailing list
Kdevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic