Skip to content

Debug natives

IS4 edited this page Jul 12, 2023 · 4 revisions

debug_loaded

native bool:debug_loaded();

Returns true if the debug information is loaded for this script, false otherwise.

debug_get_ptr

native AmxDebug:debug_get_ptr();

Returns the debug information pointer that can be passed to other plugins that inspect debug symbols, or AmxDebug:0 if no debug information is loaded.

debug_code

native debug_code(level=0);

Returns the value of the CIP register at the call site specified by level. 0 corresponds to the current function, 1 to the function that called the current function etc.

debug_line

native debug_line(code=cellmin);

Returns the line number in the script where the instruction pointed to by code is located (returned from debug_code). If no value is specified, returns the current line.

debug_file

native debug_file(file[], code=cellmin, size=sizeof(file));
native String:debug_file_s(code=cellmin);

Returns the name of the file where the instruction pointed to by code is located (returned from debug_code). If no value is specified, returns the current file.

debug_num_symbols

native debug_num_symbols();

Returns the number of debug symbols defined in the script.

debug_symbol

native Symbol:debug_symbol(const name[], code=cellmin, symbol_kind:kind=symbol_kind:-1, symbol_class:class=symbol_class:-1);

Finds a symbol by its name, visible in scope of the code located at code, or INVALID_SYMBOL_ID if no symbol was found. The other parameters can be used to limit the number of possible symbols to certain types.

debug_func

native Symbol:debug_func(code=cellmin);

Returns the symbol representing the function located at code.

debug_var

native Symbol:debug_var(&AnyTag:var);

Returns the symbol representing the variable pointed to by var. Only variables in the data section, or on the stack of the AMX can be used.

debug_var_arr

native Symbol:debug_var_arr(AnyTag:var[]) = debug_var;

Returns the symbol representing the array variable pointed to by var. Only variables in the data section, or on the stack of the AMX can be used.

debug_symbol_kind

native symbol_kind:debug_symbol_kind(Symbol:symbol);

Returns the kind of a symbol, i.e. a variable, a variable reference, an array, an array reference, or a function.

debug_symbol_class

native symbol_class:debug_symbol_class(Symbol:symbol);

Returns the visibility class of a symbol, i.e. whether it is global, local, or static.

debug_symbol_tag

native debug_symbol_tag(Symbol:symbol);

Returns the tag id of a symbol.

debug_symbol_tag_uid

native tag_uid:debug_symbol_tag_uid(Symbol:symbol);

Returns the universal tag id of a symbol.

debug_symbol_func

native Symbol:debug_symbol_func(Symbol:symbol);

Returns the function that defines a symbol.

debug_symbol_name

native debug_symbol_name(Symbol:symbol, name[], size=sizeof(name));
native String:debug_symbol_name_s(Symbol:symbol);

Returns the name of a symbol.

debug_symbol_addr

native debug_symbol_addr(Symbol:symbol);

Returns the address where a symbol is defined (code for functions, data or stack local for variables).

debug_symbol_range

native debug_symbol_range(Symbol:symbol, &codestart, &codeend);

Returns the code range where a symbol is in scope.

debug_symbol_line

native debug_symbol_line(Symbol:symbol);

Returns the line where a symbol was defined.

debug_symbol_file

native debug_symbol_file(Symbol:symbol, file[], size=sizeof(file));
native String:debug_symbol_file_s(Symbol:symbol);

Returns the file where a symbol was defined.

debug_symbol_in_scope

native bool:debug_symbol_in_scope(Symbol:symbol, level=0);

Returns true if a symbol is visible at level, i.e. if it is in scope.

debug_symbol_rank

native debug_symbol_rank(Symbol:symbol);

Returns the rank/dimension of a symbol (0 for a single cell, 1 for a single-dimensional array etc.)

debug_symbol_size

native debug_symbol_size(Symbol:symbol, dimension=0);

Returns the size of an array symbol in a specific dimension.

debug_symbol_size_tag

native debug_symbol_size_tag(Symbol:symbol, dimension=0);

Returns the size tag id of an array symbol in a specific dimension.

debug_symbol_size_tag_uid

native tag_uid:debug_symbol_size_tag_uid(Symbol:symbol, dimension=0);

Returns the size universal tag id of an array symbol in a specific dimension.

debug_symbol_to_amx_var

native Var:debug_symbol_to_amx_var(Symbol:symbol, level=0);

Created a new AMX variable reference from the symbol at stack frame level level.

debug_symbol_get

native debug_symbol_get(Symbol:symbol, level=0, offset=0);
native debug_symbol_get_arr(Symbol:symbol, AnyTag:value[], level=0, offset=0, size=sizeof(value));
native Variant:debug_symbol_get_var(Symbol:symbol, level=0);
native bool:debug_symbol_get_safe(Symbol:symbol, &AnyTag:value, level=0, offset=0, tag_id=tagof(value));
native debug_symbol_get_arr_safe(Symbol:symbol, AnyTag:value[], level=0, offset=0, size=sizeof(value), tag_id=tagof(value));

Returns the value of a symbol at stack frame level level.

debug_symbol_set

native debug_symbol_set(Symbol:symbol, AnyTag:value, level=0, offset=0);
native bool:debug_symbol_set_safe(Symbol:symbol, AnyTag:value, level=0, offset=0, tag_id=tagof(value));
native debug_symbol_set_arr(Symbol:symbol, const AnyTag:values[], level=0, offset=0, size=sizeof(values));
native debug_symbol_set_arr_safe(Symbol:symbol, const AnyTag:values[], level=0, offset=0, size=sizeof(values), tag_id=tagof(values));

Sets the value of a symbol at stack frame level level.

debug_symbol_call

native debug_symbol_call(Symbol:symbol, AnyTag:...);
native debug_symbol_indirect_call(Symbol:symbol, AnyTag:...);

Calls a function symbol. The first native performs a direct call (i.e. without creating a new context), the second an indirect call.

debug_symbol_call_list

native debug_symbol_call_list(Symbol:symbol, List:args);
native debug_symbol_indirect_call_list(Symbol:symbol, List:args);

Calls a function symbol, passing the arguments in a list.

debug_symbol_try_call

native amx_err:debug_symbol_try_call(Symbol:symbol, &result, AnyTag:...);

Calls a function symbol, suppressing errors and returning an error code.

debug_symbol_try_call_list

native amx_err:debug_symbol_try_call_list(Symbol:symbol, &result, List:args);

Calls a function symbol, passing the arguments in a list, suppressing errors and returning an error code.

debug_symbol_variables

native Iter:debug_symbol_variables(Symbol:symbol);

Creates an iterator that contains all variables defined by a function symbol.

Clone this wiki locally