Semantic stack trace
AssigneeFacebook, Inc.
InventorsAlexey Spiridonov, William Jacobs
Life of this patent
Estimating the term…
Abstract
The present disclosure provides methods and systems for instrumenting a “semantic stack trace” (SST), where semantic information and dependency relationships between a plurality of code elements (“elements”) are captured during runtime execution of various front-end declarative languages, and are subsequently extracted for display in a SST-enabled interactive user interface with traversing capability. Embodiments of the present invention enable a framework for traversing and debugging complex code, providing an unprecedented lens into understanding code behavior in mixed imperative and declarative construction languages.
Claims19
A method comprising:
- recording into a first node a mapping of a current stack trace in response to an execution of a first instruction for constructing a first element of a plurality of elements in a computer program, wherein the current stack trace is a stack trace that contains stack frames generated up to a particular point in the execution of code instructions in the computer program;
- storing the first node in a data structure suitable for a plurality of nodes;
- incrementally updating the first node by recording into the first node a first updated mapping of the current stack trace in response to the execution of a first subsequent instruction having the first element as a parameter;
- recording into a second node the mapping of the current stack trace in response to the execution of a second instruction for constructing a second element of the plurality of elements in the computer program;
- storing the second node in the data structure, wherein the second node comprises:
- a portion of the mapping of the current stack trace;
- and
- a pointer to the first node;
- incrementally updating the second node by recording into the second node a second updated mapping of the current stack trace in response to the execution of a second subsequent instruction having the second element as the parameter;
- and
- generating a node string from the plurality of nodes, including at least the first node and the second node, in response to a determination that no additional instruction for constructing an element exists.
A method comprising:
- recording into a first node a current stack trace mapping in response to an executed first instruction for constructing a first element of a plurality of elements in a computer program, wherein the first node is stored in a data structure containing a plurality of nodes;
- incrementally updating the first node with a first updated current stack trace mapping in response to an executed first subsequent instruction for rendering the first element, wherein the first updated current stack trace mapping produces a semantic stack trace associated with the first element;
- recording into a second node a current stack trace mapping in response to an executed second instruction for constructing a second element of the plurality of elements in the computer program, wherein the second node, stored in the data structure containing the plurality of nodes, comprises:
- a portion of the mapping of the current stack trace;
- a pointer to the first node;
- and
- incrementally updating the second node with a second updated current stack trace mapping in response to an executed second subsequent instruction for the rendering of the second element, wherein the second updated current stack trace mapping recorded in the second node produces the semantic stack trace associated with the second element, the second element being associated with the first element in the semantic stack trace.
A method comprising:
- receiving a hover request of a document object model (DOM) element on an interactive user interface;
- determining, from a semantic stack trace, a corresponding set of elements related to the DOM element, wherein the corresponding set comprises an origins subset and a dependents subset;
- generating, in response to the hover request, a dynamic display containing the origins subset, wherein the origins subset contains a plurality of elements sequentially linked according to their respective relationship toward creation of the DOM element;
- receiving a first inspection request for viewing details of the origins subset;
- generating, in response to the first inspection request, a dependency graph displaying hierarchical dependencies among the corresponding set of elements related to the DOM element;
- receiving a second inspection request for viewing a particular element of the corresponding set;
- and
- generating, in response to the second inspection request, a corresponding semantic stack trace comprising stack frames corresponding to the particular element.
A computer-implemented system comprising:
- a computer program product for profiling an executing program, the product comprising:
- first instructions for performing element-construction profiling of a plurality of elements in the executing program by recording into a node a current stack trace mapping comprising stack frames associated with a construction of each of the plurality of elements by the executing program;
- second instructions for updating the current stack trace mapping in the node by recording the current stack trace mapping comprising of stack frames associated with routines of the executing program that are executed after the construction of each of the plurality of elements, wherein the routines correspond to each element of the plurality of elements;
- third instructions for generating, for the plurality of elements, an interactive user interface comprising a dynamic display, a dependency graph;
- and a corresponding semantic stack trace display;
- the interactive user interface comprising:
- the dynamic display generated upon receiving a hover request of a document object model (DOM) element on the user interface, wherein the dynamic display contains an origins subset of elements;
- the dependency graph generated upon receiving a first inspection request for viewing the origins subset of elements, wherein the dependency graph contains the origins subset of elements and a dependents subset of elements;
- the corresponding semantic stack trace display comprising a corresponding semantic stack trace generated upon receiving a second inspection request for viewing a particular element in the dependency graph.
The system of 16, wherein the origins subset comprises an origins subset containing a plurality of parent elements that are sequentially linked according to their respective relationship toward creation of the DOM element, the plurality of parent elements determined from a corresponding set of elements associated with the DOM element.
The system of 16, wherein the dependents subset contains a plurality of child elements dependent on the DOM element, the plurality of child elements determined from a corresponding set of elements associated with the DOM element.
The system of 16, wherein the semantic stack trace display comprises a corresponding semantic stack trace containing stack frames that correspond to the particular element requested.
Dependencies are inferred from the claim text.