chore(gdb): add gdb cmd for nuttx drivers to support multi-instance (#9068)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
terry.rong
2025-10-17 16:56:50 +08:00
committed by GitHub
parent c016f72d4c
commit 9cdbc6695a
5 changed files with 70 additions and 1 deletions
+4
View File
@@ -5,6 +5,7 @@ from .display import DumpDisplayBuf
from .draw import InfoDrawUnit
from .misc import InfoStyle
from .debugger import Debugger
from .drivers import Lvglobal
__all__ = []
@@ -25,3 +26,6 @@ DumpDisplayBuf()
# Infos
InfoStyle()
InfoDrawUnit()
# Drivers
Lvglobal()
@@ -0,0 +1,5 @@
from .nuttx import Lvglobal
__all__ = [
"Lvglobal",
]
@@ -0,0 +1,5 @@
from .nuttx import Lvglobal
__all__ = [
"Lvglobal",
]
@@ -0,0 +1,55 @@
# GDB script to get lvgl global pointer in NuttX.
import argparse
import sys
import gdb
class Lvglobal(gdb.Command):
"""Set which lvgl instance to inspect by finding lv_global pointer in task TLS data."""
def __init__(self):
super(Lvglobal, self).__init__("lvglobal", gdb.COMMAND_USER)
def set_lvgl_instance(self, inst):
from lvglgdb.lvgl import curr_inst
curr_inst().reset()
curr_inst().ensure_init(inst)
def invoke(self, arg, from_tty):
parser = argparse.ArgumentParser(description=self.__doc__)
parser.add_argument("-p", "--pid", type=int, help="Optional process ID")
try:
args = parser.parse_args(gdb.string_to_argv(arg))
except SystemExit:
return
try:
from nxgdb import utils
except ImportError:
print("nxgdb is not installed, can't find lvgl global pointer.")
return
lv_global = utils.gdb_eval_or_none("lv_global")
if lv_global:
print(f"Found single instance lv_global@{hex(lv_global.address)}")
self.set_lvgl_instance(lv_global)
return
# find the lvgl global pointer in tls
if not args.pid:
print("LVGL is in multi-process mode; please provide --pid.")
return
lv_key = utils.gdb_eval_or_none("lv_nuttx_tlskey")
if lv_key is None:
lv_key = utils.gdb_eval_or_none("lv_global_default::index")
if lv_key is None:
print("Can't find lvgl tls key in multi-process mode.")
return
lv_global = utils.get_task_tls(args.pid, lv_key)
if lv_global:
print(f"Found lv_global@{hex(lv_global)}")
self.set_lvgl_instance(lv_global)
else:
print(f"\nCan't find lv_global with tlskey@{hex(lv_key)}.")
+1 -1
View File
@@ -76,7 +76,7 @@ class _LVGLSingleton:
print(f"Failed to get lv_global: {e}")
return False
elif not isinstance(lv_global, Value):
lv_global = Value(lv_global)
lv_global = Value(lv_global).cast("lv_global_t", ptr=True)
if not lv_global.inited:
print(