mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
gdb: Print event seqnums, object pointers and structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>
This commit is contained in:
parent
ab4821630a
commit
1c97dac2b1
1 changed files with 18 additions and 8 deletions
|
@ -450,6 +450,10 @@ class GdbGValue:
|
||||||
v += " " if v == "<" else ", "
|
v += " " if v == "<" else ", "
|
||||||
v += str(GdbGValue(l))
|
v += str(GdbGValue(l))
|
||||||
v += " >"
|
v += " >"
|
||||||
|
elif tname in ("GEnum"):
|
||||||
|
v = "%s(%s)" % (
|
||||||
|
g_type_to_name(g_type_to_typenode(self.val["g_type"])),
|
||||||
|
value["v_int"])
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
v = value.string()
|
v = value.string()
|
||||||
|
@ -543,8 +547,11 @@ class GdbGstSegment:
|
||||||
_gdb_write(indent, "%s:%s %s" %
|
_gdb_write(indent, "%s:%s %s" %
|
||||||
(key, (8-len(key))*" ", self.format_value(value)))
|
(key, (8-len(key))*" ", self.format_value(value)))
|
||||||
|
|
||||||
def print(self, indent):
|
def print(self, indent, seqnum=None):
|
||||||
_gdb_write(indent, "segment: %s" % self.fmt)
|
s = "segment:"
|
||||||
|
if seqnum:
|
||||||
|
s += "(seqnum: %s)" % seqnum
|
||||||
|
_gdb_write(indent, s)
|
||||||
rate = float(self.val["rate"])
|
rate = float(self.val["rate"])
|
||||||
applied_rate = float(self.val["applied_rate"])
|
applied_rate = float(self.val["applied_rate"])
|
||||||
if applied_rate != 1.0:
|
if applied_rate != 1.0:
|
||||||
|
@ -583,16 +590,17 @@ class GdbGstEvent:
|
||||||
@save_memory_access_print("<inaccessible memory>")
|
@save_memory_access_print("<inaccessible memory>")
|
||||||
def print(self, indent):
|
def print(self, indent):
|
||||||
typestr = self.typestr()
|
typestr = self.typestr()
|
||||||
|
seqnum = self.val["event"]["seqnum"]
|
||||||
if typestr == "caps":
|
if typestr == "caps":
|
||||||
caps = GdbGstCaps(self.structure().value("caps").value())
|
caps = GdbGstCaps(self.structure().value("caps").value())
|
||||||
caps.print(indent, "caps:")
|
caps.print(indent, "caps (seqnum: %s):" % seqnum)
|
||||||
elif typestr == "stream-start":
|
elif typestr == "stream-start":
|
||||||
stream_id = self.structure().value("stream-id").value()
|
stream_id = self.structure().value("stream-id").value()
|
||||||
_gdb_write(indent, "stream-start:")
|
_gdb_write(indent, "stream-start: (seqnum %s)" % seqnum)
|
||||||
_gdb_write(indent + 1, "stream-id: %s" % stream_id.string())
|
_gdb_write(indent + 1, "stream-id: %s" % stream_id.string())
|
||||||
elif typestr == "segment":
|
elif typestr == "segment":
|
||||||
segment = self.structure().value("segment").value()
|
segment = self.structure().value("segment").value()
|
||||||
GdbGstSegment(segment).print(indent)
|
GdbGstSegment(segment).print(indent, seqnum)
|
||||||
elif typestr == "tag":
|
elif typestr == "tag":
|
||||||
struct = self.structure()
|
struct = self.structure()
|
||||||
# skip 'GstTagList-'
|
# skip 'GstTagList-'
|
||||||
|
@ -600,11 +608,11 @@ class GdbGstEvent:
|
||||||
t = gdb.lookup_type("GstTagListImpl").pointer()
|
t = gdb.lookup_type("GstTagListImpl").pointer()
|
||||||
s = struct.value("taglist").value().cast(t)["structure"]
|
s = struct.value("taglist").value().cast(t)["structure"]
|
||||||
structure = GdbGstStructure(s)
|
structure = GdbGstStructure(s)
|
||||||
_gdb_write(indent, "tag: %s" % name)
|
_gdb_write(indent, "tag: %s (seqnum: %s)" % (name, seqnum))
|
||||||
for (key, value) in structure.values():
|
for (key, value) in structure.values():
|
||||||
_gdb_write(indent+1, "%s: %s" % (key, str(value)))
|
_gdb_write(indent+1, "%s: %s" % (key, str(value)))
|
||||||
else:
|
else:
|
||||||
self.structure().print(indent, typestr)
|
self.structure().print(indent, "%s (seqnum: %s)" % (typestr, seqnum))
|
||||||
|
|
||||||
|
|
||||||
class GdbGstBuffer:
|
class GdbGstBuffer:
|
||||||
|
@ -966,7 +974,7 @@ class GdbGstElement(GdbGstObject):
|
||||||
|
|
||||||
@save_memory_access_print("<inaccessible memory>")
|
@save_memory_access_print("<inaccessible memory>")
|
||||||
def print_tree(self, indent):
|
def print_tree(self, indent):
|
||||||
_gdb_write(indent, "%s" % self.name())
|
_gdb_write(indent, "%s(%s)" % (self.name(), self.val))
|
||||||
for child in self.children():
|
for child in self.children():
|
||||||
child.print_tree(indent+1)
|
child.print_tree(indent+1)
|
||||||
|
|
||||||
|
@ -1146,6 +1154,8 @@ Usage gst-print <gstreamer-object>"""
|
||||||
obj = GdbGstQuery(value)
|
obj = GdbGstQuery(value)
|
||||||
elif g_inherits_type(value, "GstBuffer"):
|
elif g_inherits_type(value, "GstBuffer"):
|
||||||
obj = GdbGstBuffer(value)
|
obj = GdbGstBuffer(value)
|
||||||
|
elif is_gst_type(value, "GstStructure"):
|
||||||
|
obj = GdbGstStructure(value)
|
||||||
else:
|
else:
|
||||||
raise Exception("'%s' has an unknown type (%s)" % (arg, value))
|
raise Exception("'%s' has an unknown type (%s)" % (arg, value))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue