Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Erik Verbruggen
2009-09-28 11:46:20 +02:00
68 changed files with 2139 additions and 1230 deletions

View File

@@ -5,6 +5,7 @@ language = Cpp
headerdirs = . \ headerdirs = . \
../../src/libs/aggregation \ ../../src/libs/aggregation \
../../src/libs/cplusplus \
../../src/libs/extensionsystem \ ../../src/libs/extensionsystem \
../../src/plugins/coreplugin \ ../../src/plugins/coreplugin \
../../src/plugins/find \ ../../src/plugins/find \
@@ -12,6 +13,7 @@ headerdirs = . \
sourcedirs = . \ sourcedirs = . \
../../src/libs/aggregation \ ../../src/libs/aggregation \
../../src/libs/cplusplus \
../../src/libs/extensionsystem \ ../../src/libs/extensionsystem \
../../src/plugins/coreplugin \ ../../src/plugins/coreplugin \
../../src/plugins/find \ ../../src/plugins/find \

View File

@@ -1,4 +1,4 @@
# Doxyfile 1.5.3 # Doxyfile 1.5.8
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project # doxygen (www.doxygen.org) for a project
@@ -14,24 +14,24 @@
# Project related configuration options # Project related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file that # This tag specifies the encoding used for all characters in the config file
# follow. The default is UTF-8 which is also the encoding used for all text before # that follow. The default is UTF-8 which is also the encoding used for all
# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into # text before the first occurrence of this tag. Doxygen uses libiconv (or the
# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of # iconv built into libc) for the transcoding. See
# possible encodings. # http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8 DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
PROJECT_NAME = QWorkbench PROJECT_NAME = Qt Creator
# The PROJECT_NUMBER tag can be used to enter a project or revision number. # The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 1 PROJECT_NUMBER =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
@@ -54,10 +54,11 @@ CREATE_SUBDIRS = YES
# information to generate all constant output in the proper language. # information to generate all constant output in the proper language.
# The default language is English, other supported languages are: # The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
# Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
@@ -138,7 +139,7 @@ STRIP_FROM_INC_PATH =
# (but less readable) file names. This can be useful is your file systems # (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM. # doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = YES SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style # will interpret the first line (until the first dot) of a JavaDoc-style
@@ -146,7 +147,7 @@ SHORT_NAMES = YES
# comments will behave just like regular Qt-style comments # comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.) # (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will # If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style # interpret the first line (until the first dot) of a Qt-style
@@ -154,7 +155,7 @@ JAVADOC_AUTOBRIEF = NO
# will behave just like regular Qt-style comments (thus requiring # will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.) # an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO QT_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or /// # treat a multi-line C++ special comment block (i.e. a block of //! or ///
@@ -164,13 +165,6 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO MULTILINE_CPP_IS_BRIEF = NO
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
# documentation.
DETAILS_AT_TOP = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it # member inherits the documentation from any documented member that it
# re-implements. # re-implements.
@@ -186,7 +180,7 @@ SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 4
# This tag can be used to specify a number of aliases that acts # This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value". # as commands in the documentation. An alias has the form "name=value".
@@ -205,26 +199,64 @@ ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for Java. # sources only. Doxygen will then generate output that is more tailored for
# For instance, namespaces will be presented as packages, qualified scopes # Java. For instance, namespaces will be presented as packages, qualified
# will look different, etc. # scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_OUTPUT_JAVA = NO
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# include (a tag file for) the STL sources as input, then you should # sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it parses.
# With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this tag.
# The format is ext=language, where ext is a file extension, and language is one of
# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and # set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
# func(std::string) {}). This also make the inheritance and collaboration # func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate. # diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to # If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support. # enable parsing support.
CPP_CLI_SUPPORT = NO CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen to replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = NO
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first # tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default # member in the group (if any) for the other members of the group. By default
@@ -240,6 +272,32 @@ DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES SUBGROUPING = YES
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -274,10 +332,11 @@ EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be extracted # If this flag is set to YES, the members of anonymous namespaces will be
# and appear in the documentation as a namespace called 'anonymous_namespace{file}', # extracted and appear in the documentation as a namespace called
# where file will be replaced with the base name of the file that contains the anonymous # 'anonymous_namespace{file}', where file will be replaced with the base
# namespace. By default anonymous namespace are hidden. # name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.
EXTRACT_ANON_NSPACES = NO EXTRACT_ANON_NSPACES = NO
@@ -315,7 +374,7 @@ HIDE_IN_BODY_DOCS = NO
# to NO (the default) then the documentation will be excluded. # to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation. # Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also # file names in lower-case letters. If set to YES upper-case letters are also
@@ -356,6 +415,12 @@ SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO SORT_BRIEF_DOCS = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to # sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name, # NO (the default), the class list will be sorted only by class name,
@@ -417,9 +482,22 @@ SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO SHOW_DIRECTORIES = NO
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page.
# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that # The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from the # doxygen should invoke to get the current version for each file (typically from
# version control system). Doxygen will invoke the program by executing (via # the version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of # popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
# provided by doxygen. Whatever the program writes to standard output # provided by doxygen. Whatever the program writes to standard output
@@ -427,6 +505,15 @@ SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER = FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
# doxygen. The layout file controls the global structure of the generated output files
# in an output format independent way. The create the layout file that represents
# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
# file name after the option, if omitted DoxygenLayout.xml will be used as the name
# of the layout file.
LAYOUT_FILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -489,10 +576,11 @@ WARN_LOGFILE =
INPUT = ../../src INPUT = ../../src
# This tag can be used to specify the character encoding of the source files that # This tag can be used to specify the character encoding of the source files
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. # also the default input encoding. Doxygen uses libiconv (or the iconv built
# See http://www.gnu.org/software/libiconv for the list of possible encodings. # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8 INPUT_ENCODING = UTF-8
@@ -501,9 +589,10 @@ INPUT_ENCODING = UTF-8
# and *.h) to filter out the source-files in the directories. If left # and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested: # blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.cpp *.h FILE_PATTERNS = *.cpp \
*.h
# The RECURSIVE tag can be used to turn specify whether or not subdirectories # The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO. # should be searched for input files as well. Possible values are YES and NO.
@@ -534,9 +623,10 @@ EXCLUDE_PATTERNS = moc_* \
Ui_* Ui_*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the output. # (namespaces, classes, functions, etc.) that should be excluded from the
# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, # output. The symbol name can be a fully qualified name, a word, or if the
# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test # wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS = EXCLUDE_SYMBOLS =
@@ -571,14 +661,17 @@ IMAGE_PATH =
# by executing (via popen()) the command <filter> <input-file>, where <filter> # by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an # is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes # input file. Doxygen will then use the output that the filter program writes
# to standard output. If FILTER_PATTERNS is specified, this tag will be # to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored. # ignored.
INPUT_FILTER = INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the # basis.
# filter if there is a match. The filters are a list of the form: # Doxygen will compare the file name with each pattern and apply the
# filter if there is a match.
# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files. # is applied to all files.
@@ -598,9 +691,7 @@ FILTER_SOURCE_FILES = NO
# If the SOURCE_BROWSER tag is set to YES then a list of source files will # If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources. # be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also # Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH # VERBATIM_HEADERS is set to NO.
# then you must also enable this option. If you don't then doxygen will produce
# a warning and turn it on anyway
SOURCE_BROWSER = YES SOURCE_BROWSER = YES
@@ -615,13 +706,13 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES (the default) # If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented # then for each documented function all documented
# functions referencing it will be listed. # functions referencing it will be listed.
REFERENCED_BY_RELATION = YES REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES (the default) # If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities # then for each documented function all documented entities
# called/used by that function will be listed. # called/used by that function will be listed.
@@ -630,7 +721,8 @@ REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code. Otherwise they will link to the documentstion. # link to the source code.
# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES REFERENCES_LINK_SOURCE = YES
@@ -646,7 +738,7 @@ USE_HTAGS = NO
# will generate a verbatim copy of the header file for each class for # will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this. # which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = NO VERBATIM_HEADERS = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the alphabetical class index # configuration options related to the alphabetical class index
@@ -719,20 +811,46 @@ HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the # documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports # page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = NO HTML_DYNAMIC_SECTIONS = YES
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
GENERATE_DOCSET = YES
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Qt Creator API"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = com.qtsoftware.qt-creator
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You # be used to specify the file name of the resulting .chm file. You
@@ -754,6 +872,12 @@ HHC_LOCATION =
GENERATE_CHI = NO GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a # controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file. # normal table of contents (NO) in the .chm file.
@@ -765,6 +889,55 @@ BINARY_TOC = NO
TOC_EXPAND = NO TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
# are set, an additional index file will be generated that can be used as input for
# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
# HTML documentation.
GENERATE_QHP = YES
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE = ../qch/qt-creator-api.qch
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = com.qtsoftware.qt-creator.1
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = qt-creator-api
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
# For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
# filter section matches.
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION = qhelpgenerator
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at # The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
@@ -776,12 +949,20 @@ DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4 ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# generated containing a tree-like index structure (just like the one that # structure should be generated to display hierarchical information.
# If the tag value is set to FRAME, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports # is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature. # probably better off using the HTML help feature. Other possible values
# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list;
# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
# disables this behavior completely. For backwards compatibility with previous
# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
# respectively.
GENERATE_TREEVIEW = NO GENERATE_TREEVIEW = NO
@@ -791,6 +972,14 @@ GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250 TREEVIEW_WIDTH = 250
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the LaTeX output # configuration options related to the LaTeX output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -1003,8 +1192,10 @@ GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader. This is useful # nicely formatted so it can be parsed by a human reader.
# if you want to understand what is going on. On the other hand, if this # This is useful
# if you want to understand what is going on.
# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller # tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same. # and Perl will parse it just the same.
@@ -1091,8 +1282,10 @@ SKIP_FUNCTION_MACROS = YES
# Optionally an initial location of the external documentation # Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without # can be added for each tagfile. The format of a tag file without
# this location is as follows: # this location is as follows:
#
# TAGFILES = file1 file2 ... # TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows: # Adding location for the tag files is done as follows:
#
# TAGFILES = file1=loc1 "file2 = loc2" ... # TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or # where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool # URLs. If a location is present for each tag, the installdox tool
@@ -1140,10 +1333,11 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc # You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to # command. Doxygen will then run the mscgen tool (see
# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# specify the directory where the mscgen tool resides. If left empty the tool is assumed to # documentation. The MSCGEN_PATH tag allows you to specify the directory where
# be found in the default search path. # the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH = MSCGEN_PATH =
@@ -1160,6 +1354,29 @@ HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES HAVE_DOT = YES
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
# font does not include all possible unicode characters however, so when you need
# these (or just want a differently looking font) you can specify the font name
# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and # will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the # indirect inheritance relations. Setting this tag to YES will force the
@@ -1204,19 +1421,19 @@ INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will # If the CALL_GRAPH and HAVE_DOT options are set to YES then
# generate a call dependency graph for every global function or class method. # doxygen will generate a call dependency graph for every global function
# Note that enabling this option will significantly increase the time of a run. # or class method. Note that enabling this option will significantly increase
# So in most cases it will be better to enable call graphs for selected # the time of a run. So in most cases it will be better to enable call graphs
# functions only using the \callgraph command. # for selected functions only using the \callgraph command.
CALL_GRAPH = NO CALL_GRAPH = NO
# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# generate a caller dependency graph for every global function or class method. # doxygen will generate a caller dependency graph for every global function
# Note that enabling this option will significantly increase the time of a run. # or class method. Note that enabling this option will significantly increase
# So in most cases it will be better to enable caller graphs for selected # the time of a run. So in most cases it will be better to enable caller
# functions only using the \callergraph command. # graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO CALLER_GRAPH = NO
@@ -1249,12 +1466,12 @@ DOT_PATH =
DOTFILE_DIRS = DOTFILE_DIRS =
# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph # nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is # becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the number # visualized by representing a node as a red box. Note that doxygen if the
# of direct children of the root node in a graph is already larger than # number of direct children of the root node in a graph is already larger than
# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50 DOT_GRAPH_MAX_NODES = 50
@@ -1270,10 +1487,10 @@ DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000 MAX_DOT_GRAPH_DEPTH = 1000
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, which results in a white background. # background. This is disabled by default, because dot on Windows does not
# Warning: Depending on the platform used, enabling this option may lead to # seem to support this out of the box. Warning: Depending on the platform used,
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to # enabling this option may lead to badly anti-aliased labels on the edges of
# read). # a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO DOT_TRANSPARENT = NO
@@ -1297,7 +1514,7 @@ GENERATE_LEGEND = YES
DOT_CLEANUP = YES DOT_CLEANUP = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::additions related to the search engine # Options related to the search engine
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be # The SEARCHENGINE tag specifies whether or not a search engine should be

View File

@@ -44,6 +44,11 @@
#include <QtCore/QBitArray> #include <QtCore/QBitArray>
#include <QtCore/QtDebug> #include <QtCore/QtDebug>
/*!
\namespace CPlusPlus
The namespace for C++ related tools.
*/
using namespace CPlusPlus; using namespace CPlusPlus;
namespace { namespace {
@@ -101,6 +106,7 @@ private:
} // anonymous namespace } // anonymous namespace
Document::Document(const QString &fileName) Document::Document(const QString &fileName)
: _fileName(fileName), : _fileName(fileName),
_globalNamespace(0), _globalNamespace(0),
@@ -166,9 +172,10 @@ void Document::appendMacro(const Macro &macro)
} }
void Document::addMacroUse(const Macro &macro, unsigned offset, unsigned length, void Document::addMacroUse(const Macro &macro, unsigned offset, unsigned length,
const QVector<MacroArgumentReference> &actuals) const QVector<MacroArgumentReference> &actuals, bool inCondition)
{ {
MacroUse use(macro, offset, offset + length); MacroUse use(macro, offset, offset + length);
use.setInCondition(inCondition);
foreach (const MacroArgumentReference &actual, actuals) { foreach (const MacroArgumentReference &actual, actuals) {
const Block arg(actual.position(), actual.position() + actual.length()); const Block arg(actual.position(), actual.position() + actual.length());
@@ -179,6 +186,60 @@ void Document::addMacroUse(const Macro &macro, unsigned offset, unsigned length,
_macroUses.append(use); _macroUses.append(use);
} }
void Document::addUndefinedMacroUse(const QByteArray &name, unsigned offset)
{
QByteArray copy(name.data(), name.size());
UndefinedMacroUse use(copy, offset);
_undefinedMacroUses.append(use);
}
/*!
\class Document::MacroUse
\brief Represents the usage of a macro in a \l {Document}.
\sa Document::UndefinedMacroUse
*/
/*!
\class Document::UndefinedMacroUse
\brief Represents a macro that was looked up, but not found.
Holds data about the reference to a macro in an \tt{#ifdef} or \tt{#ifndef}
or argument to the \tt{defined} operator inside an \tt{#if} or \tt{#elif} that does
not exist.
\sa Document::undefinedMacroUses(), Document::MacroUse, Macro
*/
/*!
\fn QByteArray Document::UndefinedMacroUse::name() const
Returns the name of the macro that was not found.
*/
/*!
\fn QList<UndefinedMacroUse> Document::undefinedMacroUses() const
Returns a list of referenced but undefined macros.
\sa Document::macroUses(), Document::definedMacros(), Macro
*/
/*!
\fn QList<MacroUse> Document::macroUses() const
Returns a list of macros used.
\sa Document::undefinedMacroUses(), Document::definedMacros(), Macro
*/
/*!
\fn QList<Macro> Document::definedMacros() const
Returns the list of macros defined.
\sa Document::macroUses(), Document::undefinedMacroUses()
*/
TranslationUnit *Document::translationUnit() const TranslationUnit *Document::translationUnit() const
{ {
return _translationUnit; return _translationUnit;

View File

@@ -70,7 +70,8 @@ public:
void appendMacro(const Macro &macro); void appendMacro(const Macro &macro);
void addMacroUse(const Macro &macro, unsigned offset, unsigned length, void addMacroUse(const Macro &macro, unsigned offset, unsigned length,
const QVector<MacroArgumentReference> &range); const QVector<MacroArgumentReference> &range, bool inCondition);
void addUndefinedMacroUse(const QByteArray &name, unsigned offset);
Control *control() const; Control *control() const;
TranslationUnit *translationUnit() const; TranslationUnit *translationUnit() const;
@@ -220,13 +221,15 @@ public:
class MacroUse: public Block { class MacroUse: public Block {
Macro _macro; Macro _macro;
QVector<Block> _arguments; QVector<Block> _arguments;
bool _inCondition;
public: public:
inline MacroUse(const Macro &macro, inline MacroUse(const Macro &macro,
unsigned begin = 0, unsigned begin = 0,
unsigned end = 0) unsigned end = 0)
: Block(begin, end), : Block(begin, end),
_macro(macro) _macro(macro),
_inCondition(false)
{ } { }
const Macro &macro() const const Macro &macro() const
@@ -238,11 +241,37 @@ public:
QVector<Block> arguments() const QVector<Block> arguments() const
{ return _arguments; } { return _arguments; }
bool isInCondition() const
{ return _inCondition; }
private:
void setArguments(const QVector<Block> &arguments) void setArguments(const QVector<Block> &arguments)
{ _arguments = arguments; } { _arguments = arguments; }
void addArgument(const Block &block) void addArgument(const Block &block)
{ _arguments.append(block); } { _arguments.append(block); }
void setInCondition(bool set)
{ _inCondition = set; }
friend class Document;
};
class UndefinedMacroUse: public Block {
QByteArray _name;
public:
inline UndefinedMacroUse(
const QByteArray &name,
unsigned begin = 0)
: Block(begin, begin + name.length()),
_name(name)
{ }
QByteArray name() const
{
return _name;
}
}; };
QList<Include> includes() const QList<Include> includes() const
@@ -254,6 +283,9 @@ public:
QList<MacroUse> macroUses() const QList<MacroUse> macroUses() const
{ return _macroUses; } { return _macroUses; }
QList<UndefinedMacroUse> undefinedMacroUses() const
{ return _undefinedMacroUses; }
private: private:
Symbol *findSymbolAt(unsigned line, unsigned column, Scope *scope) const; Symbol *findSymbolAt(unsigned line, unsigned column, Scope *scope) const;
@@ -267,6 +299,7 @@ private:
QList<Macro> _definedMacros; QList<Macro> _definedMacros;
QList<Block> _skippedBlocks; QList<Block> _skippedBlocks;
QList<MacroUse> _macroUses; QList<MacroUse> _macroUses;
QList<UndefinedMacroUse> _undefinedMacroUses;
QByteArray _source; QByteArray _source;
unsigned _revision; unsigned _revision;

View File

@@ -58,9 +58,13 @@ public:
virtual void macroAdded(const Macro &) {} virtual void macroAdded(const Macro &) {}
virtual void passedMacroDefinitionCheck(unsigned, const Macro &) {}
virtual void failedMacroDefinitionCheck(unsigned, const QByteArray &) {}
virtual void startExpandingMacro(unsigned, virtual void startExpandingMacro(unsigned,
const Macro &, const Macro &,
const QByteArray &, const QByteArray &,
bool,
const QVector<MacroArgumentReference> &) {} const QVector<MacroArgumentReference> &) {}
virtual void stopExpandingMacro(unsigned, const Macro &) {} virtual void stopExpandingMacro(unsigned, const Macro &) {}

View File

@@ -467,7 +467,7 @@ void LookupContext::expandFunction(Function *function,
} }
void LookupContext::expandObjCMethod(ObjCMethod *method, void LookupContext::expandObjCMethod(ObjCMethod *method,
const QList<Scope *> &visibleScopes, const QList<Scope *> &,
QList<Scope *> *expandedScopes) const QList<Scope *> *expandedScopes) const
{ {
if (! expandedScopes->contains(method->arguments())) if (! expandedScopes->contains(method->arguments()))
@@ -495,3 +495,51 @@ void LookupContext::expand(Scope *scope,
expandObjCMethod(meth, visibleScopes, expandedScopes); expandObjCMethod(meth, visibleScopes, expandedScopes);
} }
} }
Symbol *LookupContext::canonicalSymbol(Symbol *symbol)
{
Symbol *canonical = symbol;
for (; symbol; symbol = symbol->next()) {
if (symbol->name() == canonical->name())
canonical = symbol;
}
return canonical;
}
Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates)
{
if (candidates.isEmpty())
return 0;
Symbol *candidate = candidates.first();
if (candidate->scope()->isClassScope() && candidate->type()->isFunctionType()) {
Function *function = 0;
for (int i = 0; i < candidates.size(); ++i) {
Symbol *c = candidates.at(i);
if (! c->scope()->isClassScope())
continue;
else if (Function *f = c->type()->asFunctionType()) {
if (f->isVirtual())
function = f;
}
}
if (function)
return canonicalSymbol(function);
}
return canonicalSymbol(candidate);
}
Symbol *LookupContext::canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &results)
{
QList<Symbol *> candidates;
QPair<FullySpecifiedType, Symbol *> result;
foreach (result, results) {
candidates.append(result.second); // ### not exacly.
}
return canonicalSymbol(candidates);
}

View File

@@ -54,6 +54,10 @@ public:
Document::Ptr document(const QString &fileName) const; Document::Ptr document(const QString &fileName) const;
Snapshot snapshot() const; Snapshot snapshot() const;
static Symbol *canonicalSymbol(Symbol *symbol);
static Symbol *canonicalSymbol(const QList<Symbol *> &candidates);
static Symbol *canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &candidates); // ### FIXME
QList<Symbol *> resolve(Name *name) const QList<Symbol *> resolve(Name *name) const
{ return resolve(name, visibleScopes()); } { return resolve(name, visibleScopes()); }

View File

@@ -31,6 +31,44 @@
using namespace CPlusPlus; using namespace CPlusPlus;
/*!
\class Client
\brief A notification interface for for C++ preprocessor.
*/
/*!
\fn void Client::macroAdded(const Macro &macro)
Called whenever a new macro is defined.
*/
/*!
\fn void Client::passedMacroDefinitionCheck(unsigned offset, const Macro &macro)
Called when the preprocessor checks whether a macro is defined or not and the
result is positive.
\sa failedMacroDefinitionCheck()
*/
/*!
\fn void Client::failedMacroDefinitionCheck(unsigned offset, const QByteArray &name)
Called when the preprocessor checks whether a macro is defined or not and the
result is negative.
\sa passedMacroDefinitionCheck()
*/
/*!
\fn void Client::startExpandingMacro(unsigned offset, const Macro &macro, const QByteArray &originalText, bool inCondition = false, const QVector<MacroArgumentReference> &actuals = QVector<MacroArgumentReference>())
Called when starting to expand a macro. The parameter \a inCondition indicates whether the
expansion is happening inside a preprocessor conditional.
\sa stopExpandingMacro()
*/
Client::Client() Client::Client()
{ } { }

View File

@@ -75,12 +75,14 @@ public:
virtual ~Client(); virtual ~Client();
virtual void macroAdded(const Macro &macro) = 0; virtual void macroAdded(const Macro &macro) = 0;
virtual void sourceNeeded(QString &fileName, IncludeType mode,
unsigned line) = 0; // ### FIX the signature. virtual void passedMacroDefinitionCheck(unsigned offset, const Macro &macro) = 0;
virtual void failedMacroDefinitionCheck(unsigned offset, const QByteArray &name) = 0;
virtual void startExpandingMacro(unsigned offset, virtual void startExpandingMacro(unsigned offset,
const Macro &macro, const Macro &macro,
const QByteArray &originalText, const QByteArray &originalText,
bool inCondition = false,
const QVector<MacroArgumentReference> &actuals const QVector<MacroArgumentReference> &actuals
= QVector<MacroArgumentReference>()) = 0; = QVector<MacroArgumentReference>()) = 0;
@@ -89,6 +91,9 @@ public:
virtual void startSkippingBlocks(unsigned offset) = 0; virtual void startSkippingBlocks(unsigned offset) = 0;
virtual void stopSkippingBlocks(unsigned offset) = 0; virtual void stopSkippingBlocks(unsigned offset) = 0;
virtual void sourceNeeded(QString &fileName, IncludeType mode,
unsigned line) = 0; // ### FIX the signature.
}; };
} // namespace CPlusPlus } // namespace CPlusPlus

View File

@@ -138,6 +138,18 @@ using namespace CPlusPlus;
namespace { namespace {
bool isMacroDefined(QByteArray name, unsigned offset, Environment *env, Client *client)
{
Macro *m = env->resolve(name);
if (client) {
if (m)
client->passedMacroDefinitionCheck(offset, *m);
else
client->failedMacroDefinitionCheck(offset, name);
}
return m != 0;
}
class RangeLexer class RangeLexer
{ {
const Token *first; const Token *first;
@@ -193,8 +205,8 @@ class ExpressionEvaluator
void operator = (const ExpressionEvaluator &other); void operator = (const ExpressionEvaluator &other);
public: public:
ExpressionEvaluator(Environment *env) ExpressionEvaluator(Client *client, Environment *env)
: env(env), _lex(0) : client(client), env(env), _lex(0)
{ } { }
Value operator()(const Token *firstToken, const Token *lastToken, Value operator()(const Token *firstToken, const Token *lastToken,
@@ -255,13 +267,13 @@ protected:
} else if (isTokenDefined()) { } else if (isTokenDefined()) {
++(*_lex); ++(*_lex);
if ((*_lex)->is(T_IDENTIFIER)) { if ((*_lex)->is(T_IDENTIFIER)) {
_value.set_long(env->resolve(tokenSpell()) != 0); _value.set_long(isMacroDefined(tokenSpell(), (*_lex)->offset, env, client));
++(*_lex); ++(*_lex);
return true; return true;
} else if ((*_lex)->is(T_LPAREN)) { } else if ((*_lex)->is(T_LPAREN)) {
++(*_lex); ++(*_lex);
if ((*_lex)->is(T_IDENTIFIER)) { if ((*_lex)->is(T_IDENTIFIER)) {
_value.set_long(env->resolve(tokenSpell()) != 0); _value.set_long(isMacroDefined(tokenSpell(), (*_lex)->offset, env, client));
++(*_lex); ++(*_lex);
if ((*_lex)->is(T_RPAREN)) { if ((*_lex)->is(T_RPAREN)) {
++(*_lex); ++(*_lex);
@@ -519,6 +531,7 @@ protected:
} }
private: private:
Client *client;
Environment *env; Environment *env;
QByteArray source; QByteArray source;
RangeLexer *_lex; RangeLexer *_lex;
@@ -983,7 +996,7 @@ void Preprocessor::expandObjectLikeMacro(TokenIterator identifierToken,
{ {
if (client) if (client)
client->startExpandingMacro(identifierToken->offset, client->startExpandingMacro(identifierToken->offset,
*m, spell); *m, spell, false);
m->setHidden(true); m->setHidden(true);
expand(m->definition(), result); expand(m->definition(), result);
@@ -1007,7 +1020,7 @@ void Preprocessor::expandFunctionLikeMacro(TokenIterator identifierToken,
endOfText - beginOfText); endOfText - beginOfText);
client->startExpandingMacro(identifierToken->offset, client->startExpandingMacro(identifierToken->offset,
*m, text, actuals); *m, text, false, actuals);
} }
const bool was = markGeneratedTokens(true, identifierToken); const bool was = markGeneratedTokens(true, identifierToken);
@@ -1253,7 +1266,7 @@ void Preprocessor::processIf(TokenIterator firstToken, TokenIterator lastToken)
const char *first = startOfToken(*tk); const char *first = startOfToken(*tk);
const char *last = startOfToken(*lastToken); const char *last = startOfToken(*lastToken);
MacroExpander expandCondition (env); MacroExpander expandCondition (env, 0, client, tk.dot()->offset);
QByteArray condition; QByteArray condition;
condition.reserve(256); condition.reserve(256);
expandCondition(first, last, &condition); expandCondition(first, last, &condition);
@@ -1297,7 +1310,7 @@ void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken
const char *first = startOfToken(*tk); const char *first = startOfToken(*tk);
const char *last = startOfToken(*lastToken); const char *last = startOfToken(*lastToken);
MacroExpander expandCondition (env); MacroExpander expandCondition (env, 0, client, tk.dot()->offset);
QByteArray condition; QByteArray condition;
condition.reserve(256); condition.reserve(256);
expandCondition(first, last, &condition); expandCondition(first, last, &condition);
@@ -1338,7 +1351,7 @@ void Preprocessor::processIfdef(bool checkUndefined,
if (testIfLevel()) { if (testIfLevel()) {
if (tk->is(T_IDENTIFIER)) { if (tk->is(T_IDENTIFIER)) {
const QByteArray macroName = tokenSpell(*tk); const QByteArray macroName = tokenSpell(*tk);
bool value = env->resolve(macroName) != 0 || env->isBuiltinMacro(macroName); bool value = isMacroDefined(macroName, tk->offset, env, client) || env->isBuiltinMacro(macroName);
if (checkUndefined) if (checkUndefined)
value = ! value; value = ! value;
@@ -1437,7 +1450,7 @@ int Preprocessor::skipping() const
Value Preprocessor::evalExpression(TokenIterator firstToken, TokenIterator lastToken, Value Preprocessor::evalExpression(TokenIterator firstToken, TokenIterator lastToken,
const QByteArray &source) const const QByteArray &source) const
{ {
ExpressionEvaluator eval(env); ExpressionEvaluator eval(client, env);
const Value result = eval(firstToken, lastToken, source); const Value result = eval(firstToken, lastToken, source);
return result; return result;
} }

View File

@@ -66,9 +66,11 @@ inline static bool comment_p (const char *__first, const char *__last)
return (*__first == '/' || *__first == '*'); return (*__first == '/' || *__first == '*');
} }
MacroExpander::MacroExpander(Environment *env, pp_frame *frame) MacroExpander::MacroExpander(Environment *env, pp_frame *frame, Client *client, unsigned start_offset)
: env(env), : env(env),
frame(frame), frame(frame),
client(client),
start_offset(start_offset),
lines(0) lines(0)
{ } { }
@@ -97,6 +99,7 @@ const char *MacroExpander::operator()(const char *first, const char *last,
const char *MacroExpander::expand(const char *__first, const char *__last, const char *MacroExpander::expand(const char *__first, const char *__last,
QByteArray *__result) QByteArray *__result)
{ {
const char *start = __first;
__first = skip_blanks (__first, __last); __first = skip_blanks (__first, __last);
lines = skip_blanks.lines; lines = skip_blanks.lines;
@@ -284,6 +287,9 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
if (! macro->definition().isEmpty()) if (! macro->definition().isEmpty())
{ {
if (client)
client->startExpandingMacro(start_offset + (name_begin-start), *macro, fast_name, true);
macro->setHidden(true); macro->setHidden(true);
QByteArray __tmp; QByteArray __tmp;
@@ -310,6 +316,9 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
} }
macro->setHidden(false); macro->setHidden(false);
if (client)
client->stopExpandingMacro(start_offset + (name_begin-start), *macro);
} }
if (! m) if (! m)
@@ -330,6 +339,7 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
} }
QVector<QByteArray> actuals; QVector<QByteArray> actuals;
QVector<MacroArgumentReference> actuals_ref;
actuals.reserve (5); actuals.reserve (5);
++arg_it; // skip '(' ++arg_it; // skip '('
@@ -338,6 +348,7 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
const char *arg_end = skip_argument_variadics (actuals, macro, arg_it, __last); const char *arg_end = skip_argument_variadics (actuals, macro, arg_it, __last);
if (arg_it != arg_end) if (arg_it != arg_end)
{ {
actuals_ref.append(MacroArgumentReference(start_offset + (arg_it-start), arg_end - arg_it));
const QByteArray actual (arg_it, arg_end - arg_it); const QByteArray actual (arg_it, arg_end - arg_it);
QByteArray expanded; QByteArray expanded;
expand_actual (actual.constBegin (), actual.constEnd (), &expanded); expand_actual (actual.constBegin (), actual.constEnd (), &expanded);
@@ -350,6 +361,7 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
++arg_it; // skip ',' ++arg_it; // skip ','
arg_end = skip_argument_variadics (actuals, macro, arg_it, __last); arg_end = skip_argument_variadics (actuals, macro, arg_it, __last);
actuals_ref.append(MacroArgumentReference(start_offset + (arg_it-start), arg_end - arg_it));
const QByteArray actual (arg_it, arg_end - arg_it); const QByteArray actual (arg_it, arg_end - arg_it);
QByteArray expanded; QByteArray expanded;
expand_actual (actual.constBegin (), actual.constEnd (), &expanded); expand_actual (actual.constBegin (), actual.constEnd (), &expanded);
@@ -363,11 +375,17 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
++arg_it; // skip ')' ++arg_it; // skip ')'
__first = arg_it; __first = arg_it;
if (client)
client->startExpandingMacro(start_offset + (name_begin-start), *macro, fast_name, true, actuals_ref);
pp_frame frame (macro, actuals); pp_frame frame (macro, actuals);
MacroExpander expand_macro (env, &frame); MacroExpander expand_macro (env, &frame);
macro->setHidden(true); macro->setHidden(true);
expand_macro (macro->definition(), __result); expand_macro (macro->definition(), __result);
macro->setHidden(false); macro->setHidden(false);
if (client)
client->stopExpandingMacro(start_offset + (name_begin-start), *macro);
} }
else else
__result->append(*__first++); __result->append(*__first++);

View File

@@ -56,6 +56,7 @@
namespace CPlusPlus { namespace CPlusPlus {
class Environment; class Environment;
class Client;
struct pp_frame; struct pp_frame;
@@ -63,6 +64,8 @@ class MacroExpander
{ {
Environment *env; Environment *env;
pp_frame *frame; pp_frame *frame;
Client *client;
unsigned start_offset;
pp_skip_number skip_number; pp_skip_number skip_number;
pp_skip_identifier skip_identifier; pp_skip_identifier skip_identifier;
@@ -76,7 +79,7 @@ class MacroExpander
const QByteArray *resolve_formal(const QByteArray &name); const QByteArray *resolve_formal(const QByteArray &name);
public: public:
MacroExpander(Environment *env, pp_frame *frame = 0); MacroExpander(Environment *env, pp_frame *frame = 0, Client *client = 0, unsigned start_offset = 0);
const char *operator()(const char *first, const char *last, const char *operator()(const char *first, const char *last,
QByteArray *result); QByteArray *result);

View File

@@ -205,17 +205,17 @@ public slots:
bool closeAllEditors(bool askAboutModifiedEditors = true); bool closeAllEditors(bool askAboutModifiedEditors = true);
void openInExternalEditor(); void openInExternalEditor();
private slots:
bool saveFile(Core::IEditor *editor = 0); bool saveFile(Core::IEditor *editor = 0);
bool saveFileAs(Core::IEditor *editor = 0); bool saveFileAs(Core::IEditor *editor = 0);
void revertToSaved();
void closeEditor(); void closeEditor();
void closeOtherEditors(); void closeOtherEditors();
private slots:
void gotoNextDocHistory(); void gotoNextDocHistory();
void gotoPreviousDocHistory(); void gotoPreviousDocHistory();
void handleContextChange(Core::IContext *context); void handleContextChange(Core::IContext *context);
void updateActions(); void updateActions();
void revertToSaved();
void makeCurrentEditorWritable(); void makeCurrentEditorWritable();
public slots: public slots:

View File

@@ -857,22 +857,9 @@ void CPPEditor::findReferences()
lastVisibleSymbol, lastVisibleSymbol,
TypeOfExpression::Preprocess); TypeOfExpression::Preprocess);
if (! results.isEmpty()) { if (Symbol *canonicalSymbol = LookupContext::canonicalSymbol(results)) {
TypeOfExpression::Result result = results.first(); m_modelManager->findReferences(canonicalSymbol);
Symbol *symbol = result.second;
qDebug() << "result:" << symbol->fileName() << symbol->line() << symbol->column();
m_modelManager->findReferences(symbol);
} }
#if 0
LookupContext context(
Overview oo;
qDebug() << "==============> filename:" << symbol->fileName()
<< "name:" << oo(symbol->name());
m_modelManager->findReferences(symbol);
}
#endif
} }
void CPPEditor::renameSymbolUnderCursor() void CPPEditor::renameSymbolUnderCursor()
@@ -1345,6 +1332,39 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
return false; return false;
} }
static void countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen)
{
if (c == open)
++*stillopen;
else if (c == close)
--*stillopen;
if (*stillopen < 0) {
*errors += -1 * (*stillopen);
*stillopen = 0;
}
}
void countBrackets(QTextCursor cursor, int from, int end, QChar open, QChar close, int *errors, int *stillopen)
{
cursor.setPosition(from);
QTextBlock block = cursor.block();
while (block.isValid() && block.position() < end) {
TextEditor::Parentheses parenList = TextEditor::TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditor::TextEditDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
TextEditor::Parenthesis paren = parenList.at(i);
int position = block.position() + paren.pos;
if (position < from || position >= end)
continue;
countBracket(open, close, paren.chr, errors, stillopen);
}
}
block = block.next();
}
}
QString CPPEditor::autoComplete(QTextCursor &cursor, const QString &textToInsert) const QString CPPEditor::autoComplete(QTextCursor &cursor, const QString &textToInsert) const
{ {
const bool checkBlockEnd = m_allowSkippingOfBlockEnd; const bool checkBlockEnd = m_allowSkippingOfBlockEnd;
@@ -1356,6 +1376,33 @@ QString CPPEditor::autoComplete(QTextCursor &cursor, const QString &textToInsert
QString text = textToInsert; QString text = textToInsert;
const QChar lookAhead = characterAt(cursor.selectionEnd()); const QChar lookAhead = characterAt(cursor.selectionEnd());
QChar character = textToInsert.at(0);
QString parentheses = QLatin1String("()");
QString brackets = QLatin1String("[]");
if (parentheses.contains(character) || brackets.contains(character)) {
QTextCursor tmp= cursor;
TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tmp);
int blockStart = tmp.isNull() ? 0 : tmp.position();
tmp = cursor;
TextEditor::TextBlockUserData::findNextBlockClosingParenthesis(&tmp);
int blockEnd = tmp.isNull() ? (cursor.document()->characterCount()-1) : tmp.position();
QChar openChar = parentheses.contains(character) ? QLatin1Char('(') : QLatin1Char('[');
QChar closeChar = parentheses.contains(character) ? QLatin1Char(')') : QLatin1Char(']');
int errors = 0;
int stillopen = 0;
countBrackets(cursor, blockStart, blockEnd, openChar, closeChar, &errors, &stillopen);
int errorsBeforeInsertion = errors + stillopen;
errors = 0;
stillopen = 0;
countBrackets(cursor, blockStart, cursor.position(), openChar, closeChar, &errors, &stillopen);
countBracket(openChar, closeChar, character, &errors, &stillopen);
countBrackets(cursor, cursor.position(), blockEnd, openChar, closeChar, &errors, &stillopen);
int errorsAfterInsertion = errors + stillopen;
if (errorsAfterInsertion < errorsBeforeInsertion)
return QString(); // insertion fixes parentheses or bracket errors, do not auto complete
}
MatchingText matchingText; MatchingText matchingText;
int skippedChars = 0; int skippedChars = 0;
const QString autoText = matchingText.insertMatchingBrace(cursor, text, lookAhead, &skippedChars); const QString autoText = matchingText.insertMatchingBrace(cursor, text, lookAhead, &skippedChars);
@@ -1392,6 +1439,32 @@ bool CPPEditor::autoBackspace(QTextCursor &cursor)
QChar lookAhead = characterAt(pos); QChar lookAhead = characterAt(pos);
QChar lookBehind = characterAt(pos-1); QChar lookBehind = characterAt(pos-1);
QChar lookFurtherBehind = characterAt(pos-2); QChar lookFurtherBehind = characterAt(pos-2);
QChar character = lookBehind;
if (character == QLatin1Char('(') || character == QLatin1Char('[')) {
QTextCursor tmp = cursor;
TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tmp);
int blockStart = tmp.isNull() ? 0 : tmp.position();
tmp = cursor;
TextEditor::TextBlockUserData::findNextBlockClosingParenthesis(&tmp);
int blockEnd = tmp.isNull() ? (cursor.document()->characterCount()-1) : tmp.position();
QChar openChar = character;
QChar closeChar = (character == QLatin1Char('(')) ? QLatin1Char(')') : QLatin1Char(']');
int errors = 0;
int stillopen = 0;
countBrackets(cursor, blockStart, blockEnd, openChar, closeChar, &errors, &stillopen);
int errorsBeforeDeletion = errors + stillopen;
errors = 0;
stillopen = 0;
countBrackets(cursor, blockStart, pos - 1, openChar, closeChar, &errors, &stillopen);
countBrackets(cursor, pos, blockEnd, openChar, closeChar, &errors, &stillopen);
int errorsAfterDeletion = errors + stillopen;
if (errorsAfterDeletion < errorsBeforeDeletion)
return false; // insertion fixes parentheses or bracket errors, do not auto complete
}
if ((lookBehind == QLatin1Char('(') && lookAhead == QLatin1Char(')')) if ((lookBehind == QLatin1Char('(') && lookAhead == QLatin1Char(')'))
|| (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']')) || (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']'))
|| (lookBehind == QLatin1Char('"') && lookAhead == QLatin1Char('"') || (lookBehind == QLatin1Char('"') && lookAhead == QLatin1Char('"')

View File

@@ -52,12 +52,13 @@ void CppHighlighter::highlightBlock(const QString &text)
QTextCharFormat emptyFormat; QTextCharFormat emptyFormat;
const int previousState = previousBlockState(); const int previousState = previousBlockState();
int state = 0, braceDepth = 0; int state = 0, initialBraceDepth = 0;
if (previousState != -1) { if (previousState != -1) {
state = previousState & 0xff; state = previousState & 0xff;
braceDepth = previousState >> 8; initialBraceDepth = previousState >> 8;
} }
int braceDepth = initialBraceDepth;
SimpleLexer tokenize; SimpleLexer tokenize;
tokenize.setQtMocRunEnabled(false); tokenize.setQtMocRunEnabled(false);
@@ -211,6 +212,10 @@ void CppHighlighter::highlightBlock(const QString &text)
TextEditDocumentLayout::setParentheses(currentBlock(), parentheses); TextEditDocumentLayout::setParentheses(currentBlock(), parentheses);
// if the block is ifdefed out, we only store the parentheses, but
// do not adjust the brace depth.
if (TextEditDocumentLayout::ifdefedOut(currentBlock()))
braceDepth = initialBraceDepth;
// optimization: if only the brace depth changes, we adjust subsequent blocks // optimization: if only the brace depth changes, we adjust subsequent blocks
// to have QSyntaxHighlighter stop the rehighlighting // to have QSyntaxHighlighter stop the rehighlighting
@@ -222,12 +227,7 @@ void CppHighlighter::highlightBlock(const QString &text)
int delta = braceDepth - oldBraceDepth; int delta = braceDepth - oldBraceDepth;
QTextBlock block = currentBlock().next(); QTextBlock block = currentBlock().next();
while (block.isValid()) { while (block.isValid()) {
currentState = block.userState(); TextEditDocumentLayout::changeBraceDepth(block, delta);
if (currentState != -1) {
oldState = currentState & 0xff;
oldBraceDepth = currentState >> 8;
block.setUserState(((oldBraceDepth + delta) << 8 ) | oldState);
}
block = block.next(); block = block.next();
} }
} }

View File

@@ -44,10 +44,13 @@
#include <Literals.h> #include <Literals.h>
#include <TranslationUnit.h> #include <TranslationUnit.h>
#include <Symbols.h> #include <Symbols.h>
#include <Names.h>
#include <Scope.h>
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/ResolveExpression.h> #include <cplusplus/ResolveExpression.h>
#include <cplusplus/Overview.h>
#include <QtCore/QTime> #include <QtCore/QTime>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
@@ -69,13 +72,16 @@ public:
_future(future), _future(future),
_doc(doc), _doc(doc),
_snapshot(snapshot), _snapshot(snapshot),
_source(_doc->source()) _source(_doc->source()),
{ } _sem(doc->control())
void operator()(Identifier *id, AST *ast)
{ {
_snapshot.insert(_doc);
}
void operator()(Symbol *symbol, Identifier *id, AST *ast)
{
_declSymbol = symbol;
_id = id; _id = id;
_currentSymbol = _doc->globalNamespace();
_exprDoc = Document::create("<references>"); _exprDoc = Document::create("<references>");
accept(ast); accept(ast);
} }
@@ -122,54 +128,62 @@ protected:
line, lineText, col, len)); line, lineText, col, len));
} }
LookupContext currentContext() const bool checkCandidates(const QList<Symbol *> &candidates) const
{ {
return LookupContext(_currentSymbol, _exprDoc, _doc, _snapshot); // ### FIXME return isDeclSymbol(LookupContext::canonicalSymbol(candidates));
}
virtual bool visit(ClassSpecifierAST *ast)
{
_currentSymbol = ast->symbol;
return true; return true;
} }
virtual bool visit(NamespaceAST *ast) bool isDeclSymbol(Symbol *symbol) const
{ {
_currentSymbol = ast->symbol; if (! symbol)
return false;
else if (symbol == _declSymbol)
return true;
else if (symbol->line() == _declSymbol->line() && symbol->column() == _declSymbol->column()) {
if (! qstrcmp(symbol->fileName(), _declSymbol->fileName()))
return true; return true;
} }
virtual bool visit(CompoundStatementAST *ast) return false;
{
_currentSymbol = ast->symbol;
return true;
} }
virtual bool visit(FunctionDefinitionAST *ast) LookupContext currentContext(AST *ast) const
{ {
_currentSymbol = ast->symbol; unsigned line, column;
return true; getTokenStartPosition(ast->firstToken(), &line, &column);
Symbol *lastVisibleSymbol = _doc->findSymbolAt(line, column);
return LookupContext(lastVisibleSymbol, _exprDoc, _doc, _snapshot);
} }
virtual bool visit(QualifiedNameAST *ast) virtual bool visit(QualifiedNameAST *ast)
{ {
return true; if (! ast->name) {
//qWarning() << "invalid AST at" << _doc->fileName() << line << column;
ast->name = _sem.check(ast, /*scope */ static_cast<Scope *>(0));
}
Q_ASSERT(ast->name != 0);
Identifier *id = ast->name->identifier();
if (id == _id && ast->unqualified_name) {
LookupContext context = currentContext(ast);
const QList<Symbol *> candidates = context.resolve(ast->name);
if (checkCandidates(candidates))
reportResult(ast->unqualified_name->firstToken());
}
return false;
} }
virtual bool visit(SimpleNameAST *ast) virtual bool visit(SimpleNameAST *ast)
{ {
Identifier *id = identifier(ast->identifier_token); Identifier *id = identifier(ast->identifier_token);
if (id == _id) { if (id == _id) {
#if 0 LookupContext context = currentContext(ast);
LookupContext context = currentContext(); const QList<Symbol *> candidates = context.resolve(ast->name);
ResolveExpression resolveExpression(context); if (checkCandidates(candidates))
QList<ResolveExpression::Result> results = resolveExpression(ast);
if (! results.isEmpty()) {
ResolveExpression::Result result = results.first();
Symbol *resolvedSymbol = result.second;
qDebug() << "resolves to:" << resolvedSymbol->fileName() << resolvedSymbol->line();
}
#endif
reportResult(ast->identifier_token); reportResult(ast->identifier_token);
} }
@@ -179,20 +193,25 @@ protected:
virtual bool visit(TemplateIdAST *ast) virtual bool visit(TemplateIdAST *ast)
{ {
Identifier *id = identifier(ast->identifier_token); Identifier *id = identifier(ast->identifier_token);
if (id == _id) if (id == _id) {
LookupContext context = currentContext(ast);
const QList<Symbol *> candidates = context.resolve(ast->name);
if (checkCandidates(candidates))
reportResult(ast->identifier_token); reportResult(ast->identifier_token);
}
return true; return false;
} }
private: private:
QFutureInterface<Core::Utils::FileSearchResult> &_future; QFutureInterface<Core::Utils::FileSearchResult> &_future;
Identifier *_id; Identifier *_id; // ### remove me
Symbol *_declSymbol;
Document::Ptr _doc; Document::Ptr _doc;
Snapshot _snapshot; Snapshot _snapshot;
QByteArray _source; QByteArray _source;
Symbol *_currentSymbol;
Document::Ptr _exprDoc; Document::Ptr _exprDoc;
Semantic _sem;
}; };
} // end of anonymous namespace } // end of anonymous namespace
@@ -217,6 +236,9 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
QTime tm; QTime tm;
tm.start(); tm.start();
Identifier *symbolId = symbol->identifier();
Q_ASSERT(symbolId != 0);
const QString fileName = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()); const QString fileName = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
QStringList files(fileName); QStringList files(fileName);
@@ -229,24 +251,30 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
for (int i = 0; i < files.size(); ++i) { for (int i = 0; i < files.size(); ++i) {
const QString &fn = files.at(i); const QString &fn = files.at(i);
future.setProgressValueAndText(i, QFileInfo(fn).fileName()); future.setProgressValueAndText(i, QFileInfo(fn).fileName());
Document::Ptr previousDoc = snapshot.value(fn);
if (previousDoc) {
Control *control = previousDoc->control();
Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
if (! id)
continue; // skip this document, it's not using symbolId.
}
QFile f(fn); QFile f(fn);
if (! f.open(QFile::ReadOnly)) if (! f.open(QFile::ReadOnly))
continue; continue;
const QString source = QTextStream(&f).readAll(); const QString source = QTextStream(&f).readAll(); // ### FIXME
const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fn); const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fn);
Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fn); Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fn);
doc->tokenize(); doc->tokenize();
Identifier *symbolId = symbol->identifier();
Q_ASSERT(symbolId != 0);
Control *control = doc->control(); Control *control = doc->control();
if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) { if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
doc->check(); doc->check();
TranslationUnit *unit = doc->translationUnit(); TranslationUnit *unit = doc->translationUnit();
Process process(future, doc, snapshot); Process process(future, doc, snapshot);
process(id, unit->ast()); process(symbol, id, unit->ast());
} }
} }
future.setProgressValue(files.size()); future.setProgressValue(files.size());
@@ -259,9 +287,7 @@ void CppFindReferences::findAll(const Snapshot &snapshot, Symbol *symbol)
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
QFuture<Core::Utils::FileSearchResult> result = QFuture<Core::Utils::FileSearchResult> result = QtConcurrent::run(&find_helper, snapshot, symbol);
QtConcurrent::run(&find_helper, snapshot, symbol);
m_watcher.setFuture(result); m_watcher.setFuture(result);
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching..."), Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching..."),

View File

@@ -196,9 +196,12 @@ protected:
void mergeEnvironment(CPlusPlus::Document::Ptr doc); void mergeEnvironment(CPlusPlus::Document::Ptr doc);
virtual void macroAdded(const Macro &macro); virtual void macroAdded(const Macro &macro);
virtual void passedMacroDefinitionCheck(unsigned offset, const Macro &macro);
virtual void failedMacroDefinitionCheck(unsigned offset, const QByteArray &name);
virtual void startExpandingMacro(unsigned offset, virtual void startExpandingMacro(unsigned offset,
const Macro &macro, const Macro &macro,
const QByteArray &originalText, const QByteArray &originalText,
bool inCondition,
const QVector<MacroArgumentReference> &actuals); const QVector<MacroArgumentReference> &actuals);
virtual void stopExpandingMacro(unsigned offset, const Macro &macro); virtual void stopExpandingMacro(unsigned offset, const Macro &macro);
virtual void startSkippingBlocks(unsigned offset); virtual void startSkippingBlocks(unsigned offset);
@@ -446,16 +449,34 @@ void CppPreprocessor::macroAdded(const Macro &macro)
m_currentDoc->appendMacro(macro); m_currentDoc->appendMacro(macro);
} }
void CppPreprocessor::passedMacroDefinitionCheck(unsigned offset, const Macro &macro)
{
if (! m_currentDoc)
return;
m_currentDoc->addMacroUse(macro, offset, macro.name().length(),
QVector<MacroArgumentReference>(), true);
}
void CppPreprocessor::failedMacroDefinitionCheck(unsigned offset, const QByteArray &name)
{
if (! m_currentDoc)
return;
m_currentDoc->addUndefinedMacroUse(name, offset);
}
void CppPreprocessor::startExpandingMacro(unsigned offset, void CppPreprocessor::startExpandingMacro(unsigned offset,
const Macro &macro, const Macro &macro,
const QByteArray &originalText, const QByteArray &originalText,
bool inCondition,
const QVector<MacroArgumentReference> &actuals) const QVector<MacroArgumentReference> &actuals)
{ {
if (! m_currentDoc) if (! m_currentDoc)
return; return;
//qDebug() << "start expanding:" << macro.name << "text:" << originalText; //qDebug() << "start expanding:" << macro.name() << "text:" << originalText;
m_currentDoc->addMacroUse(macro, offset, originalText.length(), actuals); m_currentDoc->addMacroUse(macro, offset, originalText.length(), actuals, inCondition);
} }
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &) void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)

View File

@@ -36,11 +36,11 @@
#include <QtCore/QAbstractItemModel> #include <QtCore/QAbstractItemModel>
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class BreakpointMarker; class BreakpointMarker;
class BreakHandler; class BreakHandler;
class DebuggerManager;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //

View File

@@ -52,6 +52,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/winutils.h> #include <utils/winutils.h>
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
#include <utils/fancymainwindow.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -367,7 +368,7 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
return true; return true;
} }
IDebuggerEngine *CdbDebugEngine::create(DebuggerManager *manager, IDebuggerEngine *CdbDebugEngine::create(Debugger::DebuggerManager *manager,
const QSharedPointer<CdbOptions> &options, const QSharedPointer<CdbOptions> &options,
QString *errorMessage) QString *errorMessage)
{ {

View File

@@ -36,9 +36,10 @@
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class DebuggerManager;
class DisassemblerViewAgent; class DisassemblerViewAgent;
class CdbDebugEventCallback; class CdbDebugEventCallback;
class CdbDebugOutput; class CdbDebugOutput;

View File

@@ -42,9 +42,10 @@
#include <QtCore/QMap> #include <QtCore/QMap>
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class DebuggerManager;
class WatchHandler; class WatchHandler;
class CdbStackFrameContext; class CdbStackFrameContext;
class CdbStackTraceContext; class CdbStackTraceContext;

View File

@@ -35,8 +35,10 @@
#include <QtCore/QStringList> #include <QtCore/QStringList>
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerManager; class DebuggerManager;
namespace Internal {
class CdbDebugEngine; class CdbDebugEngine;
// Base class for event callbacks that takes care // Base class for event callbacks that takes care

View File

@@ -37,11 +37,11 @@
#include <QtCore/QMap> #include <QtCore/QMap>
namespace Debugger { namespace Debugger {
namespace Internal {
struct CdbComInterfaces;
class DebuggerManager; class DebuggerManager;
namespace Internal {
struct CdbComInterfaces;
/* For code clarity, all the stuff related to custom dumpers goes here. /* For code clarity, all the stuff related to custom dumpers goes here.
* "Custom dumper" is a library compiled against the current * "Custom dumper" is a library compiled against the current
* Qt containing functions to evaluate values of Qt classes * Qt containing functions to evaluate values of Qt classes

View File

@@ -4,14 +4,12 @@ TARGET = Debugger
# DEFINES += QT_USE_FAST_OPERATOR_PLUS # DEFINES += QT_USE_FAST_OPERATOR_PLUS
# DEFINES += QT_USE_FAST_CONCATENATION # DEFINES += QT_USE_FAST_CONCATENATION
# CONFIG += single # CONFIG += single
include(../../qtcreatorplugin.pri) include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri) include(debugger_dependencies.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/find/find.pri) DEFINES += DEBUGGER_LIBRARY
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../libs/utils/utils.pri)
INCLUDEPATH += $$PWD/../../libs/utils INCLUDEPATH += $$PWD/../../libs/utils
QT += gui \ QT += gui \
network \ network \
@@ -23,10 +21,12 @@ HEADERS += breakhandler.h \
debuggerconstants.h \ debuggerconstants.h \
debuggerdialogs.h \ debuggerdialogs.h \
debuggermanager.h \ debuggermanager.h \
debugger_global.h \
debuggeroutputwindow.h \ debuggeroutputwindow.h \
debuggerplugin.h \ debuggerplugin.h \
debuggerrunner.h \ debuggerrunner.h \
debuggertooltip.h \ debuggertooltip.h \
debuggerstringutils.h \
watchutils.h \ watchutils.h \
idebuggerengine.h \ idebuggerengine.h \
imports.h \ imports.h \

View File

@@ -0,0 +1,7 @@
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/find/find.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../libs/utils/utils.pri)

View File

@@ -0,0 +1,41 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGERGLOBAL_H
#define DEBUGGERGLOBAL_H
#include <QtCore/QtGlobal>
#if defined(DEBUGGER_LIBRARY)
# define DEBUGGER_EXPORT Q_DECL_EXPORT
#else
# define DEBUGGER_EXPORT Q_DECL_IMPORT
#endif
#endif // DEBUGGERGLOBAL_H

View File

@@ -127,6 +127,22 @@ Core::Utils::SavedAction *theDebuggerAction(int code);
bool theDebuggerBoolSetting(int code); bool theDebuggerBoolSetting(int code);
QString theDebuggerStringSetting(int code); QString theDebuggerStringSetting(int code);
struct DebuggerManagerActions {
QAction *continueAction;
QAction *stopAction;
QAction *resetAction; // FIXME: Should not be needed in a stable release
QAction *stepAction;
QAction *stepOutAction;
QAction *runToLineAction;
QAction *runToFunctionAction;
QAction *jumpToLineAction;
QAction *nextAction;
QAction *watchAction;
QAction *breakAction;
QAction *sepAction;
QAction *reverseDirectionAction;
};
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerstringutils.h"
#include "idebuggerengine.h" #include "idebuggerengine.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -193,6 +194,7 @@ DisassemblerViewAgent::~DisassemblerViewAgent()
if (d->editor) if (d->editor)
d->editor->deleteLater(); d->editor->deleteLater();
delete d; delete d;
d = 0;
} }
void DisassemblerViewAgent::setFrame(const StackFrame &frame) void DisassemblerViewAgent::setFrame(const StackFrame &frame)
@@ -206,12 +208,10 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame)
void DisassemblerViewAgent::setContents(const QString &contents) void DisassemblerViewAgent::setContents(const QString &contents)
{ {
QTC_ASSERT(d, return);
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
if (!d->editor)
return;
QPlainTextEdit *plainTextEdit = 0; QPlainTextEdit *plainTextEdit = 0;
EditorManager *editorManager = EditorManager::instance(); EditorManager *editorManager = EditorManager::instance();
if (!d->editor) { if (!d->editor) {

View File

@@ -42,9 +42,9 @@
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class DebuggerManager;
struct DisassemblerViewAgentPrivate; struct DisassemblerViewAgentPrivate;
class MemoryViewAgent : public QObject class MemoryViewAgent : public QObject

View File

@@ -60,8 +60,6 @@ namespace Internal {
} }
} // namespace Constants } // namespace Constants
namespace Internal {
enum DebuggerState enum DebuggerState
{ {
DebuggerNotReady, // Debugger not started DebuggerNotReady, // Debugger not started
@@ -118,7 +116,6 @@ enum LogChannel
LogMisc LogMisc
}; };
} // namespace Internal
} // namespace Debugger } // namespace Debugger
#endif // DEBUGGERCONSTANTS_H #endif // DEBUGGERCONSTANTS_H

File diff suppressed because it is too large Load Diff

View File

@@ -30,31 +30,29 @@
#ifndef DEBUGGER_DEBUGGERMANAGER_H #ifndef DEBUGGER_DEBUGGERMANAGER_H
#define DEBUGGER_DEBUGGERMANAGER_H #define DEBUGGER_DEBUGGERMANAGER_H
#include "debugger_global.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include <utils/fancymainwindow.h>
#include <QtCore/QByteArray>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAction; class QAction;
class QAbstractItemModel;
class QDockWidget; class QDockWidget;
class QLabel; class QLabel;
class QMessageBox;
class QModelIndex;
class QPoint;
class QTimer;
class QWidget;
class QDebug; class QDebug;
class QAbstractItemModel;
class QPoint;
class QVariant;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class IOptionsPage; class IOptionsPage;
namespace Utils {
class FancyMainWindow;
}
} // namespace Core } // namespace Core
namespace TextEditor { namespace TextEditor {
@@ -64,15 +62,8 @@ class ITextEditor;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
typedef QLatin1Char _c;
typedef QLatin1String __;
inline QString _(const char *s) { return QString::fromLatin1(s); }
inline QString _(const QByteArray &ba) { return QString::fromLatin1(ba, ba.size()); }
class DebuggerOutputWindow; class DebuggerOutputWindow;
class DebuggerRunControl;
class DebuggerPlugin; class DebuggerPlugin;
class DebugMode;
class BreakHandler; class BreakHandler;
class BreakpointData; class BreakpointData;
@@ -85,8 +76,23 @@ class Symbol;
class ThreadsHandler; class ThreadsHandler;
class WatchData; class WatchData;
class WatchHandler; class WatchHandler;
class IDebuggerEngine;
class GdbEngine;
class ScriptEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
struct DebuggerManagerActions;
class DebuggerPlugin;
class CdbDebugEventCallback;
class CdbDumperHelper;
class CdbExceptionLoggerEventCallback;
class GdbEngine;
class TcfEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
} // namespace Internal
class DebuggerStartParameters class DEBUGGER_EXPORT DebuggerStartParameters
{ {
public: public:
DebuggerStartParameters(); DebuggerStartParameters();
@@ -113,13 +119,8 @@ public:
}; };
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr; typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
QDebug operator<<(QDebug str, const DebuggerStartParameters &);
class IDebuggerEngine; DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);
class GdbEngine;
class ScriptEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
// Flags for initialization // Flags for initialization
enum DebuggerEngineTypeFlags enum DebuggerEngineTypeFlags
@@ -140,7 +141,9 @@ QDebug operator<<(QDebug d, DebuggerState state);
// DebuggerManager // DebuggerManager
// //
class DebuggerManager : public QObject struct DebuggerManagerPrivate;
class DEBUGGER_EXPORT DebuggerManager : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -148,26 +151,30 @@ public:
DebuggerManager(); DebuggerManager();
~DebuggerManager(); ~DebuggerManager();
friend class CdbDebugEngine; friend class Internal::IDebuggerEngine;
friend class CdbDebugEventCallback; friend class Internal::DebuggerPlugin;
friend class CdbDumperHelper; friend class Internal::CdbDebugEventCallback;
friend class CdbExceptionLoggerEventCallback; friend class Internal::CdbDumperHelper;
friend class GdbEngine; friend class Internal::CdbExceptionLoggerEventCallback;
friend class ScriptEngine; friend class Internal::GdbEngine;
friend class TcfEngine; friend class Internal::ScriptEngine;
friend struct CdbDebugEnginePrivate; friend class Internal::TcfEngine;
friend class Internal::CdbDebugEngine;
friend struct Internal::CdbDebugEnginePrivate;
QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags); QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags);
Core::Utils::FancyMainWindow *mainWindow() const { return m_mainWindow; } Core::Utils::FancyMainWindow *mainWindow() const;
QLabel *statusLabel() const { return m_statusLabel; } QLabel *statusLabel() const;
IDebuggerEngine *currentEngine() const { return m_engine; } Internal::IDebuggerEngine *currentEngine() const;
virtual DebuggerStartParametersPtr startParameters() const; DebuggerStartParametersPtr startParameters() const;
virtual qint64 inferiorPid() const; qint64 inferiorPid() const;
void showMessageBox(int icon, const QString &title, const QString &text); void showMessageBox(int icon, const QString &title, const QString &text);
static DebuggerManager *instance();
public slots: public slots:
void startNewDebugger(const DebuggerStartParametersPtr &sp); void startNewDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger(); void exitDebugger();
@@ -177,7 +184,7 @@ public slots:
void setBusyCursor(bool on); void setBusyCursor(bool on);
void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed); void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed);
void gotoLocation(const StackFrame &frame, bool setLocationMarker); void gotoLocation(const Debugger::Internal::StackFrame &frame, bool setLocationMarker);
void fileOpen(const QString &file); void fileOpen(const QString &file);
void resetLocation(); void resetLocation();
@@ -200,7 +207,7 @@ public slots:
void detachDebugger(); void detachDebugger();
void addToWatchWindow(); void addToWatchWindow();
void updateWatchData(const WatchData &data); void updateWatchData(const Debugger::Internal::WatchData &data);
void sessionLoaded(); void sessionLoaded();
void aboutToUnloadSession(); void aboutToUnloadSession();
@@ -243,14 +250,15 @@ private slots:
void startFailed(); void startFailed();
private: private:
ModulesHandler *modulesHandler() { return m_modulesHandler; } Internal::ModulesHandler *modulesHandler() const;
BreakHandler *breakHandler() { return m_breakHandler; } Internal::BreakHandler *breakHandler() const;
RegisterHandler *registerHandler() { return m_registerHandler; } Internal::RegisterHandler *registerHandler() const;
StackHandler *stackHandler() { return m_stackHandler; } Internal::StackHandler *stackHandler() const;
ThreadsHandler *threadsHandler() { return m_threadsHandler; } Internal::ThreadsHandler *threadsHandler() const;
WatchHandler *watchHandler() { return m_watchHandler; } Internal::WatchHandler *watchHandler() const;
SourceFilesWindow *sourceFileWindow() { return m_sourceFilesWindow; } Internal::SourceFilesWindow *sourceFileWindow() const;
QWidget *threadsWindow() const { return m_threadsWindow; } QWidget *threadsWindow() const;
Internal::DebuggerManagerActions debuggerManagerActions() const;
void notifyInferiorStopped(); void notifyInferiorStopped();
void notifyInferiorRunning(); void notifyInferiorRunning();
@@ -261,7 +269,6 @@ private:
DebuggerState state() const; DebuggerState state() const;
void setState(DebuggerState state); void setState(DebuggerState state);
DebuggerState m_state;
// //
// internal implementation // internal implementation
@@ -280,8 +287,7 @@ private:
public: public:
// stuff in this block should be made private by moving it to // stuff in this block should be made private by moving it to
// one of the interfaces // one of the interfaces
int status() const { return m_status; } QList<Internal::Symbol> moduleSymbols(const QString &moduleName);
QList<Symbol> moduleSymbols(const QString &moduleName);
signals: signals:
void debuggingFinished(); void debuggingFinished();
@@ -290,7 +296,7 @@ signals:
void debugModeRequested(); void debugModeRequested();
void previousModeRequested(); void previousModeRequested();
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever' void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
void gotoLocationRequested(const StackFrame &frame, bool setLocationMarker); void gotoLocationRequested(const Debugger::Internal::StackFrame &frame, bool setLocationMarker);
void resetLocationRequested(); void resetLocationRequested();
void currentTextEditorRequested(QString *fileName, int *lineNumber, QObject **ob); void currentTextEditorRequested(QString *fileName, int *lineNumber, QObject **ob);
void sessionValueRequested(const QString &name, QVariant *value); void sessionValueRequested(const QString &name, QVariant *value);
@@ -308,71 +314,13 @@ private:
void toggleBreakpoint(const QString &fileName, int lineNumber); void toggleBreakpoint(const QString &fileName, int lineNumber);
void toggleBreakpointEnabled(const QString &fileName, int lineNumber); void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber); Internal::BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
void setToolTipExpression(const QPoint &mousePos, void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, int cursorPos); TextEditor::ITextEditor *editor, int cursorPos);
// FIXME: Remove engine-specific state DebuggerManagerPrivate *d;
DebuggerStartParametersPtr m_startParameters;
qint64 m_inferiorPid;
/// Views
Core::Utils::FancyMainWindow *m_mainWindow;
QLabel *m_statusLabel;
QDockWidget *m_breakDock;
QDockWidget *m_modulesDock;
QDockWidget *m_outputDock;
QDockWidget *m_registerDock;
QDockWidget *m_stackDock;
QDockWidget *m_sourceFilesDock;
QDockWidget *m_threadsDock;
QDockWidget *m_watchDock;
BreakHandler *m_breakHandler;
ModulesHandler *m_modulesHandler;
RegisterHandler *m_registerHandler;
StackHandler *m_stackHandler;
ThreadsHandler *m_threadsHandler;
WatchHandler *m_watchHandler;
SourceFilesWindow *m_sourceFilesWindow;
/// Actions
friend class DebuggerPlugin;
friend class IDebuggerEngine;
QAction *m_continueAction;
QAction *m_stopAction;
QAction *m_resetAction; // FIXME: Should not be needed in a stable release
QAction *m_stepAction;
QAction *m_stepOutAction;
QAction *m_runToLineAction;
QAction *m_runToFunctionAction;
QAction *m_jumpToLineAction;
QAction *m_nextAction;
QAction *m_watchAction;
QAction *m_breakAction;
QAction *m_sepAction;
QAction *m_reverseDirectionAction;
QWidget *m_breakWindow;
QWidget *m_localsWindow;
QWidget *m_registerWindow;
QWidget *m_modulesWindow;
QWidget *m_stackWindow;
QWidget *m_threadsWindow;
QWidget *m_watchersWindow;
DebuggerOutputWindow *m_outputWindow;
int m_status;
bool m_busy;
QTimer *m_statusTimer;
QString m_lastPermanentStatusMessage;
IDebuggerEngine *engine();
IDebuggerEngine *m_engine;
}; };
} // namespace Internal
} // namespace Debugger } // namespace Debugger
#endif // DEBUGGER_DEBUGGERMANAGER_H #endif // DEBUGGER_DEBUGGERMANAGER_H

View File

@@ -55,6 +55,7 @@ using namespace Find;
#endif // GDBDEBUGGERLEAN #endif // GDBDEBUGGERLEAN
using namespace Debugger;
using namespace Debugger::Internal; using namespace Debugger::Internal;
static QChar charForChannel(int channel) static QChar charForChannel(int channel)

View File

@@ -37,6 +37,7 @@
#include "debuggermanager.h" #include "debuggermanager.h"
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "stackframe.h" #include "stackframe.h"
#include "debuggerstringutils.h"
#include "ui_commonoptionspage.h" #include "ui_commonoptionspage.h"
#include "ui_dumperoptionpage.h" #include "ui_dumperoptionpage.h"
@@ -619,7 +620,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING); am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
Core::Command *cmd = 0; Core::Command *cmd = 0;
cmd = am->registerAction(m_manager->m_continueAction, const DebuggerManagerActions actions = m_manager->debuggerManagerActions();
cmd = am->registerAction(actions.continueAction,
ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext); ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext);
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE); mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
@@ -648,7 +650,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
Constants::DETACH, globalcontext); Constants::DETACH, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE); mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
cmd = am->registerAction(m_manager->m_stopAction, cmd = am->registerAction(actions.stopAction,
Constants::INTERRUPT, globalcontext); Constants::INTERRUPT, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setAttribute(Core::Command::CA_UpdateIcon); cmd->setAttribute(Core::Command::CA_UpdateIcon);
@@ -656,7 +658,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd->setDefaultText(tr("Stop Debugger/Interrupt Debugger")); cmd->setDefaultText(tr("Stop Debugger/Interrupt Debugger"));
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE); mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
cmd = am->registerAction(m_manager->m_resetAction, cmd = am->registerAction(actions.resetAction,
Constants::RESET, globalcontext); Constants::RESET, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
@@ -668,17 +670,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Step"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Step"), globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_nextAction, cmd = am->registerAction(actions.nextAction,
Constants::NEXT, debuggercontext); Constants::NEXT, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_stepAction, cmd = am->registerAction(actions.stepAction,
Constants::STEP, debuggercontext); Constants::STEP, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_stepOutAction, cmd = am->registerAction(actions.stepOutAction,
Constants::STEPOUT, debuggercontext); Constants::STEPOUT, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
@@ -687,22 +689,22 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
Constants::STEP_BY_INSTRUCTION, debuggercontext); Constants::STEP_BY_INSTRUCTION, debuggercontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_runToLineAction, cmd = am->registerAction(actions.runToLineAction,
Constants::RUN_TO_LINE, debuggercontext); Constants::RUN_TO_LINE, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_runToFunctionAction, cmd = am->registerAction(actions.runToFunctionAction,
Constants::RUN_TO_FUNCTION, debuggercontext); Constants::RUN_TO_FUNCTION, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_jumpToLineAction, cmd = am->registerAction(actions.jumpToLineAction,
Constants::JUMP_TO_LINE, debuggercontext); Constants::JUMP_TO_LINE, debuggercontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
#ifdef USE_REVERSE_DEBUGGING #ifdef USE_REVERSE_DEBUGGING
cmd = am->registerAction(m_manager->m_reverseDirectionAction, cmd = am->registerAction(actions.reverseDirectionAction,
Constants::REVERSE, debuggercontext); Constants::REVERSE, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
@@ -713,7 +715,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Break"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Break"), globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_breakAction, cmd = am->registerAction(actions.breakAction,
Constants::TOGGLE_BREAK, cppeditorcontext); Constants::TOGGLE_BREAK, cppeditorcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
@@ -724,7 +726,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Watch"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Watch"), globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_watchAction, cmd = am->registerAction(actions.watchAction,
Constants::ADD_TO_WATCH, cppeditorcontext); Constants::ADD_TO_WATCH, cppeditorcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W"))); //cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
mdebug->addAction(cmd); mdebug->addAction(cmd);
@@ -885,8 +887,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect(m_manager, SIGNAL(resetLocationRequested()), connect(m_manager, SIGNAL(resetLocationRequested()),
this, SLOT(resetLocation())); this, SLOT(resetLocation()));
connect(m_manager, SIGNAL(gotoLocationRequested(StackFrame,bool)), connect(m_manager, SIGNAL(gotoLocationRequested(Debugger::Internal::StackFrame,bool)),
this, SLOT(gotoLocation(StackFrame,bool))); this, SLOT(gotoLocation(Debugger::Internal::StackFrame,bool)));
connect(m_manager, SIGNAL(stateChanged(int)), connect(m_manager, SIGNAL(stateChanged(int)),
this, SLOT(handleStateChanged(int))); this, SLOT(handleStateChanged(int)));
connect(m_manager, SIGNAL(previousModeRequested()), connect(m_manager, SIGNAL(previousModeRequested()),
@@ -1088,7 +1090,7 @@ void DebuggerPlugin::resetLocation()
m_locationMark = 0; m_locationMark = 0;
} }
void DebuggerPlugin::gotoLocation(const StackFrame &frame, bool setMarker) void DebuggerPlugin::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
{ {
if (theDebuggerBoolSetting(StepByInstruction) || !frame.isUsable()) { if (theDebuggerBoolSetting(StepByInstruction) || !frame.isUsable()) {
if (!m_disassemblerViewAgent) if (!m_disassemblerViewAgent)

View File

@@ -55,10 +55,11 @@ class BaseTextMark;
} }
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class BreakpointData; class BreakpointData;
class DebuggerManager;
class DebuggerRunControlFactory; class DebuggerRunControlFactory;
class DebugMode; class DebugMode;
class DisassemblerViewAgent; class DisassemblerViewAgent;
@@ -96,7 +97,7 @@ private slots:
int lineNumber, QMenu *menu); int lineNumber, QMenu *menu);
void resetLocation(); void resetLocation();
void gotoLocation(const StackFrame &frame, bool setMarker); void gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker);
void breakpointSetRemoveMarginActionTriggered(); void breakpointSetRemoveMarginActionTriggered();
void breakpointEnableDisableMarginActionTriggered(); void breakpointEnableDisableMarginActionTriggered();
@@ -119,10 +120,10 @@ private:
QString *errorMessage); QString *errorMessage);
void attachExternalApplication(qint64 pid, const QString &crashParameter = QString()); void attachExternalApplication(qint64 pid, const QString &crashParameter = QString());
friend class DebuggerManager; friend class Debugger::DebuggerManager;
friend class GdbOptionPage; friend class GdbOptionPage;
friend class DebuggingHelperOptionPage; friend class DebuggingHelperOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views friend class Debugger::Internal::DebugMode; // FIXME: Just a hack now so that it can access the views
DebuggerManager *m_manager; DebuggerManager *m_manager;
DebugMode *m_debugMode; DebugMode *m_debugMode;

View File

@@ -40,9 +40,9 @@ class LocalApplicationRunConfiguration;
} }
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerManager; class DebuggerManager;
namespace Internal {
class StartData; class StartData;
typedef QSharedPointer<ProjectExplorer::RunConfiguration> typedef QSharedPointer<ProjectExplorer::RunConfiguration>

View File

@@ -0,0 +1,45 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGERSTRINGUTILS_H
#define DEBUGGERSTRINGUTILS_H
#include <QtCore/QString>
namespace Debugger {
namespace Internal {
typedef QLatin1Char _c;
typedef QLatin1String __;
inline QString _(const char *s) { return QString::fromLatin1(s); }
inline QString _(const QByteArray &ba) { return QString::fromLatin1(ba, ba.size()); }
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGERSTRINGUTILS_H

View File

@@ -32,6 +32,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "procinterrupt.h" #include "procinterrupt.h"
#include "debuggerstringutils.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>

View File

@@ -31,6 +31,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "debuggerstringutils.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>

View File

@@ -46,6 +46,7 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include "debuggertooltip.h" #include "debuggertooltip.h"
#include "debuggerstringutils.h"
#include "gdbmi.h" #include "gdbmi.h"
#include "breakhandler.h" #include "breakhandler.h"
@@ -58,6 +59,7 @@
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -224,6 +226,11 @@ DebuggerStartMode GdbEngine::startMode() const
return m_startParameters->startMode; return m_startParameters->startMode;
} }
QMainWindow *GdbEngine::mainWindow() const
{
return m_manager->mainWindow();
}
GdbEngine::~GdbEngine() GdbEngine::~GdbEngine()
{ {
// prevent sending error messages afterwards // prevent sending error messages afterwards
@@ -783,15 +790,22 @@ void GdbEngine::handleResultRecord(const GdbResponse &response)
// In theory this should not happen, in practice it does. // In theory this should not happen, in practice it does.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. " debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token)); "TWO RESPONSES FOR ONE COMMAND?").arg(token));
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error"
if (response.resultClass == GdbResultError) { if (response.resultClass == GdbResultError) {
QByteArray msg = response.data.findChild("msg").data(); QByteArray msg = response.data.findChild("msg").data();
showMessageBox(QMessageBox::Critical, showMessageBox(QMessageBox::Critical,
tr("Executable failed"), QString::fromLocal8Bit(msg)); tr("Executable failed"), QString::fromLocal8Bit(msg));
showStatusMessage(tr("Process failed to start.")); showStatusMessage(tr("Process failed to start."));
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error"
if (msg == "Cannot find new threads: generic error")
shutdown(); shutdown();
// Handle a case known to appear on gdb 6.4 symbianelf when
// the stack is cut due to access to protected memory.
if (msg == "\"finish\" not meaningful in the outermost frame.") {
setState(InferiorStopping);
setState(InferiorStopped);
}
} }
return; return;
} }
@@ -1303,6 +1317,11 @@ void GdbEngine::handleStop2(const GdbResponse &response)
void GdbEngine::handleStop2(const GdbMi &data) void GdbEngine::handleStop2(const GdbMi &data)
{ {
if (state() == InferiorRunning) {
// Stop triggered by a breakpoint or otherwise not directly
// initiated by the user.
setState(InferiorStopping);
}
setState(InferiorStopped); setState(InferiorStopped);
showStatusMessage(tr("Stopped."), 5000); showStatusMessage(tr("Stopped."), 5000);
@@ -3808,7 +3827,7 @@ struct MemoryAgentCookie
MemoryAgentCookie(MemoryViewAgent *agent_, quint64 address_) MemoryAgentCookie(MemoryViewAgent *agent_, quint64 address_)
: agent(agent_), address(address_) : agent(agent_), address(address_)
{} {}
MemoryViewAgent *agent; QPointer<MemoryViewAgent> agent;
quint64 address; quint64 address;
}; };
@@ -3851,7 +3870,7 @@ struct DisassemblerAgentCookie
DisassemblerAgentCookie(DisassemblerViewAgent *agent_) DisassemblerAgentCookie(DisassemblerViewAgent *agent_)
: agent(agent_) : agent(agent_)
{} {}
DisassemblerViewAgent *agent; QPointer<DisassemblerViewAgent> agent;
}; };
void GdbEngine::fetchDisassembler(DisassemblerViewAgent *agent, void GdbEngine::fetchDisassembler(DisassemblerViewAgent *agent,

View File

@@ -51,14 +51,14 @@ QT_BEGIN_NAMESPACE
class QAction; class QAction;
class QAbstractItemModel; class QAbstractItemModel;
class QWidget; class QWidget;
class QMainWindow;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
class AbstractGdbAdapter; class AbstractGdbAdapter;
class DebuggerManager;
class IDebuggerManagerAccessForEngines;
class GdbResponse; class GdbResponse;
class GdbMi; class GdbMi;
@@ -271,7 +271,7 @@ private:
bool showToolTip(); bool showToolTip();
// Convenience // Convenience
QMainWindow *mainWindow() const { return m_manager->mainWindow(); } QMainWindow *mainWindow() const;
DebuggerStartMode startMode() const; DebuggerStartMode startMode() const;
qint64 inferiorPid() const { return m_manager->inferiorPid(); } qint64 inferiorPid() const { return m_manager->inferiorPid(); }

View File

@@ -32,11 +32,14 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "procinterrupt.h" #include "procinterrupt.h"
#include "debuggerstringutils.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QVariant>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
namespace Debugger { namespace Debugger {

View File

@@ -28,11 +28,12 @@
**************************************************************************/ **************************************************************************/
#include "remotegdbadapter.h" #include "remotegdbadapter.h"
#include "debuggerstringutils.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "gdbengine.h" #include "gdbengine.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>

View File

@@ -29,6 +29,7 @@
#include "trkgdbadapter.h" #include "trkgdbadapter.h"
#include "trkoptions.h" #include "trkoptions.h"
#include "debuggerstringutils.h"
#ifndef STANDALONE_RUNNER #ifndef STANDALONE_RUNNER
#include "gdbengine.h" #include "gdbengine.h"
#endif #endif
@@ -199,7 +200,7 @@ QByteArray TrkGdbAdapter::trkContinueMessage()
return ba; return ba;
} }
QByteArray TrkGdbAdapter::trkReadRegisterMessage() QByteArray TrkGdbAdapter::trkReadRegistersMessage()
{ {
QByteArray ba; QByteArray ba;
appendByte(&ba, 0); // Register set, only 0 supported appendByte(&ba, 0); // Register set, only 0 supported
@@ -210,6 +211,18 @@ QByteArray TrkGdbAdapter::trkReadRegisterMessage()
return ba; return ba;
} }
QByteArray TrkGdbAdapter::trkWriteRegisterMessage(byte reg, uint value)
{
QByteArray ba;
appendByte(&ba, 0); // ?
appendShort(&ba, reg);
appendShort(&ba, reg);
appendInt(&ba, m_session.pid);
appendInt(&ba, m_session.tid);
appendInt(&ba, value);
return ba;
}
QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint addr, uint len) QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint addr, uint len)
{ {
QByteArray ba; QByteArray ba;
@@ -574,6 +587,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendGdbServerMessage("E20", "Error " + cmd); sendGdbServerMessage("E20", "Error " + cmd);
} }
} }
else if (cmd.startsWith("p")) { else if (cmd.startsWith("p")) {
logMessage(msgGdbPacket(QLatin1String("read register"))); logMessage(msgGdbPacket(QLatin1String("read register")));
// 0xf == current instruction pointer? // 0xf == current instruction pointer?
@@ -599,6 +613,21 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
} }
} }
else if (cmd.startsWith("P")) {
logMessage(msgGdbPacket(QLatin1String("write register")));
// $Pe=70f96678#d3
sendGdbServerAck();
int pos = cmd.indexOf('=');
QByteArray regName = cmd.mid(1, pos - 1);
QByteArray valueName = cmd.mid(pos + 1);
bool ok = false;
const uint registerNumber = regName.toInt(&ok, 16);
const uint value = swapEndian(valueName.toInt(&ok, 16));
QByteArray ba = trkWriteRegisterMessage(registerNumber, value);
sendTrkMessage(0x13, TrkCB(handleWriteRegister), ba, "Write register");
// Note that App TRK refuses to write registers 13 and 14
}
else if (cmd == "qAttached") { else if (cmd == "qAttached") {
//$qAttached#8f //$qAttached#8f
// 1: attached to an existing process // 1: attached to an existing process
@@ -861,7 +890,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
//sendGdbServerMessage("S05", "Target stopped"); //sendGdbServerMessage("S05", "Target stopped");
sendTrkMessage(0x12, sendTrkMessage(0x12,
TrkCB(handleAndReportReadRegistersAfterStop), TrkCB(handleAndReportReadRegistersAfterStop),
trkReadRegisterMessage()); trkReadRegistersMessage());
break; break;
} }
case 0x91: { // Notify Exception (obsolete) case 0x91: { // Notify Exception (obsolete)
@@ -1020,6 +1049,17 @@ void TrkGdbAdapter::handleReadRegisters(const TrkResult &result)
m_snapshot.registers[i] = extractInt(data + 4 * i); m_snapshot.registers[i] = extractInt(data + 4 * i);
} }
void TrkGdbAdapter::handleWriteRegister(const TrkResult &result)
{
logMessage(" RESULT: " + result.toString() + result.cookie.toString());
if (result.errorCode()) {
logMessage("ERROR: " + result.errorString());
sendGdbServerMessage("E01");
return;
}
sendGdbServerMessage("OK");
}
void TrkGdbAdapter::reportRegisters() void TrkGdbAdapter::reportRegisters()
{ {
QByteArray ba; QByteArray ba;

View File

@@ -156,7 +156,8 @@ public:
void reportRegisters(); void reportRegisters();
QByteArray memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const; QByteArray memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const;
QByteArray trkContinueMessage(); QByteArray trkContinueMessage();
QByteArray trkReadRegisterMessage(); QByteArray trkReadRegistersMessage();
QByteArray trkWriteRegisterMessage(byte reg, uint value);
QByteArray trkReadMemoryMessage(uint addr, uint len); QByteArray trkReadMemoryMessage(uint addr, uint len);
QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true); QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true);
QByteArray trkStepRangeMessage(byte option); QByteArray trkStepRangeMessage(byte option);
@@ -169,6 +170,7 @@ public:
void handleStepOver2(const TrkResult &result); void handleStepOver2(const TrkResult &result);
void handleReadRegisters(const TrkResult &result); void handleReadRegisters(const TrkResult &result);
void reportReadMemoryBuffered(const TrkResult &result); void reportReadMemoryBuffered(const TrkResult &result);
void handleWriteRegister(const TrkResult &result);
void reportToGdb(const TrkResult &result); void reportToGdb(const TrkResult &result);
void readMemory(uint addr, uint len); void readMemory(uint addr, uint len);

View File

@@ -50,22 +50,23 @@ class IOptionsPage;
} }
namespace Debugger { namespace Debugger {
class DebuggerManager;
class DebuggerStartParameters;
namespace Internal { namespace Internal {
class DebuggerStartParameters;
class DebuggerManager;
class DisassemblerViewAgent; class DisassemblerViewAgent;
class MemoryViewAgent; class MemoryViewAgent;
struct StackFrame; struct StackFrame;
class Symbol; class Symbol;
class WatchData; class WatchData;
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
class IDebuggerEngine : public QObject class IDebuggerEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0) IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0)
: QObject(parent), m_manager(manager) : QObject(parent), m_manager(manager)
{} {}

View File

@@ -33,10 +33,10 @@
#include <QTreeView> #include <QTreeView>
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerManager; class DebuggerManager;
namespace Internal {
class ModulesWindow : public QTreeView class ModulesWindow : public QTreeView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -30,13 +30,12 @@
#ifndef DEBUGGER_REGISTERWINDOW_H #ifndef DEBUGGER_REGISTERWINDOW_H
#define DEBUGGER_REGISTERWINDOW_H #define DEBUGGER_REGISTERWINDOW_H
#include <QTreeView> #include <QtGui/QTreeView>
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerManager; class DebuggerManager;
namespace Internal {
class RegisterWindow : public QTreeView class RegisterWindow : public QTreeView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -39,9 +39,9 @@ class QModelIndex;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerManager; class DebuggerManager;
namespace Internal {
class DisassemblerViewAgent; class DisassemblerViewAgent;
class StackWindow : public QTreeView class StackWindow : public QTreeView

View File

@@ -29,6 +29,7 @@
#include "tcfengine.h" #include "tcfengine.h"
#include "debuggerstringutils.h"
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"

View File

@@ -262,7 +262,7 @@ public:
static QString watcherEditPlaceHolder(); static QString watcherEditPlaceHolder();
signals: signals:
void watchDataUpdateNeeded(const WatchData &data); void watchDataUpdateNeeded(const Debugger::Internal::WatchData &data);
void sessionValueRequested(const QString &name, QVariant *value); void sessionValueRequested(const QString &name, QVariant *value);
void setSessionValueRequested(const QString &name, const QVariant &value); void setSessionValueRequested(const QString &name, const QVariant &value);

View File

@@ -33,6 +33,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "debuggermanager.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -50,6 +51,7 @@
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QResizeEvent> #include <QtGui/QResizeEvent>
using namespace Debugger;
using namespace Debugger::Internal; using namespace Debugger::Internal;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

View File

@@ -33,6 +33,8 @@
#include <QtGui/QTreeView> #include <QtGui/QTreeView>
namespace Debugger { namespace Debugger {
class DebuggerManager;
namespace Internal { namespace Internal {
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@@ -41,8 +43,6 @@ namespace Internal {
// //
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
class DebuggerManager;
class WatchWindow : public QTreeView class WatchWindow : public QTreeView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -129,7 +129,6 @@ GitPlugin::GitPlugin() :
m_showAction(0), m_showAction(0),
m_stageAction(0), m_stageAction(0),
m_unstageAction(0), m_unstageAction(0),
m_revertAction(0),
m_commitAction(0), m_commitAction(0),
m_pullAction(0), m_pullAction(0),
m_pushAction(0), m_pushAction(0),
@@ -298,12 +297,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_unstageAction, SIGNAL(triggered()), this, SLOT(unstageFile())); connect(m_unstageAction, SIGNAL(triggered()), this, SLOT(unstageFile()));
gitContainer->addAction(command); gitContainer->addAction(command);
m_revertAction = new Core::Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Core::Utils::ParameterAction::AlwaysEnabled, this);
command = actionManager->registerAction(m_revertAction, "Git.Revert", globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertFile()));
gitContainer->addAction(command);
gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Project"), this)); gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Project"), this));
m_diffProjectAction = new Core::Utils::ParameterAction(tr("Diff Current Project"), tr("Diff Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); m_diffProjectAction = new Core::Utils::ParameterAction(tr("Diff Current Project"), tr("Diff Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this);
@@ -756,7 +749,6 @@ void GitPlugin::updateActions()
m_undoFileAction->setParameter(fileName); m_undoFileAction->setParameter(fileName);
m_stageAction->setParameter(fileName); m_stageAction->setParameter(fileName);
m_unstageAction->setParameter(fileName); m_unstageAction->setParameter(fileName);
m_revertAction->setParameter(fileName);
bool enabled = !fileName.isEmpty() && !repository.isEmpty(); bool enabled = !fileName.isEmpty() && !repository.isEmpty();
m_diffAction->setEnabled(enabled); m_diffAction->setEnabled(enabled);
@@ -766,7 +758,6 @@ void GitPlugin::updateActions()
m_undoFileAction->setEnabled(enabled); m_undoFileAction->setEnabled(enabled);
m_stageAction->setEnabled(enabled); m_stageAction->setEnabled(enabled);
m_unstageAction->setEnabled(enabled); m_unstageAction->setEnabled(enabled);
m_revertAction->setEnabled(enabled);
if (repository.isEmpty()) { if (repository.isEmpty()) {
// If the file is not in a repository, the corresponding project will // If the file is not in a repository, the corresponding project will

View File

@@ -145,7 +145,6 @@ private:
QAction *m_showAction; QAction *m_showAction;
Core::Utils::ParameterAction *m_stageAction; Core::Utils::ParameterAction *m_stageAction;
Core::Utils::ParameterAction *m_unstageAction; Core::Utils::ParameterAction *m_unstageAction;
Core::Utils::ParameterAction *m_revertAction;
QAction *m_commitAction; QAction *m_commitAction;
QAction *m_pullAction; QAction *m_pullAction;
QAction *m_pushAction; QAction *m_pushAction;

View File

@@ -122,9 +122,5 @@ void ProFileReader::errorMessage(const QString &message)
ProFile *ProFileReader::proFileFor(const QString &name) ProFile *ProFileReader::proFileFor(const QString &name)
{ {
QMap<QString, ProFile *>::const_iterator it = m_includeFiles.constFind(name); return m_includeFiles.value(name);
if (it == m_includeFiles.constEnd())
return 0;
else
return it.value();
} }

View File

@@ -644,6 +644,7 @@ void S60DeviceRunControl::signsisProcessFinished()
connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice())); connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
connect(m_launcher, SIGNAL(startingApplication()), this, SLOT(printStartingNotice())); connect(m_launcher, SIGNAL(startingApplication()), this, SLOT(printStartingNotice()));
connect(m_launcher, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint))); connect(m_launcher, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint)));
connect(m_launcher, SIGNAL(canNotRun(QString)), this, SLOT(printRunFailNotice(QString)));
connect(m_launcher, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString))); connect(m_launcher, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString)));
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int))); connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
@@ -692,6 +693,10 @@ void S60DeviceRunControl::printRunNotice(uint pid)
emit addToOutputWindow(this, tr("Application running with pid %1.").arg(pid)); emit addToOutputWindow(this, tr("Application running with pid %1.").arg(pid));
} }
void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) {
emit addToOutputWindow(this, tr("Could not start application: %1").arg(errorMessage));
}
void S60DeviceRunControl::printApplicationOutput(const QString &output) void S60DeviceRunControl::printApplicationOutput(const QString &output)
{ {
emit addToOutputWindowInline(this, output); emit addToOutputWindowInline(this, output);

View File

@@ -164,6 +164,7 @@ private slots:
void printInstallingNotice(); void printInstallingNotice();
void printStartingNotice(); void printStartingNotice();
void printRunNotice(uint pid); void printRunNotice(uint pid);
void printRunFailNotice(const QString &errorMessage);
void printApplicationOutput(const QString &output); void printApplicationOutput(const QString &output);
void runFinished(); void runFinished();

View File

@@ -1528,6 +1528,18 @@ int TextBlockUserData::collapseAtPos() const
return Parenthesis::collapseAtPos(m_parentheses); return Parenthesis::collapseAtPos(m_parentheses);
} }
int TextBlockUserData::braceDepthDelta() const
{
int delta = 0;
for (int i = 0; i < m_parentheses.size(); ++i) {
switch (m_parentheses.at(i).chr.unicode()) {
case '{': case '+': ++delta; break;
case '}': case '-': --delta; break;
default: break;
}
}
return delta;
}
void TextEditDocumentLayout::setParentheses(const QTextBlock &block, const Parentheses &parentheses) void TextEditDocumentLayout::setParentheses(const QTextBlock &block, const Parentheses &parentheses)
{ {
@@ -1553,6 +1565,35 @@ bool TextEditDocumentLayout::hasParentheses(const QTextBlock &block)
return false; return false;
} }
int TextEditDocumentLayout::braceDepthDelta(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->braceDepthDelta();
return 0;
}
int TextEditDocumentLayout::braceDepth(const QTextBlock &block)
{
int state = block.userState();
if (state == -1)
return 0;
return state >> 8;
}
void TextEditDocumentLayout::setBraceDepth(QTextBlock &block, int depth)
{
int state = block.userState();
if (state == -1)
state = 0;
state = state & 0xff;
block.setUserState((depth << 8) | state);
}
void TextEditDocumentLayout::changeBraceDepth(QTextBlock &block, int delta)
{
if (delta)
setBraceDepth(block, braceDepth(block) + delta);
}
bool TextEditDocumentLayout::setIfdefedOut(const QTextBlock &block) bool TextEditDocumentLayout::setIfdefedOut(const QTextBlock &block)
{ {
@@ -2683,6 +2724,11 @@ void BaseTextEditor::updateCurrentLineHighlight()
void BaseTextEditor::slotCursorPositionChanged() void BaseTextEditor::slotCursorPositionChanged()
{ {
#if 0
qDebug() << "block" << textCursor().blockNumber()+1
<< "depth:" << TextEditDocumentLayout::braceDepth(textCursor().block())
<< "/" << TextEditDocumentLayout::braceDepth(document()->lastBlock());
#endif
if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) { if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) {
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editableInterface(), d->m_tempNavigationState); Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editableInterface(), d->m_tempNavigationState);
d->m_lastCursorChangeWasInteresting = false; d->m_lastCursorChangeWasInteresting = false;
@@ -4026,21 +4072,36 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
QTextBlock block = doc->firstBlock(); QTextBlock block = doc->firstBlock();
int rangeNumber = 0; int rangeNumber = 0;
int braceDepthDelta = 0;
while (block.isValid()) { while (block.isValid()) {
bool cleared = false;
bool set = false;
if (rangeNumber < blocks.size()) { if (rangeNumber < blocks.size()) {
const BlockRange &range = blocks.at(rangeNumber); const BlockRange &range = blocks.at(rangeNumber);
if (block.position() >= range.first && (block.position() <= range.last || !range.last)) { if (block.position() >= range.first && (block.position() <= range.last || !range.last)) {
needUpdate |= TextEditDocumentLayout::setIfdefedOut(block); set = TextEditDocumentLayout::setIfdefedOut(block);
} else { } else {
needUpdate |= TextEditDocumentLayout::clearIfdefedOut(block); cleared = TextEditDocumentLayout::clearIfdefedOut(block);
} }
if (block.contains(range.last)) if (block.contains(range.last))
++rangeNumber; ++rangeNumber;
} else { } else {
needUpdate |= TextEditDocumentLayout::clearIfdefedOut(block); cleared = TextEditDocumentLayout::clearIfdefedOut(block);
} }
if (cleared || set) {
needUpdate = true;
int delta = TextEditDocumentLayout::braceDepthDelta(block);
if (cleared)
braceDepthDelta += delta;
else if (set)
braceDepthDelta -= delta;
}
if (braceDepthDelta)
TextEditDocumentLayout::changeBraceDepth(block,braceDepthDelta);
block = block.next(); block = block.next();
} }

View File

@@ -128,6 +128,7 @@ public:
inline void clearParentheses() { m_parentheses.clear(); } inline void clearParentheses() { m_parentheses.clear(); }
inline const Parentheses &parentheses() const { return m_parentheses; } inline const Parentheses &parentheses() const { return m_parentheses; }
inline bool hasParentheses() const { return !m_parentheses.isEmpty(); } inline bool hasParentheses() const { return !m_parentheses.isEmpty(); }
int braceDepthDelta() const;
inline bool setIfdefedOut() { bool result = m_ifdefedOut; m_ifdefedOut = true; return !result; } inline bool setIfdefedOut() { bool result = m_ifdefedOut; m_ifdefedOut = true; return !result; }
inline bool clearIfdefedOut() { bool result = m_ifdefedOut; m_ifdefedOut = false; return result;} inline bool clearIfdefedOut() { bool result = m_ifdefedOut; m_ifdefedOut = false; return result;}
@@ -215,6 +216,10 @@ public:
static bool setIfdefedOut(const QTextBlock &block); static bool setIfdefedOut(const QTextBlock &block);
static bool clearIfdefedOut(const QTextBlock &block); static bool clearIfdefedOut(const QTextBlock &block);
static bool ifdefedOut(const QTextBlock &block); static bool ifdefedOut(const QTextBlock &block);
static int braceDepthDelta(const QTextBlock &block);
static int braceDepth(const QTextBlock &block);
static void setBraceDepth(QTextBlock &block, int depth);
static void changeBraceDepth(QTextBlock &block, int delta);
static TextBlockUserData *testUserData(const QTextBlock &block) { static TextBlockUserData *testUserData(const QTextBlock &block) {
return static_cast<TextBlockUserData*>(block.userData()); return static_cast<TextBlockUserData*>(block.userData());

View File

@@ -316,6 +316,7 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
translationUnit()->error(ast->ctor_initializer->firstToken(), translationUnit()->error(ast->ctor_initializer->firstToken(),
"only constructors take base initializers"); "only constructors take base initializers");
} }
accept(ast->ctor_initializer);
} }
const int previousVisibility = semantic()->switchVisibility(Symbol::Public); const int previousVisibility = semantic()->switchVisibility(Symbol::Public);

View File

@@ -168,6 +168,9 @@ bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
ast->symbol = fun; ast->symbol = fun;
fun->setReturnType(_fullySpecifiedType); fun->setReturnType(_fullySpecifiedType);
if (_fullySpecifiedType.isVirtual())
fun->setVirtual(true);
if (ast->parameters) { if (ast->parameters) {
DeclarationListAST *parameter_declarations = ast->parameters->parameter_declarations; DeclarationListAST *parameter_declarations = ast->parameters->parameter_declarations;
for (DeclarationListAST *decl = parameter_declarations; decl; decl = decl->next) { for (DeclarationListAST *decl = parameter_declarations; decl; decl = decl->next) {

View File

@@ -259,6 +259,12 @@ bool Function::hasArguments() const
(argumentCount() == 1 && argumentAt(0)->type()->isVoidType())); (argumentCount() == 1 && argumentAt(0)->type()->isVoidType()));
} }
bool Function::isVirtual() const
{ return f._isVirtual; }
void Function::setVirtual(bool isVirtual)
{ f._isVirtual = isVirtual; }
bool Function::isVariadic() const bool Function::isVariadic() const
{ return f._isVariadic; } { return f._isVariadic; }

View File

@@ -307,6 +307,9 @@ public:
/** Convenience function that returns whether the function receives any arguments. */ /** Convenience function that returns whether the function receives any arguments. */
bool hasArguments() const; bool hasArguments() const;
bool isVirtual() const;
void setVirtual(bool isVirtual);
bool isVariadic() const; bool isVariadic() const;
void setVariadic(bool isVariadic); void setVariadic(bool isVariadic);
@@ -348,6 +351,7 @@ private:
TemplateParameters *_templateParameters; TemplateParameters *_templateParameters;
FullySpecifiedType _returnType; FullySpecifiedType _returnType;
struct Flags { struct Flags {
unsigned _isVirtual: 1;
unsigned _isVariadic: 1; unsigned _isVariadic: 1;
unsigned _isPureVirtual: 1; unsigned _isPureVirtual: 1;
unsigned _isConst: 1; unsigned _isConst: 1;

View File

@@ -368,6 +368,11 @@ void Launcher::handleCpuType(const TrkResult &result)
void Launcher::handleCreateProcess(const TrkResult &result) void Launcher::handleCreateProcess(const TrkResult &result)
{ {
if (result.errorCode()) {
emit canNotRun(errorMessage(result.errorCode()));
emit finished();
return;
}
// 40 00 00] // 40 00 00]
//logMessage(" RESULT: " + result.toString()); //logMessage(" RESULT: " + result.toString());
// [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00] // [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00]

View File

@@ -60,6 +60,7 @@ signals:
void installingStarted(); void installingStarted();
void startingApplication(); void startingApplication();
void applicationRunning(uint pid); void applicationRunning(uint pid);
void canNotRun(const QString &errorMessage);
void finished(); void finished();
void applicationOutputReceived(const QString &output); void applicationOutputReceived(const QString &output);
void copyProgress(int percent); void copyProgress(int percent);
@@ -71,8 +72,6 @@ private slots:
void handleResult(const trk::TrkResult &data); void handleResult(const trk::TrkResult &data);
private: private:
void tryTrkRead();
// kill process and breakpoints // kill process and breakpoints
void cleanUp(); void cleanUp();
@@ -89,7 +88,6 @@ private:
void handleTrkVersion(const TrkResult &result); void handleTrkVersion(const TrkResult &result);
void waitForTrkFinished(const TrkResult &data); void waitForTrkFinished(const TrkResult &data);
void handleAndReportCreateProcess(const TrkResult &result);
void copyFileToRemote(); void copyFileToRemote();
void installRemotePackageSilently(const QString &filename); void installRemotePackageSilently(const QString &filename);
void installAndRun(); void installAndRun();

View File

@@ -119,6 +119,7 @@ TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) :
} // namespace trk } // namespace trk
Q_DECLARE_METATYPE(trk::TrkMessage) Q_DECLARE_METATYPE(trk::TrkMessage)
Q_DECLARE_METATYPE(trk::TrkResult)
namespace trk { namespace trk {
@@ -408,7 +409,7 @@ static inline bool overlappedSyncWrite(HANDLE file, const char *data,
bool WriterThread::write(const QByteArray &data, QString *errorMessage) bool WriterThread::write(const QByteArray &data, QString *errorMessage)
{ {
QMutexLocker(&m_context->mutex); QMutexLocker locker(&m_context->mutex);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
DWORD charsWritten; DWORD charsWritten;
if (!overlappedSyncWrite(m_context->device, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped)) { if (!overlappedSyncWrite(m_context->device, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped)) {
@@ -465,6 +466,65 @@ void WriterThread::slotHandleResult(const TrkResult &result)
tryWrite(); // Have messages been enqueued in-between? tryWrite(); // Have messages been enqueued in-between?
} }
///////////////////////////////////////////////////////////////////////
//
// ReaderThreadBase: Base class for a thread that reads data from
// the device, decodes the messages and emit signals for the messages.
// A Qt::BlockingQueuedConnection should be used for the message signal
// to ensure messages are processed in the correct sequence.
//
///////////////////////////////////////////////////////////////////////
class ReaderThreadBase : public QThread {
Q_OBJECT
Q_DISABLE_COPY(ReaderThreadBase)
public:
signals:
void messageReceived(const trk::TrkResult &result, const QByteArray &rawData);
protected:
explicit ReaderThreadBase(const QSharedPointer<DeviceContext> &context);
void processData(const QByteArray &a);
void processData(char c);
const QSharedPointer<DeviceContext> m_context;
private:
void readMessages();
QByteArray m_trkReadBuffer;
};
ReaderThreadBase::ReaderThreadBase(const QSharedPointer<DeviceContext> &context) :
m_context(context)
{
static const int trkResultMetaId = qRegisterMetaType<trk::TrkResult>();
Q_UNUSED(trkResultMetaId)
}
void ReaderThreadBase::processData(const QByteArray &a)
{
m_trkReadBuffer += a;
readMessages();
}
void ReaderThreadBase::processData(char c)
{
m_trkReadBuffer += c;
if (m_trkReadBuffer.size() > 1)
readMessages();
}
void ReaderThreadBase::readMessages()
{
TrkResult r;
QByteArray rawData;
while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, &rawData)) {
emit messageReceived(r, rawData);
}
}
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -474,7 +534,7 @@ void WriterThread::slotHandleResult(const TrkResult &result)
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
class WinReaderThread : public QThread { class WinReaderThread : public ReaderThreadBase {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(WinReaderThread) Q_DISABLE_COPY(WinReaderThread)
public: public:
@@ -485,8 +545,6 @@ public:
signals: signals:
void error(const QString &); void error(const QString &);
void dataReceived(char c);
void dataReceived(const QByteArray &data);
public slots: public slots:
void terminate(); void terminate();
@@ -496,12 +554,11 @@ private:
inline int tryRead(); inline int tryRead();
const QSharedPointer<DeviceContext> m_context;
HANDLE m_handles[HandleCount]; HANDLE m_handles[HandleCount];
}; };
WinReaderThread::WinReaderThread(const QSharedPointer<DeviceContext> &context) : WinReaderThread::WinReaderThread(const QSharedPointer<DeviceContext> &context) :
m_context(context) ReaderThreadBase(context)
{ {
m_handles[FileHandle] = NULL; m_handles[FileHandle] = NULL;
m_handles[TerminateEventHandle] = CreateEvent(NULL, FALSE, FALSE, NULL); m_handles[TerminateEventHandle] = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -528,9 +585,9 @@ int WinReaderThread::tryRead()
DWORD bytesRead = 0; DWORD bytesRead = 0;
if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) { if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) {
if (bytesRead == 1) { if (bytesRead == 1) {
emit dataReceived(buffer[0]); processData(buffer[0]);
} else { } else {
emit dataReceived(QByteArray(buffer, bytesRead)); processData(QByteArray(buffer, bytesRead));
} }
return 0; return 0;
} }
@@ -554,9 +611,9 @@ int WinReaderThread::tryRead()
return -3; return -3;
} }
if (bytesRead == 1) { if (bytesRead == 1) {
emit dataReceived(buffer[0]); processData(buffer[0]);
} else { } else {
emit dataReceived(QByteArray(buffer, bytesRead)); processData(QByteArray(buffer, bytesRead));
} }
return 0; return 0;
} }
@@ -564,8 +621,7 @@ int WinReaderThread::tryRead()
void WinReaderThread::run() void WinReaderThread::run()
{ {
m_handles[FileHandle] = m_context->readOverlapped.hEvent; m_handles[FileHandle] = m_context->readOverlapped.hEvent;
int readResult; while ( tryRead() == 0) ;
while ( (readResult = tryRead()) == 0) ;
} }
void WinReaderThread::terminate() void WinReaderThread::terminate()
@@ -593,7 +649,7 @@ static inline QString msgUnixCallFailedErrno(const char *func, int errorNumber)
return QString::fromLatin1("Call to %1() failed: %2").arg(QLatin1String(func), QString::fromLocal8Bit(strerror(errorNumber))); return QString::fromLatin1("Call to %1() failed: %2").arg(QLatin1String(func), QString::fromLocal8Bit(strerror(errorNumber)));
} }
class UnixReaderThread : public QThread { class UnixReaderThread : public ReaderThreadBase {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(UnixReaderThread) Q_DISABLE_COPY(UnixReaderThread)
public: public:
@@ -604,7 +660,6 @@ public:
signals: signals:
void error(const QString &); void error(const QString &);
void dataReceived(const QByteArray &);
public slots: public slots:
void terminate(); void terminate();
@@ -612,12 +667,11 @@ public slots:
private: private:
inline int tryRead(); inline int tryRead();
const QSharedPointer<DeviceContext> m_context;
int m_terminatePipeFileDescriptors[2]; int m_terminatePipeFileDescriptors[2];
}; };
UnixReaderThread::UnixReaderThread(const QSharedPointer<DeviceContext> &context) : UnixReaderThread::UnixReaderThread(const QSharedPointer<DeviceContext> &context) :
m_context(context) ReaderThreadBase(context)
{ {
m_terminatePipeFileDescriptors[0] = m_terminatePipeFileDescriptors[1] = -1; m_terminatePipeFileDescriptors[0] = m_terminatePipeFileDescriptors[1] = -1;
// Set up pipes for termination. Should not fail // Set up pipes for termination. Should not fail
@@ -675,15 +729,14 @@ int UnixReaderThread::tryRead()
m_context->mutex.lock(); m_context->mutex.lock();
const QByteArray data = m_context->file.read(numBytes); const QByteArray data = m_context->file.read(numBytes);
m_context->mutex.unlock(); m_context->mutex.unlock();
emit dataReceived(data); processData(data);
return 0; return 0;
} }
void UnixReaderThread::run() void UnixReaderThread::run()
{ {
int readResult;
// Read loop // Read loop
while ( (readResult = tryRead()) == 0) ; while ( tryRead() == 0) ;
} }
void UnixReaderThread::terminate() void UnixReaderThread::terminate()
@@ -801,12 +854,9 @@ bool TrkDevice::open(const QString &port, QString *errorMessage)
d->readerThread = QSharedPointer<ReaderThread>(new ReaderThread(d->deviceContext)); d->readerThread = QSharedPointer<ReaderThread>(new ReaderThread(d->deviceContext));
connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)), connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)),
Qt::QueuedConnection); Qt::QueuedConnection);
#ifdef Q_OS_WIN connect(d->readerThread.data(), SIGNAL(messageReceived(trk::TrkResult,QByteArray)),
connect(d->readerThread.data(), SIGNAL(dataReceived(char)), this, SLOT(slotMessageReceived(trk::TrkResult,QByteArray)),
this, SLOT(dataReceived(char)), Qt::QueuedConnection); Qt::BlockingQueuedConnection);
#endif
connect(d->readerThread.data(), SIGNAL(dataReceived(QByteArray)),
this, SLOT(dataReceived(QByteArray)), Qt::QueuedConnection);
d->readerThread->start(); d->readerThread->start();
d->writerThread = QSharedPointer<WriterThread>(new WriterThread(d->deviceContext)); d->writerThread = QSharedPointer<WriterThread>(new WriterThread(d->deviceContext));
@@ -872,30 +922,12 @@ void TrkDevice::setVerbose(int b)
d->verbose = b; d->verbose = b;
} }
void TrkDevice::dataReceived(char c) void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData)
{ {
d->trkReadBuffer += c; d->writerThread->slotHandleResult(result);
readMessages(); emit messageReceived(result);
}
void TrkDevice::dataReceived(const QByteArray &data)
{
d->trkReadBuffer += data;
readMessages();
}
void TrkDevice::readMessages()
{
TrkResult r;
QByteArray rawData;
while (extractResult(&d->trkReadBuffer, d->deviceContext->serialFrame, &r, &rawData)) {
if (d->verbose > 1)
emitLogMessage("Read TrkResult " + r.data.toHex());
d->writerThread->slotHandleResult(r);
emit messageReceived(r);
if (!rawData.isEmpty()) if (!rawData.isEmpty())
emit rawDataReceived(rawData); emit rawDataReceived(rawData);
}
} }
void TrkDevice::emitError(const QString &s) void TrkDevice::emitError(const QString &s)
@@ -908,8 +940,11 @@ void TrkDevice::emitError(const QString &s)
void TrkDevice::sendTrkMessage(byte code, TrkCallback callback, void TrkDevice::sendTrkMessage(byte code, TrkCallback callback,
const QByteArray &data, const QVariant &cookie) const QByteArray &data, const QVariant &cookie)
{ {
if (!d->writerThread.isNull()) if (!d->writerThread.isNull()) {
if (d->verbose > 1)
qDebug() << "Sending " << code << data.toHex();
d->writerThread->queueTrkMessage(code, callback, data, cookie); d->writerThread->queueTrkMessage(code, callback, data, cookie);
}
} }
void TrkDevice::sendTrkInitialPing() void TrkDevice::sendTrkInitialPing()

View File

@@ -95,8 +95,6 @@ public:
// Send an Ack synchronously, bypassing the queue // Send an Ack synchronously, bypassing the queue
bool sendTrkAck(unsigned char token); bool sendTrkAck(unsigned char token);
void tryTrkRead(); // TODO: Why public?
signals: signals:
void messageReceived(const trk::TrkResult &result); void messageReceived(const trk::TrkResult &result);
// Emitted with the contents of messages enclosed in 07e, not for log output // Emitted with the contents of messages enclosed in 07e, not for log output
@@ -105,8 +103,7 @@ signals:
void logMessage(const QString &msg); void logMessage(const QString &msg);
private slots: private slots:
void dataReceived(char c); void slotMessageReceived(const trk::TrkResult &result, const QByteArray &a);
void dataReceived(const QByteArray &a);
protected slots: protected slots:
void emitError(const QString &msg); void emitError(const QString &msg);