lua-bc-0.1.0.2: Lua bytecode parser

Safe HaskellNone
LanguageHaskell2010

Language.Lua.Bytecode.Debug

Synopsis

Documentation

lookupLineNumber Source #

Arguments

:: Function 
-> Int

program counter

-> Maybe Int 

shallowLineNumberMap :: Function -> Map Int [Int] Source #

Given a function, compute a map from line numbers to op-codes in the function. This is useful for adding break-points identified by line number. Does not consider nested functions.

deepLineNumberMap :: Function -> Map Int [(FunId, [Int])] Source #

Given a function, compute a map from line numbers to op-codes in this function or a nested function. For each line number we return a list of pairs (typically just 1). The first element in the pair is the path to the nested function---empty if not nested---and the second one are the PC locations associated with that function.

lookupLocalName :: Function -> Int -> Reg -> Maybe ByteString Source #

Compute the locals at a specific program counter. This function is memoized, so it is fast to lookup things many times.

getRegistersAt Source #

Arguments

:: Function 
-> Int

PC

-> Vector VarInfo 

Get what registers are in scope at a particular op-code. R1 is at entry 0, R2 is entry 1, etc. NOTE that there might be multiple registers with the same named thing. The one currently in scope is the last one.

inferSubFunctionNames :: Function -> [(Int, ByteString)] Source #

Compute the names for the functions defined withing the given function. The Int is the index of the sub-function's prototype.

inferFunctionName :: Function -> Int -> Maybe ByteString Source #

Figure out a name for the function defined at the given program counter in a function. Note that this operation could be fairly expensive, so probably a good idea to cache the results.