Skip to content
Snippets Groups Projects
Commit b1e63fff authored by hjk's avatar hjk
Browse files

doc: adjust after changes to the debugging helpers

parent c6b8e520
No related branches found
No related tags found
No related merge requests found
...@@ -4713,14 +4713,13 @@ ...@@ -4713,14 +4713,13 @@
d.putNumChild(size) d.putNumChild(size)
if d.isExpanded(item): if d.isExpanded(item):
p = gdb.Value(p_ptr["array"]).cast(innerType.pointer()) p = gdb.Value(p_ptr["array"]).cast(innerType.pointer())
d.beginChildren([size, 2000], innerType) with Children(d, [size, 2000], innerType)
for i in d.childRange(): for i in d.childRange():
d.safePutItem(Item(p.dereference(), item.iname, i)) d.putItem(Item(p.dereference(), item.iname, i))
p += 1 p += 1
d.endChildren()
\endcode \endcode
\section2 Item Python Class \section2 Item Class
The Item Python class is a thin wrapper around values corresponding to one The Item Python class is a thin wrapper around values corresponding to one
line in the \gui{Locals and Watchers} view. The Item members are as follows : line in the \gui{Locals and Watchers} view. The Item members are as follows :
...@@ -4746,7 +4745,7 @@ ...@@ -4746,7 +4745,7 @@
\endlist \endlist
\section2 Dumper Python Class \section2 Dumper Class
For each line in the \gui{Locals and Watchers} view, a string like the For each line in the \gui{Locals and Watchers} view, a string like the
following needs to be created and channeled to the debugger plugin. following needs to be created and channeled to the debugger plugin.
...@@ -4791,26 +4790,14 @@ ...@@ -4791,26 +4790,14 @@
\o \gui{putField(self, name, value)} - Appends a comma if needed, and a \o \gui{putField(self, name, value)} - Appends a comma if needed, and a
name='value' field. name='value' field.
\o \gui{beginHash(self)} - Appends a comma if needed and a '{', marking
the begin of a set of fields.
\o \gui{endHash(self)} - Appends a '}', marking the end of a set of
fields.
\o \gui{beginItem(self, name)} - Starts writing a field by writing \c {name='}. \o \gui{beginItem(self, name)} - Starts writing a field by writing \c {name='}.
\o \gui{endItem(self)} - Ends writing a field by writing \c {'}. \o \gui{endItem(self)} - Ends writing a field by writing \c {'}.
\o \gui{beginChildren(self, numChild_ = 1, childType_ = None, childNumChild_ = None)}
- Starts writing a list of \c numChild children, with type
\c childType_ and \c childNumChild_ grandchildren each. If \c numChild_
is a list of two integers, the first one specifies the actual number
of children and the second the maximum number of children to print.
\o \gui{endChildren(self)} - Ends writing a list of children. \o \gui{endChildren(self)} - Ends writing a list of children.
\o \gui{childRange(self)} - Return the range of children specified in \o \gui{childRange(self)} - Returns the range of children specified in
\c beginChildren. the current \c Children scope.
\o \gui{putItemCount(self, count)} - Appends a field \c {value='<%d items'} \o \gui{putItemCount(self, count)} - Appends a field \c {value='<%d items'}
to the output. to the output.
...@@ -4907,35 +4894,51 @@ ...@@ -4907,35 +4894,51 @@
over base classes and class members of compound types and calls over base classes and class members of compound types and calls
\c qdump__* functions whenever appropriate. \c qdump__* functions whenever appropriate.
\o \gui{putItem(self, item)} - Equivalent to: \o \gui{putItem(self, item)} - Equivalent to:
\code \code
self.beginHash() with SubItem(self):
self.putItemHelper(item) self.putItemHelper(item)
self.endHash()
\endcode \endcode
Exceptions raised by nested function calls are caught and all
\o \gui{safePutItemHelper(self, item)} - Calls \c putItemHelper(self, item). output produced by \c putItemHelper is replaced by the output of:
If an exception is raised, catches it, and replaces all output produced by
\c putItemHelper with the output of:
\code \code
self.putName(item.name) ...
self.putValue("<invalid>") except RuntimeError:
self.putType(str(item.value.type)) d.put('value="<invalid>",type="<unknown>",numchild="0",')
self.putNumChild(0)
self.beginChildren()
self.endChildren()
\endcode \endcode
\endlist
\o \gui{safePutItem(self, item)} - Equivalent to:
\code
self.beginHash()
self.safePutItemHelper(item)
self.endHash()
\endcode
\endlist \section2 Children and SubItem Class
Child items might report errors if data is uninitialized or corrupted
or if the helper code is broken. To gracefully recover from these
errors, use \c Children and \c SubItem \e{Context Managers} to create
nested items.
The \c Children constructor \gui{__init__(self, dumper, numChild = 1,
childType = None, childNumChild = None)} uses one non-optional argument
\c dumper to refer to the current \c Dumper object and three optional
arguments, specifying the number \c numChild of children, with type
\c childType_ and \c childNumChild_ grandchildren each. If \c numChild_
is a list of two integers, the first one specifies the actual number
of children and the second the maximum number of children to print.
Similarly, using the \SubItem class helps to protect individual items.
Example:
\code
d.putNumChild(2)
if d.isExpanded(item):
with Children(d):
with SubItem(d):
d.putName("key")
d.putItemHelper(Item(key, item.iname, "key"))
with SubItem(d):
d.putName("value")
d.putItemHelper(Item(value, item.iname, "value"))
\endcode
*/ */
......
TEMPLATE = app
TARGET = debuggertest
DEPENDPATH += .
INCLUDEPATH += .
DESTDIR = .
# Input
SOURCES += app.cpp
# SOURCES += ../../../share/qtcreator/gdbmacros/gdbmacros.cpp
QT += network
message("this says <foo & bar>")
TEMPLATE = lib
TARGET = plugin
DESTDIR = ..
CONFIG += shared
SOURCES += ../plugin.cpp
macx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
QMAKE_RPATHDIR += \$\$ORIGIN/..
IDE_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${IDE_PLUGIN_RPATH}\'
QMAKE_RPATHDIR =
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment