# ldebug.c File Reference

`#include <stdarg.h>`
`#include <stddef.h>`
`#include <string.h>`
`#include "lua.h"`
`#include "lapi.h"`
`#include "lcode.h"`
`#include "ldebug.h"`
`#include "ldo.h"`
`#include "lfunc.h"`
`#include "lobject.h"`
`#include "lopcodes.h"`
`#include "lstate.h"`
`#include "lstring.h"`
`#include "ltable.h"`
`#include "ltm.h"`
`#include "lvm.h"`

## Defines
#define | ldebug_c
#define | LUA_CORE
#define | check(x) if (!(x)) return 0;
#define | checkjump(pt, pc) check(0 <= pc && pc < pt->sizecode)
#define | checkreg(pt, reg) check((reg) < (pt)->maxstacksize)
#define | checkopenop(pt, pc) luaG_checkopenop((pt)->code[(pc)+1])
## Functions
static const char * | getfuncname (lua_State *L, CallInfo *ci, const char **name)
static int | currentpc (lua_State *L, CallInfo *ci)
static int | currentline (lua_State *L, CallInfo *ci)
LUA_API int | lua_sethook (lua_State *L, lua_Hook func, int mask, int count)
LUA_API lua_Hook | lua_gethook (lua_State *L)
LUA_API int | lua_gethookmask (lua_State *L)
LUA_API int | lua_gethookcount (lua_State *L)
LUA_API int | lua_getstack (lua_State *L, int level, lua_Debug *ar)
static Proto * | getluaproto (CallInfo *ci)
static const char * | findlocal (lua_State *L, CallInfo *ci, int n)
LUA_API const char * | lua_getlocal (lua_State *L, const lua_Debug *ar, int n)
LUA_API const char * | lua_setlocal (lua_State *L, const lua_Debug *ar, int n)
static void | funcinfo (lua_Debug *ar, Closure *cl)
static void | info_tailcall (lua_Debug *ar)
static void | collectvalidlines (lua_State *L, Closure *f)
static int | auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)
LUA_API int | lua_getinfo (lua_State *L, const char *what, lua_Debug *ar)
static int | precheck (const Proto *pt)
int | luaG_checkopenop (Instruction i)
static int | checkArgMode (const Proto *pt, int r, enum OpArgMask mode)
static Instruction | symbexec (const Proto *pt, int lastpc, int reg)
int | luaG_checkcode (const Proto *pt)
static const char * | kname (Proto *p, int c)
static const char * | getobjname (lua_State *L, CallInfo *ci, int stackpos, const char **name)
static int | isinstack (CallInfo *ci, const TValue *o)
void | luaG_typeerror (lua_State *L, const TValue *o, const char *op)
void | luaG_concaterror (lua_State *L, StkId p1, StkId p2)
void | luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2)
int | luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2)
static void | addinfo (lua_State *L, const char *msg)
void | luaG_errormsg (lua_State *L)
void | luaG_runerror (lua_State *L, const char *fmt,...)

## Define Documentation

#define check | ( | x |  | ) | if (!(x)) return 0;

#define checkjump | ( | pt,
|  | pc |  | ) | check(0 <= pc && pc < pt->sizecode)

#define checkopenop | ( | pt,
|  | pc |  | ) | luaG_checkopenop((pt)->code[(pc)+1])

#define checkreg | ( | pt,
|  | reg |  | ) | check((reg) < (pt)->maxstacksize)

#define ldebug_c

#define LUA_CORE

## Function Documentation

static void addinfo | ( | lua_State * | L,
|  | const char * | msg |
| ) |  |  | `[static]`

static int auxgetinfo | ( | lua_State * | L,
|  | const char * | what,
|  | lua_Debug * | ar,
|  | Closure * | f,
|  | CallInfo * | ci |
| ) |  |  | `[static]`

static int checkArgMode | ( | const Proto * | pt,
|  | int | r,
|  | enum OpArgMask | mode |
| ) |  |  | `[static]`

static void collectvalidlines | ( | lua_State * | L,
|  | Closure * | f |
| ) |  |  | `[static]`

static int currentline | ( | lua_State * | L,
|  | CallInfo * | ci |
| ) |  |  | `[static]`

static int currentpc | ( | lua_State * | L,
|  | CallInfo * | ci |
| ) |  |  | `[static]`

static const char* findlocal | ( | lua_State * | L,
|  | CallInfo * | ci,
|  | int | n |
| ) |  |  | `[static]`

static void funcinfo | ( | lua_Debug * | ar,
|  | Closure * | cl |
| ) |  |  | `[static]`

static const char * getfuncname | ( | lua_State * | L,
|  | CallInfo * | ci,
|  | const char ** | name |
| ) |  |  | `[static]`

static Proto* getluaproto | ( | CallInfo * | ci | ) | `[static]`

static const char* getobjname | ( | lua_State * | L,
|  | CallInfo * | ci,
|  | int | stackpos,
|  | const char ** | name |
| ) |  |  | `[static]`

static void info_tailcall | ( | lua_Debug * | ar | ) | `[static]`

static int isinstack | ( | CallInfo * | ci,
|  | const TValue * | o |
| ) |  |  | `[static]`

static const char* kname | ( | Proto * | p,
|  | int | c |
| ) |  |  | `[static]`

LUA_API lua_Hook lua_gethook | ( | lua_State * | L | ) |

LUA_API int lua_gethookcount | ( | lua_State * | L | ) |

LUA_API int lua_gethookmask | ( | lua_State * | L | ) |

LUA_API int lua_getinfo | ( | lua_State * | L,
|  | const char * | what,
|  | lua_Debug * | ar |
| ) |  |  |

LUA_API const char* lua_getlocal | ( | lua_State * | L,
|  | const lua_Debug * | ar,
|  | int | n |
| ) |  |  |

LUA_API int lua_getstack | ( | lua_State * | L,
|  | int | level,
|  | lua_Debug * | ar |
| ) |  |  |

LUA_API int lua_sethook | ( | lua_State * | L,
|  | lua_Hook | func,
|  | int | mask,
|  | int | count |
| ) |  |  |

LUA_API const char* lua_setlocal | ( | lua_State * | L,
|  | const lua_Debug * | ar,
|  | int | n |
| ) |  |  |

void luaG_aritherror | ( | lua_State * | L,
|  | const TValue * | p1,
|  | const TValue * | p2 |
| ) |  |  |

int luaG_checkcode | ( | const Proto * | pt | ) |

int luaG_checkopenop | ( | Instruction | i | ) |

void luaG_concaterror | ( | lua_State * | L,
|  | StkId | p1,
|  | StkId | p2 |
| ) |  |  |

void luaG_errormsg | ( | lua_State * | L | ) |

int luaG_ordererror | ( | lua_State * | L,
|  | const TValue * | p1,
|  | const TValue * | p2 |
| ) |  |  |

void luaG_runerror | ( | lua_State * | L,
|  | const char * | fmt,
|  |  | ... |
| ) |  |  |

void luaG_typeerror | ( | lua_State * | L,
|  | const TValue * | o,
|  | const char * | op |
| ) |  |  |

static int precheck | ( | const Proto * | pt | ) | `[static]`

static Instruction symbexec | ( | const Proto * | pt,
|  | int | lastpc,
|  | int | reg |
| ) |  |  | `[static]`