HAL log generation method, debugging method, device and storage medium

By injecting generation instructions into the HAL tool and compiling the HAL function to generate the target file, it solves the problem of the lack of debug logs for Android HAL services, and realizes efficient log automatic generation and problem positioning.

CN113986209BActive Publication Date: 2025-08-12SPREADTRUM SEMICON (NANJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111239859.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-25
Publication Date
2025-08-12
Estimated Expiration
2041-10-25

AI Technical Summary

Technical Problem

In the prior art, Android HAL services lack debug logs, which leads to difficulty in positioning problems and requires manual addition of logs for each HAL service owner, which is time-consuming and laborious.

Method used

By injecting the generated instructions into the target location of the HAL tool, the target file including the HAL function and the generated instructions is generated when compiling the HAL function, and the automatic generation of the HAL log is achieved.

Benefits of technology

Improves log injection efficiency, can locate the problem in which layer, which HAL or which method, and reduces the workload of manually adding logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986209B_ABST
    Figure CN113986209B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating a HAL log, a debugging method, a device, and a storage medium. The generating method comprises: obtaining a generating instruction for a HAL log; injecting the generating instruction into a first target position of a HAL tool; obtaining a target object; compiling the target object based on the HAL tool to generate a target file; and generating a HAL log when the target file is run. The present invention uses the HAL tool when compiling a HAL function in a target object, thereby injecting the generating instruction in the HAL tool into the HAL function to generate a target file including both the HAL function and the generating instruction. When the target file is run, a HAL log of the HAL function is simultaneously generated. The present invention no longer requires adding a log separately to the owner of each HAL. The interfaces of all HAL services are injected with the HAL log generating instruction, thereby improving the efficiency of log injection and realizing automatic log generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Android HAL layer processing, and in particular to a HAL log generation method, a debugging method, a device and a storage medium. Background Art

[0002] Since Android 8.0 (an Android operating system), Android HAL (Hardware Abstraction Layer) services (hereinafter referred to as HAL services) lack debug logs. Specifically, during compilation, the Android build system automatically generates different versions of source code for HAL services. These source codes contain the interface call methods for communication between the HAL service client and server. However, since these codes are automatically generated during compilation, no logs are generated.

[0003] The HAL service involves multiple layers during use, including the call layer, the middle layer, and the service layer. Due to the lack of logs in the current HAL service, it is very difficult to quickly locate which layer, which HAL, or which method in the HAL the problem occurs in.

[0004] Since there are many HAL services, the implementations of different HAL services are different and the formats are not unified, if you want to add logs for all HAL services, you need to add logs for each HAL service owner one by one, which is time-consuming and labor-intensive. Summary of the Invention

[0005] The following explains the terms that often appear in the embodiments for easier understanding:

[0006] [Definition of including] As used herein, the terms "having", "may have", "including" or "may include" indicate the existence of the corresponding functions, operations, elements, etc. of the present disclosure, and do not limit the existence of one or more other functions, operations, elements, etc. In addition, it should be understood that as used herein, the terms "including" or "having" indicate the existence of the features, numbers, steps, operations, elements, parts or their combination described in the specification, and do not exclude the existence or addition of one or more other features, numbers, steps, operations, elements, parts or their combination.

[0007] [Definition of and / or] As used herein, the terms "A or B", "at least one of A and / or B", or "one or more of A and / or B" include any and all combinations of the words listed therewith. For example, "A or B", "at least one of A and B", or "at least one of A or B" means (1) including at least one A, (2) including at least one B, or (3) including at least one A and at least one B.

[0008] [Definition of First and Second] The terms "first," "second," and so on, appearing in the embodiments of this application are for illustration and distinction purposes only. They are not in any order, do not represent a specific limit on the number of devices in the embodiments of this application, and do not constitute any limitation on the embodiments of this application. For example, a first element could be referred to as a second element without departing from the scope of this disclosure. Similarly, a second element could be referred to as a first element.

[0009] [Meaning of electronic device] The electronic device according to various embodiments of the present disclosure may include, for example, at least one of the following: a smartphone, a tablet personal computer (PC), a mobile phone, a video phone, an e-book reader, a desktop PC, a laptop PC, a netbook, a workstation, a server, a personal digital assistant (PDA), a portable multimedia player (PMP), an MP3 player, a mobile medical device, a camera, or a wearable device (e.g., a head-mounted device (HMD), electronic glasses, electronic clothing, electronic bracelets, electronic necklaces, electronic accessories, electronic tattoos, smart mirrors, or smart watches). In other embodiments, the electronic device may be a smart home appliance, such as a television (TV), a digital video disc (DVD) player, an audio component, a refrigerator, an air conditioner, a vacuum cleaner, an oven, a microwave oven, a dishwasher, an air purifier, a set-top box, a home automation control panel, a security control panel, a TV box, a game console, an electronic dictionary, an electronic key, a camcorder, or an electronic photo frame.

[0010] In other embodiments, the electronic device may include at least one of the following: a medical device (e.g., a mobile medical device (e.g., a blood glucose monitoring device, a heart rate monitor, a blood pressure monitoring device, or a thermometer)), a magnetic resonance angiography (MRA) machine, a magnetic resonance imaging (MRI) machine, a computed tomography (CT) scanner, or an ultrasound machine); a navigation device; a global positioning system (GPS) receiver; an event data recorder (EDR); a flight data recorder (FDR); an in-vehicle infotainment device; marine electronic equipment (e.g., a ship's navigation equipment and / or a gyrocompass); avionics equipment; security equipment; a car audio system; an industrial or home robot; an automated teller machine (ATM) at a financial institution; a point of sale (POS) device at a retail store; or an Internet of Things device (e.g., a light bulb, various sensors, electricity meters, gas meters, sprinklers, fire alarms, thermostats, street lights, toasters, sports equipment, thermoses, heaters, or water heaters, etc.).

[0011] In some embodiments, the electronic device may include at least one of a piece of furniture or building / structure, an electronic board, an electronic signature receiving device, a projector, and various measuring instruments (e.g., a water meter, an electricity meter, a gas meter, or a wave meter).

[0012] The electronic device according to various embodiments of the present disclosure may also include one or more combinations of the above-mentioned devices. Further, the electronic device according to various embodiments of the present disclosure is not limited to the above-mentioned devices, which will be obvious to those skilled in the art.

[0013] The technical problem to be solved by the present invention is to overcome the defect of the HAL service lacking logs in the prior art and to provide a HAL log generation method, debugging method, device and storage medium that can effectively and efficiently generate logs.

[0014] The present invention solves the above technical problems through the following technical solutions:

[0015] The present invention provides a method for generating a HAL log, the method comprising:

[0016] Get the HAL log generation instructions;

[0017] Injecting the generation instruction into a first target location of a HAL tool, wherein the HAL tool is a framework for automatically generating source code for a HAL service;

[0018] Acquire a target object, where the target object includes a HAL function, and the HAL function is a function used by the HAL layer;

[0019] Compile the target object based on the HAL tool to generate a target file, wherein the target file includes the HAL function and the generation instruction;

[0020] Get the HAL log while running the target file.

[0021] Preferably, the HAL tool includes a HIDL HAL (interface definition language HAL) tool and / or an AIDL HAL (Android Interface Definition Language) tool.

[0022] Preferably, the step of obtaining the HAL log generation instruction includes: obtaining different versions of HAL log generation instructions;

[0023] Injecting the generation instruction into the first target location of the HAL tool includes: injecting the generation instruction of the different versions of the HAL log into the first target location of the HAL tool.

[0024] Preferably, the step of compiling the target object based on the HAL tool to generate a target file includes:

[0025] Obtaining the HAL function in the target object through the HAL tool;

[0026] inserting the generate instruction into a second target location of the HAL function;

[0027] Generate a target file according to the HAL function and the generation instruction.

[0028] The present invention also provides a debugging method based on HAL log, which is applied to a receiving end and includes:

[0029] Generate a target HAL log according to the HAL log generation method described above;

[0030] receiving a target print instruction, the target print instruction being used to print a target HAL log, the target print instruction including a target service identifier, the target service identifier being used to match a corresponding HAL service;

[0031] Run the target file, and match and print the target HAL log according to the target printing instruction;

[0032] The target HAL service is debugged according to the target HAL log.

[0033] The present invention also provides a debugging method based on HAL log, which is applied to a sending end and includes:

[0034] Configure a target print instruction, the target print instruction is used to print a target HAL log, the target print instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service;

[0035] Send the target printing instruction to the receiving end.

[0036] The present invention also provides a HAL log generation device, which includes: an instruction acquisition module, an instruction injection module, an object acquisition module, a file generation module and a log acquisition module;

[0037] The instruction acquisition module is used to obtain the generation instruction of the HAL log;

[0038] The instruction injection module is used to inject the generated instruction into a first target location of a HAL tool, wherein the HAL tool is a framework for automatically generating source code for a HAL service;

[0039] The object acquisition module is used to acquire a target object, wherein the target object includes a HAL function, and the HAL function is a function used by the HAL layer;

[0040] The file generation module is used to compile the target object based on the HAL tool to generate a target file, wherein the target file includes the HAL function and the generation instruction;

[0041] The log acquisition module is used to obtain the HAL log when running the target file.

[0042] The present invention also provides a debugging device based on HAL log, which is applied to a receiving end and includes: a log generating module, an instruction receiving module, a file running module and a debugging module;

[0043] The log generation module is used to generate a target HAL log according to the HAL log generation method described above;

[0044] The instruction receiving module is used to receive a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service;

[0045] The file running module is used to run the target file and match and print the target HAL log according to the target printing instruction;

[0046] The debugging module is used to debug the target HAL service according to the target HAL log.

[0047] The present invention also provides a debugging device based on HAL log, which is applied to a sending end and includes: an instruction configuration module and an instruction sending module;

[0048] The instruction configuration module is used to configure a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service;

[0049] The instruction sending module is used to send the target printing instruction to the receiving end.

[0050] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the HAL log debugging method as described above when executing the computer program.

[0051] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for generating a HAL log or the method for debugging a HAL log as described above is implemented.

[0052] The positive progress of the present invention is that: in this embodiment, by injecting the generation instruction into the first target position of the HAL tool, when the target object is compiled, when the HAL function in the target object is compiled, the HAL tool will be used, thereby the generation instruction in the HAL tool can be injected into the HAL function to generate a target file that includes both the HAL function and the generation instruction. When the target file is run, a HAL log of the HAL function can be generated at the same time. Through this method in the present invention, it is no longer necessary to add a log to the owner of each HAL separately. All interfaces of the HAL service, including some automatically generated hidden public interfaces, are injected with the HAL log generation instruction, and only exist in the compiled target file. They are not visible in the HAL function and will not affect the implementation of the HAL function. The efficiency of log injection is improved. When the target file is run, the automatic generation of the log can be realized, and the problem can be located in which layer, which HAL, or which method in the HAL. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a flowchart of the method for generating a HAL log in Example 1 of the present invention.

[0054] Figure 2 This is a flowchart of a specific implementation method of step 104 in embodiment 1 of the present invention.

[0055] Figure 3 This is a flowchart of a method for generating a HAL log in a specific scenario in Example 1 of the present invention.

[0056] Figure 4 This is a flowchart of the HAL log-based debugging method at the receiving end in Example 2 of the present invention.

[0057] Figure 5 This is a flowchart of the HAL log-based debugging method of the sending end in Example 2 of the present invention.

[0058] Figure 6 This is a module diagram of the HAL log generation system in Example 3 of the present invention.

[0059] Figure 7 This is a module diagram of the first debugging system based on HAL log in Example 4 of the present invention.

[0060] Figure 8 This is a module diagram of the second debugging system based on HAL log in Example 4 of the present invention.

[0061] Figure 9 This is a module diagram of the electronic device in Example 5 of the present invention. DETAILED DESCRIPTION

[0062] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0063] Example 1

[0064] This embodiment 1 provides a method for generating a HAL log. Figure 1 As shown, the generation method includes:

[0065] Step 101: Obtain a HAL log generation instruction.

[0066] The generation instruction may generate a corresponding HAL log when running a file including the generation instruction.

[0067] Step 102: Inject the generated instruction into the first target location of the HAL tool.

[0068] Among them, the HAL tool is a framework for automatically generating source code for HAL services.

[0069] Step 103: Acquire a target object, where the target object includes a HAL function, which is a function used by the HAL layer.

[0070] The target object can be a complete application, a module of the application, or a single HAL function.

[0071] Step 104: Compile the target object based on the HAL tool to generate a target file.

[0072] The target file includes HAL functions and generation instructions.

[0073] Step 105: Obtain the HAL log when running the target file.

[0074] Specifically, in practice, it is found that the HAL tool needs to be used when compiling the HAL function. Therefore, by injecting the generation instruction into the first target position of the HAL tool, when the target object is compiled, when compiling the HAL function in the target object, the HAL tool will be used, so that the generation instruction in the HAL tool can be injected into the HAL function to generate a target file that includes both the HAL function and the generation instruction. When the target file is run, the HAL log of the HAL function can be generated at the same time. Through this method in this embodiment, it is no longer necessary to add logs to each HAL owner separately. All HAL service interfaces, including some automatically generated hidden public interfaces, are injected with HAL log generation instructions, and only exist in the compiled target file. They are not visible in the HAL function, which improves the efficiency of log injection. When the target file is run, the automatic generation of logs can be realized, and the problem can be located in which layer, which HAL, or which method in the HAL.

[0075] To better understand this embodiment, the process of generating the target file in this embodiment is explained below using a specific scenario:

[0076] If the method of this embodiment is not used, the target object is obtained, and the target object includes the HAL function, the code Code B of the HAL service is as follows:

[0077] Method_name()

[0078] {

[0079] Method_body;

[0080] }.

[0081] In practice, it is found that when compiling the target object, all HAL service compilations will go to the HAL tool for processing first:

[0082] Out< <Method_name+“()”

[0083] Out<<“{”

[0084] Out<<"Method_body;"

[0085] Out<<“}”

[0086] Out–>Code C

[0087] The above is the code automatically generated by the HAL tool when processed by the HAL tool.

[0088] The normal compilation process is Code B + HAL tool processing target object to generate Code C (as shown below). The target file generated after compilation includes the following Code C:

[0089] Method_name()

[0090] {

[0091] Method_body;

[0092] }

[0093] According to the method of this embodiment, the HAL log generation instruction is obtained in step 101, specifically the code Code A for printing the log: Log.d(MESSAGE). In step 102, the code is injected into the first target location of the HAL tool. In step 103, the target object is obtained. Then, step 104 is executed to generate a target file when the target object is compiled based on the HAL tool. The target file includes Code C. The HAL tool automatically searches for the HAL function of the HAL service and generates Code C as shown below after processing:

[0094] Out< <Method_name+“()”

[0095] Out<<“{”

[0096] Out<<“Log.d(MESSAGE);” / / This line is the Code A we injected into the HAL tool.

[0097] Out<<"Method_body;"

[0098] Out<<“}”

[0099] Out–>Code C

[0100] The modified compilation process is that the HAL tool processes the target object after injecting Code A into Code B and generates Code C (as shown below). The target file generated after compilation includes Code C. Specifically, the final target file includes the following Code C code:

[0101]

[0102] When the final target file is run, the logs related to the HAL service can be printed according to the above-mentioned generated instruction Log.d(MESSAGE).

[0103] It should be understood that the function names, functions, and specific implementations of compilation in the above examples are only for illustration and should not be construed as limiting the present embodiment.

[0104] In a specific implementation, the HAL tool includes a HIDL HAL tool and / or an AIDL HAL tool.

[0105] HIDL HAL is a framework tool for defining and implementing HAL interfaces in Android. AIDL HAL is an interface recognized by both the client and the server in Android, and IPC (inter-process) communication is performed through this interface. After Android 11 (an Android operating system), AIDL can also be used to define and implement HAL interfaces.

[0106] It should be understood that if the HAL tool includes both HIDL HAL and AIDL HAL, it is necessary to inject the generation instructions of the HAL log for the tool into both HIDL HAL and AIDL HAL, so that when the HAL function is compiled based on different HAL tools, the generation instructions of the HAL log can be smoothly inserted into the HAL function.

[0107] In a specific implementation, step 101 specifically includes: obtaining generation instructions for different versions of HAL logs;

[0108] Step 102 specifically includes: injecting generation instructions of different versions of HAL logs into the first target location of the HAL tool.

[0109] Since the target object may have different versions, such as Java version, C++ version, NDK version, etc., in order to ensure that the generation instructions of the HAL log can match the target objects of different versions, step 102 specifically obtains the generation instructions of the HAL log of different versions and injects the generation instructions of the HAL log of different versions into the first target position of the HAL tool, so that when compiling HAL functions of different versions, the generation instructions of the corresponding version can be injected into the HAL function through the HAL tool.

[0110] In a specific embodiment, Figure 2 As shown, step 104 specifically includes:

[0111] Step 1041: Obtain the HAL function in the target object through the HAL tool;

[0112] Step 1042: insert the generate instruction into the second target location of the HAL function;

[0113] Step 1043: Generate a target file according to the HAL function and the generation instruction.

[0114] The second target position includes the entry and key nodes (such as error-prone judgment nodes) of each HAL function. Since the HAL tool will traverse the second target position when compiling the HAL function, the HAL log generation instruction is injected into the node corresponding to the HAL function (i.e., the first target position). When the target object including the HAL function is compiled based on the HAL tool, the HAL log generation instruction can be injected into the second target position of the HAL function. In this way, the generation of the HAL log can be achieved in a targeted manner.

[0115] In order to better understand this embodiment, the present embodiment is described below through a specific example:

[0116] like Figure 3 As shown, through step 201, the log is injected into the HAL source code (i.e., the generation instruction of the HAL log) generation tool of the C++ version of the HIDL HAL source code generation tool set; through step 202, the log is injected into the HAL source code generation tool of the JAVA version of the HIDL HAL source code generation tool set; through step 203, the log is injected into the HAL source code generation tool of the C++ version of the AIDL HAL source code generation tool set; through step 204, the log is injected into the HAL source code generation tool of the NDK version of the AIDL HAL source code generation tool set; through step 205, the log is injected into the HAL source code generation tool of the JAVA version of the AIDL HAL source code generation tool set; through step 206, Android is compiled to automatically generate a HAL service containing the injection log, that is, a target file is generated, and then the HAL log can be generated by running the target file.

[0117] Example 2

[0118] This embodiment provides a debugging method based on HAL log, which is applied to the receiving end, such as Figure 4 As shown, the debugging method includes:

[0119] Step 301: Generate a target HAL log according to a HAL log generation method;

[0120] The method for generating the HAL log may refer to the specific method in Example 1.

[0121] Step 302: Receive a target printing instruction.

[0122] The target printing instruction is used to print the target HAL log.

[0123] In this embodiment, the target printing instruction may include a target service identifier, and the target service identifier is used to match a corresponding HAL service.

[0124] Step 303: Run the target file, and match and print the target HAL log according to the target printing instruction;

[0125] Step 304: Debug the target HAL service according to the target HAL log.

[0126] This embodiment also provides a debugging method based on HAL log, which is applied to the sending end, such as Figure 5 As shown, the debugging method includes:

[0127] Step 311: Configure target printing instructions.

[0128] The target printing instruction is used to print a target HAL log. The target printing instruction includes a target service identifier. The target service identifier is used to match a corresponding HAL service.

[0129] Step 312: Send the target printing instruction to the receiving end.

[0130] Specifically, what is received in step 201 is the target printing instruction sent in step 302 .

[0131] Since in the actual operation process, if too many logs are added to the HAL service, the performance of the Android device will also be affected. Therefore, in this embodiment, by configuring the target print instruction, it is not necessary to generate logs for all HAL functions, and the required HAL logs corresponding to the target print instruction can be generated in a targeted manner. For example, logs for all HAL functions can be generated, a single public interface for all HAL functions can be generated (for example, a single public interface is A, and a single public interface of a HAL function is such as 1_A, 2_A, 3_A, etc.), all interfaces of a single HAL function can be generated (i.e., all interfaces of a single HAL function are used), and a single interface of a single HAL function can be generated (i.e., only a specific HAL function at a specific location).

[0132] This embodiment provides control over log printing at different levels. No printing is performed during normal operation, and the log printing level can be flexibly controlled at any time through target printing instructions as needed, greatly improving the debugging efficiency of HAL layer problems.

[0133] In order to better understand this embodiment, the present embodiment is described below through a specific example:

[0134] Configure the target print instruction, where the target print instruction can not set the target service identifier. In this case, when the target file is run, the log instruction injected into the HAL function will be closed and no HAL log will be generated.

[0135] If the target service identifier includes the name of a HAL service, the HAL log of the corresponding HAL service will be generated when the target file is run. If the target print instruction includes the public interface name of the HAL service, such as unlinkToDeath, it means that the logs of the public interface of all HAL services will be printed.

[0136] If the target service identifier includes the interface name of the HAL service, it means that the log in the interface of the HAL service will be printed. If the target service identifier is ALL, it means that the logs of all HAL services will be printed.

[0137] The sending end sends the configured target printing instruction to the receiving end, and the receiving end matches the target HAL service according to the target service identifier in the target printing instruction and prints the log corresponding to the matched target HAL service.

[0138] Example 3

[0139] This embodiment provides a device for generating a HAL log, such as Figure 6 As shown, the HAL log generation device includes: an instruction acquisition module 401, an instruction injection module 402, an object acquisition module 403, a file generation module 404 and a log acquisition module 405;

[0140] The instruction acquisition module 401 is used to obtain the generation instruction of the HAL log;

[0141] The instruction injection module 402 is used to inject the generated instruction into the first target location of the HAL tool, which is a framework for automatically generating the source code of the HAL service;

[0142] The object acquisition module 403 is used to acquire the target object, which includes the HAL function, which is the function used by the HAL layer;

[0143] The file generation module 404 is used to compile the target object based on the HAL tool to generate a target file, and the target file includes a HAL function and a generation instruction;

[0144] The log acquisition module 405 is used to obtain the HAL log when running the target file.

[0145] For the specific processing methods of each module, please refer to the corresponding processing methods in Example 1.

[0146] In this embodiment, based on the discovery in practice that the HAL tool is required when compiling the HAL function, the generation instruction is injected into the first target position of the HAL tool through the instruction injection module. When the file generation module compiles the target object, the HAL tool is used when compiling the HAL function in the target object. Thus, the generation instruction in the HAL tool can be injected into the HAL function to generate a target file that includes both the HAL function and the generation instruction. When the log generation module runs the target file, it can simultaneously generate a HAL log for the HAL function. Through this method in this embodiment, it is no longer necessary to add a log to each HAL owner separately. All HAL service interfaces, including some automatically generated hidden public interfaces, are injected with HAL log generation instructions, and only exist in the compiled target file. They are not visible in the HAL function, which improves the efficiency of log injection. When the target file is run, the automatic generation of the log can be realized, and the problem can be located in which layer, which HAL, or which method in the HAL.

[0147] Example 4

[0148] This embodiment provides a first debugging device based on HAL log, which is applied to the receiving end. Figure 7 As shown, the first debugging device includes: a log generating module 501, an instruction receiving module 502, a file running module 503 and a debugging module 504;

[0149] The log generation module 501 is used to generate a target HAL log according to the HAL log generation system in Example 3;

[0150] The instruction receiving module 502 is used to receive a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service;

[0151] The file execution module 503 is used to execute the target file and match and print the target HAL log according to the target printing instruction;

[0152] The debugging module 504 is used to debug the target HAL service according to the target HAL log.

[0153] Specifically, the processing method of each module in the debugging device of this embodiment can refer to the specific processing method of the receiving end in Example 2, and will not be repeated here.

[0154] This embodiment also provides a second debugging device based on the HAL log, such as Figure 8 As shown, the second debugging device is applied to the sending end, and the debugging device includes: an instruction configuration module 511 and an instruction sending module 512;

[0155] The instruction configuration module 511 is used to configure a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service;

[0156] The instruction sending module 512 is used to send the target printing instruction to the receiving end.

[0157] Specifically, the processing method of each module in the debugging device of this embodiment can refer to the specific processing method of the sending end in Example 2, and will not be repeated here.

[0158] This embodiment provides control over log printing at different levels. Through the cooperation of the first debugging device and the second debugging device, no printing is performed when the target file is run normally. The instruction configuration module can flexibly control the log printing level by configuring the target printing instruction at any time as needed. The instruction receiving module can receive the target printing instruction sent by the instruction sending module. The file running module can generate a target HAL log when running the target file. The debugging module can debug the target HAL service, thereby enabling targeted debugging of the HAL service, greatly improving the debugging efficiency of HAL layer problems.

[0159] Example 5

[0160] This embodiment provides an electronic device, which can be expressed in the form of a computing device (for example, a server device), including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the HAL log generation method described in Example 1 or the HAL log debugging method described in Example 2 can be implemented.

[0161] Figure 9 The hardware structure diagram of this embodiment is shown in FIG. Figure 9 As shown, the electronic device 9 specifically includes:

[0162] At least one processor 91, at least one memory 92, and a bus 93 for connecting different system components (including the processor 91 and the memory 92), wherein:

[0163] The bus 93 includes a data bus, an address bus, and a control bus.

[0164] The memory 92 includes a volatile memory, such as a random access memory (RAM) 921 and / or a cache memory 922 , and may further include a read-only memory (ROM) 923 .

[0165] Memory 92 also includes a program / utility 925 having a set (at least one) of program modules 924, such program modules 924 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0166] The processor 91 executes various functional applications and data processing by running the computer programs stored in the memory 92, such as the HAL log generation method described in Example 1 or the HAL log debugging method described in Example 2.

[0167] The electronic device 9 can further communicate with one or more external devices 94 (e.g., a keyboard, pointing device, etc.). Such communication can be performed via an input / output (I / O) interface 95. Furthermore, the electronic device 9 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 96. The network adapter 96 communicates with other modules of the electronic device 9 via a bus 93. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the electronic device 9, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) systems, tape drives, and data backup storage systems.

[0168] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, depending on the embodiment of the present application, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.

[0169] Example 6

[0170] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method for generating a HAL log described in Example 1 or the method for debugging a HAL log described in Example 2 is implemented.

[0171] The readable storage medium may include, but is not limited to, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0172] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the HAL log generation method described in Example 1 or the HAL log debugging method described in Example 2.

[0173] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or entirely on the remote device.

[0174] Although specific embodiments of the present invention have been described above, those skilled in the art will appreciate that these are merely illustrative and that the scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, and such changes and modifications are intended to fall within the scope of the present invention.

Claims

1. A method for generating a HAL log, characterized in that: The generation method comprises: Get the HAL log generation instructions; Injecting the generation instruction into a first target location of a HAL tool, wherein the HAL tool is a framework for automatically generating source code for a HAL service; Acquire a target object, where the target object includes a HAL function, and the HAL function is a function used by the HAL layer; Compile the target object based on the HAL tool to generate a target file, wherein the target file includes the HAL function and the generation instruction; Get the HAL log while running the target file.

2. The method for generating a HAL log according to claim 1, wherein: The HAL tool includes a HIDL HAL tool and / or an AIDL HAL tool.

3. The method for generating a HAL log according to claim 1, wherein: The step of obtaining the generation instruction of the HAL log includes: obtaining the generation instruction of the HAL log of different versions; Injecting the generation instruction into the first target location of the HAL tool includes: injecting the generation instruction of the different versions of the HAL log into the first target location of the HAL tool.

4. The method for generating a HAL log according to claim 1, wherein: The step of compiling the target object based on the HAL tool to generate a target file includes: Obtaining the HAL function in the target object through the HAL tool; inserting the generate instruction into a second target location of the HAL function; Generate a target file according to the HAL function and the generation instruction.

5. A debugging method based on HAL log, characterized in that: The debugging method is applied to the receiving end, and the debugging method includes: Generate a target HAL log according to the HAL log generation method according to any one of claims 1 to 4; receiving a target print instruction, the target print instruction being used to print a target HAL log, the target print instruction including a target service identifier, the target service identifier being used to match a corresponding target HAL service; Run the target file, and match and print the target HAL log according to the target printing instruction; The target HAL service is debugged according to the target HAL log.

6. A debugging method based on HAL log, characterized in that: The debugging method is applied to the sending end, and the debugging method includes: Configure a target print instruction, the target print instruction is used to print a target HAL log, the target print instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service; Sending the target print instruction to a receiving end; the receiving end is used to generate a target HAL log according to the HAL log generation method according to any one of claims 1 to 4.

7. A device for generating a HAL log, characterized in that: The generating device includes: an instruction acquisition module, an instruction injection module, an object acquisition module, a file generation module and a log acquisition module; The instruction acquisition module is used to obtain the generation instruction of the HAL log; The instruction injection module is used to inject the generated instruction into a first target location of a HAL tool, wherein the HAL tool is a framework for automatically generating source code for a HAL service; The object acquisition module is used to acquire a target object, wherein the target object includes a HAL function, and the HAL function is a function used by the HAL layer; The file generation module is used to compile the target object based on the HAL tool to generate a target file, wherein the target file includes the HAL function and the generation instruction; The log acquisition module is used to obtain the HAL log when running the target file.

8. A debugging device based on HAL log, characterized in that: The debugging device is applied to the receiving end, and comprises: a log generating module, an instruction receiving module, a file running module and a debugging module; The log generation module is used to generate a target HAL log according to the HAL log generation method according to any one of claims 1 to 4; The instruction receiving module is used to receive a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding target HAL service; The file running module is used to run the target file and match and print the target HAL log according to the target printing instruction; The debugging module is used to debug the target HAL service according to the target HAL log.

9. A debugging device based on HAL log, characterized in that: The debugging device is applied to the sending end, and the debugging device includes: an instruction configuration module and an instruction sending module; The instruction configuration module is used to configure a target printing instruction, the target printing instruction is used to print a target HAL log, the target printing instruction includes a target service identifier, and the target service identifier is used to match a corresponding HAL service; The instruction sending module is used to send the target printing instruction to the receiving end; the receiving end is used to generate a target HAL log according to the HAL log generation method according to any one of claims 1 to 4.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a HAL log according to any one of claims 1 to 4 and the method for debugging a HAL log according to claim 5 or claim 6 are implemented.

Citation Information

Patent Citations

  • Hardware abstraction layer debugging method and apparatus

    CN107656861A

  • Debugging support device, method therefor and recording medium recorded with softwater for supporting debugging

    JP2000207246A