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
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
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 ...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


