Call-Stack Frame Retrieval Using Direct Memory Structures

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for obtaining detailed information about a stack frame in a call stack, such as method names and source code line numbers, are either limited in the information they provide or require complex and unstable underlying technologies with compatibility issues across different system versions.

Innovation Solution

A method and apparatus that involve applying for specific memory areas to store method pointers and instruction offset values in a controlled manner, followed by using a stack frame information obtaining functional module to retrieve detailed information like method names, class names, and source code line numbers, ensuring stability and compatibility across system versions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of information

If PrettyMethod function is used to obtain method information, then method name can be obtained, but source code line number cannot be obtained

Engineering Contradiction:
Improvemethod information completenessVSAvoidinformation retrieval complexity
Core Design Contradiction:
Loss of informationVSDevice complexity

Solution Approach 1:

The patent segments the information retrieval process into distinct components: method pointer extraction, instruction offset value extraction, and separate lookup operations for method names and line numbers. This segmentation allows each component to be optimized independently and resolves the contradiction by enabling complete information retrieval without increasing overall system complexity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces intermediary data structures (such as method ID tables and line number tables) that act as mediators between the raw stack trace data and the final information output. These intermediaries enable efficient lookup and retrieval of both method names and line numbers, resolving the limitation of the PrettyMethod function while maintaining system simplicity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of information

If underlying technologies are used to obtain dex_file information, then class name and method name can be obtained, but implementation becomes complex and stability is difficult to guarantee

Engineering Contradiction:
Improvestack frame information completenessVSAvoidsystem compatibility stability
Core Design Contradiction:
Loss of informationVSReliability

Solution Approach 1:

The patent extracts the essential information (method pointers and instruction offset values) directly from the stack trace without relying on complex underlying technologies or dex_file parsing. By taking out only the necessary data elements and processing them through simplified lookup tables, the patent achieves complete information retrieval while ensuring stability and compatibility across different system versions.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent uses lightweight, version-agnostic data structures and lookup tables that can be easily created and discarded, rather than relying on heavy, version-dependent underlying technologies. This approach ensures reliability across system versions while maintaining implementation simplicity.

Inventive Principle:
Principle #27Cheap short-living objects (Disposable)

3Loss of information

If multiple underlying technologies are required to obtain detailed information, then information completeness improves, but adaptability workload increases

Engineering Contradiction:
Improvedetail information completenessVSAvoidsystem version adaptability
Core Design Contradiction:
Loss of informationVSAdaptability or versatility

Solution Approach 1:

The patent creates a universal information retrieval mechanism that works across different system versions using the same core approach. The method uses standardized lookup tables and direct extraction techniques that are version-agnostic, providing complete information without requiring adaptation to different system versions, thus resolving the contradiction between information completeness and adaptability workload.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS12443475B2Method and apparatus for obtaining information of stack frame in call stack, device, and medium
Publication Date: 2025.10.14 DOUYIN VISION CO LTD
  • US12443475B2 patent drawing
  • US12443475B2 patent drawing
  • US12443475B2 patent drawing

AI summary

Provided are a method and apparatus for obtaining information of a stack frame in a call stack, a device, and a medium. The method includes: obtaining to-be-processed call stack with an abnormality during running of a program, each area element of the to-be-processed call stack including a method pointer and corresponding instruction offset value; applying for a first memory area used to store the method pointer and the corresponding instruction offset value; applying for a second memory area, and storing an address of the first memory area into a first area element in the second memory area; applying for a third memory area, and storing an address of the second memory area into a target storage area in the third memory area; and obtaining information of each stack frame in the to-be-processed call stack based on the address of the second memory area stored in the target storage area.