diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-01 23:17:29 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-01 23:17:29 -0500 |
commit | 2a4ac40341c5380228812180a09343dd787bad8b (patch) | |
tree | d4361ffcdee7537634c94f3eeb15cec31711afdc /tools/autodebugger_c.py | |
parent | 86c668e53bfd657b6164b9821fc58ba23c23cebc (diff) |
improve c autodebugger
Diffstat (limited to 'tools/autodebugger_c.py')
-rw-r--r-- | tools/autodebugger_c.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/autodebugger_c.py b/tools/autodebugger_c.py index 5d41faf0..54a4d691 100644 --- a/tools/autodebugger_c.py +++ b/tools/autodebugger_c.py @@ -21,9 +21,13 @@ for filename in filenames: if m and (' if ' not in lines[i-1] or '{' in lines[i-1]) and \ (' if ' not in lines[i+1] or '{' in lines[i+1]) and \ (' else' not in lines[i-1] or '{' in lines[i-1]) and \ - (' else' not in lines[i+1] or '{' in lines[i+1]): - var = m.groups(1)[0].rstrip().split(' ')[-1] - lines[i] += ''' printf("%s:%d:%s=%%d\\n", %s);''' % (filename, i+1, var, var) + (' else' not in lines[i+1] or '{' in lines[i+1]) and \ + (' for' not in lines[i-1]) and \ + ('struct' not in lines[i]): + raw = m.groups(1)[0].rstrip() + var = raw.split(' ')[-1] + if ' ' in raw and '[' in var: continue + lines[i] += ''' printf("%s:%d:%s=%%d\\n", (int)%s);''' % (filename, i+1, var, var) f = open(filename, 'w') f.write('\n'.join(lines)) |