Class: RbBCC::BCC
- Inherits:
-
Object
- Object
- RbBCC::BCC
- Defined in:
- lib/rbbcc/bcc.rb
Instance Attribute Summary collapse
-
#module ⇒ Object
readonly
Returns the value of attribute module.
-
#perf_buffers ⇒ Object
readonly
Returns the value of attribute perf_buffers.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Class Method Summary collapse
- ._find_file(filename) ⇒ Object
- .attach_raw_socket(fn, dev) ⇒ Object
- .check_path_symbol(module_, symname, addr, pid) ⇒ Object
- .decode_table_type(desc) ⇒ Object
- .get_kprobe_functions(event_re) ⇒ Object
- .ksym(addr, show_module: false, show_offset: false) ⇒ Object
- .ksymname(name) ⇒ Object
- .support_raw_tracepoint ⇒ Object
- .sym(addr, pid, show_module: false, show_offset: false, demangle: true) ⇒ Object
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #attach_kprobe(event:, fn_name:, event_off: 0) ⇒ Object
- #attach_kretprobe(event:, fn_name:, event_re: nil, maxactive: 0) ⇒ Object
- #attach_raw_tracepoint(tp: "", fn_name: "") ⇒ Object
- #attach_tracepoint(tp: "", tp_re: "", fn_name: "") ⇒ Object
- #attach_uprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1)) ⇒ Object
- #attach_uretprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1)) ⇒ Object
- #cleanup ⇒ Object
- #detach_kprobe_event(ev_name) ⇒ Object
- #detach_raw_tracepoint(tp) ⇒ Object
- #detach_tracepoint(tp) ⇒ Object
- #detach_uprobe_event(ev_name) ⇒ Object
- #gen_args_from_usdt ⇒ Object
- #get_syscall_fnname(name) ⇒ Object
- #get_syscall_prefix ⇒ Object
- #get_table(name, keytype: nil, leaftype: nil, reducer: nil) ⇒ Object
-
#initialize(text: "", src_file: nil, hdr_file: nil, debug: 0, cflags: [], usdt_contexts: [], allow_rlimit: 0) ⇒ BCC
constructor
A new instance of BCC.
- #ksymname(name) ⇒ Object
- #load_func(func_name, prog_type, device: nil) ⇒ Object
- #num_open_kprobes ⇒ Object
- #num_open_tracepoints ⇒ Object
- #num_open_uprobes ⇒ Object
- #perf_buffer_poll(timeout = -1)) ⇒ Object
- #trace_fields(&do_each_line) ⇒ Object
- #trace_print(fmt: nil) ⇒ Object
- #trace_readline ⇒ Object
- #tracefile ⇒ Object
Constructor Details
#initialize(text: "", src_file: nil, hdr_file: nil, debug: 0, cflags: [], usdt_contexts: [], allow_rlimit: 0) ⇒ BCC
Returns a new instance of BCC.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/rbbcc/bcc.rb', line 198 def initialize(text: "", src_file: nil, hdr_file: nil, debug: 0, cflags: [], usdt_contexts: [], allow_rlimit: 0) @kprobe_fds = {} @uprobe_fds = {} @tracepoint_fds = {} @raw_tracepoint_fds = {} if src_file src_file = BCC._find_file(src_file) hdr_file = BCC._find_file(hdr_file) end if src_file && src_file.end_with?(".b") @module = Clib.bpf_module_create_b(src_file, hdr_file, debug, device) else if src_file text = File.read(src_file) end @usdt_contexts = usdt_contexts if code = gen_args_from_usdt text = code + text end cflags_safe = if cflags.empty? or !cflags[-1].nil? cflags + [nil] else cflags end @module = Clib.bpf_module_create_c_from_string( text, debug, cflags_safe.pack("p*"), cflags_safe.size, allow_rlimit ) end @funcs = {} @tables = {} @perf_buffers = {} unless @module raise "BPF module not created" end trace_autoload! @usdt_contexts.each do |usdt| usdt.enumerate_active_probes.each do |probe| attach_uprobe(name: probe.binpath, fn_name: probe.fn_name, addr: probe.addr, pid: probe.pid) end end at_exit { self.cleanup } end |
Instance Attribute Details
#module ⇒ Object (readonly)
Returns the value of attribute module.
254 255 256 |
# File 'lib/rbbcc/bcc.rb', line 254 def module @module end |
#perf_buffers ⇒ Object (readonly)
Returns the value of attribute perf_buffers.
254 255 256 |
# File 'lib/rbbcc/bcc.rb', line 254 def perf_buffers @perf_buffers end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
495 496 497 |
# File 'lib/rbbcc/bcc.rb', line 495 def tables @tables end |
Class Method Details
._find_file(filename) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rbbcc/bcc.rb', line 18 def _find_file(filename) if filename unless File.exist?(filename) t = File. "../#{filename}", $0 if File.exist?(t) filename = t else raise "Could not find file #{filename}" end end end return filename end |
.attach_raw_socket(fn, dev) ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/rbbcc/bcc.rb', line 180 def attach_raw_socket(fn, dev) unless fn.is_a?(Hash) raise "arg 1 must be of BPF.Function Hash" end sock = Clib.bpf_open_raw_sock(dev) if sock < 0 raise SystemCallError.new("Failed to open raw device %s" % dev, Fiddle.last_error) end res = Clib.bpf_attach_socket(sock, fn[:fd]) if res < 0 raise SystemCallError.new("Failed to attach BPF to device %s" % dev, Fiddle.last_error) end fn[:sock] = sock fn end |
.check_path_symbol(module_, symname, addr, pid) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/rbbcc/bcc.rb', line 110 def check_path_symbol(module_, symname, addr, pid) sym = Clib::BCCSymbol.malloc c_pid = pid == -1 ? 0 : pid if Clib.bcc_resolve_symname(module_, symname, (addr || 0x0), c_pid, nil, sym) < 0 raise("could not determine address of symbol %s" % symname) end module_path = Clib.__extract_char sym.module # XXX: need to free char* in ruby ffi? Clib.bcc_procutils_free(sym.module) return module_path, sym.offset end |
.decode_table_type(desc) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/rbbcc/bcc.rb', line 122 def decode_table_type(desc) return desc if desc.is_a?(String) anon = [] fields = [] # e.g. ["bpf_stacktrace", [["ip", "unsigned long long", [127]]], "struct_packed"] name, typedefs, data_type = desc typedefs.each do |field| case field.size when 2 fields << "#{decode_table_type(field[1])} #{field[0]}" when 3 ftype = field.last if ftype.is_a?(Array) fields << "#{decode_table_type(field[1])}[#{ftype[0]}] #{field[0]}" elsif ftype.is_a?(Integer) warn("Warning: Ruby fiddle does not support bitfield member, ignoring") warn("Adding member `#{field[1]} #{field[0]}:#{ftype}'") fields << "#{decode_table_type(field[1])} #{field[0]}" elsif %w(union struct struct_packed).in?(ftype) name = field[0] if name.empty? name = "__anon%d" % anon.size anon << name end # FIXME: nested struct fields << "#{decode_table_type(field)} #{name}" else raise("Failed to decode type #{field.inspect}") end else raise("Failed to decode type #{field.inspect}") end end if data_type == "union" return Fiddle::Importer.union(fields) else return Fiddle::Importer.struct(fields) end end |
.get_kprobe_functions(event_re) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/rbbcc/bcc.rb', line 46 def get_kprobe_functions(event_re) blacklist = [] fns = [] File.open(File.("../kprobes/blacklist", TRACEFS), "rb") do |blacklist_f| blacklist = blacklist_f.each_line.map { |line| line.rstrip.split[1] }.uniq end in_init_section = 0 in_irq_section = 0 File.open("/proc/kallsyms", "rb") do |avail_file| avail_file.each_line do |line| t, fn = line.rstrip.split[1,2] # Skip all functions defined between __init_begin and # __init_end if in_init_section == 0 if fn == '__init_begin' in_init_section = 1 next elsif in_init_section == 1 if fn == '__init_end' in_init_section = 2 next end end # Skip all functions defined between __irqentry_text_start and # __irqentry_text_end if in_irq_section == 0 if fn == '__irqentry_text_start' in_irq_section = 1 next elsif in_irq_section == 1 if fn == '__irqentry_text_end' in_irq_section = 2 next end end end # All functions defined as NOKPROBE_SYMBOL() start with the # prefix _kbl_addr_*, blacklisting them by looking at the name # allows to catch also those symbols that are defined in kernel # modules. if fn.start_with?('_kbl_addr_') next # Explicitly blacklist perf-related functions, they are all # non-attachable. elsif fn.start_with?('__perf') || fn.start_with?('perf_') next # Exclude all gcc 8's extra .cold functions elsif fn =~ /^.*\.cold\.\d+$/ next end if %w(t w).include?(t.downcase) \ && /#{event_re}/ =~ fn \ && !blacklist.include?(fn) fns << fn end end end end fns = fns.uniq return fns.empty? ? nil : fns end |
.ksym(addr, show_module: false, show_offset: false) ⇒ Object
32 33 34 |
# File 'lib/rbbcc/bcc.rb', line 32 def ksym(addr, show_module: false, show_offset: false) self.sym(addr, -1, show_module: show_module, show_offset: show_offset, demangle: false) end |
.ksymname(name) ⇒ Object
36 37 38 |
# File 'lib/rbbcc/bcc.rb', line 36 def ksymname(name) SymbolCache.resolve_global(name) end |
.support_raw_tracepoint ⇒ Object
40 41 42 43 44 |
# File 'lib/rbbcc/bcc.rb', line 40 def support_raw_tracepoint # kernel symbol "bpf_find_raw_tracepoint" # indicates raw_tracepint support ksymname("bpf_find_raw_tracepoint") || ksymname("bpf_get_raw_tracepoint") end |
.sym(addr, pid, show_module: false, show_offset: false, demangle: true) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/rbbcc/bcc.rb', line 163 def sym(addr, pid, show_module: false, show_offset: false, demangle: true) # FIXME: case of typeofaddr.find('bpf_stack_build_id') #s = Clib::BCCSymbol.malloc #b = Clib::BCCStacktraceBuildID.malloc #b.status = addr.status #b.build_id = addr.build_id #b.u = addr.offset #Clib.bcc_buildsymcache_resolve(BPF.bsymcache, b, s) name, offset_, module_ = SymbolCache.cache(pid).resolve(addr, demangle) offset = (show_offset && name) ? ("+0x%x" % offset_) : "" name = name || "[unknown]" name = name + offset module_ = (show_module && module_) ? " [#{File.basename.basename(module_)}]" : "" return name + module_ end |
Instance Method Details
#[](key) ⇒ Object
516 517 518 |
# File 'lib/rbbcc/bcc.rb', line 516 def [](key) self.tables[key] ||= get_table(key) end |
#[]=(key, value) ⇒ Object
520 521 522 |
# File 'lib/rbbcc/bcc.rb', line 520 def []=(key, value) self.tables[key] = value end |
#attach_kprobe(event:, fn_name:, event_off: 0) ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/rbbcc/bcc.rb', line 313 def attach_kprobe(event:, fn_name:, event_off: 0) fn = load_func(fn_name, BPF::KPROBE) ev_name = "p_" + event.gsub(/[\+\.]/, "_") fd = Clib.bpf_attach_kprobe(fn[:fd], 0, ev_name, event, event_off, 0) if fd < 0 raise SystemCallError.new("Failed to attach BPF program #{fn_name} to kprobe #{event}", Fiddle.last_error) end Util.debug "Attach: #{ev_name}" @kprobe_fds[ev_name] = fd [ev_name, fd] end |
#attach_kretprobe(event:, fn_name:, event_re: nil, maxactive: 0) ⇒ Object
325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/rbbcc/bcc.rb', line 325 def attach_kretprobe(event:, fn_name:, event_re: nil, maxactive: 0) # TODO: if event_re ... fn = load_func(fn_name, BPF::KPROBE) ev_name = "r_" + event.gsub(/[\+\.]/, "_") fd = Clib.bpf_attach_kprobe(fn[:fd], 1, ev_name, event, 0, maxactive) if fd < 0 raise SystemCallError.new("Failed to attach BPF program #{fn_name} to kretprobe #{event}", Fiddle.last_error) end Util.debug "Attach: #{ev_name}" @kprobe_fds[ev_name] = fd [ev_name, fd] end |
#attach_raw_tracepoint(tp: "", fn_name: "") ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/rbbcc/bcc.rb', line 298 def attach_raw_tracepoint(tp: "", fn_name: "") if @raw_tracepoint_fds.keys.include?(tp) raise "Raw tracepoint #{tp} has been attached" end fn = load_func(fn_name, BPF::RAW_TRACEPOINT) fd = Clib.bpf_attach_raw_tracepoint(fn[:fd], tp) if fd < 0 raise SystemCallError.new("Failed to attach BPF program #{fn_name} to raw tracepoint #{tp}", Fiddle.last_error) end Util.debug "Attach: #{tp}" @raw_tracepoint_fds[tp] = fd self end |
#attach_tracepoint(tp: "", tp_re: "", fn_name: "") ⇒ Object
286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/rbbcc/bcc.rb', line 286 def attach_tracepoint(tp: "", tp_re: "", fn_name: "") fn = load_func(fn_name, BPF::TRACEPOINT) tp_category, tp_name = tp.split(':') fd = Clib.bpf_attach_tracepoint(fn[:fd], tp_category, tp_name) if fd < 0 raise SystemCallError.new("Failed to attach BPF program #{fn_name} to tracepoint #{tp}", Fiddle.last_error) end Util.debug "Attach: #{tp}" @tracepoint_fds[tp] = fd self end |
#attach_uprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1)) ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/rbbcc/bcc.rb', line 338 def attach_uprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1) path, addr = BCC.check_path_symbol(name, sym, addr, pid) fn = load_func(fn_name, BPF::KPROBE) ev_name = to_uprobe_evname("p", path, addr, pid) fd = Clib.bpf_attach_uprobe(fn[:fd], 0, ev_name, path, addr, pid) if fd < 0 raise SystemCallError.new(Fiddle.last_error) end Util.debug "Attach: #{ev_name}" @uprobe_fds[ev_name] = fd [ev_name, fd] end |
#attach_uretprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1)) ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/rbbcc/bcc.rb', line 353 def attach_uretprobe(name: "", sym: "", addr: nil, fn_name: "", pid: -1) path, addr = BCC.check_path_symbol(name, sym, addr, pid) fn = load_func(fn_name, BPF::KPROBE) ev_name = to_uprobe_evname("r", path, addr, pid) fd = Clib.bpf_attach_uprobe(fn[:fd], 1, ev_name, path, addr, pid) if fd < 0 raise SystemCallError.new(Fiddle.last_error) end Util.debug "Attach: #{ev_name}" @uprobe_fds[ev_name] = fd [ev_name, fd] end |
#cleanup ⇒ Object
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/rbbcc/bcc.rb', line 473 def cleanup @kprobe_fds.each do |k, v| detach_kprobe_event(k) end @uprobe_fds.each do |k, v| detach_uprobe_event(k) end @tracepoint_fds.each do |k, v| detach_tracepoint(k) end @raw_tracepoint_fds.each do |k, v| detach_raw_tracepoint(k) end if @module Clib.bpf_module_destroy(@module) end end |
#detach_kprobe_event(ev_name) ⇒ Object
396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/rbbcc/bcc.rb', line 396 def detach_kprobe_event(ev_name) unless @kprobe_fds.keys.include?(ev_name) raise "Event #{ev_name} not registered" end if Clib.bpf_close_perf_event_fd(@kprobe_fds[ev_name]) < 0 raise SystemCallError.new(Fiddle.last_error) end if Clib.bpf_detach_kprobe(ev_name) < 0 raise SystemCallError.new(Fiddle.last_error) end @kprobe_fds.delete(ev_name) end |
#detach_raw_tracepoint(tp) ⇒ Object
384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/rbbcc/bcc.rb', line 384 def detach_raw_tracepoint(tp) unless @raw_tracepoint_fds.keys.include?(tp) raise "Raw tracepoint #{tp} is not attached" end begin File.for_fd(@raw_tracepoint_fds[tp]).close rescue => e warn "Closing fd failed: #{e.inspect}. Ignore and skip" end @tracepoint_fds.delete(tp) end |
#detach_tracepoint(tp) ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/rbbcc/bcc.rb', line 368 def detach_tracepoint(tp) unless @tracepoint_fds.keys.include?(tp) raise "Tracepoint #{tp} is not attached" end res = Clib.bpf_close_perf_event_fd(@tracepoint_fds[tp]) if res < 0 raise "Failed to detach BPF from tracepoint" end tp_category, tp_name = tp.split(':') res = Clib.bpf_detach_tracepoint(tp_category, tp_name) if res < 0 raise "Failed to detach BPF from tracepoint" end @tracepoint_fds.delete(tp) end |
#detach_uprobe_event(ev_name) ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/rbbcc/bcc.rb', line 409 def detach_uprobe_event(ev_name) unless @uprobe_fds.keys.include?(ev_name) raise "Event #{ev_name} not registered" end if Clib.bpf_close_perf_event_fd(@uprobe_fds[ev_name]) < 0 raise SystemCallError.new(Fiddle.last_error) end if Clib.bpf_detach_uprobe(ev_name) < 0 raise SystemCallError.new(Fiddle.last_error) end @uprobe_fds.delete(ev_name) end |
#gen_args_from_usdt ⇒ Object
256 257 258 259 260 261 262 263 264 |
# File 'lib/rbbcc/bcc.rb', line 256 def gen_args_from_usdt ptr = Clib.bcc_usdt_genargs(@usdt_contexts.map(&:context).pack('J*'), @usdt_contexts.size) code = "" if !ptr || ptr.null? return nil end Clib.__extract_char ptr end |
#get_syscall_fnname(name) ⇒ Object
544 545 546 |
# File 'lib/rbbcc/bcc.rb', line 544 def get_syscall_fnname(name) get_syscall_prefix + name end |
#get_syscall_prefix ⇒ Object
535 536 537 538 539 540 541 542 |
# File 'lib/rbbcc/bcc.rb', line 535 def get_syscall_prefix SYSCALL_PREFIXES.each do |prefix| if ksymname("%sbpf" % prefix) return prefix end end SYSCALL_PREFIXES[0] end |
#get_table(name, keytype: nil, leaftype: nil, reducer: nil) ⇒ Object
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'lib/rbbcc/bcc.rb', line 496 def get_table(name, keytype: nil, leaftype: nil, reducer: nil) map_id = Clib.bpf_table_id(@module, name) map_fd = Clib.bpf_table_fd(@module, name) raise KeyError, "map not found" if map_fd < 0 unless keytype key_desc = Clib.bpf_table_key_desc(@module, name) raise("Failed to load BPF Table #{name} key desc") if key_desc.null? keytype = BCC.decode_table_type(eval(key_desc.to_extracted_char_ptr)) end unless leaftype leaf_desc = Clib.bpf_table_leaf_desc(@module, name) raise("Failed to load BPF Table #{name} leaf desc") if leaf_desc.null? leaftype = BCC.decode_table_type(eval(leaf_desc.to_extracted_char_ptr)) end return Table.new(self, map_id, map_fd, keytype, leaftype, name, reducer: reducer) end |
#ksymname(name) ⇒ Object
531 532 533 |
# File 'lib/rbbcc/bcc.rb', line 531 def ksymname(name) SymbolCache.resolve_global(name) end |
#load_func(func_name, prog_type, device: nil) ⇒ Object
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/rbbcc/bcc.rb', line 266 def load_func(func_name, prog_type, device: nil) if @funcs.keys.include?(func_name) return @funcs[func_name] end log_level = 0 fd = Clib.do_bcc_func_load(@module, prog_type, func_name, Clib.bpf_function_start(@module, func_name), Clib.bpf_function_size(@module, func_name), Clib.bpf_module_license(@module), Clib.bpf_module_kern_version(@module), log_level, nil, 0, device); if fd < 0 raise SystemCallError.new(Fiddle.last_error) end fnobj = {fd: fd, name: func_name} @funcs[func_name] = fnobj return fnobj end |
#num_open_kprobes ⇒ Object
422 423 424 |
# File 'lib/rbbcc/bcc.rb', line 422 def num_open_kprobes @kprobe_fds.size end |
#num_open_tracepoints ⇒ Object
430 431 432 |
# File 'lib/rbbcc/bcc.rb', line 430 def num_open_tracepoints @tracepoint_fds.size end |
#num_open_uprobes ⇒ Object
426 427 428 |
# File 'lib/rbbcc/bcc.rb', line 426 def num_open_uprobes @uprobe_fds.size end |
#perf_buffer_poll(timeout = -1)) ⇒ Object
524 525 526 527 528 529 |
# File 'lib/rbbcc/bcc.rb', line 524 def perf_buffer_poll(timeout=-1) readers = self.perf_buffers.values readers.each {|r| r.size = Clib::PerfReader.size } pack = readers.map{|r| r[0, Clib::PerfReader.size] }.pack('p*') Clib.perf_reader_poll(readers.size, pack, timeout) end |
#trace_fields(&do_each_line) ⇒ Object
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/rbbcc/bcc.rb', line 454 def trace_fields(&do_each_line) ret = [] while buf = trace_readline next if buf.start_with? "CPU:" task = buf[0..15].lstrip() , _addr, msg = buf[17..-1].split(": ", 3) pid, cpu, flags, ts = .split(" ") cpu = cpu[1..-2] if do_each_line do_each_line.call(task, pid, cpu, flags, ts, msg) else ret = [task, pid, cpu, flags, ts, msg] break end end ret end |
#trace_print(fmt: nil) ⇒ Object
442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/rbbcc/bcc.rb', line 442 def trace_print(fmt: nil) loop do if fmt # TBD else line = trace_readline end puts line $stdout.flush end end |
#trace_readline ⇒ Object
438 439 440 |
# File 'lib/rbbcc/bcc.rb', line 438 def trace_readline tracefile.readline(1024) end |
#tracefile ⇒ Object
434 435 436 |
# File 'lib/rbbcc/bcc.rb', line 434 def tracefile @tracefile ||= File.open("#{TRACEFS}/trace_pipe", "rb") end |