Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3059046a
Commit
3059046a
authored
Mar 02, 2009
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes: debugger: start work on core file loading
parent
f4e875b9
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
103 additions
and
620 deletions
+103
-620
src/plugins/debugger/attachcoredialog.ui
src/plugins/debugger/attachcoredialog.ui
+64
-0
src/plugins/debugger/attachexternaldialog.cpp
src/plugins/debugger/attachexternaldialog.cpp
+0
-160
src/plugins/debugger/attachexternaldialog.h
src/plugins/debugger/attachexternaldialog.h
+0
-61
src/plugins/debugger/attachremotedialog.cpp
src/plugins/debugger/attachremotedialog.cpp
+0
-154
src/plugins/debugger/attachremotedialog.h
src/plugins/debugger/attachremotedialog.h
+0
-62
src/plugins/debugger/debugger.pro
src/plugins/debugger/debugger.pro
+5
-6
src/plugins/debugger/debuggermanager.cpp
src/plugins/debugger/debuggermanager.cpp
+29
-2
src/plugins/debugger/debuggermanager.h
src/plugins/debugger/debuggermanager.h
+3
-1
src/plugins/debugger/gdbengine.cpp
src/plugins/debugger/gdbengine.cpp
+1
-2
src/plugins/debugger/scriptengine.cpp
src/plugins/debugger/scriptengine.cpp
+1
-2
src/plugins/debugger/startexternaldialog.cpp
src/plugins/debugger/startexternaldialog.cpp
+0
-113
src/plugins/debugger/startexternaldialog.h
src/plugins/debugger/startexternaldialog.h
+0
-57
No files found.
src/plugins/debugger/attachcoredialog.ui
0 → 100644
View file @
3059046a
<ui version="4.0" >
<class>AttachCoreDialog</class>
<widget class="QDialog" name="AttachCoreDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>866</height>
</rect>
</property>
<property name="windowTitle" >
<string>Start Debugger</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="pidLabel" >
<property name="text" >
<string>Attach to Process ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pidLineEdit" />
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="procView" >
<property name="editTriggers" >
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
src/plugins/debugger/attachexternaldialog.cpp
deleted
100644 → 0
View file @
f4e875b9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "attachexternaldialog.h"
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QPushButton>
#include <QStandardItemModel>
#include <QHeaderView>
#ifdef Q_OS_WINDOWS
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <stdio.h>
#endif
using
namespace
Debugger
::
Internal
;
AttachExternalDialog
::
AttachExternalDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
setupUi
(
this
);
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setDefault
(
true
);
m_model
=
new
QStandardItemModel
(
this
);
procView
->
setSortingEnabled
(
true
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
accept
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
connect
(
procView
,
SIGNAL
(
activated
(
const
QModelIndex
&
)),
this
,
SLOT
(
procSelected
(
const
QModelIndex
&
)));
rebuildProcessList
();
}
static
bool
isProcessName
(
const
QString
&
procname
)
{
for
(
int
i
=
0
;
i
!=
procname
.
size
();
++
i
)
if
(
!
procname
.
at
(
i
).
isDigit
())
return
false
;
return
true
;
}
struct
ProcData
{
QString
ppid
;
QString
name
;
QString
state
;
};
static
void
insertItem
(
QStandardItem
*
root
,
const
QString
&
pid
,
const
QMap
<
QString
,
ProcData
>
&
procs
,
QMap
<
QString
,
QStandardItem
*>
&
known
)
{
//qDebug() << "HANDLING " << pid;
QStandardItem
*
parent
=
0
;
const
ProcData
&
proc
=
procs
[
pid
];
if
(
1
||
pid
==
"0"
)
{
// FIXME: a real tree is not-so-nice to search
parent
=
root
;
}
else
{
if
(
!
known
.
contains
(
proc
.
ppid
))
insertItem
(
root
,
proc
.
ppid
,
procs
,
known
);
parent
=
known
[
proc
.
ppid
];
}
QList
<
QStandardItem
*>
row
;
row
.
append
(
new
QStandardItem
(
pid
));
row
.
append
(
new
QStandardItem
(
proc
.
name
));
//row.append(new QStandardItem(proc.ppid));
row
.
append
(
new
QStandardItem
(
proc
.
state
));
parent
->
appendRow
(
row
);
known
[
pid
]
=
row
[
0
];
}
void
AttachExternalDialog
::
rebuildProcessList
()
{
QStringList
procnames
=
QDir
(
"/proc/"
).
entryList
();
if
(
procnames
.
isEmpty
())
{
procView
->
hide
();
return
;
}
typedef
QMap
<
QString
,
ProcData
>
Procs
;
Procs
procs
;
foreach
(
const
QString
&
procname
,
procnames
)
{
if
(
!
isProcessName
(
procname
))
continue
;
QString
filename
=
"/proc/"
+
procname
+
"/stat"
;
QFile
file
(
filename
);
file
.
open
(
QIODevice
::
ReadOnly
);
QStringList
data
=
QString
::
fromLocal8Bit
(
file
.
readAll
()).
split
(
' '
);
//qDebug() << filename << data;
ProcData
proc
;
proc
.
name
=
data
.
at
(
1
);
if
(
proc
.
name
.
startsWith
(
'('
)
&&
proc
.
name
.
endsWith
(
')'
))
proc
.
name
=
proc
.
name
.
mid
(
1
,
proc
.
name
.
size
()
-
2
);
proc
.
state
=
data
.
at
(
2
);
proc
.
ppid
=
data
.
at
(
3
);
procs
[
procname
]
=
proc
;
}
m_model
->
clear
();
QMap
<
QString
,
QStandardItem
*>
known
;
for
(
Procs
::
const_iterator
it
=
procs
.
begin
();
it
!=
procs
.
end
();
++
it
)
insertItem
(
m_model
->
invisibleRootItem
(),
it
.
key
(),
procs
,
known
);
m_model
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
"Process ID"
,
Qt
::
DisplayRole
);
m_model
->
setHeaderData
(
1
,
Qt
::
Horizontal
,
"Name"
,
Qt
::
DisplayRole
);
//model->setHeaderData(2, Qt::Horizontal, "Parent", Qt::DisplayRole);
m_model
->
setHeaderData
(
2
,
Qt
::
Horizontal
,
"State"
,
Qt
::
DisplayRole
);
procView
->
setModel
(
m_model
);
procView
->
expandAll
();
procView
->
resizeColumnToContents
(
0
);
procView
->
resizeColumnToContents
(
1
);
procView
->
sortByColumn
(
1
,
Qt
::
AscendingOrder
);
}
void
AttachExternalDialog
::
procSelected
(
const
QModelIndex
&
index0
)
{
QModelIndex
index
=
index0
.
sibling
(
index0
.
row
(),
0
);
QStandardItem
*
item
=
m_model
->
itemFromIndex
(
index
);
if
(
!
item
)
return
;
pidLineEdit
->
setText
(
item
->
text
());
accept
();
}
int
AttachExternalDialog
::
attachPID
()
const
{
return
pidLineEdit
->
text
().
toInt
();
}
src/plugins/debugger/attachexternaldialog.h
deleted
100644 → 0
View file @
f4e875b9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef ATTACHEXTERNALDIALOG_H
#define ATTACHEXTERNALDIALOG_H
#include "ui_attachexternaldialog.h"
QT_BEGIN_NAMESPACE
class
QStandardItemModel
;
QT_END_NAMESPACE
namespace
Debugger
{
namespace
Internal
{
class
AttachExternalDialog
:
public
QDialog
,
Ui
::
AttachExternalDialog
{
Q_OBJECT
public:
explicit
AttachExternalDialog
(
QWidget
*
parent
);
int
attachPID
()
const
;
private
slots
:
void
rebuildProcessList
();
void
procSelected
(
const
QModelIndex
&
);
private:
QStandardItemModel
*
m_model
;
};
}
// namespace Debugger
}
// namespace Internal
#endif // ATTACHEEXTERNALDIALOG_H
src/plugins/debugger/attachremotedialog.cpp
deleted
100644 → 0
View file @
f4e875b9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "attachremotedialog.h"
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QPushButton>
#include <QStandardItemModel>
#include <QHeaderView>
using
namespace
Debugger
::
Internal
;
AttachRemoteDialog
::
AttachRemoteDialog
(
QWidget
*
parent
,
const
QString
&
pid
)
:
QDialog
(
parent
)
{
setupUi
(
this
);
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setDefault
(
true
);
m_defaultPID
=
pid
;
m_model
=
new
QStandardItemModel
(
this
);
procView
->
setSortingEnabled
(
true
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
accept
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
connect
(
procView
,
SIGNAL
(
activated
(
const
QModelIndex
&
)),
this
,
SLOT
(
procSelected
(
const
QModelIndex
&
)));
pidLineEdit
->
setText
(
m_defaultPID
);
rebuildProcessList
();
}
static
bool
isProcessName
(
const
QString
&
procname
)
{
for
(
int
i
=
0
;
i
!=
procname
.
size
();
++
i
)
if
(
!
procname
.
at
(
i
).
isDigit
())
return
false
;
return
true
;
}
struct
ProcData
{
QString
ppid
;
QString
name
;
QString
state
;
};
static
void
insertItem
(
QStandardItem
*
root
,
const
QString
&
pid
,
const
QMap
<
QString
,
ProcData
>
&
procs
,
QMap
<
QString
,
QStandardItem
*>
&
known
)
{
//qDebug() << "HANDLING " << pid;
QStandardItem
*
parent
=
0
;
const
ProcData
&
proc
=
procs
[
pid
];
if
(
1
||
pid
==
"0"
)
{
parent
=
root
;
}
else
{
if
(
!
known
.
contains
(
proc
.
ppid
))
insertItem
(
root
,
proc
.
ppid
,
procs
,
known
);
parent
=
known
[
proc
.
ppid
];
}
QList
<
QStandardItem
*>
row
;
row
.
append
(
new
QStandardItem
(
pid
));
row
.
append
(
new
QStandardItem
(
proc
.
name
));
//row.append(new QStandardItem(proc.ppid));
row
.
append
(
new
QStandardItem
(
proc
.
state
));
parent
->
appendRow
(
row
);
known
[
pid
]
=
row
[
0
];
}
void
AttachRemoteDialog
::
rebuildProcessList
()
{
QStringList
procnames
=
QDir
(
"/proc/"
).
entryList
();
if
(
procnames
.
isEmpty
())
{
procView
->
hide
();
return
;
}
typedef
QMap
<
QString
,
ProcData
>
Procs
;
Procs
procs
;
foreach
(
const
QString
&
procname
,
procnames
)
{
if
(
!
isProcessName
(
procname
))
continue
;
QString
filename
=
"/proc/"
+
procname
+
"/stat"
;
QFile
file
(
filename
);
file
.
open
(
QIODevice
::
ReadOnly
);
QStringList
data
=
QString
::
fromLocal8Bit
(
file
.
readAll
()).
split
(
' '
);
//qDebug() << filename << data;
ProcData
proc
;
proc
.
name
=
data
.
at
(
1
);
if
(
proc
.
name
.
startsWith
(
'('
)
&&
proc
.
name
.
endsWith
(
')'
))
proc
.
name
=
proc
.
name
.
mid
(
1
,
proc
.
name
.
size
()
-
2
);
proc
.
state
=
data
.
at
(
2
);
proc
.
ppid
=
data
.
at
(
3
);
procs
[
procname
]
=
proc
;
}
m_model
->
clear
();
QMap
<
QString
,
QStandardItem
*>
known
;
for
(
Procs
::
const_iterator
it
=
procs
.
begin
();
it
!=
procs
.
end
();
++
it
)
insertItem
(
m_model
->
invisibleRootItem
(),
it
.
key
(),
procs
,
known
);
m_model
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
"Process ID"
,
Qt
::
DisplayRole
);
m_model
->
setHeaderData
(
1
,
Qt
::
Horizontal
,
"Name"
,
Qt
::
DisplayRole
);
//model->setHeaderData(2, Qt::Horizontal, "Parent", Qt::DisplayRole);
m_model
->
setHeaderData
(
2
,
Qt
::
Horizontal
,
"State"
,
Qt
::
DisplayRole
);
procView
->
setModel
(
m_model
);
procView
->
expandAll
();
procView
->
resizeColumnToContents
(
0
);
procView
->
resizeColumnToContents
(
1
);
}
void
AttachRemoteDialog
::
procSelected
(
const
QModelIndex
&
index0
)
{
QModelIndex
index
=
index0
.
sibling
(
index0
.
row
(),
0
);
QStandardItem
*
item
=
m_model
->
itemFromIndex
(
index
);
if
(
!
item
)
return
;
pidLineEdit
->
setText
(
item
->
text
());
accept
();
}
int
AttachRemoteDialog
::
attachPID
()
const
{
return
pidLineEdit
->
text
().
toInt
();
}
src/plugins/debugger/attachremotedialog.h
deleted
100644 → 0
View file @
f4e875b9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef ATTACHREMOTE_DIALOG_H
#define ATTACHREMOTE_DIALOG_H
#include "ui_attachremotedialog.h"
QT_BEGIN_NAMESPACE
class
QStandardItemModel
;
QT_END_NAMESPACE
namespace
Debugger
{
namespace
Internal
{
class
AttachRemoteDialog
:
public
QDialog
,
Ui
::
AttachRemoteDialog
{
Q_OBJECT
public:
explicit
AttachRemoteDialog
(
QWidget
*
parent
,
const
QString
&
pid
);
int
attachPID
()
const
;
private
slots
:
void
rebuildProcessList
();
void
procSelected
(
const
QModelIndex
&
);
private:
QString
m_defaultPID
;
QStandardItemModel
*
m_model
;
};
}
// namespace Debugger
}
// namespace Internal
#endif // ATTACHREMOTEDIALOG_H
src/plugins/debugger/debugger.pro
View file @
3059046a
...
...
@@ -14,11 +14,11 @@ INCLUDEPATH += $$PWD/../../libs/utils
QT
+=
gui
network
script
HEADERS
+=
attachexternaldialog
.
h
\
attachremotedialog
.
h
\
HEADERS
+=
\
breakhandler
.
h
\
breakwindow
.
h
\
debuggerconstants
.
h
\
debuggerdialogs
.
h
\
debuggermanager
.
h
\
debuggeroutputwindow
.
h
\
debuggerplugin
.
h
\
...
...
@@ -39,16 +39,15 @@ HEADERS += attachexternaldialog.h \
stackhandler
.
h
\
stackwindow
.
h
\
sourcefileswindow
.
h
\
startexternaldialog
.
h
\
threadswindow
.
h
\
watchhandler
.
h
\
watchwindow
.
h
SOURCES
+=
attachexternaldialog
.
cpp
\
attachremotedialog
.
cpp
\
SOURCES
+=
\
breakhandler
.
cpp
\
breakwindow
.
cpp
\
breakwindow
.
h
\
debuggerdialogs
.
cpp
\
debuggermanager
.
cpp
\
debuggeroutputwindow
.
cpp
\
debuggerplugin
.
cpp
\
...
...
@@ -67,13 +66,13 @@ SOURCES += attachexternaldialog.cpp \
stackhandler
.
cpp
\
stackwindow
.
cpp
\
sourcefileswindow
.
cpp
\
startexternaldialog
.
cpp
\
threadswindow
.
cpp
\
watchhandler
.
cpp
\
watchwindow
.
cpp
FORMS
+=
attachexternaldialog
.
ui
\
attachremotedialog
.
ui
\
attachcoredialog
.
ui
\
breakbyfunction
.
ui
\
breakcondition
.
ui
\
gdboptionpage
.
ui
\
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
3059046a
...
...
@@ -51,8 +51,7 @@
#include "stackhandler.h"
#include "watchhandler.h"
#include "startexternaldialog.h"
#include "attachexternaldialog.h"
#include "debuggerdialogs.h"
#include <utils/qtcassert.h>
...
...
@@ -294,6 +293,9 @@ void DebuggerManager::init()
m_attachExternalAction
=
new
QAction
(
this
);
m_attachExternalAction
->
setText
(
tr
(
"Attach to Running External Application..."
));
m_attachCoreAction
=
new
QAction
(
this
);
m_attachCoreAction
->
setText
(
tr
(
"Attach to Core..."
));
m_continueAction
=
new
QAction
(
this
);
m_continueAction
->
setText
(
tr
(
"Continue"
));
m_continueAction
->
setIcon
(
QIcon
(
":/gdbdebugger/images/debugger_continue_small.png"
));
...
...
@@ -362,6 +364,8 @@ void DebuggerManager::init()
this
,
SLOT
(
startExternalApplication
()));
connect
(
m_attachExternalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachExternalApplication
()));
connect
(
m_attachCoreAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachCore
()));
connect
(
m_stopAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
interruptDebuggingRequest
()));
...
...
@@ -769,6 +773,12 @@ void DebuggerManager::attachExternalApplication()
emit
debuggingFinished
();
}
void
DebuggerManager
::
attachCore
()
{
if
(
!
startNewDebugger
(
AttachCore
))
emit
debuggingFinished
();
}
bool
DebuggerManager
::
startNewDebugger
(
StartMode
mode
)
{
m_startMode
=
mode
;
...
...
@@ -827,6 +837,22 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
//m_processArgs = sd.processArgs.join(QLatin1String(" "));
m_attachedPID
=
0
;
}
}
else
if
(
startMode
()
==
AttachCore
)
{
StartExternalDialog
dlg
(
mainWindow
());
dlg
.
setExecutableFile
(
configValue
(
QLatin1String
(
"LastExternalExecutableFile"
)).
toString
());
dlg
.
setExecutableArguments
(
configValue
(
QLatin1String
(
"LastExternalExecutableArguments"
)).
toString
());
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
setConfigValue
(
QLatin1String
(
"LastExternalExecutableFile"
),
dlg
.
executableFile
());
setConfigValue
(
QLatin1String
(
"LastExternalExecutableArguments"
),
dlg
.
executableArguments
());