Method for locating errors in a computer program
AssigneeHewlett-Packard Company
InventorsWade Satterfield, John Diamant, Timothy J. Duesing
Life of this patent
Estimating the term…
Abstract
A system that automatically detects logical errors when compiling a program. The system detects such logical errors as a signal handler routine modifying the errno global variable, a signal handler routine calling a non-reentrant library function, a signal handler routine calling a non-reentrant user function, and a signal handler routine calling a memory allocation function without first disabling all other signal handlers. The system also detects using "/n" at the end of a string.
Claims21
A method for indicating logical errors within a computer program, said method comprising the steps of:
- (a) building a list of signal handler functions contained within said computer program;
- (b) for each function in said list built in step (a) performing the following steps (b1) through (b4)
- (b1) searching all symbols of said signal handler function for both a use of a global error variable and a modification of said global error variable;
- (b2) when step (b1) finds both a use and a modification of said global error variable. returning an indication of no potential error;
- (b3) searching said signal handler function for a call to a second function that modifies said global error variable;
- and
- (b4) when step (b3) finds a call to said second function that modifies said global error variable, warning of a potential error in said signal handler function;
- (c) retrieving a symbol contained within said computer program;
- (d) matching a kind of said symbol with a kind of symbol processed by each rule of a plurality of rules;
- (e) when said kind of said symbol matches a kind of symbol processed by a selected rule of said plurality of rules, performing said selected rule for said symbol;
- (f) when said selected rule indicates that a potential error is present within said computer program, warning of a potential error in said computer program.
A method for indicating logical errors within a computer program, said method comprising the steps of:
- (a) building a list of signal handler functions contained within said computer program;
- (b) for each function in said list built in step (a), performing the steps of:
- (b1) searching all symbols of said signal handler function for both a use of a global error variable and a modification of said global error variable;
- (b2) when step (b1) finds both a use and a modification of said global error variable, returning an indication of no error;
- (b3) searching said signal handler function for a call to a second function that modifies said global error variable;
- and
- (b4) when step (b3) finds a call to said second function that modifies said global error variable, warning of a potential error in said computer program.
A method for indicating logical errors within a computer program, said method comprising the steps of:
- (a) examining each function within a library of functions and creating a non-reentrant list containing each function within said library that is not a reentrant function;
- (b) building a signal handler function list of signal handler functions contained within said computer program;
- and
- (c) for each signal handler function in said signal handler function list, performing the steps of (c1) searching said signal handler function for a call to a second function contained in said nonreentrant list, and
- (c2) when step (c1) finds a call to said second function, warning of a potential error in said computer program.
A method for indicating logical errors within a computer program, said method comprising the steps of:
- (a) retrieving a symbol contained within said computer program;
- and
- (b) when a kind of said symbol is a function, performing the steps of
- (b1) searching said function for programming statements that indicate that said function is not a reentrant function,
- (b2) searching all symbols of said function for a modification of a global variable,
- (b3) when step (b1) finds no indication that said function is not a reentrant function, and step (b2) finds no modification of a global variable, continuing with step (a),
- (b4) locating all signal handler functions within said computer program,
- (b5) searching each of said signal handler functions found in step (b4) for a call to said function, and
- (b6) when step (b5) finds a signal handler function that calls said function, warning of a potential error in said computer program.
A method for indicating logical errors within a computer program, said method comprising the steps of.
- (a) examining each function within a library of functions and creating a function list of each function within said library that allocates memory from a dynamic resource allocation pool;
- (b) searching said program for statements that prevent an error when a call is made to allocate memory from said dynamic resource allocation pool;
- (c) when step (b) finds statements within said program hat prevent an error when a call is made to allocate memory from said dynamic resource allocation pool, indicating no potential error;
- (d) building a signal handler list of signal handler functions contained within said computer program;
- and
- (e) for each signal handler function in said signal handler list, performing the steps of:
- (e1) searching said signal handler function for a call to a second function contained in said function list;
- and
- (e2) when step (e1) finds a call to said second function, and step (c) did not find statements that prevent an error when a call to allocate memory from said dynamic resource allocation pool, warning of potential error in said computer program.
Dependencies are inferred from the claim text.