Module src/gnome/debug.c

Functions

local _dump_item (L, level, name) Dump a Lua value, possibly recurse.
local _dump_stack (L, everything) Display the contents of the Lua stack.
local _dump_struct_1 (L, ts, obj, indent, follow_ptr) Dump all elements of a structure.
local _function_sig_for_closure (closure, align) Get the function signature for a closure that has been created for a library function.
local _set_debug_flags (L, new_flags) Apply the debug flags.
local dump_stack (everything) Run a stack dump from the current stack frame.
local function_sig (module, name, align) Get the function signature, similar to a C declaration.
function_signature (L, fi, align) Returns the function's signature as string.
local get_refcount (object) Return the reference counter of the object the given variable points to.
local l_dump_memory (L) walk through all reachable memory objects.
local l_dump_struct (a) Display a structure for debugging purposes.
lg_breakfunc (L) While debugging you can add a call to this function anywhere in the C code, then run it with the debugger (e.g. gdb) and set a breakpoint here.
lg_call_trace (L, fi, index) Display the current Gtk call on stderr; this is used either to trace all calls or to show where an error/warning happened.
lg_debug_flags_global (L) Certain debug flags have to be set before initializing GLib; if you set the global variable "gnome_debug_flags" before loading the core library, these flags can be set after all.
lg_object_tostring (L) Called for a structure, return a printable representation.
local set_debug_flags (flags...) Set runtime flags (for debugging).


Functions

local _dump_item (L, level, name)
Dump a Lua value, possibly recurse. It doesn't show simple values (nil, string, number), but tables (with their key/value pairs), environment and metatables. Lua Stack: [1] function tostring [2] seen table (key=object, value=true) ... [-1] object to dump

Parameters

  • L:
  • level: Indentation
  • name: Name of this item
In file: src/gnome/debug.c line 448
local _dump_stack (L, everything)
Display the contents of the Lua stack. If a parameter is given, and is non-zero, then start at the absolute stack base; else dump only the stack frame of the current function. Note that the standard Lua function debug.traceback() also traverses the Lua stack, but only shows function calls, whereas this function shows all values on the stack. It is useful to find stack related bugs.

Parameters

  • L:
  • everything:
In file: src/gnome/debug.c line 39
local _dump_struct_1 (L, ts, obj, indent, follow_ptr)
Dump all elements of a structure. Recurse into substructures and optionally also follow pointers.

Parameters

  • L: Lua State
  • ts: Typespec for the object at "obj"
  • obj: Pointer to the first byte of the object to show
  • indent: Level of indentation
  • follow_ptr: true if to follow pointers
In file: src/gnome/debug.c line 319
local _function_sig_for_closure (closure, align)
Get the function signature for a closure that has been created for a library function. This is easier to use than the module/functionname method.

Parameters

  • closure: The closure representing a library function
  • align: (optional) Minimum width of return value type

Return values:

  1. A string with the function signature.
In file: src/gnome/debug.c line 220
local _set_debug_flags (L, new_flags)
Apply the debug flags. A few of them require interaction with GLib, others are internal to LuaGnome, like "trace".

Parameters

  • L: Lua State
  • new_flags: A bitmask of the flags to set
In file: src/gnome/debug.c line 725
local dump_stack (everything)
Run a stack dump from the current stack frame.

Parameters

  • everything: If true is given, dump the complete Lua stack, else only the current function's stack.
In file: src/gnome/debug.c line 100
local function_sig (module, name, align)
Get the function signature, similar to a C declaration. No closure needs to be allocated for the function in order for this to work.

Parameters

  • module: The module the function is in (a table)
  • name: The function name
  • align: (optional) Minimum width of the return value

Return values:

  1. A string with the function signature.
In file: src/gnome/debug.c line 236
function_signature (L, fi, align)
Returns the function's signature as string. Can be accessed from Lua by calling gnome.function_sig(fname).

Parameters

  • L:
  • fi: Pointer to a function info struct as filled in by #lg_find_func.
  • align: Pad return type to this length

Return value:

A string on the Lua stack; 1 from the C function. In file: src/gnome/debug.c line 155
local get_refcount (object)
Return the reference counter of the object the given variable points to. Returns NIL if the object has no reference counting.

Parameters

  • object: The object to query

Return values:

  1. The current reference counter
  2. Widget type name
In file: src/gnome/debug.c line 615
local l_dump_memory (L)
walk through all reachable memory objects. Starting points: - the global table - the registry

Parameters

  • L:
In file: src/gnome/debug.c line 577
local l_dump_struct (a)
Display a structure for debugging purposes.

Parameters

  • a: structure, i.e. an object represented by a userdata.
In file: src/gnome/debug.c line 400
lg_breakfunc (L)
While debugging you can add a call to this function anywhere in the C code, then run it with the debugger (e.g. gdb) and set a breakpoint here. Or you could call it from Lua like this: gtk.breakfunc().

Parameters

  • L:
In file: src/gnome/debug.c line 26
lg_call_trace (L, fi, index)
Display the current Gtk call on stderr; this is used either to trace all calls or to show where an error/warning happened. Outputs the current Lua source position, return value, function name and all parameter types. NOTE: this is required even when debugging is off (--disable-debug) because warning and error messages still have to be displayed.

Parameters

  • L: Lua State
  • fi: Pointer to the function information structure
  • index: Lua stack position of function's first argument (currently unused)
In file: src/gnome/debug.c line 285
lg_debug_flags_global (L)
Certain debug flags have to be set before initializing GLib; if you set the global variable "gnome_debug_flags" before loading the core library, these flags can be set after all.

Parameters

  • L:
In file: src/gnome/debug.c line 809
lg_object_tostring (L)
Called for a structure, return a printable representation. This is the default routine if no specialized tostring exists (e.g., for GValue). stack: object

Parameters

  • L:
In file: src/gnome/debug.c line 116
local set_debug_flags (flags...)
Set runtime flags (for debugging). The currently defined debug flags are: trace Show a trace of function calls return Warn about returned pointers that couldn't be used memory Show memory debuggin info (new objects, garbage collection) gmem At exit, show the GMem profile valgrind Do something to make valgrind run better (see source)

Parameters

  • flags...: Debugging flags (zero or more may be given)
In file: src/gnome/debug.c line 771

Valid XHTML 1.0!