This application discloses a memory debugging method and apparatus, belonging to the technical field of computer and embedded devices. The memory debugging method includes: responding to a query command from an external program,
parsing the variable hierarchy name in the query command to obtain the variable object name; searching in a variable object registry based on the variable object name to obtain the corresponding variable object information, which includes at least the variable object
memory address and the variable object
data type name; searching in a variable type registry based on the variable object
data type name to obtain the corresponding
data type information; calculating the actual
memory address of the variable object; and generating a feedback command based on the actual
memory address and data type information and sending it to the external program. By
parsing the variable hierarchy name to extract the variable object name and searching in the variable object registry and variable type registry, inconsistencies between the tables and the program can be avoided, preventing abnormal query results.