First commit with working display
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from .lv_style import InfoStyle
|
||||
from .lv_cache import DumpCache
|
||||
|
||||
__all__ = ["InfoStyle", "DumpCache"]
|
||||
@@ -0,0 +1,40 @@
|
||||
import argparse
|
||||
import gdb
|
||||
|
||||
|
||||
class DumpCache(gdb.Command):
|
||||
"""dump cache info for specified cache"""
|
||||
|
||||
def __init__(self):
|
||||
super(DumpCache, self).__init__(
|
||||
"dump cache", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
|
||||
)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
parser = argparse.ArgumentParser(description="Dump lvgl cache info.")
|
||||
parser.add_argument(
|
||||
"cache",
|
||||
type=str,
|
||||
choices=["image", "image_header"],
|
||||
default="image",
|
||||
help="cache to dump.",
|
||||
)
|
||||
|
||||
from lvglgdb import curr_inst
|
||||
|
||||
try:
|
||||
args = parser.parse_args(gdb.string_to_argv(args))
|
||||
except SystemExit:
|
||||
return
|
||||
|
||||
cache = None
|
||||
if args.cache == "image":
|
||||
cache = curr_inst().image_cache()
|
||||
elif args.cache == "image_header":
|
||||
cache = curr_inst().image_header_cache()
|
||||
|
||||
if not cache:
|
||||
print("Invalid cache: ", args.cache)
|
||||
return
|
||||
|
||||
cache.print_entries()
|
||||
@@ -0,0 +1,40 @@
|
||||
import argparse
|
||||
import gdb
|
||||
|
||||
from lvglgdb.value import Value
|
||||
from lvglgdb.lvgl import LVObject
|
||||
from lvglgdb.lvgl import dump_style_info
|
||||
|
||||
|
||||
class InfoStyle(gdb.Command):
|
||||
"""dump obj style value for specified obj"""
|
||||
|
||||
def __init__(self):
|
||||
super(InfoStyle, self).__init__(
|
||||
"info style", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
|
||||
)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
parser = argparse.ArgumentParser(description="Dump lvgl obj local style.")
|
||||
parser.add_argument(
|
||||
"obj",
|
||||
type=str,
|
||||
help="obj to show style.",
|
||||
)
|
||||
|
||||
try:
|
||||
args = parser.parse_args(gdb.string_to_argv(args))
|
||||
except SystemExit:
|
||||
return
|
||||
|
||||
obj = gdb.parse_and_eval(args.obj)
|
||||
if not obj:
|
||||
print("Invalid obj: ", args.obj)
|
||||
return
|
||||
|
||||
obj = Value(obj)
|
||||
|
||||
# show all styles applied to this obj
|
||||
for style in LVObject(obj).styles:
|
||||
print(" ", end="")
|
||||
dump_style_info(style)
|
||||
Reference in New Issue
Block a user