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
Marco Bubke
flatpak-qt-creator
Commits
1f797099
Commit
1f797099
authored
Dec 01, 2010
by
Arvid Ephraim Picciani
Browse files
lldb: fetch source from remote, if not locally valid
parent
7bcac797
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/lldb/guest/lldbengineguest.cpp
View file @
1f797099
...
...
@@ -397,6 +397,13 @@ void LldbEngineGuest::disassemble(quint64 pc)
}
}
}
void
LldbEngineGuest
::
fetchFrameSource
(
qint64
frame
)
{
QFile
f
(
m_frame_to_file
.
value
(
frame
));
f
.
open
(
QFile
::
ReadOnly
);
frameSourceFetched
(
frame
,
QFileInfo
(
m_frame_to_file
.
value
(
frame
)).
fileName
()
,
QString
::
fromLocal8Bit
(
f
.
readAll
()));
}
void
LldbEngineGuest
::
addBreakpoint
(
BreakpointId
id
,
const
Internal
::
BreakpointParameters
&
bp_
)
...
...
@@ -459,6 +466,7 @@ void LldbEngineGuest::selectThread(qint64 token)
DEBUG_FUNC_ENTER
;
SYNC_INFERIOR_OR
(
return
);
m_frame_to_file
.
clear
();
for
(
uint
i
=
0
;
i
<
m_process
->
GetNumThreads
();
i
++
)
{
lldb
::
SBThread
t
=
m_process
->
GetThreadAtIndex
(
i
);
if
(
t
.
GetThreadID
()
==
token
)
{
...
...
@@ -537,7 +545,9 @@ void LldbEngineGuest::selectThread(qint64 token)
frame
.
address
=
fr
.
GetPCAddress
().
GetLoadAddress
(
*
m_target
);
frame
.
line
=
lineNumber
;
frame
.
file
=
sourceFilePath
;
frame
.
usable
=
QFileInfo
(
frame
.
file
).
isReadable
();
frames
.
append
(
frame
);
m_frame_to_file
.
insert
(
j
,
frame
.
file
);
}
currentThreadChanged
(
token
);
listFrames
(
frames
);
...
...
src/plugins/debugger/lldb/guest/lldbengineguest.h
View file @
1f797099
...
...
@@ -94,9 +94,9 @@ public:
void
addBreakpoint
(
BreakpointId
id
,
const
BreakpointParameters
&
bp
);
void
removeBreakpoint
(
BreakpointId
id
);
void
changeBreakpoint
(
BreakpointId
id
,
const
BreakpointParameters
&
bp
);
void
requestUpdateWatchData
(
const
WatchData
&
data
,
const
WatchUpdateFlags
&
flags
);
void
fetchFrameSource
(
qint64
frame
);
private:
bool
m_running
;
...
...
@@ -115,6 +115,7 @@ private:
bool
m_relistFrames
;
QHash
<
QString
,
lldb
::
SBValue
>
m_localesCache
;
QHash
<
BreakpointId
,
lldb
::
SBBreakpoint
>
m_breakpoints
;
QHash
<
qint64
,
QString
>
m_frame_to_file
;
void
updateThreads
();
void
getWatchDataR
(
lldb
::
SBValue
v
,
int
level
,
...
...
src/plugins/debugger/lldb/ipcengineguest.cpp
View file @
1f797099
...
...
@@ -312,6 +312,15 @@ void IPCEngineGuest::rpcCallback(quint64 f, QByteArray payload)
requestUpdateWatchData
(
data
);
}
break
;
case
IPCEngineHost
::
FetchFrameSource
:
{
QDataStream
s
(
payload
);
SET_NATIVE_BYTE_ORDER
(
s
);
qint64
id
;
s
>>
id
;
fetchFrameSource
(
id
);
}
break
;
};
}
...
...
@@ -609,6 +618,19 @@ void IPCEngineGuest::updateWatchData(bool fullCycle, const QList<WatchData> &wd)
rpcCall
(
UpdateWatchData
,
p
);
}
void
IPCEngineGuest
::
frameSourceFetched
(
qint64
id
,
const
QString
&
name
,
const
QString
&
source
)
{
QByteArray
p
;
{
QDataStream
s
(
&
p
,
QIODevice
::
WriteOnly
);
SET_NATIVE_BYTE_ORDER
(
s
);
s
<<
id
;
s
<<
name
;
s
<<
source
;
}
rpcCall
(
FrameSourceFetched
,
p
);
}
}
// namespace Internal
}
// namespace Debugger
...
...
src/plugins/debugger/lldb/ipcengineguest.h
View file @
1f797099
...
...
@@ -81,6 +81,7 @@ public:
virtual
void
changeBreakpoint
(
BreakpointId
id
,
const
BreakpointParameters
&
bp
)
=
0
;
virtual
void
requestUpdateWatchData
(
const
WatchData
&
data
,
const
WatchUpdateFlags
&
flags
=
WatchUpdateFlags
())
=
0
;
virtual
void
fetchFrameSource
(
qint64
frame
)
=
0
;
enum
Function
{
...
...
@@ -120,7 +121,8 @@ public:
NotifyChangeBreakpointOk
=
34
,
NotifyChangeBreakpointFailed
=
35
,
NotifyBreakpointAdjusted
=
36
,
UpdateWatchData
=
47
UpdateWatchData
=
47
,
FrameSourceFetched
=
48
};
Q_ENUMS
(
Function
);
...
...
@@ -166,6 +168,8 @@ public:
void
updateWatchData
(
bool
fullCycle
,
const
QList
<
WatchData
>
&
);
void
frameSourceFetched
(
qint64
frame
,
const
QString
&
name
,
const
QString
&
sourceCode
);
void
rpcCall
(
Function
f
,
QByteArray
payload
=
QByteArray
());
public
slots
:
void
rpcCallback
(
quint64
f
,
QByteArray
payload
=
QByteArray
());
...
...
src/plugins/debugger/lldb/ipcenginehost.cpp
View file @
1f797099
...
...
@@ -40,6 +40,9 @@
#include
"threadshandler.h"
#include
"debuggeragents.h"
#include
"debuggerstreamops.h"
#include
<coreplugin/editormanager/editormanager.h>
#include
<coreplugin/editormanager/ieditor.h>
#include
<cppeditor/cppeditorconstants.h>
#include
<QSysInfo>
#include
<QDebug>
...
...
@@ -294,6 +297,17 @@ void IPCEngineHost::updateWatchData(const WatchData &data,
rpcCall
(
RequestUpdateWatchData
,
p
);
}
void
IPCEngineHost
::
fetchFrameSource
(
qint64
id
)
{
QByteArray
p
;
{
QDataStream
s
(
&
p
,
QIODevice
::
WriteOnly
);
SET_NATIVE_BYTE_ORDER
(
s
);
s
<<
id
;
}
rpcCall
(
FetchFrameSource
,
p
);
}
void
IPCEngineHost
::
rpcCallback
(
quint64
f
,
QByteArray
payload
)
{
switch
(
f
)
{
...
...
@@ -410,7 +424,10 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
resetLocation
();
StackHandler
*
sh
=
stackHandler
();
sh
->
setCurrentIndex
(
token
);
gotoLocation
(
sh
->
currentFrame
(),
true
);
if
(
QFileInfo
(
sh
->
currentFrame
().
file
).
exists
())
gotoLocation
(
sh
->
currentFrame
(),
true
);
else
fetchFrameSource
(
token
);
}
break
;
case
IPCEngineGuest
::
CurrentThreadChanged
:
...
...
@@ -539,6 +556,21 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
breakHandler
()
->
notifyBreakpointAdjusted
(
id
,
d
);
}
break
;
case
IPCEngineGuest
::
FrameSourceFetched
:
{
QDataStream
s
(
payload
);
SET_NATIVE_BYTE_ORDER
(
s
);
qint64
token
;
QString
name
;
QString
source
;
s
>>
token
>>
name
>>
source
;
Core
::
EditorManager
*
editorManager
=
Core
::
EditorManager
::
instance
();
Core
::
IEditor
*
editor
=
editorManager
->
openEditorWithContents
(
CppEditor
::
Constants
::
CPPEDITOR_ID
,
&
name
,
source
);
editorManager
->
activateEditor
(
editor
);
editor
->
gotoLine
(
stackHandler
()
->
currentFrame
().
line
,
0
);
editor
->
setProperty
(
Debugger
::
Constants
::
OPENED_BY_DEBUGGER
,
true
);
}
break
;
}
}
...
...
src/plugins/debugger/lldb/ipcenginehost.h
View file @
1f797099
...
...
@@ -81,7 +81,8 @@ public:
AddBreakpoint
=
22
,
RemoveBreakpoint
=
23
,
ChangeBreakpoint
=
24
,
RequestUpdateWatchData
=
25
RequestUpdateWatchData
=
25
,
FetchFrameSource
=
26
};
Q_ENUMS
(
Function
);
...
...
@@ -110,6 +111,7 @@ public:
void
changeBreakpoint
(
BreakpointId
id
);
void
updateWatchData
(
const
WatchData
&
data
,
const
WatchUpdateFlags
&
flags
=
WatchUpdateFlags
());
void
fetchFrameSource
(
qint64
id
);
void
rpcCall
(
Function
f
,
QByteArray
payload
=
QByteArray
());
protected:
...
...
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