Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
LuaDebuggerDialog Class Reference

Top-level dialog hosting the Lua debugger UI components. More...

#include <lua_debugger_dialog.h>

Inheritance diagram for LuaDebuggerDialog:
GeometryStateDialog

Public Slots

void onCodeViewContextMenu (const QPoint &pos)
 Build and show the editor context menu (right-click in a code tab). Routed through Qt's signal/slot mechanism, so it must be visible from connect() sites in the code-tabs controller.
 
void handleEscapeKey ()
 Escape: hide inline find/go accordions if shown, else close dialog. Invoked from the script editor because keys often go to the viewport, not the top-level dialog event filter.
 
void runToCurrentLineInPausedEditor (LuaDebuggerCodeView *codeView, qint32 line)
 Run-to-line dispatch from the focused paused editor. Public so LuaDebuggerKeyRouter can fire it from the dialog's event filter without reaching into private members. Same entry point used by the gutter context menu's "Run to Line".
 

Public Member Functions

 LuaDebuggerDialog (QWidget *parent=nullptr)
 Construct the dialog and initialize all child widgets.
 
 ~LuaDebuggerDialog ()
 Destroy the dialog and disconnect debugger callbacks.
 
void handlePause (const char *file_path, int64_t line)
 React to the debugger pausing execution at a breakpoint.
 
void reject () override
 Close from Esc or programmatic reject(); queues close() so closeEvent() runs (unsaved-scripts prompt matches the window close button). The base QDialog::reject() hides via done() and skips closeEvent(); synchronous close() from Esc can fail to close.
 
void addWatchFromSpec (const QString &watchSpec)
 Add a watch from an expression/path spec without opening the inline editor. Convenience used by the editor right-click menu and by the Variables panel context menu.
 
LuaDebuggerChangeHighlightTrackerchangeHighlight ()
 Borrowed reference to the change-highlight tracker. Used by controllers that compute "changed since last pause" cues without having to friend the dialog.
 
LuaDebuggerStackControllerstackController ()
 Borrowed reference to the stack controller. Used by Watch / Variables / Eval to read the currently inspected stack frame without friending the dialog.
 
bool isDebuggerPaused () const
 True while the dialog is in a pause-entry / nested event-loop UI. Mirrors the C side's wslua_debugger_is_paused on most paths but is updated from a different code path; controllers that need the Qt-side flag read it via this accessor.
 
bool changeHighlightAllowed () const
 Combined "is the change-highlight cue allowed for paint this pass?" gate. Reads the tracker policy with the active stack selection level; centralised here so callers do not have to thread the level themselves.
 
void applyChangedVisuals (QStandardItem *valueCell, bool changed)
 Stamp valueCell with the change-highlight visuals; the dialog supplies itself as the timer owner so the one-shot row flash gets cleaned up if the dialog is destroyed.
 
QKeySequence addWatchShortcut () const
 Shortcut bound to the Add Watch toolbar action. Watch / Variables context menus mirror it on their "Add Watch" entries.
 
QString pausedFile () const
 Source file path (normalized) of the line the debugger is paused on; empty when not paused. Paired with pausedLine.
 
qlonglong pausedLine () const
 Line number of the pause; zero when the debugger is not paused. Paired with pausedFile.
 
QCheckBox * enabledToggle ()
 Borrowed reference to the toggle that mirrors the core's enable/disable state; the reload coordinator round-trips it across a forced-on reload.
 
QString normalizedFilePath (const QString &file_path) const
 Normalize a path by trimming prefixes and resolving symbolic components. Public so controllers and the capture-suppression helper can canonicalise paths without friending the dialog.
 
void refreshDebuggerStateUi ()
 Refresh checkbox sync + all debugger state chrome/widgets.
 
void updateWidgets ()
 Update all widgets based on the current debugger state.
 
void ensureDebuggerEnabledForActiveBreakpoints ()
 Enable the debugger if any active breakpoint requires it.
 
void refreshVariablesForCurrentStackFrame ()
 Rebuild the variables tree after the stack frame for inspection changed.
 
void syncVariablesTreeToCurrentWatch ()
 Select the Variables row matching the current Watch row, or clear the Variables selection when no match exists.
 
void updateLuaEditorAuxFrames ()
 Point find / goto bars at the active code tab.
 
void updateContinueActionState ()
 Enable or disable the Continue action based on debugger state.
 
void clearPausedStateUi ()
 Remove paused-state UI artifacts like stacks and highlights.
 
void setSaveActionEnabled (bool enabled)
 Toggle the toolbar Save Script action's enabled state. Surfaced as a typed setter so the code-tabs controller does not need to reach into the dialog's QAction members.
 
bool tearDownPauseLoopForReload ()
 Tear down an active pause loop because the Lua engine is about to be reloaded under us. Returns true if a pause loop was active (the caller may need to defer follow-up work to the post-reload phase). Unlike resumeDebuggerAndExitLoop, the engine is NOT signalled to continue; the reload owns restarting the VM.
 
Controller accessors

Borrowed references to the dialog's per-panel controllers. Returned by reference because the controllers are direct (non-pointer) members of the dialog and have the same lifetime as the dialog itself. Callers must not store these references past the dialog's destruction.

LuaDebuggerVariablesControllervariablesController ()
 
LuaDebuggerCodeTabsControllercodeTabsController ()
 
LuaDebuggerFilesControllerfilesController ()
 
LuaDebuggerWatchControllerwatchController ()
 
LuaDebuggerBreakpointsControllerbreakpointsController ()
 
LuaDebuggerPauseControllerpauseController ()
 
LuaDebuggerLuaReloadCoordinatorreloadCoordinator ()
 
LuaDebuggerEvalControllerevalController ()
 
LuaDebuggerFontPolicyfontPolicy ()
 
- Public Member Functions inherited from GeometryStateDialog
 GeometryStateDialog (QWidget *parent, Qt::WindowFlags f=Qt::Window)
 
void setWindowModality (Qt::WindowModality windowModality)
 

Static Public Member Functions

static int32_t currentTheme ()
 Get the current theme setting.
 
static LuaDebuggerDialoginstance (QWidget *parent=nullptr)
 Retrieve the singleton instance, creating it if needed.
 
static LuaDebuggerDialoginstanceIfExists ()
 Like instance but never creates the dialog; returns nullptr when no instance exists yet. Used by helpers that may run before the dialog has ever been opened.
 
static bool handleMainCloseIfPaused (QCloseEvent *event)
 If the debugger is paused or owns unsaved scripts, defer the supplied main-window close event so the Lua C stack can unwind first; otherwise return false and let the main window close normally.
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 Flush state and resume execution when the dialog closes.
 
void showEvent (QShowEvent *event) override
 
bool event (QEvent *event) override
 
bool eventFilter (QObject *obj, QEvent *event) override
 
void childEvent (QChildEvent *event) override
 
- Protected Member Functions inherited from GeometryStateDialog
void loadGeometry (int width=0, int height=0, const QString &dialog_name=QString())
 
void loadSplitterState (QSplitter *splitter=nullptr)
 

Detailed Description

Top-level dialog hosting the Lua debugger UI components.

Constructor & Destructor Documentation

◆ LuaDebuggerDialog()

LuaDebuggerDialog::LuaDebuggerDialog ( QWidget *  parent = nullptr)
explicit

Construct the dialog and initialize all child widgets.

Parameters
parentOptional parent widget used for ownership and stacking.

Member Function Documentation

◆ closeEvent()

void LuaDebuggerDialog::closeEvent ( QCloseEvent *  event)
overrideprotected

Flush state and resume execution when the dialog closes.

Parameters
eventClose request metadata from Qt.

◆ currentTheme()

int32_t LuaDebuggerDialog::currentTheme ( )
static

Get the current theme setting.

Returns
Theme enum value (WSLUA_DEBUGGER_THEME_AUTO, DARK, or LIGHT).

◆ handleMainCloseIfPaused()

bool LuaDebuggerDialog::handleMainCloseIfPaused ( QCloseEvent *  event)
static

If the debugger is paused or owns unsaved scripts, defer the supplied main-window close event so the Lua C stack can unwind first; otherwise return false and let the main window close normally.

Called from WiresharkMainWindow::closeEvent / StratosharkMainWindow::closeEvent through LuaDebugger::tryDeferMainWindowClose.

Returns
true if the close has been deferred (the caller MUST treat the event as ignored and return without closing); false to let the main window close normally.

◆ handlePause()

void LuaDebuggerDialog::handlePause ( const char *  file_path,
int64_t  line 
)

React to the debugger pausing execution at a breakpoint.

Parameters
file_pathPath of the Lua file that triggered the pause.
lineLine number where execution stopped.

◆ instance()

LuaDebuggerDialog * LuaDebuggerDialog::instance ( QWidget *  parent = nullptr)
static

Retrieve the singleton instance, creating it if needed.

Parameters
parentOptional parent widget supplied when instantiating.
Returns
Pointer to the global dialog instance.

The documentation for this class was generated from the following files: