Skip to content
GitLab
Menu
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
f098f039
Commit
f098f039
authored
Dec 16, 2009
by
Thorbjørn Lindeijer
Browse files
Merge branch '1.3'
Conflicts: src/plugins/projectexplorer/outputwindow.cpp
parents
b9927f99
777071c9
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
f098f039
...
...
@@ -49,6 +49,18 @@ using namespace Debugger::Internal;
//
//////////////////////////////////////////////////////////////////
// Compare file names case insensitively on Windows.
static
inline
bool
fileNameMatch
(
const
QString
&
f1
,
const
QString
&
f2
)
{
return
f1
.
compare
(
f2
,
#ifdef Q_OS_WIN
Qt
::
CaseInsensitive
#else
Qt
::
CaseSensitive
#endif
)
==
0
;
}
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -236,7 +248,7 @@ bool BreakpointData::isLocatedAt(const QString &fileName_, int lineNumber_) cons
return true;
return false;
*/
return
lineNumber_
==
markerLineNumber
&&
fileName
_
==
markerFileName
;
return
lineNumber_
==
markerLineNumber
&&
fileName
Match
(
fileName_
,
markerFileName
)
;
}
bool
BreakpointData
::
conditionsMatch
()
const
...
...
@@ -310,7 +322,7 @@ int BreakHandler::findBreakpoint(const BreakpointData &needle)
return
index
;
// at least at a position we were looking for
// FIXME: breaks multiple breakpoints at the same location
if
(
data
->
fileName
==
needle
.
bpFileName
if
(
fileNameMatch
(
data
->
fileName
,
needle
.
bpFileName
)
&&
data
->
lineNumber
==
needle
.
bpLineNumber
)
return
index
;
}
...
...
src/plugins/debugger/cdb/cdb.pri
View file @
f098f039
...
...
@@ -62,6 +62,7 @@ SOURCES += \
FORMS += $$PWD/cdboptionspagewidget.ui
LIBS+=-lpsapi
} else {
message("Debugging Tools for Windows could not be found in $$CDB_PATH")
} # exists($$CDB_PATH)
...
...
src/plugins/debugger/cdb/cdbbreakpoint.cpp
View file @
f098f039
...
...
@@ -37,6 +37,8 @@
#include <QtCore/QDebug>
#include <QtCore/QMap>
#include <psapi.h>
enum
{
debugBP
=
0
};
namespace
Debugger
{
...
...
@@ -215,16 +217,106 @@ bool CDBBreakPoint::add(CIDebugControl* debugControl,
return
true
;
}
// Make sure file can be found in editor manager and text markers
// Use '/' and capitalize drive letter
QString
CDBBreakPoint
::
canonicalSourceFile
(
const
QString
&
f
)
// Helper for normalizing file names:
// Map the device paths in a file name to back to drive letters
// "/Device/HarddiskVolume1/file.cpp" -> "C:/file.cpp"
static
bool
mapDeviceToDriveLetter
(
QString
*
s
)
{
if
(
f
.
isEmpty
())
enum
{
bufSize
=
512
};
// Retrieve drive letters and get their device names.
// Do not cache as it may change due to removable/network drives.
TCHAR
driveLetters
[
bufSize
];
if
(
!
GetLogicalDriveStrings
(
bufSize
-
1
,
driveLetters
))
return
false
;
TCHAR
driveName
[
MAX_PATH
];
TCHAR
szDrive
[
3
]
=
TEXT
(
" :"
);
for
(
const
TCHAR
*
driveLetter
=
driveLetters
;
*
driveLetter
;
driveLetter
++
)
{
szDrive
[
0
]
=
*
driveLetter
;
// Look up each device name
if
(
QueryDosDevice
(
szDrive
,
driveName
,
MAX_PATH
))
{
const
QString
deviceName
=
QString
::
fromUtf16
(
driveName
);
if
(
s
->
startsWith
(
deviceName
))
{
s
->
replace
(
0
,
deviceName
.
size
(),
QString
::
fromUtf16
(
szDrive
));
return
true
;
}
}
}
return
false
;
}
// Helper for normalizing file names:
// Determine normalized case of a Windows file name (camelcase.cpp -> CamelCase.cpp)
// as the debugger reports lower case file names.
// Restriction: File needs to exists and be non-empty and will be to be opened/mapped.
// This is the MSDN-recommended way of doing that. The result should be cached.
static
inline
QString
normalizeFileNameCaseHelper
(
const
QString
&
f
)
{
HANDLE
hFile
=
CreateFile
(
f
.
utf16
(),
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
f
;
QString
rc
=
QDir
::
fromNativeSeparators
(
f
);
if
(
rc
.
size
()
>
2
&&
rc
.
at
(
1
)
==
QLatin1Char
(
':'
))
rc
[
0
]
=
rc
.
at
(
0
).
toUpper
();
return
rc
;
// Get the file size. We need a non-empty file to map it.
DWORD
dwFileSizeHi
=
0
;
DWORD
dwFileSizeLo
=
GetFileSize
(
hFile
,
&
dwFileSizeHi
);
if
(
dwFileSizeLo
==
0
&&
dwFileSizeHi
==
0
)
{
CloseHandle
(
hFile
);
return
f
;
}
// Create a file mapping object.
HANDLE
hFileMap
=
CreateFileMapping
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
1
,
NULL
);
if
(
!
hFileMap
)
{
CloseHandle
(
hFile
);
return
f
;
}
// Create a file mapping to get the file name.
void
*
pMem
=
MapViewOfFile
(
hFileMap
,
FILE_MAP_READ
,
0
,
0
,
1
);
if
(
!
pMem
)
{
CloseHandle
(
hFileMap
);
CloseHandle
(
hFile
);
return
f
;
}
QString
rc
;
WCHAR
pszFilename
[
MAX_PATH
];
pszFilename
[
0
]
=
0
;
// Get a file name of the form "/Device/HarddiskVolume1/file.cpp"
if
(
GetMappedFileName
(
GetCurrentProcess
(),
pMem
,
pszFilename
,
MAX_PATH
))
{
rc
=
QString
::
fromUtf16
(
pszFilename
);
if
(
!
mapDeviceToDriveLetter
(
&
rc
))
rc
.
clear
();
}
UnmapViewOfFile
(
pMem
);
CloseHandle
(
hFileMap
);
CloseHandle
(
hFile
);
return
rc
.
isEmpty
()
?
f
:
rc
;
}
// Make sure file can be found in editor manager and text markers
// Use '/', correct case and capitalize drive letter. Use a cache.
typedef
QHash
<
QString
,
QString
>
NormalizedFileCache
;
Q_GLOBAL_STATIC
(
NormalizedFileCache
,
normalizedFileNameCache
)
QString
CDBBreakPoint
::
normalizeFileName
(
const
QString
&
f
)
{
QTC_ASSERT
(
!
f
.
isEmpty
(),
return
f
)
const
NormalizedFileCache
::
const_iterator
it
=
normalizedFileNameCache
()
->
constFind
(
f
);
if
(
it
!=
normalizedFileNameCache
()
->
constEnd
())
return
it
.
value
();
QString
normalizedName
=
QDir
::
fromNativeSeparators
(
normalizeFileNameCaseHelper
(
f
));
// Upcase drive letter for consistency even if case mapping fails.
if
(
normalizedName
.
size
()
>
2
&&
normalizedName
.
at
(
1
)
==
QLatin1Char
(
':'
))
normalizedName
[
0
]
=
normalizedName
.
at
(
0
).
toUpper
();
normalizedFileNameCache
()
->
insert
(
f
,
normalizedName
);
return
f
;
}
void
CDBBreakPoint
::
clearNormalizeFileNameCache
()
{
normalizedFileNameCache
()
->
clear
();
}
bool
CDBBreakPoint
::
retrieve
(
CIDebugBreakpoint
*
ibp
,
QString
*
errorMessage
)
...
...
@@ -267,7 +359,7 @@ bool CDBBreakPoint::parseExpression(const QString &expr)
conditionPos
=
expr
.
indexOf
(
sourceFileQuote
,
colonPos
+
1
);
if
(
conditionPos
==
-
1
)
return
false
;
fileName
=
canonicalSourceFil
e
(
expr
.
mid
(
1
,
colonPos
-
1
));
fileName
=
normalizeFileNam
e
(
expr
.
mid
(
1
,
colonPos
-
1
));
const
QString
lineNumberS
=
expr
.
mid
(
colonPos
+
1
,
conditionPos
-
colonPos
-
1
);
bool
lineNumberOk
=
false
;
lineNumber
=
lineNumberS
.
toInt
(
&
lineNumberOk
);
...
...
src/plugins/debugger/cdb/cdbbreakpoint.h
View file @
f098f039
...
...
@@ -80,7 +80,8 @@ struct CDBBreakPoint
QString
*
errorMessage
,
QStringList
*
warnings
);
// Return a 'canonical' file (using '/' and capitalized drive letter)
static
QString
canonicalSourceFile
(
const
QString
&
f
);
static
QString
normalizeFileName
(
const
QString
&
f
);
static
void
clearNormalizeFileNameCache
();
QString
fileName
;
// short name of source file
QString
condition
;
// condition associated with breakpoint
...
...
src/plugins/debugger/cdb/cdbdebugengine.cpp
View file @
f098f039
...
...
@@ -625,12 +625,14 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
{
if
(
debugCDBExecution
)
qDebug
()
<<
"startDebugger"
<<
*
sp
;
CDBBreakPoint
::
clearNormalizeFileNameCache
();
setState
(
AdapterStarting
,
Q_FUNC_INFO
,
__LINE__
);
m_d
->
checkVersion
();
if
(
m_d
->
m_hDebuggeeProcess
)
{
warning
(
QLatin1String
(
"Internal error: Attempt to start debugger while another process is being debugged."
));
setState
(
AdapterStartFailed
,
Q_FUNC_INFO
,
__LINE__
);
emit
startFailed
();
return
;
}
m_d
->
clearDisplay
();
m_d
->
m_inferiorStartupComplete
=
false
;
...
...
@@ -655,7 +657,7 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
m_d
->
m_dumper
->
reset
(
dumperLibName
,
dumperEnabled
);
setState
(
InferiorStarting
,
Q_FUNC_INFO
,
__LINE__
);
manager
()
->
showStatusMessage
(
"Starting Debugger"
,
-
1
);
manager
()
->
showStatusMessage
(
"Starting Debugger"
,
messageTimeOut
);
QString
errorMessage
;
bool
rc
=
false
;
...
...
@@ -692,7 +694,6 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
break
;
}
if
(
rc
)
{
manager
()
->
showStatusMessage
(
tr
(
"Debugger running"
),
-
1
);
if
(
needWatchTimer
)
startWatchTimer
();
emit
startSuccessful
();
...
...
@@ -732,8 +733,6 @@ bool CdbDebugEngine::startAttachDebugger(qint64 pid, DebuggerStartMode sm, QStri
bool
CdbDebugEngine
::
startDebuggerWithExecutable
(
DebuggerStartMode
sm
,
QString
*
errorMessage
)
{
showStatusMessage
(
"Starting Debugger"
,
-
1
);
DEBUG_CREATE_PROCESS_OPTIONS
dbgopts
;
memset
(
&
dbgopts
,
0
,
sizeof
(
dbgopts
));
dbgopts
.
CreateFlags
=
DEBUG_PROCESS
|
DEBUG_ONLY_THIS_PROCESS
;
...
...
@@ -1196,7 +1195,7 @@ bool CdbDebugEnginePrivate::continueInferior(QString *errorMessage)
setCodeLevel
();
m_engine
->
killWatchTimer
();
manager
()
->
resetLocation
();
manager
()
->
showStatusMessage
(
CdbDebugEngine
::
tr
(
"Running requested..."
),
5000
);
manager
()
->
showStatusMessage
(
CdbDebugEngine
::
tr
(
"Running requested..."
),
messageTimeOut
);
if
(
!
continueInferiorProcess
(
errorMessage
))
break
;
...
...
src/plugins/debugger/cdb/cdbdebugengine_p.h
View file @
f098f039
...
...
@@ -194,6 +194,8 @@ const char *executionStatusString(CIDebugControl *ctl);
QString
msgDebugEngineComResult
(
HRESULT
hr
);
QString
msgComFailed
(
const
char
*
func
,
HRESULT
hr
);
enum
{
messageTimeOut
=
5000
};
enum
{
debugCDB
=
0
};
enum
{
debugCDBExecution
=
0
};
enum
{
debugCDBWatchHandling
=
0
};
...
...
src/plugins/debugger/cdb/cdbdumperhelper.cpp
View file @
f098f039
...
...
@@ -288,13 +288,13 @@ bool CdbDumperInitThread::ensureDumperInitialized(CdbDumperHelper &h, QString *e
eventLoop
.
exec
(
QEventLoop
::
ExcludeUserInputEvents
);
QApplication
::
restoreOverrideCursor
();
if
(
thread
.
m_ok
)
{
h
.
m_manager
->
showStatusMessage
(
QCoreApplication
::
translate
(
"Debugger::Internal::CdbDumperHelper"
,
"Stopped / Custom dumper library initialized."
),
-
1
);
h
.
m_manager
->
showStatusMessage
(
QCoreApplication
::
translate
(
"Debugger::Internal::CdbDumperHelper"
,
"Stopped / Custom dumper library initialized."
),
messageTimeOut
);
h
.
m_manager
->
showDebuggerOutput
(
LogMisc
,
h
.
m_helper
.
toString
());
h
.
m_state
=
CdbDumperHelper
::
Initialized
;
}
else
{
h
.
m_state
=
CdbDumperHelper
::
Disabled
;
// No message here
*
errorMessage
=
QCoreApplication
::
translate
(
"Debugger::Internal::CdbDumperHelper"
,
"The custom dumper library could not be initialized: %1"
).
arg
(
*
errorMessage
);
h
.
m_manager
->
showStatusMessage
(
*
errorMessage
,
-
1
);
h
.
m_manager
->
showStatusMessage
(
*
errorMessage
,
messageTimeOut
);
h
.
m_manager
->
showQtDumperLibraryWarning
(
*
errorMessage
);
}
if
(
loadDebug
)
...
...
@@ -332,7 +332,7 @@ void CdbDumperInitThread ::run()
break
;
}
// Perform remaining initialization
emit
statusMessage
(
QCoreApplication
::
translate
(
"Debugger::Internal::CdbDumperHelper"
,
"Initializing dumpers..."
),
-
1
);
emit
statusMessage
(
QCoreApplication
::
translate
(
"Debugger::Internal::CdbDumperHelper"
,
"Initializing dumpers..."
),
60000
);
m_ok
=
m_helper
.
initResolveSymbols
(
m_errorMessage
)
&&
m_helper
.
initKnownTypes
(
m_errorMessage
);
}
...
...
@@ -404,7 +404,7 @@ void CdbDumperHelper::moduleLoadHook(const QString &module, HANDLE debuggeeHandl
// for the thread to finish as this would lock up.
if
(
m_tryInjectLoad
&&
module
.
contains
(
QLatin1String
(
"Qt"
),
Qt
::
CaseInsensitive
))
{
// Also shows up in the log window.
m_manager
->
showStatusMessage
(
msgLoading
(
m_library
,
true
),
10000
);
m_manager
->
showStatusMessage
(
msgLoading
(
m_library
,
true
),
messageTimeOut
);
QString
errorMessage
;
SharedLibraryInjector
sh
(
GetProcessId
(
debuggeeHandle
));
if
(
sh
.
remoteInject
(
m_library
,
false
,
&
errorMessage
))
{
...
...
src/plugins/debugger/cdb/cdbstacktracecontext.cpp
View file @
f098f039
...
...
@@ -116,7 +116,7 @@ bool CdbStackTraceContext::init(unsigned long frameCount, QString * /*errorMessa
frame
.
line
=
ulLine
;
// Vitally important to use canonical file that matches editormanager,
// else the marker will not show.
frame
.
file
=
CDBBreakPoint
::
canonicalSourceFil
e
(
QString
::
fromUtf16
(
reinterpret_cast
<
const
ushort
*>
(
wszBuf
)));
frame
.
file
=
CDBBreakPoint
::
normalizeFileNam
e
(
QString
::
fromUtf16
(
reinterpret_cast
<
const
ushort
*>
(
wszBuf
)));
}
m_frames
.
push_back
(
frame
);
}
...
...
src/plugins/projectexplorer/outputwindow.cpp
View file @
f098f039
...
...
@@ -88,7 +88,6 @@ OutputPane::OutputPane()
m_stopAction
->
setEnabled
(
false
);
Core
::
Command
*
cmd
=
am
->
registerAction
(
m_stopAction
,
Constants
::
STOP
,
globalcontext
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+Shift+R"
)));
m_stopButton
=
new
QToolButton
;
m_stopButton
->
setDefaultAction
(
cmd
->
action
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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