chore(gdb): update docs and clean up command naming

This commit is contained in:
Benign X
2026-03-06 13:53:12 +08:00
committed by VIFEX
parent e27bba80fe
commit f5a61ccf84
11 changed files with 145 additions and 30 deletions
+17
View File
@@ -15,8 +15,16 @@ In your GDB session, run:
py import lvglgdb
dump obj
dump display -f png
dump cache image
dump cache image_header
check cache image
dump anim
dump timer
dump indev
dump group
dump image_decoder
dump fs_drv
dump draw_task <layer_expr>
# Inspect a single lv_style_t variable
@@ -24,6 +32,15 @@ info style my_style
# Inspect all styles of an lv_obj_t
info style --obj my_obj
# Show draw unit information
info draw_unit
# Show object class hierarchy
info obj_class obj->class_p
# Show subject and its observers
info subject &my_subject
```
# Structure
@@ -16,10 +16,10 @@ class DumpDrawTask(gdb.Command):
if not args.strip():
print("Usage: dump draw_task <layer_expression>")
return
try:
val = gdb.parse_and_eval(args.strip())
except gdb.error as e:
print(f"Error: {e}")
return
LVDrawTask.print_entries(LVDrawTask(Value(val)))
layer = Value(gdb.parse_and_eval(args.strip()))
task_head = layer.draw_task_head
if not int(task_head):
print("No draw tasks on this layer.")
return
LVDrawTask.print_entries(LVDrawTask(task_head))
+2 -7
View File
@@ -5,16 +5,11 @@ from lvglgdb.lvgl.misc.lv_anim import LVAnim
class DumpAnim(gdb.Command):
"""dump all active animations
Usage:
dump anims - list all animations in a table
dump anims --detail - print detailed info for each animation
"""
"""dump all active animations"""
def __init__(self):
super(DumpAnim, self).__init__(
"dump anims", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
"dump anim", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
)
def invoke(self, args, from_tty):
+1 -1
View File
@@ -9,7 +9,7 @@ class DumpTimer(gdb.Command):
def __init__(self):
super(DumpTimer, self).__init__(
"dump timers", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
"dump timer", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
)
def invoke(self, args, from_tty):
@@ -57,7 +57,6 @@ class LVDrawTask(Value):
table.field_names = ["#", "type", "state", "area", "opa", "unit_id"]
table.align = "l"
count = 0
for i, t in enumerate(tasks):
table.add_row(
[
@@ -69,9 +68,8 @@ class LVDrawTask(Value):
t.preferred_draw_unit_id,
]
)
count += 1
if count == 0:
if not table.rows:
print("No draw tasks.")
else:
print(table)
@@ -36,12 +36,10 @@ class LVDrawUnit(Value):
table.field_names = ["#", "name", "idx"]
table.align = "l"
count = 0
for i, unit in enumerate(units):
table.add_row([i, unit.name, unit.idx])
count += 1
if count == 0:
if not table.rows:
print("No draw units.")
else:
print(table)
+6 -2
View File
@@ -111,11 +111,15 @@ class LVAnim(Value):
print(f" completed_cb = {_fmt_cb(self.completed_cb)}")
print(f" deleted_cb = {_fmt_cb(self.deleted_cb)}")
print(f" user_data = {self.user_data}")
print(f" value = {self.start_value} -> {self.current_value} -> {self.end_value}")
print(
f" value = {self.start_value} -> {self.current_value} -> {self.end_value}"
)
print(f" duration = {self.duration}ms act_time={self.act_time}ms")
repeat = "inf" if self.repeat_cnt == 0xFFFF else str(self.repeat_cnt)
print(f" repeat = {repeat} repeat_delay={self.repeat_delay}ms")
print(f" reverse = dur={self.reverse_duration}ms delay={self.reverse_delay}ms")
print(
f" reverse = dur={self.reverse_duration}ms delay={self.reverse_delay}ms"
)
print(f" status = {self._status_str()} early_apply={self.early_apply}")
@staticmethod
+1 -3
View File
@@ -139,7 +139,6 @@ class LVEventList(Value):
table.field_names = ["#", "callback", "filter", "flags", "user_data"]
table.align = "l"
count = 0
for i, dsc in enumerate(event_dscs):
cb_str = dsc.cb.format_string(symbols=True, address=True)
flags = []
@@ -150,9 +149,8 @@ class LVEventList(Value):
table.add_row(
[i, cb_str, dsc.filter_name, ",".join(flags) or "-", dsc.user_data]
)
count += 1
if count == 0:
if not table.rows:
print("No event descriptors.")
else:
print(table)
+9 -1
View File
@@ -41,7 +41,15 @@ class LVTimer(Value):
def print_entries(timers):
"""Print timers as a PrettyTable."""
table = PrettyTable()
table.field_names = ["#", "callback", "period", "freq", "last_run", "repeat", "paused"]
table.field_names = [
"#",
"callback",
"period",
"freq",
"last_run",
"repeat",
"paused",
]
table.align = "l"
for i, timer in enumerate(timers):
+1 -3
View File
@@ -44,9 +44,7 @@ def generate(subject_types: dict[int, str]) -> str:
def main():
subject_types = parse_enum(
OBSERVER_H, "lv_subject_type_t", "LV_SUBJECT_TYPE_"
)
subject_types = parse_enum(OBSERVER_H, "lv_subject_type_t", "LV_SUBJECT_TYPE_")
src = generate(subject_types)
OUTPUT.write_text(src)
print(f"Generated {OUTPUT} ({len(subject_types)} subject types)")