Files
lvgl/docs/overview/debugging.rst
T
Neo Xu d460edbcac feat(gdb): add lvgl GDB plugin
Usage:
Launch gdb firstly, then execute source path/to/lvgl.py

Or
`gdb bin/main -ex source "scripts/gdb/lvgl.py"`

Currently only "dump obj" and "info style" commands are available.
Usage:
(gdb) dump obj -h
usage: [-h] [-L LEVEL] [root]

Dump lvgl obj tree.

positional arguments:
  root                  Optional root obj to dump.

options:
  -h, --help            show this help message and exit
  -L LEVEL, --level LEVEL
                        Limit the depth of the tree.

Example:
(gdb) dump obj -L 2
Display 0x9e503080
  Screen@0xf5f0a760
  obj@0xf5f0a760 (0,0,639,479)
  Screen@0xf5f0a700
  obj@0xf5f0a700 (0,0,639,479)
    tabview@0xf5f0d100 (0,0,639,479)
    keyboard@0xf3402d20 (0,240,639,479)
    dropdown-list@0xf5f0c620 (0,0,129,129)
  Screen@0xf5f0a6a0
  obj@0xf5f0a6a0 (0,0,639,479)
  Screen@0xf5f0a640
  obj@0xf5f0a640 (0,0,639,479)

(gdb) info style 0x60700000dd10
  32 = {num = 90, ptr = 0x5a, color = {blue = 90 'Z', green = 0 '\000', red = 0 '\000'}}
  158 = {num = 32767, ptr = 0x7fff, color = {blue = 255 '\377', green = 127 '\177', red = 0 '\000'}}
(gdb) p lv_global->disp_default->act_scr
$4 = (lv_obj_t *) 0x60700000dd10
(gdb) info style $4
  32 = {num = 90, ptr = 0x5a, color = {blue = 90 'Z', green = 0 '\000', red = 0 '\000'}}
  158 = {num = 32767, ptr = 0x7fff, color = {blue = 255 '\377', green = 127 '\177', red = 0 '\000'}}
(gdb)

Change-Id: Id73e20a761913fe767308f9ee29ae16fbf4f876c
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-16 17:19:02 +02:00

76 lines
2.3 KiB
ReStructuredText

.. _tools:
=====
Tools
=====
LVGL has provided many tools to help you develop and debug your application. They are located in the ``lvgl/scripts`` directory.
GDB Plugin
**********
### Debugging LVGL with GDB
To facilitate debugging LVGL with GDB, a GDB plugin is provided. This plugin can be found in the ``lvgl/scripts/gdb`` directory.
The GDB plugin can be used with any target where GDB is available. For example, you can use it to debug a device connected to a PC via JLink, which provides a GDB server. Additionally, if your device crashes and you have a core dump, you can use GDB to analyze the core dump.
To load the LVGL GDB plugin within GDB's command line, type the following command:
``source lvgl/scripts/gdb/lvgl.py``
Example of usage:
.. code:: bash
(gdb) source lvgl/scripts/gdb/lvgl.py
(gdb) dump obj -L 2
obj@0x60700000dd10 (0,0,799,599)
tabview@0x608000204ca0 (0,0,799,599)
obj@0x607000025da0 (0,0,799,69)
obj@0x607000025e80 (0,70,799,599)
obj@0x60700002bd70 (743,543,791,591)
btn@0x60700002c7f0 (747,547,787,587)
keyboard@0x60d0000f7040 (0,300,799,599)
dropdown-list@0x608000205420 (0,0,129,129)
label@0x60d0000f7ba0 (22,22,56,39)
(gdb)
The plugin provides the following commands.
- ``dump obj``: Dump the object tree.
- ``info style``: Show the object's style.
Dump obj tree
-------------
``dump obj``: Dump the object tree.
``dump obj -L 2``: Dump the object tree with a depth of 2.
``dump obj -a 0x60700000dd10``: Dump the object tree starting from the specified address.
Show obj's style
----------------
This command can dump the object's local style, since style value is a union, it's displayed in all possible formats.
``info style address_of_obj``: Show the object's style.
Example:
.. code:: bash
(gdb) info style 0x60700000dd10
32 = {num = 90, ptr = 0x5a, color = {blue = 90 'Z', green = 0 '\000', red = 0 '\000'}}
158 = {num = 32767, ptr = 0x7fff, color = {blue = 255 '\377', green = 127 '\177', red = 0 '\000'}}
(gdb) p lv_global->disp_default->act_scr
$4 = (lv_obj_t *) 0x60700000dd10
(gdb) info style $4
32 = {num = 90, ptr = 0x5a, color = {blue = 90 'Z', green = 0 '\000', red = 0 '\000'}}
158 = {num = 32767, ptr = 0x7fff, color = {blue = 255 '\377', green = 127 '\177', red = 0 '\000'}}
(gdb)