IP Library Granted Patent US 11,182,272
Granted Patent B2
US 11,182,272 · App. 15/955,160 · Granted Nov 23, 2021

Application state monitoring

Inventors: Zheng Chen (Shanghai, CN); Jinsong Ji (Ponte Vedra, FL); Ke Wen Lin (Shanghai, CN); Qing Shan Zhang (Shanghai, CN)
Assignee: International Business Machines Corporation
G06F11/364G06F8/44
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,182,272
App. No.
15/955,160
Granted
Nov 23, 2021
Kind
B2
Abstract

Embodiments of the present disclosure relate to methods, systems, and computer program products for monitoring a state of an application. A target object that is to be monitored in an application may be determined in response to receiving a monitoring configuration. A position of the target object in source codes of the application may be identified. A state of the target object may be monitored in response to the application being traced to a location corresponding to the position.

Claims (56)

1. A computer program product for detecting bugs in an application, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a processor to cause the processor to perform a method comprising:

receiving a monitoring configuration file that defines one or more aspects of an application to monitor during execution of the application, wherein the monitoring configuration file includes a scope to be monitored and a variable to be monitored;

parsing the monitoring configuration file to determine a target object that is to be monitored;

identifying a plurality of positions of the target object in the source code of the application, wherein identifying the plurality of positions comprises:

analyzing the source code to identify one or more trace scopes in the source code based on the monitoring configuration file;

identifying, within at least one trace scope, a plurality of variables that includes a first variable and a second variable;

determining that the first variable is the variable to be monitored included in the monitoring configuration file;

determining that the second variable is an alias of the variable to be monitored included in the monitoring configuration file; and

determining that the plurality of positions includes the positions in the source code that (i) include at least one of the first or second variables, and (ii) are within at least one trace scope;

analyzing, without executing the source code, one or more lines of code at each of the plurality of positions to determine whether the one or more lines of code at each respective position change a state of the target object;

determining, based on the analyzing, a first set of positions of the plurality of positions, wherein the first set of positions includes one or more positions having lines of code that change the state of the target object; and

inserting a logging command at each position of the first set of positions.

2. The computer program product of claim 1 , wherein the monitoring configuration file includes a rule that only positions in the source code that will be called during execution of the application are monitored, and wherein determining the first set of positions comprises:

analyzing the source code to determine that one or more lines of code at a first position of the plurality of positions will not be called during execution of the application; and

omitting, from the first set of positions, the first position even if the one or more lines of code at the first position change the state of the target object.

3. The computer program product of claim 1 , wherein the plurality of positions further includes a second set of positions, wherein the second set of positions includes one or more positions having lines of code that do not change the state of the target object, wherein the method is performed by a compiler, and wherein determining the first set of positions comprises:

analyzing, by the compiler, the source code to determine whether the target object at a first position of the plurality of positions is alive at the first position, wherein the target object is considered alive at a given position if the target object could be read after the given position and before the target object is modified again; and

omitting, from the first set of positions, in response to determining that the target object in not alive at the first position, the first position even if the one or more lines of code at the first position change the state of the target object.

4. A method comprising:

receiving a monitoring configuration file that defines one or more aspects of an application to monitor during execution of the application, wherein the monitoring configuration file includes a scope to be monitored and a variable to be monitored;

parsing the monitoring configuration file to determine a target object that is to be monitored;

identifying a plurality of positions of the target object in the source code of the application, wherein identifying the plurality of positions comprises:

analyzing the source code to identify one or more trace scopes in the source code based on the monitoring configuration file;

identifying, within at least one trace scope, a plurality of variables that includes a first variable and a second variable;

determining that the first variable is the variable to be monitored included in the monitoring configuration file;

determining that the second variable is an alias of the variable to be monitored included in the monitoring configuration file; and

determining that the plurality of positions includes the positions in the source code that (i) include at least one of the first or second variables, and (ii) are within at least one trace scope;

analyzing, without executing the source code, one or more lines of code at each of the plurality of positions to determine whether the one or more lines of code at each respective position change a state of the target object;

determining, based on the analyzing, a first set of positions of the plurality of positions, wherein the first set of positions includes one or more positions having lines of code that change the state of the target object; and

inserting a logging command at each position of the first set of positions.

5. The method of claim 4 , wherein the monitoring configuration file includes a rule that only positions in the source code that will be called during execution of the application are monitored, and wherein determining the first set of positions comprises:

analyzing the source code to determine that one or more lines of code at a first position of the plurality of positions will not be called during execution of the application; and

omitting, from the first set of positions, the first position even if the one or more lines of code at the first position change the state of the target object.

6. The method of claim 4 , wherein the plurality of positions further includes a second set of positions, wherein the second set of positions includes one or more positions having lines of code that do not change the state of the target object, wherein the method is performed by a compiler, and wherein determining the first set of positions comprises:

analyzing, by the compiler, the source code to determine whether the target object at a first position of the plurality of positions is alive at the first position, wherein the target object is considered alive at a given position if the target object could be read after the given position and before the target object is modified again; and

omitting, from the first set of positions, in response to determining that the target object in not alive at the first position, the first position even if the one or more lines of code at the first position change the state of the target object.

7. A system comprising:

a computer-readable memory unit; and

a processor communicatively coupled to the computer-readable memory unit, the processor being configured to perform a method comprising:

receiving a monitoring configuration file that defines one or more aspects of an application to monitor during execution of the application, wherein the monitoring configuration file includes a scope to be monitored and a variable to be monitored;

parsing the monitoring configuration file to determine a target object that is to be monitored;

identifying a plurality of positions of the target object in the source code of the application, wherein identifying the plurality of positions comprises:

analyzing the source code to identify one or more trace scopes in the source code based on the monitoring configuration file;

identifying, within at least one trace scope, a plurality of variables that includes a first variable and a second variable;

determining that the first variable is the variable to be monitored included in the monitoring configuration file;

determining that the second variable is an alias of the variable to be monitored included in the monitoring configuration file; and

determining that the plurality of positions includes the positions in the source code that (i) include at least one of the first or second variables, and (ii) are within at least one trace scope;

analyzing, without executing the source code, one or more lines of code at each of the plurality of positions to determine whether the one or more lines of code at each respective position change a state of the target object;

determining, based on the analyzing, a first set of positions of the plurality of positions, wherein the first set of positions includes one or more positions having lines of code that change the state of the target object; and

inserting a logging command at each position of the first set of positions.

8. The system of claim 7 , wherein the monitoring configuration file includes a rule that only positions in the source code that will be called during execution of the application are monitored, and wherein determining the first set of positions comprises:

analyzing the source code to determine that one or more lines of code at a first position of the plurality of positions will not be called during execution of the application; and

omitting, from the first set of positions, the first position even if the one or more lines of code at the first position change the state of the target object.

9. The system of claim 7 , wherein the plurality of positions further includes a second set of positions, wherein the second set of positions includes one or more positions having lines of code that do not change the state of the target object, wherein the method is performed by a compiler, and wherein determining the first set of positions comprises:

analyzing, by the compiler, the source code to determine whether the target object at a first position of the plurality of positions is alive at the first position, wherein the target object is considered alive at a given position if the target object could be read after the given position and before the target object is modified again; and

omitting, from the first set of positions, in response to determining that the target object in not alive at the first position, the first position even if the one or more lines of code at the first position change the state of the target object.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 17, 2018
From: CHEN, ZHENG; JI, JINSONG; LIN, KE WEN; ZHANG, QING SHAN
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 045563/0320 →
Continuity (1)
Related Publication 20190317877A1 · Oct 17, 2019