Module: RbBCC::Clib

Extended by:
Fiddle::Importer
Defined in:
lib/rbbcc/clib.rb

Constant Summary collapse

PerfReader =

FIXME: This size of struct will change in future version and no struct member info in header. This is hacky

struct(
  [
    "void * raw_cb",
    "void * lost_cb",
    "void * cb_cookie",
    "void * buf",
    "int buf_size",
    "void * base",
    "int rb_use_state",
    "int rb_read_tid",
    "int page_size",
    "int page_cnt",
    "int fd"
  ]
)
BCCSymbol =
struct([
        "const char *name",
        "const char *demangle_name",
        "const char *module",
        "unsigned long offset"
])
BCCSymbolOption =
struct([
  'int use_debug_file',
  'int check_debug_file_crc',
  'unsigned int use_symbol_type'
])
BCCIPOffsetUnion =
union(['unsigned long long offset', 'unsigned long long ip'])
BCCStacktraceBuildID =
struct([
  'unsigned int status',
  'unsigned char[20] build_id',
  'unsigned long long u' # truly union
])

Class Method Summary collapse

Class Method Details

.__extract_char(ptr) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/rbbcc/clib.rb', line 5

def self.__extract_char(ptr)
  return nil if ptr.null?
  idx = 0
  while ptr[idx, 1] != "\x00"
    idx += 1
  end
  ptr.size = idx + 1
  ptr.to_s
end

.do_bcc_func_load(mod, prog_type, name, insns, len, license, kver, loglv, buf, buf_size, device) ⇒ Object



67
68
69
# File 'lib/rbbcc/clib.rb', line 67

def self.do_bcc_func_load(mod, prog_type, name, insns, len, license, kver, loglv, buf, buf_size, device)
  bcc_func_load(mod, prog_type, name, insns, len, license, kver, loglv, buf, buf_size, device)
end

.do_bpf_module_create_c_from_string(text, flags, cflags, ncflags, allow_limit, dev_name = nil) ⇒ Object



63
64
65
# File 'lib/rbbcc/clib.rb', line 63

def self.do_bpf_module_create_c_from_string(text, flags, cflags, ncflags, allow_limit, dev_name)
  bpf_module_create_c_from_string(text, flags, cflags, ncflags, allow_limit, dev_name)
end

.libbcc_versionObject



19
20
21
# File 'lib/rbbcc/clib.rb', line 19

def self.libbcc_version
  @@libbcc_version
end

.libbcc_version=(ver) ⇒ Object



15
16
17
# File 'lib/rbbcc/clib.rb', line 15

def self.libbcc_version=(ver)
  @@libbcc_version ||= Gem::Version.new(ver)
end

.libbcc_version_gteq?(ver) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/rbbcc/clib.rb', line 23

def self.libbcc_version_gteq?(ver)
  @@libbcc_version >= Gem::Version.new(ver)
end