diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-01-19 12:52:41 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-01-19 12:52:41 +1100 |
| commit | cd650b30bd3ddfb9f71622278ef5b6f94ae27ac8 (patch) | |
| tree | 482058e274f0daee21a1e8798cdd39e4b94be17c /src/app_console | |
| parent | 1525afe8aaadfaa877f8987f0ea224263a612b5e (diff) | |
| download | tangara-fw-cd650b30bd3ddfb9f71622278ef5b6f94ae27ac8.tar.gz | |
fix some lua stack leaks + add a console func to help debug
Diffstat (limited to 'src/app_console')
| -rw-r--r-- | src/app_console/app_console.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp index 2d16b60b..7347f130 100644 --- a/src/app_console/app_console.cpp +++ b/src/app_console/app_console.cpp @@ -43,6 +43,7 @@ #include "service_locator.hpp" #include "system_events.hpp" #include "track.hpp" +#include "ui_events.hpp" namespace console { @@ -326,6 +327,25 @@ void RegisterHeaps() { esp_console_cmd_register(&cmd); } +int CmdStacks(int argc, char** argv) { + static const std::pmr::string usage = "usage: stacks"; + if (argc != 1) { + std::cout << usage << std::endl; + return 1; + } + events::Ui().Dispatch(ui::DumpLuaStack{}); + return 0; +} + +void RegisterStacks() { + esp_console_cmd_t cmd{.command = "stacks", + .help = "prints contents of each lua stack", + .hint = NULL, + .func = &CmdStacks, + .argtable = NULL}; + esp_console_cmd_register(&cmd); +} + #if CONFIG_HEAP_TRACING static heap_trace_record_t* sTraceRecords = nullptr; static bool sIsTracking = false; @@ -630,6 +650,7 @@ auto AppConsole::RegisterExtraComponents() -> void { RegisterTasks(); RegisterHeaps(); + RegisterStacks(); #if CONFIG_HEAP_TRACING RegisterAllocs(); |
