Avoid all systemtap reserved words
Over time various systemtap reserved words have been blacklisted in the trace backend generator. The list is not complete though, so there is continued risk of problems in the future. Preempt such problems by specifying the full list of systemtap keywords listed in its parser as identified here: http://sourceware.org/ml/systemtap/2012-q4/msg00157.html Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
		
				
					committed by
					
						
						Stefan Hajnoczi
					
				
			
			
				
	
			
			
			
						parent
						
							6801038bc5
						
					
				
				
					commit
					81dee729c1
				
			@@ -73,6 +73,15 @@ def d(events):
 | 
			
		||||
        '};')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Technically 'self' is not used by systemtap yet, but
 | 
			
		||||
# they recommended we keep it in the reserved list anyway
 | 
			
		||||
RESERVED_WORDS = (
 | 
			
		||||
    'break', 'catch', 'continue', 'delete', 'else', 'for',
 | 
			
		||||
    'foreach', 'function', 'global', 'if', 'in', 'limit',
 | 
			
		||||
    'long', 'next', 'probe', 'return', 'self', 'string',
 | 
			
		||||
    'try', 'while'
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
def stap(events):
 | 
			
		||||
    for e in events:
 | 
			
		||||
        # Define prototype for probe arguments
 | 
			
		||||
@@ -87,7 +96,7 @@ def stap(events):
 | 
			
		||||
        if len(e.args) > 0:
 | 
			
		||||
            for name in e.args.names():
 | 
			
		||||
                # Append underscore to reserved keywords
 | 
			
		||||
                if name in ('limit', 'in', 'next', 'self', 'function'):
 | 
			
		||||
                if name in RESERVED_WORDS:
 | 
			
		||||
                    name += '_'
 | 
			
		||||
                out('  %s = $arg%d;' % (name, i))
 | 
			
		||||
                i += 1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user