From 67a644bc2a51cbe5eda991614d749b1368ac7077 Mon Sep 17 00:00:00 2001 From: Sasha Goldshtein Date: Sun, 27 Mar 2016 01:44:26 -0700 Subject: [PATCH] Fixed bug around local assignment from char array --- src/python/bcc/tracepoint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python/bcc/tracepoint.py b/src/python/bcc/tracepoint.py index c2b0665..57807a8 100644 --- a/src/python/bcc/tracepoint.py +++ b/src/python/bcc/tracepoint.py @@ -147,6 +147,11 @@ struct %s { def _generate_struct_locals(self): text = "" for field_type, field_name in self.struct_fields: + if field_type == "char" and field_name.endswith(']'): + # Special case for 'char whatever[N]', should + # be assigned to a 'char *' + field_type = "char *" + field_name = re.sub(r'\[\d+\]$', '', field_name) text += " %s %s = tp.%s;\n" % ( field_type, field_name, field_name) return text -- 2.7.4