最近對qt-creator的源代碼進行了分析研究,包括編譯、靜態分析、動態調試,用source insight感覺看不太清,於是用qt-creator調試qt-creator,(以前用vs2013調試過qt-creator,但現在忘了當時有什麼研究成果,沒有記錄下來),做下記錄備忘。
qt-creator採用plugin機制,連主界面都是plugin,(叫做coreplugin),這次想研究qt-creator的編輯器,於是跟蹤到texteditor創建過程:
1 TextEditor::TextEditorFactory::createEditor texteditor.cpp 7796 0x7fffd9f9b877
2 Core::Internal::EditorManagerPrivate::createEditor editormanager.cpp 1128 0x7fffdb106898
3 Core::Internal::EditorManagerPrivate::openEditor editormanager.cpp 620 0x7fffdb103045
4 Core::EditorManager::openEditor editormanager.cpp 2567 0x7fffdb10eec7
5 ProjectExplorer::Internal::ProjectTreeWidget::openItem projecttreewidget.cpp 544 0x7fffd94c972a
6 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QModelIndex const&>, void, void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&)>::call qobjectdefs_impl.h 501 0x7fffd94d039c
7 QtPrivate::FunctionPointer<void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&)>::call<QtPrivate::List<QModelIndex const&>, void> qobjectdefs_impl.h 520 0x7fffd94cfc65
8 QtPrivate::QSlotObject<void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&), QtPrivate::List<QModelIndex const&>, void>::impl qobject_impl.h 143 0x7fffd94cee23
9 QMetaObject::activate(QObject *, int, int, void * *) 0x7ffff5ed70ce
10 QAbstractItemView::activated(QModelIndex const&) 0x7ffff7251cc5
11 QTreeView::mouseDoubleClickEvent(QMouseEvent *) 0x7ffff729ab27
12 QWidget::event(QEvent *) 0x7ffff7045b21
13 QFrame::event(QEvent *) 0x7ffff7142b9e
14 QAbstractItemView::viewportEvent(QEvent *) 0x7ffff725f06b
15 QTreeView::viewportEvent(QEvent *) 0x7ffff729ca10
16 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *) 0x7ffff5ead8f3
17 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x7ffff7002b75
18 QApplication::notify(QObject *, QEvent *) 0x7ffff7007820
19 QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x7ffff5eadb80
20 QApplicationPrivate::sendMouseEvent(QWidget *, QMouseEvent *, QWidget *, QWidget *, QWidget * *, QPointer<QWidget>&, bool) 0x7ffff700649f
21 ?? 0x7ffff70614c6
22 ?? 0x7ffff7063aa3
23 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x7ffff7002b9c
24 QApplication::notify(QObject *, QEvent *) 0x7ffff7006f00
25 QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x7ffff5eadb80
26 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *) 0x7ffff67ae3a3
27 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *) 0x7ffff67af5c5
28 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) 0x7ffff6790b23
29 ?? 0x7fffedd99550
30 g_main_context_dispatch 0x7ffff3cdfc5d
31 ?? 0x7ffff3cdff48
32 g_main_context_iteration 0x7ffff3cdfffc
33 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 0x7ffff5efd177
34 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) 0x7ffff5eabbca
35 QCoreApplication::exec() 0x7ffff5eb3a5d
36 main main.cpp 527 0x40ee8a
這是從coreplugin跟過來的,下面進入TextEditor的分析。(先保存,待續)