Skip to content

Commit

Permalink
Merge pull request iovisor#449 from goldshtn/tp-str-fix
Browse files Browse the repository at this point in the history
Fixed bug around local assignment from char array
  • Loading branch information
drzaeus77 committed Mar 28, 2016
2 parents c256e94 + 67a644b commit af66546
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/python/bcc/tracepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ def generate_struct(self):
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
Expand Down

0 comments on commit af66546

Please sign in to comment.