add ktap.vim for ktap syntax highlight

This file is based on stap syntax vim file initially.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add sample script: samples/userspace/pthread.kp

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add KTAP-CFLAGS into .gitignore

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
install ktap.vim syntax file in `make install`

Also move all vim related file into vim/ directory

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add sample script samples/basic/memcpy_memset.kp

This script is for histgram memcpy/memset size output,
to get know which size is operated most frequently.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
pass event filter correctly

Pass the event filter string "filter", not "/filter/"

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add test for event filter parse

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Add .gnu_debuglink symbol lookup support.

Signed-off-by: Grzegorz Miłoś <grzegorz.milos@gmail.com>
rename KTAP_TXXX to KTAP_TYPE_XXX

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
change "local" declaration to "var"

disable local function, all function will be
locally by default.

declare local scope variable:
	var i = 1

Bytecode generate:
	./ktap -b -e 'var i = 1'
	sizecode: 2
	00000001        LOADK           i <- 1
	00800023        RETURN

declare global scope variable:
	i = 1

Bytecode generate:
	./ktap -b -e 'i = 1'
	sizecode: 2
	80404008        SETTABUP        global{i} <- 1
	00800023        RETURN

TODO: variable must be declared with "var".

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
update ktap.vim

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
update README and tuorial

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Add tags + etags + ctags to the Makefile.

Signed-off-by: Grzegorz Miłoś <grzegorz.milos@gmail.com>
add permission check

disallow non-root user to execute ktap script.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
use correct realloc size for ktapc table/string resize

This patch fix the coredump when ran:
./ktap samples/syscalls/errinfo.kp

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
fix gettimeofday_us return type to long

Reported by Yichun Zhang.
change ktap output default to stdout instead of stderr

Since we have -o option now, so change default output to stdout,
if user want to redirect to another file, use -o option.

Reported by Yichun Zhang.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
use ffi.cast for type convention and add sample script skb_cast.kp

Example:
	trace net:netif_receive_skb {
        	var skb = ffi.cast("struct sk_buff *", arg1)
		print(skb.len, skb.data_len, skb.skb_iif)
	}

Now ktap can support type convention functionality, this is
a big step for ktap.

In future, there will don't need to declare 'struct sk_buff'
anymore in ktap script.

This patch also kill ffi.free, all memory allocated by ffi.new
will be free automatically when ktap thread exit.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add 'reload' build target in Makefile

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add argument type validate for kp_str_fmt

This patch fix kernel crash caused by below command:
	ktap -e 'printf("%s\n", 32)'

Reported-by: YiChun Zhang (agentzh)

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>