From: Michael Olbrich Date: Sat, 11 May 2019 19:02:37 +0000 (+0200) Subject: gdb: add 'gst-pipeline-tree' command X-Git-Tag: 1.19.3~1179 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2bd2ed289a115f448fd5a345acd61fcea27794bc;p=platform%2Fupstream%2Fgstreamer.git gdb: add 'gst-pipeline-tree' command It shows a simple tree of all elements in pipeline. As with gst-dot, the toplevel bin is found from any element of the pipeline: (gdb) gst-pipeline-tree bsink playbin inputselector1 inputselector0 uridecodebin0 queue2-0 decodebin0 avdec_aac0 aacparse0 vaapidecodebin0 vaapipostproc0 capsfilter1 vaapi-queue vaapidecode0 capsfilter0 h264parse0 multiqueue0 matroskademux0 typefind typefindelement0 source playsink abin aconv resample conv identity aqueue pulsesink0 vbin vconv scale conv identity vqueue vaapisink0 vdbin deinterlace vdconv audiotee streamsynchronizer0 --- diff --git a/libs/gst/helpers/gst_gdb.py b/libs/gst/helpers/gst_gdb.py index 597e9bf..1159e97 100644 --- a/libs/gst/helpers/gst_gdb.py +++ b/libs/gst/helpers/gst_gdb.py @@ -871,6 +871,12 @@ class GdbGstElement(GdbGstObject): _gdb_write(indent, "}") + @save_memory_access_print("") + def print_tree(self, indent): + _gdb_write(indent, "%s" % self.name()) + for child in self.children(): + child.print_tree(indent+1) + def _dot(self, indent=0): spc = " " * indent @@ -1049,8 +1055,31 @@ Usage gst-print """ obj.print(0) +class GstPipelineTree(gdb.Command): + """\ +Usage: gst-pipeline-tree """ + def __init__(self): + super(GstPipelineTree, self).__init__("gst-pipeline-tree", + gdb.COMPLETE_SYMBOL) + + def invoke(self, arg, from_tty): + self.dont_repeat() + args = gdb.string_to_argv(arg) + if len(args) != 1: + raise Exception("Usage: gst-pipeline-tree ") + + value = gdb.parse_and_eval(args[0]) + if not value: + raise Exception("'%s' is not a valid object" % args[0]) + + value = gst_object_from_value(value) + value = gst_object_pipeline(value) + GdbGstElement(value).print_tree(0) + + GstDot() GstPrint() +GstPipelineTree() class GstPipeline(gdb.Function):