examples: Make some improvements for stacksnoop.py
diff --git a/examples/tracing/stacksnoop.py b/examples/tracing/stacksnoop.py
index 827c1c1..b08eac9 100755
--- a/examples/tracing/stacksnoop.py
+++ b/examples/tracing/stacksnoop.py
@@ -13,7 +13,6 @@
 from __future__ import print_function
 from bcc import BPF
 import argparse
-import ctypes as ct
 import time
 
 # arguments
@@ -79,13 +78,6 @@
 
 TASK_COMM_LEN = 16  # linux/sched.h
 
-class Data(ct.Structure):
-    _fields_ = [
-        ("stack_id", ct.c_ulonglong),
-        ("pid", ct.c_uint),
-        ("comm", ct.c_char * TASK_COMM_LEN),
-    ]
-
 matched = b.num_open_kprobes()
 if matched == 0:
     print("Function \"%s\" not found. Exiting." % function)
@@ -102,18 +94,18 @@
     print("%-18s %s" % ("TIME(s)", "FUNCTION"))
 
 def print_event(cpu, data, size):
-    event = ct.cast(data, ct.POINTER(Data)).contents
+    event = b["events"].event(data)
 
     ts = time.time() - start_ts
 
     if verbose:
         print("%-18.9f %-12.12s %-6d %-3d %s" %
-              (ts, event.comm.decode(), event.pid, cpu, function))
+              (ts, event.comm.decode('utf-8', 'replace'), event.pid, cpu, function))
     else:
         print("%-18.9f %s" % (ts, function))
 
     for addr in stack_traces.walk(event.stack_id):
-        sym = b.ksym(addr, show_offset=offset)
+        sym = b.ksym(addr, show_offset=offset).decode('utf-8', 'replace')
         print("\t%s" % sym)
 
     print()
diff --git a/examples/tracing/vfsreadlat.py b/examples/tracing/vfsreadlat.py
index b2c4156..4fbfded 100755
--- a/examples/tracing/vfsreadlat.py
+++ b/examples/tracing/vfsreadlat.py
@@ -17,7 +17,6 @@
 
 from __future__ import print_function
 from bcc import BPF
-from ctypes import c_ushort, c_int, c_ulonglong
 from time import sleep
 from sys import argv