mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	lib: Make igt_assert() abort under gdb
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									398be7d573
								
							
						
					
					
						commit
						2a37b1d78e
					
				@ -894,12 +894,23 @@ void igt_fail(int exitcode)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool run_under_gdb(void)
 | 
			
		||||
{
 | 
			
		||||
	char buf[1024];
 | 
			
		||||
 | 
			
		||||
	sprintf(buf, "/proc/%d/exe", getppid());
 | 
			
		||||
	return (readlink (buf, buf, sizeof (buf)) != -1 &&
 | 
			
		||||
		strncmp (basename (buf), "gdb", 3) == 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __igt_fail_assert(int exitcode, const char *file,
 | 
			
		||||
		       const int line, const char *func, const char *assertion)
 | 
			
		||||
{
 | 
			
		||||
	printf("Test assertion failure function %s, file %s:%i:\n"
 | 
			
		||||
	       "Failed assertion: %s\n",
 | 
			
		||||
	       func, file, line, assertion);
 | 
			
		||||
	if (run_under_gdb())
 | 
			
		||||
		abort();
 | 
			
		||||
	igt_fail(exitcode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user