Method and device for debugging lua based on gdb, equipment and storage medium

A memory and stack technology, applied in the field of debugging lua based on gdb, can solve the problem of not being able to see the code logic, etc., and achieve the effect of fast and effective replay

Active Publication Date: 2021-01-05
SUZHOU EAGLE NETWORK TECH CO LTD
View PDF7 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] Gdb is a debugging tool, which reads the C language level of the virtual machine, and cannot see the actual code logic
In this field, online games (online games) are well known. Online games can be divided into client games, page games, and mobile client games (i.e. mobile games). In the development process of online games, the main logic of some game engines The program is written in lua. Since lua itself is parasitic on the C++ engine, when the program crashes, you can only see the logic at the C++ level. How to view the logic edited with lua from the crashed file? Where is the problem, there is no better way to achieve it

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for debugging lua based on gdb, equipment and storage medium
  • Method and device for debugging lua based on gdb, equipment and storage medium
  • Method and device for debugging lua based on gdb, equipment and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0037] Such as figure 1 As shown, a method for debugging lua based on gdb is provided, including the following steps:

[0038] S1: Print the lua stack and get function parameters;

[0039] S2: Print the corresponding relationship between the current JIT code and the source code;

[0040] S3: Print the total memory consumed by current luajit.

[0041] Among them, the above S1-S3 steps all need to obtain lua-state from gdb, and when gdb prints the stack, it will list the function stack and function parameters, and the lua state will be seen from the stack traceback. By printing the lua stack to obtain function parameters; printing the corresponding relationship between the current jit code and the source code; printing the total memory consumed by the current luajit, etc., to establish a method of debugging lua based on gdb, which effectively overcomes the gdb can only Seeing things at the virtual machine level, but not seeing the technical problems of the actual code logic, ...

Embodiment 2

[0043] Such as figure 2 As shown, print the stack and get function parameters, including the following steps:

[0044] S101: Obtain lua-state from gdb.

[0045] Specifically, when gdb prints the stack, it will list the function stack and function parameters, and the lua state will be seen from the stack traceback.

[0046] S102: Obtain a start frame and an end frame, and start traversing from the start frame.

[0047] Specifically, after getting the lua state, you can write an access expression according to its memory layout, and you can access the start frame and end frame. The memory layout can be obtained according to the source code. For example, lua will store the call relationship of the function in the CallInfo array of lua_State, the start frame is the member ci of lua_State, and the end frame is the member base_ci of lua_State.

[0048] S103: Determine whether the end frame is reached, specifically by comparing it with the base_ci member of lua_State. If yes, th...

Embodiment 3

[0050] Such as image 3 As shown, print the lua stack, specifically including:

[0051] S11: Obtain lua-state from gdb.

[0052] Specifically, when gdb prints the stack, it will list the function stack and function parameters, and the lua state will be seen from the stack traceback.

[0053] S12: Obtain the start frame and end frame, and start traversing from the start frame.

[0054]Specifically, after getting the lua state, you can write an access expression according to its memory layout, and you can access the start frame and end frame. The memory layout can be obtained according to the source code. For example, lua will store the call relationship of the function in the CallInfo array of lua_State, the start frame is the member ci of lua_State, and the end frame is the member base_ci of lua_State.

[0055] S13: Determine whether the end frame is reached. Specifically, it is compared with the base_ci member of lua_State.

[0056] S14: If not, obtain the lua function ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for debugging lua based on gdb, and the method comprises the following steps: printing a lua stack, and obtaining a function parameter; printing the corresponding relationship between the current jit code and the source code; and printing the total memory consumed by the current luajit. The method comprises steps: printing a lua stack to obtain the function parameters; and printing the corresponding relationship between the current jit code and the source code. According to the method, a method for debugging lua based on gdb is established in such a manner thatthe total memory consumed by the current luajit is printed, the technical problem that the gdb can only see things on the virtual machine level and cannot see actual code logic is effectively solved,and the source code can be obtained by applying the method disclosed by the invention. Developers can conveniently and quickly check where the logic edited by lua finally goes wrong from the collapsed file, and then disk replication can be quickly and effectively carried out.

Description

technical field [0001] The present application relates to the technical field of computer internet, in particular to a method, device, equipment and storage medium for debugging lua based on gdb. Background technique [0002] Gdb is a debugging tool, which reads the C language level of the virtual machine, and cannot see the actual code logic. In this field, online games (online games) are well known. Online games can be divided into client games, page games, and mobile client games (i.e. mobile games). In the development process of online games, the main logic of some game engines The program is written in lua. Since lua itself is parasitic on the C++ engine, when the program crashes, you can only see the logic at the C++ level. How to view the logic edited with lua from the crashed file? Where is the problem, there is currently no better way to achieve it. Contents of the invention [0003] The object of the present invention is to provide a method, device, equipment a...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F11/36
CPCG06F11/3624
Inventor宋大伟李拓陈建华
OwnerSUZHOU EAGLE NETWORK TECH CO LTD