Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
5976b1ba
Commit
5976b1ba
authored
Nov 09, 2009
by
Oswald Buddenhagen
Browse files
actively try to obtain PID of non-pthread inferiors with gdb < 7 on linux
Reviewed-by: hjk
parent
23e06304
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/gdb/gdbengine.cpp
View file @
5976b1ba
...
...
@@ -1152,14 +1152,21 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
setState
(
InferiorStopped
);
#ifdef Q_OS_LINUX
// For some reason, attaching to a stopped process causes *two* stops
// when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8).
// Interestingly enough, on MacOSX no signal is delivered at all.
if
(
!
m_entryPoint
.
isEmpty
())
{
if
(
reason
==
"signal-received"
&&
data
.
findChild
(
"signal-name"
).
data
()
==
"SIGSTOP"
)
{
GdbMi
frameData
=
data
.
findChild
(
"frame"
);
if
(
frameData
.
findChild
(
"addr"
).
data
()
==
m_entryPoint
)
{
GdbMi
frameData
=
data
.
findChild
(
"frame"
);
if
(
frameData
.
findChild
(
"addr"
).
data
()
==
m_entryPoint
)
{
if
(
reason
==
"signal-received"
&&
data
.
findChild
(
"signal-name"
).
data
()
==
"SIGSTOP"
)
{
// For some reason, attaching to a stopped process causes *two* stops
// when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8).
// Interestingly enough, on MacOSX no signal is delivered at all.
continueInferiorInternal
();
return
;
}
if
(
reason
.
isEmpty
())
{
// tbreak does that
// For programs without -pthread under gdb <= 6.8.
if
(
!
inferiorPid
())
postCommand
(
_
(
"info proc"
),
CB
(
handleInfoProc
));
continueInferiorInternal
();
return
;
}
...
...
@@ -1325,6 +1332,18 @@ void GdbEngine::handleStop1(const GdbMi &data)
manager
()
->
reloadRegisters
();
}
#ifdef Q_OS_LINUX
void
GdbEngine
::
handleInfoProc
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultDone
)
{
static
QRegExp
re
(
_
(
"
\\
bprocess ([0-9]+)
\n
"
));
QTC_ASSERT
(
re
.
isValid
(),
return
);
if
(
re
.
indexIn
(
_
(
response
.
data
.
findChild
(
"consolestreamoutput"
).
data
()))
!=
-
1
)
maybeHandleInferiorPidChanged
(
re
.
cap
(
1
));
}
}
#endif
void
GdbEngine
::
handleShowVersion
(
const
GdbResponse
&
response
)
{
//qDebug () << "VERSION 2:" << response.data.findChild("consolestreamoutput").data();
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
5976b1ba
...
...
@@ -302,6 +302,8 @@ private: ////////// Inferior Management //////////
void
maybeHandleInferiorPidChanged
(
const
QString
&
pid
);
#ifdef Q_OS_LINUX
void
handleInfoProc
(
const
GdbResponse
&
response
);
QByteArray
m_entryPoint
;
#endif
...
...
src/plugins/debugger/gdb/plaingdbadapter.cpp
View file @
5976b1ba
...
...
@@ -110,6 +110,13 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
QTC_ASSERT
(
state
()
==
InferiorStarting
,
qDebug
()
<<
state
());
if
(
response
.
resultClass
==
GdbResultDone
)
{
#ifdef Q_OS_LINUX
// Old gdbs do not announce the PID for programs without pthreads.
// Note that successfully preloading the debugging helpers will
// automatically load pthreads, so this will be unnecessary.
if
(
m_engine
->
m_gdbVersion
<
70000
)
m_engine
->
postCommand
(
_
(
"info target"
),
CB
(
handleInfoTarget
));
#endif
emit
inferiorPrepared
();
}
else
{
QString
msg
=
tr
(
"Starting executable failed:
\n
"
)
+
...
...
@@ -118,6 +125,29 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
}
}
#ifdef Q_OS_LINUX
void
PlainGdbAdapter
::
handleInfoTarget
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultDone
)
{
// [some leading stdout here]
// >&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n"
// [some trailing stdout here]
QString
msg
=
_
(
response
.
data
.
findChild
(
"consolestreamoutput"
).
data
());
QRegExp
needle
(
_
(
"
\\
bEntry point: 0x([0-9a-f]+)
\\
b"
));
if
(
needle
.
indexIn
(
msg
)
!=
-
1
)
{
m_engine
->
m_entryPoint
=
"0x"
+
needle
.
cap
(
1
).
toLatin1
().
rightJustified
(
sizeof
(
void
*
)
*
2
,
'0'
);
m_engine
->
postCommand
(
_
(
"tbreak *0x"
)
+
needle
.
cap
(
1
));
// Do nothing here - inferiorPrepared handles the sequencing.
}
else
{
emit
inferiorStartFailed
(
_
(
"Parsing start address failed"
));
}
}
else
if
(
response
.
resultClass
==
GdbResultError
)
{
emit
inferiorStartFailed
(
_
(
"Fetching start address failed"
));
}
}
#endif
void
PlainGdbAdapter
::
startInferiorPhase2
()
{
setState
(
InferiorRunningRequested
);
...
...
src/plugins/debugger/gdb/plaingdbadapter.h
View file @
5976b1ba
...
...
@@ -62,6 +62,9 @@ public:
private:
void
handleFileExecAndSymbols
(
const
GdbResponse
&
response
);
void
handleExecRun
(
const
GdbResponse
&
response
);
#ifdef Q_OS_LINUX
void
handleInfoTarget
(
const
GdbResponse
&
response
);
#endif
OutputCollector
m_outputCollector
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment