mirror of
https://github.com/wader/fq.git
synced 2024-12-26 06:51:35 +03:00
luajit: initial support
This commit is contained in:
parent
6ec4def24b
commit
1afdf8b1cf
@ -106,6 +106,7 @@ ipv6_packet Internet protocol v6 packet
|
||||
jpeg Joint Photographic Experts Group file
|
||||
json JavaScript Object Notation
|
||||
jsonl JavaScript Object Notation Lines
|
||||
luajit LuaJIT 2.0 bytecode dump
|
||||
macho Mach-O macOS executable
|
||||
macho_fat Fat Mach-O macOS executable (multi-architecture)
|
||||
markdown Markdown
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
_ "github.com/wader/fq/format/inet"
|
||||
_ "github.com/wader/fq/format/jpeg"
|
||||
_ "github.com/wader/fq/format/json"
|
||||
_ "github.com/wader/fq/format/luajit"
|
||||
_ "github.com/wader/fq/format/markdown"
|
||||
_ "github.com/wader/fq/format/math"
|
||||
_ "github.com/wader/fq/format/matroska"
|
||||
|
@ -123,6 +123,7 @@ var (
|
||||
JPEG = &decode.Group{Name: "jpeg"}
|
||||
JSON = &decode.Group{Name: "json"}
|
||||
JSONL = &decode.Group{Name: "jsonl"}
|
||||
LuaJIT = &decode.Group{Name: "luajit"}
|
||||
MachO = &decode.Group{Name: "macho"}
|
||||
MachO_Fat = &decode.Group{Name: "macho_fat"}
|
||||
Markdown = &decode.Group{Name: "markdown"}
|
||||
|
355
format/luajit/luajit.go
Normal file
355
format/luajit/luajit.go
Normal file
@ -0,0 +1,355 @@
|
||||
package luajit
|
||||
|
||||
// dump = header proto+ 0U
|
||||
// header = ESC 'L' 'J' versionB flagsU [namelenU nameB*]
|
||||
// proto = lengthU pdata
|
||||
// pdata = phead bcinsW* uvdataH* kgc* knum* [debugB*]
|
||||
// phead = flagsB numparamsB framesizeB numuvB numkgcU numknU numbcU
|
||||
// [debuglenU [firstlineU numlineU]]
|
||||
// kgc = kgctypeU { ktab | (loU hiU) | (rloU rhiU iloU ihiU) | strB* }
|
||||
// knum = intU0 | (loU1 hiU)
|
||||
// ktab = narrayU nhashU karray* khash*
|
||||
// karray = ktabk
|
||||
// khash = ktabk ktabk
|
||||
// ktabk = ktabtypeU { intU | (loU hiU) | strB* }
|
||||
//
|
||||
// B = 8 bit, H = 16 bit, W = 32 bit, U = ULEB128 of W, U0/U1 = ULEB128 of W+1
|
||||
|
||||
// see:
|
||||
//
|
||||
// * http://scm.zoomquiet.top/data/20131216145900/index.html
|
||||
// * https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_bcdump.h
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
"golang.org/x/text/encoding"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.LuaJIT,
|
||||
&decode.Format{
|
||||
Description: "LuaJIT 2.0 bytecode dump",
|
||||
DecodeFn: LuaJITDecode,
|
||||
})
|
||||
}
|
||||
|
||||
// reinterpret an int as a float
|
||||
func u64tof64(u uint64) float64 {
|
||||
var buf [8]byte
|
||||
|
||||
binary.BigEndian.PutUint64(buf[:], u)
|
||||
|
||||
var f float64
|
||||
binary.Read(bytes.NewBuffer(buf[:]), binary.BigEndian, &f)
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
type DumpInfo struct {
|
||||
Strip bool
|
||||
BigEndian bool
|
||||
}
|
||||
|
||||
func LuaJITDecodeHeader(di *DumpInfo, d *decode.D) {
|
||||
magic := d.FieldStr("magic", 3, encoding.Nop)
|
||||
|
||||
ok := bytes.Equal([]byte(magic), []byte{0x1b, 0x4c, 0x4a})
|
||||
if !ok {
|
||||
d.Errorf("invalid magic number")
|
||||
}
|
||||
|
||||
d.FieldU8("version")
|
||||
|
||||
var flags uint64
|
||||
d.FieldStruct("flags", func(d *decode.D) {
|
||||
flags = d.FieldULEB128("raw")
|
||||
|
||||
d.FieldValueBool("BE", flags&0x01 > 0)
|
||||
d.FieldValueBool("STRIP", flags&0x02 > 0)
|
||||
d.FieldValueBool("FFI", flags&0x04 > 0)
|
||||
d.FieldValueBool("FR2", flags&0x08 > 0)
|
||||
})
|
||||
|
||||
di.Strip = flags&0x2 > 0
|
||||
di.BigEndian = flags&0x1 > 0
|
||||
|
||||
if !di.Strip {
|
||||
namelen := d.FieldU8("namelen")
|
||||
d.FieldStr("name", int(namelen), encoding.Nop)
|
||||
}
|
||||
}
|
||||
|
||||
type jumpBias struct{}
|
||||
func (j *jumpBias) MapUint(u scalar.Uint) (scalar.Uint, error) {
|
||||
u.Actual -= 0x8000
|
||||
return u, nil
|
||||
}
|
||||
|
||||
func LuaJITDecodeBCIns(d *decode.D) {
|
||||
op := d.FieldU8("op", bcOpSyms)
|
||||
|
||||
d.FieldU8("a")
|
||||
|
||||
if opcodes[int(op)].HasD() {
|
||||
if opcodes[int(op)].IsJump() {
|
||||
d.FieldU16("j", &jumpBias{})
|
||||
} else {
|
||||
d.FieldU16("d")
|
||||
}
|
||||
} else {
|
||||
d.FieldU8("c")
|
||||
d.FieldU8("b")
|
||||
}
|
||||
}
|
||||
|
||||
type ktabType struct{}
|
||||
func (t *ktabType) MapUint(u scalar.Uint) (scalar.Uint, error) {
|
||||
switch u.Actual {
|
||||
case 0:
|
||||
u.Sym = "nil"
|
||||
case 1:
|
||||
u.Sym = "false"
|
||||
case 2:
|
||||
u.Sym = "true"
|
||||
case 3:
|
||||
u.Sym = "int"
|
||||
case 4:
|
||||
u.Sym = "num"
|
||||
default:
|
||||
u.Sym = "str"
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
|
||||
func LuaJITDecodeKTabK(d *decode.D) {
|
||||
ktabtype := d.FieldULEB128("ktabtype", &ktabType{})
|
||||
|
||||
if ktabtype >= 5 {
|
||||
sz := ktabtype - 5
|
||||
d.FieldStr("str", int(sz), encoding.Nop)
|
||||
} else {
|
||||
switch ktabtype {
|
||||
case 3:
|
||||
d.FieldULEB128("int")
|
||||
|
||||
case 4:
|
||||
d.FieldAnyFn("num", func(d *decode.D) any {
|
||||
lo := d.ULEB128()
|
||||
hi := d.ULEB128()
|
||||
return u64tof64((hi << 32) + lo)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func LuaJITDecodeCplx(d *decode.D) any {
|
||||
lo := d.ULEB128()
|
||||
if lo&1 == 0 {
|
||||
return lo >> 1
|
||||
} else {
|
||||
hi := d.ULEB128()
|
||||
return u64tof64((hi << 32) + (lo >> 1))
|
||||
}
|
||||
}
|
||||
|
||||
type kgcType struct{}
|
||||
func (t *kgcType) MapUint(u scalar.Uint) (scalar.Uint, error) {
|
||||
switch u.Actual {
|
||||
case 0:
|
||||
u.Sym = "child"
|
||||
case 1:
|
||||
u.Sym = "tab"
|
||||
case 2:
|
||||
u.Sym = "i64"
|
||||
case 3:
|
||||
u.Sym = "u64"
|
||||
case 4:
|
||||
u.Sym = "complex"
|
||||
default:
|
||||
u.Sym = "str"
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
func LuaJITDecodeKGC(d *decode.D) {
|
||||
kgctype := d.FieldULEB128("type", &kgcType{})
|
||||
|
||||
if kgctype >= 5 {
|
||||
sz := kgctype - 5
|
||||
d.FieldStr("str", int(sz), encoding.Nop)
|
||||
} else {
|
||||
switch kgctype {
|
||||
case 0:
|
||||
//child
|
||||
|
||||
case 1:
|
||||
// tab
|
||||
narray := d.FieldULEB128("narray")
|
||||
nhash := d.FieldULEB128("nhash")
|
||||
|
||||
d.FieldArray("karray", func(d *decode.D) {
|
||||
for i := uint64(0); i < narray; i++ {
|
||||
d.FieldStruct("ktab", LuaJITDecodeKTabK)
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("khash", func(d *decode.D) {
|
||||
for i := uint64(0); i < nhash; i++ {
|
||||
d.FieldStruct("khash", func(d *decode.D) {
|
||||
d.FieldStruct("k", LuaJITDecodeKTabK)
|
||||
d.FieldStruct("v", LuaJITDecodeKTabK)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
case 2:
|
||||
d.FieldAnyFn("i64", func (d *decode.D) any {
|
||||
lo := d.ULEB128()
|
||||
hi := d.ULEB128()
|
||||
return int64((hi << 32) + lo)
|
||||
})
|
||||
|
||||
case 3:
|
||||
d.FieldAnyFn("u64", func (d *decode.D) any {
|
||||
lo := d.ULEB128()
|
||||
hi := d.ULEB128()
|
||||
return (hi << 32) + lo
|
||||
})
|
||||
|
||||
case 4:
|
||||
// complex
|
||||
|
||||
d.FieldAnyFn("real", func (d *decode.D) any {
|
||||
rlo := d.ULEB128()
|
||||
rhi := d.ULEB128()
|
||||
r := (rhi << 32) + rlo
|
||||
return u64tof64(r)
|
||||
})
|
||||
|
||||
d.FieldAnyFn("imag", func (d *decode.D) any {
|
||||
ilo := d.ULEB128()
|
||||
ihi := d.ULEB128()
|
||||
i := (ihi << 32) + ilo
|
||||
return u64tof64(i)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func LuaJITDecodeKNum(d *decode.D) any {
|
||||
lo := d.ULEB128()
|
||||
if lo&1 == 0 {
|
||||
return lo >> 1
|
||||
} else {
|
||||
hi := d.ULEB128()
|
||||
return u64tof64((hi << 32) + (lo >> 1))
|
||||
}
|
||||
}
|
||||
|
||||
func LuaJITDecodeProto(di *DumpInfo, d *decode.D) {
|
||||
length := d.FieldULEB128("length")
|
||||
|
||||
d.LimitedFn(8*int64(length), func(d *decode.D) {
|
||||
d.FieldStruct("pdata", func(d *decode.D) {
|
||||
var numuv uint64
|
||||
var numkgc uint64
|
||||
var numkn uint64
|
||||
var numbc uint64
|
||||
var debuglen uint64
|
||||
|
||||
d.FieldStruct("phead", func(d *decode.D) {
|
||||
d.FieldU8("flags")
|
||||
d.FieldU8("numparams")
|
||||
d.FieldU8("framesize")
|
||||
numuv = d.FieldU8("numuv")
|
||||
numkgc = d.FieldULEB128("numkgc")
|
||||
numkn = d.FieldULEB128("numkn")
|
||||
numbc = d.FieldULEB128("numbc")
|
||||
|
||||
debuglen = 0
|
||||
if !di.Strip {
|
||||
debuglen = d.FieldULEB128("debuglen")
|
||||
if debuglen > 0 {
|
||||
d.FieldULEB128("firstline")
|
||||
d.FieldULEB128("numline")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("bcins", func(d *decode.D) {
|
||||
for i := uint64(0); i < numbc; i++ {
|
||||
d.FieldStruct("ins", func(d *decode.D) {
|
||||
LuaJITDecodeBCIns(d)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("uvdata", func(d *decode.D) {
|
||||
for i := uint64(0); i < numuv; i++ {
|
||||
d.FieldU16("uv")
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("kgc", func(d *decode.D) {
|
||||
for i := uint64(0); i < numkgc; i++ {
|
||||
d.FieldStruct("kgc", LuaJITDecodeKGC)
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("knum", func(d *decode.D) {
|
||||
for i := uint64(0); i < numkn; i++ {
|
||||
d.FieldAnyFn("knum", LuaJITDecodeKNum)
|
||||
}
|
||||
})
|
||||
|
||||
if !di.Strip {
|
||||
d.FieldArray("debug", func(d *decode.D) {
|
||||
for i := uint64(0); i < debuglen; i++ {
|
||||
d.FieldU8("db")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func LuaJITDecode(d *decode.D) any {
|
||||
di := DumpInfo{}
|
||||
|
||||
d.FieldStruct("header", func(d *decode.D) {
|
||||
LuaJITDecodeHeader(&di, d)
|
||||
})
|
||||
|
||||
if di.BigEndian {
|
||||
d.Endian = decode.BigEndian
|
||||
} else {
|
||||
d.Endian = decode.LittleEndian
|
||||
}
|
||||
|
||||
d.FieldArray("proto", func(d *decode.D) {
|
||||
for {
|
||||
nextByte := d.PeekBytes(1)
|
||||
if bytes.Equal(nextByte, []byte{0}) {
|
||||
break
|
||||
}
|
||||
|
||||
d.FieldStruct("proto", func(d *decode.D) {
|
||||
LuaJITDecodeProto(&di, d)
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
d.FieldU8("end")
|
||||
|
||||
return nil
|
||||
}
|
175
format/luajit/opcodes.go
Normal file
175
format/luajit/opcodes.go
Normal file
@ -0,0 +1,175 @@
|
||||
package luajit
|
||||
|
||||
import (
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
type BcDef struct {
|
||||
Name string
|
||||
MA int
|
||||
MB int
|
||||
MC int
|
||||
}
|
||||
|
||||
const (
|
||||
BcMnone = iota
|
||||
BcMdst
|
||||
BcMbase
|
||||
BcMvar
|
||||
BcMrbase
|
||||
BcMuv
|
||||
BcMlit
|
||||
BcMlits
|
||||
BcMpri
|
||||
BcMnum
|
||||
BcMstr
|
||||
BcMtab
|
||||
BcMfunc
|
||||
BcMjump
|
||||
BcMcdata
|
||||
)
|
||||
|
||||
var opcodes = []BcDef{
|
||||
{"ISLT", BcMvar, BcMnone, BcMvar},
|
||||
{"ISGE", BcMvar, BcMnone, BcMvar},
|
||||
{"ISLE", BcMvar, BcMnone, BcMvar},
|
||||
{"ISGT", BcMvar, BcMnone, BcMvar},
|
||||
|
||||
{"ISEQV", BcMvar, BcMnone, BcMvar},
|
||||
{"ISNEV", BcMvar, BcMnone, BcMvar},
|
||||
{"ISEQS", BcMvar, BcMnone, BcMstr},
|
||||
{"ISNES", BcMvar, BcMnone, BcMstr},
|
||||
{"ISEQN", BcMvar, BcMnone, BcMnum},
|
||||
{"ISNEN", BcMvar, BcMnone, BcMnum},
|
||||
{"ISEQP", BcMvar, BcMnone, BcMpri},
|
||||
{"ISNEP", BcMvar, BcMnone, BcMpri},
|
||||
|
||||
// Unary test and copy ops.
|
||||
{"ISTC", BcMdst, BcMnone, BcMvar},
|
||||
{"ISFC", BcMdst, BcMnone, BcMvar},
|
||||
{"IST", BcMnone, BcMnone, BcMvar},
|
||||
{"ISF", BcMnone, BcMnone, BcMvar},
|
||||
{"ISTYPE", BcMvar, BcMnone, BcMlit},
|
||||
{"ISNUM", BcMvar, BcMnone, BcMlit},
|
||||
|
||||
// Unary ops.
|
||||
{"MOV", BcMdst, BcMnone, BcMvar},
|
||||
{"NOT", BcMdst, BcMnone, BcMvar},
|
||||
{"UNM", BcMdst, BcMnone, BcMvar},
|
||||
{"LEN", BcMdst, BcMnone, BcMvar},
|
||||
|
||||
// Binary ops. ORDER OPR. VV last, POW must be next.
|
||||
{"ADDVN", BcMdst, BcMvar, BcMnum},
|
||||
{"SUBVN", BcMdst, BcMvar, BcMnum},
|
||||
{"MULVN", BcMdst, BcMvar, BcMnum},
|
||||
{"DIVVN", BcMdst, BcMvar, BcMnum},
|
||||
{"MODVN", BcMdst, BcMvar, BcMnum},
|
||||
|
||||
{"ADDNV", BcMdst, BcMvar, BcMnum},
|
||||
{"SUBNV", BcMdst, BcMvar, BcMnum},
|
||||
{"MULNV", BcMdst, BcMvar, BcMnum},
|
||||
{"DIVNV", BcMdst, BcMvar, BcMnum},
|
||||
{"MODNV", BcMdst, BcMvar, BcMnum},
|
||||
|
||||
{"ADDVV", BcMdst, BcMvar, BcMvar},
|
||||
{"SUBVV", BcMdst, BcMvar, BcMvar},
|
||||
{"MULVV", BcMdst, BcMvar, BcMvar},
|
||||
{"DIVVV", BcMdst, BcMvar, BcMvar},
|
||||
{"MODVV", BcMdst, BcMvar, BcMvar},
|
||||
|
||||
{"POW", BcMdst, BcMvar, BcMvar},
|
||||
{"CAT", BcMdst, BcMrbase, BcMrbase},
|
||||
|
||||
// Constant ops.
|
||||
{"KSTR", BcMdst, BcMnone, BcMstr},
|
||||
{"KCDATA", BcMdst, BcMnone, BcMcdata},
|
||||
{"KSHORT", BcMdst, BcMnone, BcMlits},
|
||||
{"KNUM", BcMdst, BcMnone, BcMnum},
|
||||
{"KPRI", BcMdst, BcMnone, BcMpri},
|
||||
{"KNIL", BcMbase, BcMnone, BcMbase},
|
||||
|
||||
// Upvalue and function ops.
|
||||
{"UGET", BcMdst, BcMnone, BcMuv},
|
||||
{"USETV", BcMuv, BcMnone, BcMvar},
|
||||
{"USETS", BcMuv, BcMnone, BcMstr},
|
||||
{"USETN", BcMuv, BcMnone, BcMnum},
|
||||
{"USETP", BcMuv, BcMnone, BcMpri},
|
||||
{"UCLO", BcMrbase, BcMnone, BcMjump},
|
||||
{"FNEW", BcMdst, BcMnone, BcMfunc},
|
||||
|
||||
// Table ops.
|
||||
{"TNEW", BcMdst, BcMnone, BcMlit},
|
||||
{"TDUP", BcMdst, BcMnone, BcMtab},
|
||||
{"GGET", BcMdst, BcMnone, BcMstr},
|
||||
{"GSET", BcMvar, BcMnone, BcMstr},
|
||||
{"TGETV", BcMdst, BcMvar, BcMvar},
|
||||
{"TGETS", BcMdst, BcMvar, BcMstr},
|
||||
{"TGETB", BcMdst, BcMvar, BcMlit},
|
||||
{"TGETR", BcMdst, BcMvar, BcMvar},
|
||||
{"TSETV", BcMvar, BcMvar, BcMvar},
|
||||
{"TSETS", BcMvar, BcMvar, BcMstr},
|
||||
{"TSETB", BcMvar, BcMvar, BcMlit},
|
||||
{"TSETM", BcMbase, BcMnone, BcMnum},
|
||||
{"TSETR", BcMvar, BcMvar, BcMvar},
|
||||
|
||||
// Calls and vararg handling. T = tail call.
|
||||
{"CALLM", BcMbase, BcMlit, BcMlit},
|
||||
{"CALL", BcMbase, BcMlit, BcMlit},
|
||||
{"CALLMT", BcMbase, BcMnone, BcMlit},
|
||||
{"CALLT", BcMbase, BcMnone, BcMlit},
|
||||
{"ITERC", BcMbase, BcMlit, BcMlit},
|
||||
{"ITERN", BcMbase, BcMlit, BcMlit},
|
||||
{"VARG", BcMbase, BcMlit, BcMlit},
|
||||
{"ISNEXT", BcMbase, BcMnone, BcMjump},
|
||||
|
||||
// Returns.
|
||||
{"RETM", BcMbase, BcMnone, BcMlit},
|
||||
{"RET", BcMrbase, BcMnone, BcMlit},
|
||||
{"RET0", BcMrbase, BcMnone, BcMlit},
|
||||
{"RET1", BcMrbase, BcMnone, BcMlit},
|
||||
|
||||
// Loops and branches. I/J = interp/JIT, I/C/L = init/call/loop.
|
||||
{"FORI", BcMbase, BcMnone, BcMjump},
|
||||
{"JFORI", BcMbase, BcMnone, BcMjump},
|
||||
|
||||
{"FORL", BcMbase, BcMnone, BcMjump},
|
||||
{"IFORL", BcMbase, BcMnone, BcMjump},
|
||||
{"JFORL", BcMbase, BcMnone, BcMlit},
|
||||
|
||||
{"ITERL", BcMbase, BcMnone, BcMjump},
|
||||
{"IITERL", BcMbase, BcMnone, BcMjump},
|
||||
{"JITERL", BcMbase, BcMnone, BcMlit},
|
||||
|
||||
{"LOOP", BcMrbase, BcMnone, BcMjump},
|
||||
{"ILOOP", BcMrbase, BcMnone, BcMjump},
|
||||
{"JLOOP", BcMrbase, BcMnone, BcMlit},
|
||||
|
||||
{"JMP", BcMrbase, BcMnone, BcMjump},
|
||||
|
||||
// Function headers. I/J = interp/JIT, F/V/C = fixarg/vararg/C func.
|
||||
{"FUNCF", BcMrbase, BcMnone, BcMnone},
|
||||
{"IFUNCF", BcMrbase, BcMnone, BcMnone},
|
||||
{"JFUNCF", BcMrbase, BcMnone, BcMlit},
|
||||
{"FUNCV", BcMrbase, BcMnone, BcMnone},
|
||||
{"IFUNCV", BcMrbase, BcMnone, BcMnone},
|
||||
{"JFUNCV", BcMrbase, BcMnone, BcMlit},
|
||||
{"FUNCC", BcMrbase, BcMnone, BcMnone},
|
||||
{"FUNCCW", BcMrbase, BcMnone, BcMnone},
|
||||
}
|
||||
|
||||
func (op *BcDef) HasD() bool {
|
||||
return op.MB == BcMnone
|
||||
}
|
||||
|
||||
func (op *BcDef) IsJump() bool {
|
||||
return op.MC == BcMjump
|
||||
}
|
||||
|
||||
var bcOpSyms = scalar.UintMapSymStr{}
|
||||
|
||||
func init() {
|
||||
for i := 0; i < len(opcodes); i++ {
|
||||
bcOpSyms[uint64(i)] = opcodes[i].Name
|
||||
}
|
||||
}
|
||||
|
24
format/luajit/testdata/example.lua
vendored
Normal file
24
format/luajit/testdata/example.lua
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
local sometable = {
|
||||
somenil= nil,
|
||||
sometrue= true,
|
||||
somefalse= false,
|
||||
someint= -3,
|
||||
somenum= 7.89437298e11,
|
||||
somestr= "it's a trap",
|
||||
}
|
||||
|
||||
mycplx = 3.2i
|
||||
|
||||
mytbl = sometable
|
||||
|
||||
-- f1's upvalue
|
||||
local a = 123
|
||||
local b = 666
|
||||
|
||||
local f1 = function(x)
|
||||
local c = a + b
|
||||
return x * c * 2973289 + 38793457897
|
||||
end
|
||||
|
||||
myfunc = f1
|
||||
myfunc_result = f1(42)
|
274
format/luajit/testdata/simple.fqtest
vendored
Normal file
274
format/luajit/testdata/simple.fqtest
vendored
Normal file
@ -0,0 +1,274 @@
|
||||
$ fq dv -d luajit simple.luac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: simple.luac (luajit) 0x0-0x14e.7 (335)
|
||||
| | | header{}: 0x0-0x17.7 (24)
|
||||
0x000|1b 4c 4a |.LJ | magic: "\x1bLJ" 0x0-0x2.7 (3)
|
||||
0x000| 02 | . | version: 2 0x3-0x3.7 (1)
|
||||
| | | flags{}: 0x4-0x4.7 (1)
|
||||
0x000| 0c | . | raw: 12 0x4-0x4.7 (1)
|
||||
| | | BE: false 0x5-NA (0)
|
||||
| | | STRIP: false 0x5-NA (0)
|
||||
| | | FFI: true 0x5-NA (0)
|
||||
| | | FR2: true 0x5-NA (0)
|
||||
0x000| 12 | . | namelen: 18 0x5-0x5.7 (1)
|
||||
0x000| 40 2e 2e 2f 2e 2e 2f 65 78 61| @../../exa| name: "@../../example.lua" 0x6-0x17.7 (18)
|
||||
0x010|6d 70 6c 65 2e 6c 75 61 |mple.lua |
|
||||
| | | proto[0:2]: 0x18-0x14d.7 (310)
|
||||
| | | [0]{}: proto 0x18-0x64.7 (77)
|
||||
0x010| 4c | L | length: 76 0x18-0x18.7 (1)
|
||||
| | | pdata{}: 0x19-0x64.7 (76)
|
||||
| | | phead{}: 0x19-0x22.7 (10)
|
||||
0x010| 00 | . | flags: 0 0x19-0x19.7 (1)
|
||||
0x010| 01 | . | numparams: 1 0x1a-0x1a.7 (1)
|
||||
0x010| 03 | . | framesize: 3 0x1b-0x1b.7 (1)
|
||||
0x010| 02 | . | numuv: 2 0x1c-0x1c.7 (1)
|
||||
0x010| 00 | . | numkgc: 0 0x1d-0x1d.7 (1)
|
||||
0x010| 02 | . | numkn: 2 0x1e-0x1e.7 (1)
|
||||
0x010| 07| .| numbc: 7 0x1f-0x1f.7 (1)
|
||||
0x020|14 |. | debuglen: 20 0x20-0x20.7 (1)
|
||||
0x020| 12 | . | firstline: 18 0x21-0x21.7 (1)
|
||||
0x020| 03 | . | numline: 3 0x22-0x22.7 (1)
|
||||
| | | bcins[0:7]: 0x23-0x3e.7 (28)
|
||||
| | | [0]{}: ins 0x23-0x26.7 (4)
|
||||
0x020| 2d | - | op: "UGET" (45) 0x23-0x23.7 (1)
|
||||
0x020| 01 | . | a: 1 0x24-0x24.7 (1)
|
||||
0x020| 00 00 | .. | d: 0 0x25-0x26.7 (2)
|
||||
| | | [1]{}: ins 0x27-0x2a.7 (4)
|
||||
0x020| 2d | - | op: "UGET" (45) 0x27-0x27.7 (1)
|
||||
0x020| 02 | . | a: 2 0x28-0x28.7 (1)
|
||||
0x020| 01 00 | .. | d: 1 0x29-0x2a.7 (2)
|
||||
| | | [2]{}: ins 0x2b-0x2e.7 (4)
|
||||
0x020| 20 | | op: "ADDVV" (32) 0x2b-0x2b.7 (1)
|
||||
0x020| 01 | . | a: 1 0x2c-0x2c.7 (1)
|
||||
0x020| 02 | . | c: 2 0x2d-0x2d.7 (1)
|
||||
0x020| 01 | . | b: 1 0x2e-0x2e.7 (1)
|
||||
| | | [3]{}: ins 0x2f-0x32.7 (4)
|
||||
0x020| 22| "| op: "MULVV" (34) 0x2f-0x2f.7 (1)
|
||||
0x030|02 |. | a: 2 0x30-0x30.7 (1)
|
||||
0x030| 01 | . | c: 1 0x31-0x31.7 (1)
|
||||
0x030| 00 | . | b: 0 0x32-0x32.7 (1)
|
||||
| | | [4]{}: ins 0x33-0x36.7 (4)
|
||||
0x030| 18 | . | op: "MULVN" (24) 0x33-0x33.7 (1)
|
||||
0x030| 02 | . | a: 2 0x34-0x34.7 (1)
|
||||
0x030| 00 | . | c: 0 0x35-0x35.7 (1)
|
||||
0x030| 02 | . | b: 2 0x36-0x36.7 (1)
|
||||
| | | [5]{}: ins 0x37-0x3a.7 (4)
|
||||
0x030| 16 | . | op: "ADDVN" (22) 0x37-0x37.7 (1)
|
||||
0x030| 02 | . | a: 2 0x38-0x38.7 (1)
|
||||
0x030| 01 | . | c: 1 0x39-0x39.7 (1)
|
||||
0x030| 02 | . | b: 2 0x3a-0x3a.7 (1)
|
||||
| | | [6]{}: ins 0x3b-0x3e.7 (4)
|
||||
0x030| 4c | L | op: "RET1" (76) 0x3b-0x3b.7 (1)
|
||||
0x030| 02 | . | a: 2 0x3c-0x3c.7 (1)
|
||||
0x030| 02 00 | .. | d: 2 0x3d-0x3e.7 (2)
|
||||
| | | uvdata[0:2]: 0x3f-0x42.7 (4)
|
||||
0x030| 01| .| [0]: 49153 uv 0x3f-0x40.7 (2)
|
||||
0x040|c0 |. |
|
||||
0x040| 02 c0 | .. | [1]: 49154 uv 0x41-0x42.7 (2)
|
||||
| | | kgc[0:0]: 0x43-NA (0)
|
||||
| | | knum[0:2]: 0x43-0x50.7 (14)
|
||||
0x040| d2 f9 ea 02 | .... | [0]: 2973289 knum 0x43-0x46.7 (4)
|
||||
0x040| 81 80 90 9d 0c 8a a1 88 91| .........| [1]: 3.8793457897e+10 knum 0x47-0x50.7 (10)
|
||||
0x050|04 |. |
|
||||
| | | debug[0:20]: 0x51-0x64.7 (20)
|
||||
0x050| 01 | . | [0]: 1 db 0x51-0x51.7 (1)
|
||||
0x050| 01 | . | [1]: 1 db 0x52-0x52.7 (1)
|
||||
0x050| 01 | . | [2]: 1 db 0x53-0x53.7 (1)
|
||||
0x050| 02 | . | [3]: 2 db 0x54-0x54.7 (1)
|
||||
0x050| 02 | . | [4]: 2 db 0x55-0x55.7 (1)
|
||||
0x050| 02 | . | [5]: 2 db 0x56-0x56.7 (1)
|
||||
0x050| 02 | . | [6]: 2 db 0x57-0x57.7 (1)
|
||||
0x050| 61 | a | [7]: 97 db 0x58-0x58.7 (1)
|
||||
0x050| 00 | . | [8]: 0 db 0x59-0x59.7 (1)
|
||||
0x050| 62 | b | [9]: 98 db 0x5a-0x5a.7 (1)
|
||||
0x050| 00 | . | [10]: 0 db 0x5b-0x5b.7 (1)
|
||||
0x050| 78 | x | [11]: 120 db 0x5c-0x5c.7 (1)
|
||||
0x050| 00 | . | [12]: 0 db 0x5d-0x5d.7 (1)
|
||||
0x050| 00 | . | [13]: 0 db 0x5e-0x5e.7 (1)
|
||||
0x050| 08| .| [14]: 8 db 0x5f-0x5f.7 (1)
|
||||
0x060|63 |c | [15]: 99 db 0x60-0x60.7 (1)
|
||||
0x060| 00 | . | [16]: 0 db 0x61-0x61.7 (1)
|
||||
0x060| 04 | . | [17]: 4 db 0x62-0x62.7 (1)
|
||||
0x060| 04 | . | [18]: 4 db 0x63-0x63.7 (1)
|
||||
0x060| 00 | . | [19]: 0 db 0x64-0x64.7 (1)
|
||||
| | | [1]{}: proto 0x65-0x14d.7 (233)
|
||||
0x060| e7 01 | .. | length: 231 0x65-0x66.7 (2)
|
||||
| | | pdata{}: 0x67-0x14d.7 (231)
|
||||
| | | phead{}: 0x67-0x70.7 (10)
|
||||
0x060| 07 | . | flags: 7 0x67-0x67.7 (1)
|
||||
0x060| 00 | . | numparams: 0 0x68-0x68.7 (1)
|
||||
0x060| 07 | . | framesize: 7 0x69-0x69.7 (1)
|
||||
0x060| 00 | . | numuv: 0 0x6a-0x6a.7 (1)
|
||||
0x060| 07 | . | numkgc: 7 0x6b-0x6b.7 (1)
|
||||
0x060| 00 | . | numkn: 0 0x6c-0x6c.7 (1)
|
||||
0x060| 0e | . | numbc: 14 0x6d-0x6d.7 (1)
|
||||
0x060| 28 | ( | debuglen: 40 0x6e-0x6e.7 (1)
|
||||
0x060| 00| .| firstline: 0 0x6f-0x6f.7 (1)
|
||||
0x070|19 |. | numline: 25 0x70-0x70.7 (1)
|
||||
| | | bcins[0:14]: 0x71-0xa8.7 (56)
|
||||
| | | [0]{}: ins 0x71-0x74.7 (4)
|
||||
0x070| 35 | 5 | op: "TDUP" (53) 0x71-0x71.7 (1)
|
||||
0x070| 00 | . | a: 0 0x72-0x72.7 (1)
|
||||
0x070| 00 00 | .. | d: 0 0x73-0x74.7 (2)
|
||||
| | | [1]{}: ins 0x75-0x78.7 (4)
|
||||
0x070| 28 | ( | op: "KCDATA" (40) 0x75-0x75.7 (1)
|
||||
0x070| 01 | . | a: 1 0x76-0x76.7 (1)
|
||||
0x070| 01 00 | .. | d: 1 0x77-0x78.7 (2)
|
||||
| | | [2]{}: ins 0x79-0x7c.7 (4)
|
||||
0x070| 37 | 7 | op: "GSET" (55) 0x79-0x79.7 (1)
|
||||
0x070| 01 | . | a: 1 0x7a-0x7a.7 (1)
|
||||
0x070| 02 00 | .. | d: 2 0x7b-0x7c.7 (2)
|
||||
| | | [3]{}: ins 0x7d-0x80.7 (4)
|
||||
0x070| 37 | 7 | op: "GSET" (55) 0x7d-0x7d.7 (1)
|
||||
0x070| 00 | . | a: 0 0x7e-0x7e.7 (1)
|
||||
0x070| 03| .| d: 3 0x7f-0x80.7 (2)
|
||||
0x080|00 |. |
|
||||
| | | [4]{}: ins 0x81-0x84.7 (4)
|
||||
0x080| 29 | ) | op: "KSHORT" (41) 0x81-0x81.7 (1)
|
||||
0x080| 01 | . | a: 1 0x82-0x82.7 (1)
|
||||
0x080| 7b 00 | {. | d: 123 0x83-0x84.7 (2)
|
||||
| | | [5]{}: ins 0x85-0x88.7 (4)
|
||||
0x080| 29 | ) | op: "KSHORT" (41) 0x85-0x85.7 (1)
|
||||
0x080| 02 | . | a: 2 0x86-0x86.7 (1)
|
||||
0x080| 9a 02 | .. | d: 666 0x87-0x88.7 (2)
|
||||
| | | [6]{}: ins 0x89-0x8c.7 (4)
|
||||
0x080| 33 | 3 | op: "FNEW" (51) 0x89-0x89.7 (1)
|
||||
0x080| 03 | . | a: 3 0x8a-0x8a.7 (1)
|
||||
0x080| 04 00 | .. | d: 4 0x8b-0x8c.7 (2)
|
||||
| | | [7]{}: ins 0x8d-0x90.7 (4)
|
||||
0x080| 37 | 7 | op: "GSET" (55) 0x8d-0x8d.7 (1)
|
||||
0x080| 03 | . | a: 3 0x8e-0x8e.7 (1)
|
||||
0x080| 05| .| d: 5 0x8f-0x90.7 (2)
|
||||
0x090|00 |. |
|
||||
| | | [8]{}: ins 0x91-0x94.7 (4)
|
||||
0x090| 12 | . | op: "MOV" (18) 0x91-0x91.7 (1)
|
||||
0x090| 04 | . | a: 4 0x92-0x92.7 (1)
|
||||
0x090| 03 00 | .. | d: 3 0x93-0x94.7 (2)
|
||||
| | | [9]{}: ins 0x95-0x98.7 (4)
|
||||
0x090| 29 | ) | op: "KSHORT" (41) 0x95-0x95.7 (1)
|
||||
0x090| 06 | . | a: 6 0x96-0x96.7 (1)
|
||||
0x090| 2a 00 | *. | d: 42 0x97-0x98.7 (2)
|
||||
| | | [10]{}: ins 0x99-0x9c.7 (4)
|
||||
0x090| 42 | B | op: "CALL" (66) 0x99-0x99.7 (1)
|
||||
0x090| 04 | . | a: 4 0x9a-0x9a.7 (1)
|
||||
0x090| 02 | . | c: 2 0x9b-0x9b.7 (1)
|
||||
0x090| 02 | . | b: 2 0x9c-0x9c.7 (1)
|
||||
| | | [11]{}: ins 0x9d-0xa0.7 (4)
|
||||
0x090| 37 | 7 | op: "GSET" (55) 0x9d-0x9d.7 (1)
|
||||
0x090| 04 | . | a: 4 0x9e-0x9e.7 (1)
|
||||
0x090| 06| .| d: 6 0x9f-0xa0.7 (2)
|
||||
0x0a0|00 |. |
|
||||
| | | [12]{}: ins 0xa1-0xa4.7 (4)
|
||||
0x0a0| 32 | 2 | op: "UCLO" (50) 0xa1-0xa1.7 (1)
|
||||
0x0a0| 00 | . | a: 0 0xa2-0xa2.7 (1)
|
||||
0x0a0| 00 80 | .. | j: 0 0xa3-0xa4.7 (2)
|
||||
| | | [13]{}: ins 0xa5-0xa8.7 (4)
|
||||
0x0a0| 4b | K | op: "RET0" (75) 0xa5-0xa5.7 (1)
|
||||
0x0a0| 00 | . | a: 0 0xa6-0xa6.7 (1)
|
||||
0x0a0| 01 00 | .. | d: 1 0xa7-0xa8.7 (2)
|
||||
| | | uvdata[0:0]: 0xa9-NA (0)
|
||||
| | | kgc[0:7]: 0xa9-0x125.7 (125)
|
||||
| | | [0]{}: kgc 0xa9-0xb6.7 (14)
|
||||
0x0a0| 12 | . | type: "str" (18) 0xa9-0xa9.7 (1)
|
||||
0x0a0| 6d 79 66 75 6e 63| myfunc| str: "myfunc_result" 0xaa-0xb6.7 (13)
|
||||
0x0b0|5f 72 65 73 75 6c 74 |_result |
|
||||
| | | [1]{}: kgc 0xb7-0xbd.7 (7)
|
||||
0x0b0| 0b | . | type: "str" (11) 0xb7-0xb7.7 (1)
|
||||
0x0b0| 6d 79 66 75 6e 63 | myfunc | str: "myfunc" 0xb8-0xbd.7 (6)
|
||||
| | | [2]{}: kgc 0xbe-0xbe.7 (1)
|
||||
0x0b0| 00 | . | type: "child" (0) 0xbe-0xbe.7 (1)
|
||||
| | | [3]{}: kgc 0xbf-0xc4.7 (6)
|
||||
0x0b0| 0a| .| type: "str" (10) 0xbf-0xbf.7 (1)
|
||||
0x0c0|6d 79 74 62 6c |mytbl | str: "mytbl" 0xc0-0xc4.7 (5)
|
||||
| | | [4]{}: kgc 0xc5-0xcb.7 (7)
|
||||
0x0c0| 0b | . | type: "str" (11) 0xc5-0xc5.7 (1)
|
||||
0x0c0| 6d 79 63 70 6c 78 | mycplx | str: "mycplx" 0xc6-0xcb.7 (6)
|
||||
| | | [5]{}: kgc 0xcc-0xd8.7 (13)
|
||||
0x0c0| 04 | . | type: "complex" (4) 0xcc-0xcc.7 (1)
|
||||
0x0c0| 00 00 | .. | real: 0 0xcd-0xce.7 (2)
|
||||
0x0c0| 9a| .| imag: 3.2 0xcf-0xd8.7 (10)
|
||||
0x0d0|b3 e6 cc 09 99 b3 a6 80 04 |......... |
|
||||
| | | [6]{}: kgc 0xd9-0x125.7 (77)
|
||||
0x0d0| 01 | . | type: "tab" (1) 0xd9-0xd9.7 (1)
|
||||
0x0d0| 00 | . | narray: 0 0xda-0xda.7 (1)
|
||||
0x0d0| 05 | . | nhash: 5 0xdb-0xdb.7 (1)
|
||||
| | | karray[0:0]: 0xdc-NA (0)
|
||||
| | | khash[0:5]: 0xdc-0x125.7 (74)
|
||||
| | | [0]{}: khash 0xdc-0xe6.7 (11)
|
||||
| | | k{}: 0xdc-0xe5.7 (10)
|
||||
0x0d0| 0e | . | ktabtype: "str" (14) 0xdc-0xdc.7 (1)
|
||||
0x0d0| 73 6f 6d| som| str: "somefalse" 0xdd-0xe5.7 (9)
|
||||
0x0e0|65 66 61 6c 73 65 |efalse |
|
||||
| | | v{}: 0xe6-0xe6.7 (1)
|
||||
0x0e0| 01 | . | ktabtype: "false" (1) 0xe6-0xe6.7 (1)
|
||||
| | | [1]{}: khash 0xe7-0xf0.7 (10)
|
||||
| | | k{}: 0xe7-0xef.7 (9)
|
||||
0x0e0| 0d | . | ktabtype: "str" (13) 0xe7-0xe7.7 (1)
|
||||
0x0e0| 73 6f 6d 65 74 72 75 65| sometrue| str: "sometrue" 0xe8-0xef.7 (8)
|
||||
| | | v{}: 0xf0-0xf0.7 (1)
|
||||
0x0f0|02 |. | ktabtype: "true" (2) 0xf0-0xf0.7 (1)
|
||||
| | | [2]{}: khash 0xf1-0x104.7 (20)
|
||||
| | | k{}: 0xf1-0xf8.7 (8)
|
||||
0x0f0| 0c | . | ktabtype: "str" (12) 0xf1-0xf1.7 (1)
|
||||
0x0f0| 73 6f 6d 65 73 74 72 | somestr | str: "somestr" 0xf2-0xf8.7 (7)
|
||||
| | | v{}: 0xf9-0x104.7 (12)
|
||||
0x0f0| 10 | . | ktabtype: "str" (16) 0xf9-0xf9.7 (1)
|
||||
0x0f0| 69 74 27 73 20 61| it's a| str: "it's a trap" 0xfa-0x104.7 (11)
|
||||
0x100|20 74 72 61 70 | trap |
|
||||
| | | [3]{}: khash 0x105-0x117.7 (19)
|
||||
| | | k{}: 0x105-0x10c.7 (8)
|
||||
0x100| 0c | . | ktabtype: "str" (12) 0x105-0x105.7 (1)
|
||||
0x100| 73 6f 6d 65 6e 75 6d | somenum | str: "somenum" 0x106-0x10c.7 (7)
|
||||
| | | v{}: 0x10d-0x117.7 (11)
|
||||
0x100| 04 | . | ktabtype: "num" (4) 0x10d-0x10d.7 (1)
|
||||
0x100| 80 80| ..| num: 7.89437298e+11 0x10e-0x117.7 (10)
|
||||
0x110|a8 b5 02 c4 f3 9b 93 04 |........ |
|
||||
| | | [4]{}: khash 0x118-0x125.7 (14)
|
||||
| | | k{}: 0x118-0x11f.7 (8)
|
||||
0x110| 0c | . | ktabtype: "str" (12) 0x118-0x118.7 (1)
|
||||
0x110| 73 6f 6d 65 69 6e 74| someint| str: "someint" 0x119-0x11f.7 (7)
|
||||
| | | v{}: 0x120-0x125.7 (6)
|
||||
0x120|03 |. | ktabtype: "int" (3) 0x120-0x120.7 (1)
|
||||
0x120| fd ff ff ff 0f | ..... | int: 4294967293 0x121-0x125.7 (5)
|
||||
| | | knum[0:0]: 0x126-NA (0)
|
||||
| | | debug[0:40]: 0x126-0x14d.7 (40)
|
||||
0x120| 01 | . | [0]: 1 db 0x126-0x126.7 (1)
|
||||
0x120| 0a | . | [1]: 10 db 0x127-0x127.7 (1)
|
||||
0x120| 0a | . | [2]: 10 db 0x128-0x128.7 (1)
|
||||
0x120| 0c | . | [3]: 12 db 0x129-0x129.7 (1)
|
||||
0x120| 0f | . | [4]: 15 db 0x12a-0x12a.7 (1)
|
||||
0x120| 10 | . | [5]: 16 db 0x12b-0x12b.7 (1)
|
||||
0x120| 15 | . | [6]: 21 db 0x12c-0x12c.7 (1)
|
||||
0x120| 17 | . | [7]: 23 db 0x12d-0x12d.7 (1)
|
||||
0x120| 18 | . | [8]: 24 db 0x12e-0x12e.7 (1)
|
||||
0x120| 18| .| [9]: 24 db 0x12f-0x12f.7 (1)
|
||||
0x130|18 |. | [10]: 24 db 0x130-0x130.7 (1)
|
||||
0x130| 18 | . | [11]: 24 db 0x131-0x131.7 (1)
|
||||
0x130| 18 | . | [12]: 24 db 0x132-0x132.7 (1)
|
||||
0x130| 18 | . | [13]: 24 db 0x133-0x133.7 (1)
|
||||
0x130| 73 | s | [14]: 115 db 0x134-0x134.7 (1)
|
||||
0x130| 6f | o | [15]: 111 db 0x135-0x135.7 (1)
|
||||
0x130| 6d | m | [16]: 109 db 0x136-0x136.7 (1)
|
||||
0x130| 65 | e | [17]: 101 db 0x137-0x137.7 (1)
|
||||
0x130| 74 | t | [18]: 116 db 0x138-0x138.7 (1)
|
||||
0x130| 61 | a | [19]: 97 db 0x139-0x139.7 (1)
|
||||
0x130| 62 | b | [20]: 98 db 0x13a-0x13a.7 (1)
|
||||
0x130| 6c | l | [21]: 108 db 0x13b-0x13b.7 (1)
|
||||
0x130| 65 | e | [22]: 101 db 0x13c-0x13c.7 (1)
|
||||
0x130| 00 | . | [23]: 0 db 0x13d-0x13d.7 (1)
|
||||
0x130| 02 | . | [24]: 2 db 0x13e-0x13e.7 (1)
|
||||
0x130| 0d| .| [25]: 13 db 0x13f-0x13f.7 (1)
|
||||
0x140|61 |a | [26]: 97 db 0x140-0x140.7 (1)
|
||||
0x140| 00 | . | [27]: 0 db 0x141-0x141.7 (1)
|
||||
0x140| 04 | . | [28]: 4 db 0x142-0x142.7 (1)
|
||||
0x140| 09 | . | [29]: 9 db 0x143-0x143.7 (1)
|
||||
0x140| 62 | b | [30]: 98 db 0x144-0x144.7 (1)
|
||||
0x140| 00 | . | [31]: 0 db 0x145-0x145.7 (1)
|
||||
0x140| 01 | . | [32]: 1 db 0x146-0x146.7 (1)
|
||||
0x140| 08 | . | [33]: 8 db 0x147-0x147.7 (1)
|
||||
0x140| 66 | f | [34]: 102 db 0x148-0x148.7 (1)
|
||||
0x140| 31 | 1 | [35]: 49 db 0x149-0x149.7 (1)
|
||||
0x140| 00 | . | [36]: 0 db 0x14a-0x14a.7 (1)
|
||||
0x140| 01 | . | [37]: 1 db 0x14b-0x14b.7 (1)
|
||||
0x140| 07 | . | [38]: 7 db 0x14c-0x14c.7 (1)
|
||||
0x140| 00 | . | [39]: 0 db 0x14d-0x14d.7 (1)
|
||||
0x140| 00| | .|| end: 0 0x14e-0x14e.7 (1)
|
BIN
format/luajit/testdata/simple.luac
vendored
Normal file
BIN
format/luajit/testdata/simple.luac
vendored
Normal file
Binary file not shown.
200
format/luajit/testdata/simple_stripped.fqtest
vendored
Normal file
200
format/luajit/testdata/simple_stripped.fqtest
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
$ fq dv -d luajit simple_stripped.luac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: simple_stripped.luac (luajit) 0x0-0xf9.7 (250)
|
||||
| | | header{}: 0x0-0x4.7 (5)
|
||||
0x00|1b 4c 4a |.LJ | magic: "\x1bLJ" 0x0-0x2.7 (3)
|
||||
0x00| 02 | . | version: 2 0x3-0x3.7 (1)
|
||||
| | | flags{}: 0x4-0x4.7 (1)
|
||||
0x00| 0e | . | raw: 14 0x4-0x4.7 (1)
|
||||
| | | BE: false 0x5-NA (0)
|
||||
| | | STRIP: true 0x5-NA (0)
|
||||
| | | FFI: true 0x5-NA (0)
|
||||
| | | FR2: true 0x5-NA (0)
|
||||
| | | proto[0:2]: 0x5-0xf8.7 (244)
|
||||
| | | [0]{}: proto 0x5-0x3a.7 (54)
|
||||
0x00| 35 | 5 | length: 53 0x5-0x5.7 (1)
|
||||
| | | pdata{}: 0x6-0x3a.7 (53)
|
||||
| | | phead{}: 0x6-0xc.7 (7)
|
||||
0x00| 00 | . | flags: 0 0x6-0x6.7 (1)
|
||||
0x00| 01 | . | numparams: 1 0x7-0x7.7 (1)
|
||||
0x00| 03 | . | framesize: 3 0x8-0x8.7 (1)
|
||||
0x00| 02 | . | numuv: 2 0x9-0x9.7 (1)
|
||||
0x00| 00 | . | numkgc: 0 0xa-0xa.7 (1)
|
||||
0x00| 02 | . | numkn: 2 0xb-0xb.7 (1)
|
||||
0x00| 07 | . | numbc: 7 0xc-0xc.7 (1)
|
||||
| | | bcins[0:7]: 0xd-0x28.7 (28)
|
||||
| | | [0]{}: ins 0xd-0x10.7 (4)
|
||||
0x00| 2d | - | op: "UGET" (45) 0xd-0xd.7 (1)
|
||||
0x00| 01 | . | a: 1 0xe-0xe.7 (1)
|
||||
0x00| 00| .| d: 0 0xf-0x10.7 (2)
|
||||
0x10|00 |. |
|
||||
| | | [1]{}: ins 0x11-0x14.7 (4)
|
||||
0x10| 2d | - | op: "UGET" (45) 0x11-0x11.7 (1)
|
||||
0x10| 02 | . | a: 2 0x12-0x12.7 (1)
|
||||
0x10| 01 00 | .. | d: 1 0x13-0x14.7 (2)
|
||||
| | | [2]{}: ins 0x15-0x18.7 (4)
|
||||
0x10| 20 | | op: "ADDVV" (32) 0x15-0x15.7 (1)
|
||||
0x10| 01 | . | a: 1 0x16-0x16.7 (1)
|
||||
0x10| 02 | . | c: 2 0x17-0x17.7 (1)
|
||||
0x10| 01 | . | b: 1 0x18-0x18.7 (1)
|
||||
| | | [3]{}: ins 0x19-0x1c.7 (4)
|
||||
0x10| 22 | " | op: "MULVV" (34) 0x19-0x19.7 (1)
|
||||
0x10| 02 | . | a: 2 0x1a-0x1a.7 (1)
|
||||
0x10| 01 | . | c: 1 0x1b-0x1b.7 (1)
|
||||
0x10| 00 | . | b: 0 0x1c-0x1c.7 (1)
|
||||
| | | [4]{}: ins 0x1d-0x20.7 (4)
|
||||
0x10| 18 | . | op: "MULVN" (24) 0x1d-0x1d.7 (1)
|
||||
0x10| 02 | . | a: 2 0x1e-0x1e.7 (1)
|
||||
0x10| 00| .| c: 0 0x1f-0x1f.7 (1)
|
||||
0x20|02 |. | b: 2 0x20-0x20.7 (1)
|
||||
| | | [5]{}: ins 0x21-0x24.7 (4)
|
||||
0x20| 16 | . | op: "ADDVN" (22) 0x21-0x21.7 (1)
|
||||
0x20| 02 | . | a: 2 0x22-0x22.7 (1)
|
||||
0x20| 01 | . | c: 1 0x23-0x23.7 (1)
|
||||
0x20| 02 | . | b: 2 0x24-0x24.7 (1)
|
||||
| | | [6]{}: ins 0x25-0x28.7 (4)
|
||||
0x20| 4c | L | op: "RET1" (76) 0x25-0x25.7 (1)
|
||||
0x20| 02 | . | a: 2 0x26-0x26.7 (1)
|
||||
0x20| 02 00 | .. | d: 2 0x27-0x28.7 (2)
|
||||
| | | uvdata[0:2]: 0x29-0x2c.7 (4)
|
||||
0x20| 01 c0 | .. | [0]: 49153 uv 0x29-0x2a.7 (2)
|
||||
0x20| 02 c0 | .. | [1]: 49154 uv 0x2b-0x2c.7 (2)
|
||||
| | | kgc[0:0]: 0x2d-NA (0)
|
||||
| | | knum[0:2]: 0x2d-0x3a.7 (14)
|
||||
0x20| d2 f9 ea| ...| [0]: 2973289 knum 0x2d-0x30.7 (4)
|
||||
0x30|02 |. |
|
||||
0x30| 81 80 90 9d 0c 8a a1 88 91 04 | .......... | [1]: 3.8793457897e+10 knum 0x31-0x3a.7 (10)
|
||||
| | | [1]{}: proto 0x3b-0xf8.7 (190)
|
||||
0x30| bc 01 | .. | length: 188 0x3b-0x3c.7 (2)
|
||||
| | | pdata{}: 0x3d-0xf8.7 (188)
|
||||
| | | phead{}: 0x3d-0x43.7 (7)
|
||||
0x30| 07 | . | flags: 7 0x3d-0x3d.7 (1)
|
||||
0x30| 00 | . | numparams: 0 0x3e-0x3e.7 (1)
|
||||
0x30| 07| .| framesize: 7 0x3f-0x3f.7 (1)
|
||||
0x40|00 |. | numuv: 0 0x40-0x40.7 (1)
|
||||
0x40| 07 | . | numkgc: 7 0x41-0x41.7 (1)
|
||||
0x40| 00 | . | numkn: 0 0x42-0x42.7 (1)
|
||||
0x40| 0e | . | numbc: 14 0x43-0x43.7 (1)
|
||||
| | | bcins[0:14]: 0x44-0x7b.7 (56)
|
||||
| | | [0]{}: ins 0x44-0x47.7 (4)
|
||||
0x40| 35 | 5 | op: "TDUP" (53) 0x44-0x44.7 (1)
|
||||
0x40| 00 | . | a: 0 0x45-0x45.7 (1)
|
||||
0x40| 00 00 | .. | d: 0 0x46-0x47.7 (2)
|
||||
| | | [1]{}: ins 0x48-0x4b.7 (4)
|
||||
0x40| 28 | ( | op: "KCDATA" (40) 0x48-0x48.7 (1)
|
||||
0x40| 01 | . | a: 1 0x49-0x49.7 (1)
|
||||
0x40| 01 00 | .. | d: 1 0x4a-0x4b.7 (2)
|
||||
| | | [2]{}: ins 0x4c-0x4f.7 (4)
|
||||
0x40| 37 | 7 | op: "GSET" (55) 0x4c-0x4c.7 (1)
|
||||
0x40| 01 | . | a: 1 0x4d-0x4d.7 (1)
|
||||
0x40| 02 00| ..| d: 2 0x4e-0x4f.7 (2)
|
||||
| | | [3]{}: ins 0x50-0x53.7 (4)
|
||||
0x50|37 |7 | op: "GSET" (55) 0x50-0x50.7 (1)
|
||||
0x50| 00 | . | a: 0 0x51-0x51.7 (1)
|
||||
0x50| 03 00 | .. | d: 3 0x52-0x53.7 (2)
|
||||
| | | [4]{}: ins 0x54-0x57.7 (4)
|
||||
0x50| 29 | ) | op: "KSHORT" (41) 0x54-0x54.7 (1)
|
||||
0x50| 01 | . | a: 1 0x55-0x55.7 (1)
|
||||
0x50| 7b 00 | {. | d: 123 0x56-0x57.7 (2)
|
||||
| | | [5]{}: ins 0x58-0x5b.7 (4)
|
||||
0x50| 29 | ) | op: "KSHORT" (41) 0x58-0x58.7 (1)
|
||||
0x50| 02 | . | a: 2 0x59-0x59.7 (1)
|
||||
0x50| 9a 02 | .. | d: 666 0x5a-0x5b.7 (2)
|
||||
| | | [6]{}: ins 0x5c-0x5f.7 (4)
|
||||
0x50| 33 | 3 | op: "FNEW" (51) 0x5c-0x5c.7 (1)
|
||||
0x50| 03 | . | a: 3 0x5d-0x5d.7 (1)
|
||||
0x50| 04 00| ..| d: 4 0x5e-0x5f.7 (2)
|
||||
| | | [7]{}: ins 0x60-0x63.7 (4)
|
||||
0x60|37 |7 | op: "GSET" (55) 0x60-0x60.7 (1)
|
||||
0x60| 03 | . | a: 3 0x61-0x61.7 (1)
|
||||
0x60| 05 00 | .. | d: 5 0x62-0x63.7 (2)
|
||||
| | | [8]{}: ins 0x64-0x67.7 (4)
|
||||
0x60| 12 | . | op: "MOV" (18) 0x64-0x64.7 (1)
|
||||
0x60| 04 | . | a: 4 0x65-0x65.7 (1)
|
||||
0x60| 03 00 | .. | d: 3 0x66-0x67.7 (2)
|
||||
| | | [9]{}: ins 0x68-0x6b.7 (4)
|
||||
0x60| 29 | ) | op: "KSHORT" (41) 0x68-0x68.7 (1)
|
||||
0x60| 06 | . | a: 6 0x69-0x69.7 (1)
|
||||
0x60| 2a 00 | *. | d: 42 0x6a-0x6b.7 (2)
|
||||
| | | [10]{}: ins 0x6c-0x6f.7 (4)
|
||||
0x60| 42 | B | op: "CALL" (66) 0x6c-0x6c.7 (1)
|
||||
0x60| 04 | . | a: 4 0x6d-0x6d.7 (1)
|
||||
0x60| 02 | . | c: 2 0x6e-0x6e.7 (1)
|
||||
0x60| 02| .| b: 2 0x6f-0x6f.7 (1)
|
||||
| | | [11]{}: ins 0x70-0x73.7 (4)
|
||||
0x70|37 |7 | op: "GSET" (55) 0x70-0x70.7 (1)
|
||||
0x70| 04 | . | a: 4 0x71-0x71.7 (1)
|
||||
0x70| 06 00 | .. | d: 6 0x72-0x73.7 (2)
|
||||
| | | [12]{}: ins 0x74-0x77.7 (4)
|
||||
0x70| 32 | 2 | op: "UCLO" (50) 0x74-0x74.7 (1)
|
||||
0x70| 00 | . | a: 0 0x75-0x75.7 (1)
|
||||
0x70| 00 80 | .. | j: 0 0x76-0x77.7 (2)
|
||||
| | | [13]{}: ins 0x78-0x7b.7 (4)
|
||||
0x70| 4b | K | op: "RET0" (75) 0x78-0x78.7 (1)
|
||||
0x70| 00 | . | a: 0 0x79-0x79.7 (1)
|
||||
0x70| 01 00 | .. | d: 1 0x7a-0x7b.7 (2)
|
||||
| | | uvdata[0:0]: 0x7c-NA (0)
|
||||
| | | kgc[0:7]: 0x7c-0xf8.7 (125)
|
||||
| | | [0]{}: kgc 0x7c-0x89.7 (14)
|
||||
0x70| 12 | . | type: "str" (18) 0x7c-0x7c.7 (1)
|
||||
0x70| 6d 79 66| myf| str: "myfunc_result" 0x7d-0x89.7 (13)
|
||||
0x80|75 6e 63 5f 72 65 73 75 6c 74 |unc_result |
|
||||
| | | [1]{}: kgc 0x8a-0x90.7 (7)
|
||||
0x80| 0b | . | type: "str" (11) 0x8a-0x8a.7 (1)
|
||||
0x80| 6d 79 66 75 6e| myfun| str: "myfunc" 0x8b-0x90.7 (6)
|
||||
0x90|63 |c |
|
||||
| | | [2]{}: kgc 0x91-0x91.7 (1)
|
||||
0x90| 00 | . | type: "child" (0) 0x91-0x91.7 (1)
|
||||
| | | [3]{}: kgc 0x92-0x97.7 (6)
|
||||
0x90| 0a | . | type: "str" (10) 0x92-0x92.7 (1)
|
||||
0x90| 6d 79 74 62 6c | mytbl | str: "mytbl" 0x93-0x97.7 (5)
|
||||
| | | [4]{}: kgc 0x98-0x9e.7 (7)
|
||||
0x90| 0b | . | type: "str" (11) 0x98-0x98.7 (1)
|
||||
0x90| 6d 79 63 70 6c 78 | mycplx | str: "mycplx" 0x99-0x9e.7 (6)
|
||||
| | | [5]{}: kgc 0x9f-0xab.7 (13)
|
||||
0x90| 04| .| type: "complex" (4) 0x9f-0x9f.7 (1)
|
||||
0xa0|00 00 |.. | real: 0 0xa0-0xa1.7 (2)
|
||||
0xa0| 9a b3 e6 cc 09 99 b3 a6 80 04 | .......... | imag: 3.2 0xa2-0xab.7 (10)
|
||||
| | | [6]{}: kgc 0xac-0xf8.7 (77)
|
||||
0xa0| 01 | . | type: "tab" (1) 0xac-0xac.7 (1)
|
||||
0xa0| 00 | . | narray: 0 0xad-0xad.7 (1)
|
||||
0xa0| 05 | . | nhash: 5 0xae-0xae.7 (1)
|
||||
| | | karray[0:0]: 0xaf-NA (0)
|
||||
| | | khash[0:5]: 0xaf-0xf8.7 (74)
|
||||
| | | [0]{}: khash 0xaf-0xc2.7 (20)
|
||||
| | | k{}: 0xaf-0xb6.7 (8)
|
||||
0xa0| 0c| .| ktabtype: "str" (12) 0xaf-0xaf.7 (1)
|
||||
0xb0|73 6f 6d 65 73 74 72 |somestr | str: "somestr" 0xb0-0xb6.7 (7)
|
||||
| | | v{}: 0xb7-0xc2.7 (12)
|
||||
0xb0| 10 | . | ktabtype: "str" (16) 0xb7-0xb7.7 (1)
|
||||
0xb0| 69 74 27 73 20 61 20 74| it's a t| str: "it's a trap" 0xb8-0xc2.7 (11)
|
||||
0xc0|72 61 70 |rap |
|
||||
| | | [1]{}: khash 0xc3-0xd5.7 (19)
|
||||
| | | k{}: 0xc3-0xca.7 (8)
|
||||
0xc0| 0c | . | ktabtype: "str" (12) 0xc3-0xc3.7 (1)
|
||||
0xc0| 73 6f 6d 65 6e 75 6d | somenum | str: "somenum" 0xc4-0xca.7 (7)
|
||||
| | | v{}: 0xcb-0xd5.7 (11)
|
||||
0xc0| 04 | . | ktabtype: "num" (4) 0xcb-0xcb.7 (1)
|
||||
0xc0| 80 80 a8 b5| ....| num: 7.89437298e+11 0xcc-0xd5.7 (10)
|
||||
0xd0|02 c4 f3 9b 93 04 |...... |
|
||||
| | | [2]{}: khash 0xd6-0xe3.7 (14)
|
||||
| | | k{}: 0xd6-0xdd.7 (8)
|
||||
0xd0| 0c | . | ktabtype: "str" (12) 0xd6-0xd6.7 (1)
|
||||
0xd0| 73 6f 6d 65 69 6e 74 | someint | str: "someint" 0xd7-0xdd.7 (7)
|
||||
| | | v{}: 0xde-0xe3.7 (6)
|
||||
0xd0| 03 | . | ktabtype: "int" (3) 0xde-0xde.7 (1)
|
||||
0xd0| fd| .| int: 4294967293 0xdf-0xe3.7 (5)
|
||||
0xe0|ff ff ff 0f |.... |
|
||||
| | | [3]{}: khash 0xe4-0xee.7 (11)
|
||||
| | | k{}: 0xe4-0xed.7 (10)
|
||||
0xe0| 0e | . | ktabtype: "str" (14) 0xe4-0xe4.7 (1)
|
||||
0xe0| 73 6f 6d 65 66 61 6c 73 65 | somefalse | str: "somefalse" 0xe5-0xed.7 (9)
|
||||
| | | v{}: 0xee-0xee.7 (1)
|
||||
0xe0| 01 | . | ktabtype: "false" (1) 0xee-0xee.7 (1)
|
||||
| | | [4]{}: khash 0xef-0xf8.7 (10)
|
||||
| | | k{}: 0xef-0xf7.7 (9)
|
||||
0xe0| 0d| .| ktabtype: "str" (13) 0xef-0xef.7 (1)
|
||||
0xf0|73 6f 6d 65 74 72 75 65 |sometrue | str: "sometrue" 0xf0-0xf7.7 (8)
|
||||
| | | v{}: 0xf8-0xf8.7 (1)
|
||||
0xf0| 02 | . | ktabtype: "true" (2) 0xf8-0xf8.7 (1)
|
||||
| | | knum[0:0]: 0xf9-NA (0)
|
||||
0xf0| 00| | .| | end: 0 0xf9-0xf9.7 (1)
|
BIN
format/luajit/testdata/simple_stripped.luac
vendored
Normal file
BIN
format/luajit/testdata/simple_stripped.luac
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user