[go: up one dir, main page]

CN111694704B - Debug information output method, device, electronic equipment and storage medium - Google Patents

Debug information output method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111694704B
CN111694704B CN201910191056.2A CN201910191056A CN111694704B CN 111694704 B CN111694704 B CN 111694704B CN 201910191056 A CN201910191056 A CN 201910191056A CN 111694704 B CN111694704 B CN 111694704B
Authority
CN
China
Prior art keywords
information
module
target
identifier
printed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910191056.2A
Other languages
Chinese (zh)
Other versions
CN111694704A (en
Inventor
张晓奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201910191056.2A priority Critical patent/CN111694704B/en
Publication of CN111694704A publication Critical patent/CN111694704A/en
Application granted granted Critical
Publication of CN111694704B publication Critical patent/CN111694704B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a debug information output method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not; when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data; according to the information attribute data, determining a target module of the debug information to be printed and a target type of the debug information to be printed in the target module; and calling a preset printout function, printing target debugging information of the target type of the target module, and storing the target debugging information into the mobile storage equipment. The debugging information is stored in the mobile storage device through the configuration file in the mobile storage device, a technician is not required to be dispatched to print on site, the data in the mobile storage device can be remotely sent to the technician after the printing is finished, and the obtaining efficiency of the debugging information is improved.

Description

Debug information output method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for outputting debug information, an electronic device, and a storage medium.
Background
In the use process of various devices, various problems are inevitably encountered, because the devices usually run in a private network rather than a public network, cannot be accessed remotely, only debug information can be collected by connecting a serial port line, and the operation process needs to be verified safely, so that common users are difficult to operate, the common method is as follows: the user dials the technical support phone and requests the technical support; then, according to the actual situation, the technical support side arranges technicians to the site for debugging information collection (mainly collecting serial port information); and finally, returning the problems and the collected debugging information to research personnel for positioning and solving.
In the process, people need to be arranged to go to each site, so that on one hand, the hands are not enough, and on the other hand, the processing is not timely, and the debug information acquisition efficiency is low.
Disclosure of Invention
The embodiment of the application aims to provide a debug information output method, a device, electronic equipment and a storage medium, so as to increase the obtaining efficiency of debug information. The specific technical scheme is as follows:
In a first aspect, an embodiment of the present application provides a debug information output method, which is applied to a device to be debugged, where the method includes:
after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not;
when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data;
determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data, wherein the target type comprises a target information level;
and calling a preset printout function, printing target debugging information of a target type of the target module, and storing the target debugging information into the mobile storage equipment.
Optionally, when the device to be debugged is connected with a mobile storage device, acquiring a configuration file in the mobile storage device includes:
detecting whether a configuration file is stored in the mobile storage device or not when the device to be debugged is connected with the mobile storage device;
and when the configuration file is detected in the mobile storage device, acquiring the configuration file in the mobile storage device.
Optionally, the configuration file further includes key data, and the method further includes:
detecting whether the key data is correct;
the determining, according to the information attribute data, a target module of the debug information to be printed and a target type of the debug information to be printed in the target module includes:
and when the key data are correct, determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data.
Optionally, the information attribute data includes an information level identifier, a display format identifier, a module identifier and a sub-module identifier;
the determining, according to the information attribute data, a target module of the debug information to be printed and a target type of the debug information to be printed in the target module includes:
determining a target module of the debugging information to be printed according to the module identifier and the sub-module identifier;
and determining a target type of the debugging information to be printed according to the level identification and the display format identification, wherein the target type comprises a target information level and a target display format.
Optionally, the configuration file further includes: redirecting switch information, wherein the calling of the preset printout function prints target debugging information of a target type of the target module and stores the target debugging information into the mobile storage device comprises the following steps:
When the redirection switch information represents that redirection is needed, a preset redirection function is called, and the output position of the preset printout function is redirected to a specified text file of the mobile storage device;
and printing target debugging information of the target type of the target module through the preset printout function, and storing the target debugging information into the appointed text file.
Optionally, before calling a preset redirection function according to the redirection information and redirecting the output position of the preset printout function to the specified text file of the mobile storage device, the method further includes:
and acquiring the current time, and establishing a specified text file in the mobile storage device according to the current time, wherein the naming of the specified text file comprises the current time.
Optionally, the debug information output method of the embodiment of the present application further includes:
acquiring file configuration information;
and configuring the configuration file of the mobile storage device according to the file configuration information.
In a second aspect, an embodiment of the present application provides a debug information output apparatus, which is applied to a device to be debugged, and the apparatus includes:
The storage device detection module is used for detecting whether the device to be debugged is connected with a mobile storage device or not after the device to be debugged is started;
a configuration file obtaining module, configured to obtain a configuration file in the mobile storage device when the device to be debugged is connected with the mobile storage device, where the configuration file includes information attribute data;
the information to be printed determining module is used for determining a target module of debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data, wherein the target type comprises a target information level;
the debugging information printing module is used for calling a preset printout function, printing target debugging information of a target type of the target module and storing the target debugging information into the mobile storage device.
Optionally, the configuration file obtaining module includes:
the configuration file detection submodule is used for detecting whether a configuration file is stored in the mobile storage device or not when the device to be debugged is connected with the mobile storage device;
and the configuration file reading sub-module is used for acquiring the configuration file in the mobile storage device when the configuration file is detected in the mobile storage device.
Optionally, the configuration file further includes key data, and the debug information output device of the embodiment of the present application further includes:
the key data detection module is used for detecting whether the key data is correct or not;
the information to be printed determining module is specifically configured to:
and when the key data are correct, determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data.
Optionally, the information attribute data includes an information level identifier, a display format identifier, a module identifier and a sub-module identifier;
the information to be printed determining module includes:
the target module determining submodule is used for determining a target module of the debugging information to be printed according to the module identifier and the submodule identifier;
and the target module determining submodule is used for determining a target type of the debugging information to be printed according to the level identification and the display format identification, wherein the target type comprises a target information level and a target display format.
Optionally, the configuration file further includes: redirecting switch information, the debug information printing module comprising:
The redirection function calling sub-module is used for calling a preset redirection function when the redirection switch information indicates that redirection is needed, and redirecting the output position of the preset printing output function to be a designated text file of the mobile storage device;
and the printing output function calling sub-module is used for printing target debugging information of the target type of the target module through the preset printing output function and storing the target debugging information into the appointed text file.
Optionally, the debug information output of the embodiment of the present application further includes:
and the appointed text file establishing module is used for acquiring the current time and establishing an appointed text file in the mobile storage device according to the current time, wherein the appointed text file comprises the current time in the naming.
Optionally, the debug information output of the embodiment of the present application further includes:
the configuration information acquisition module is used for acquiring file configuration information;
and the configuration file configuration module is used for configuring the configuration file of the mobile storage device according to the file configuration information.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
The memory is used for storing a computer program;
the processor is configured to implement any one of the debug information output methods described in the first aspect when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, in which a computer program is stored, the computer program implementing any one of the debug information output methods of the first aspect described above when executed by a processor.
According to the debugging information output method, the device, the electronic equipment and the storage medium, after equipment to be debugged is started, whether the equipment to be debugged is connected with the mobile storage equipment or not is detected; when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data; according to the information attribute data, determining a target module of the debug information to be printed and a target type of the debug information to be printed in the target module; and calling a preset printout function, printing target debugging information of the target type of the target module, and storing the target debugging information into the mobile storage equipment. The debugging information is stored in the mobile storage device through the configuration file in the mobile storage device, a technician is not required to be dispatched to print on site, the data in the mobile storage device can be remotely sent to the technician after the printing is finished, and the obtaining efficiency of the debugging information is improved. And the configuration file is stored in the mobile storage device and is not an executable program, so that compared with the executable program in the mobile storage device, the efficiency of calling the executable program of the device to be debugged is higher. Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a first diagram illustrating a debug information output method according to an embodiment of the present application;
FIG. 2 is a second schematic diagram of a debug information output method according to an embodiment of the present application;
FIG. 3 is a third schematic diagram of a debug information output method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a debug information output device according to an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
First, terms in the embodiments of the present application will be described.
Debug level: as the functions of the device become more and more powerful, the print information added in the device is more and more, and for convenience in display, the debug information is divided into modules, such as a storage module and a preview module, and the levels are divided into a general print information level and an error print information level. The program may output the relevant debug information according to the module and print level set by the user. If the user configures and outputs the printing information as the error level information of the storage module, the final output result only displays all error reporting information in the logic of the storage module; the contents of other modules and other levels of information of the storage module are not output, so that a user can conveniently extract useful debugging information.
Debug information: the method refers to printing information output by a serial port of the device, wherein the printing information comprises content which is actively added in a program by a developer and also comprises some printing information of an embedded Linux system.
Configuration file: the content of the file is a file placed in the mobile storage device, and the content of the file comprises information related to debugging and printing of the control device, and the content comprises a module, a printing level and the like.
In order to improve the efficiency of obtaining debug information, an embodiment of the present application provides a debug information output method, which is applied to a device to be debugged, referring to fig. 1, and the method includes:
s101, after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not.
The debugging information output method of the embodiment of the application is applied to the equipment to be debugged, so that the equipment to be debugged can be executed by the equipment to be debugged, the equipment to be debugged comprises a processor and a memory, the memory stores computer programs, and the processor can realize the debugging information output method of the embodiment of the application when executing the computer programs stored in the memory. In the starting process of the equipment to be debugged, whether the equipment to be debugged is connected with a mobile storage device or not is detected, wherein the mobile storage device can be a U disk, a mobile hard disk or an optical disk and the like.
Under normal conditions, a user connects the mobile storage device stored with the configuration file to the device to be debugged, and starts the device to be debugged, and when the device to be debugged is started, whether the mobile storage device is accessed is automatically detected. Without creating a special daemon in the device to be debugged, and without detecting the presence of the mobile storage device at the moment of the special daemon. The user only needs to copy the configuration file into the mobile storage device, then access the device to be debugged, and start the device to be debugged. When the equipment to be debugged is started to be electrified, the mobile storage equipment is detected once, the judgment work is completed, and a special daemon is not required to be created, so that system resources are saved.
S102, when the device to be debugged is connected with the mobile storage device, acquiring a configuration file in the mobile storage device, wherein the configuration file comprises information attribute data.
The configuration file may be in a specific naming manner or may be stored in a designated directory to facilitate the retrieval of the configuration file by the device to be debugged. The configuration file comprises information attribute data, wherein the information attribute data represents a module of the debugging information to be printed and the type of the debugging information to be printed. Optionally, a check field may be further included in the configuration file to check whether the configuration file is complete.
Before acquiring the configuration file in the mobile storage device, the device to be debugged can also check whether the configuration file exists in the mobile storage device. Optionally, when the device to be debugged is connected with a mobile storage device, acquiring a configuration file in the mobile storage device includes:
step one, when the equipment to be debugged is connected with a mobile storage device, detecting whether a configuration file is stored in the mobile storage device.
The equipment to be debugged detects whether the configuration file is stored in the mobile storage equipment, and the mobile storage equipment can be traversed for the equipment to be debugged so as to detect whether the configuration file is stored in the mobile storage equipment; it is also possible to detect whether a configuration file exists under a specified path or folder for the device to be debugged, etc.
And step two, when the configuration file is detected in the mobile storage device, acquiring the configuration file in the mobile storage device.
When the configuration file is not detected in the mobile storage device, the device to be debugged gives up the printing of the debugging information, and executes other functions set by the device to be debugged.
S103, determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data, wherein the target type comprises a target information level.
In the embodiment of the application, in order to facilitate debugging, the debugging information to be printed can be modularly classified in advance. For example, it may be divided into a storage module, a network module, and a preview module. When the system is more complex, each module may be further divided into sub-modules for greater accuracy. For example, the storage module may be divided into an optical disc storage and a hard disc storage, the network module may be divided into a network search and a network configuration, and the preview module may be divided into a local preview, a remote preview, a playback preview, and the like. The print level of the debug information may also be divided, i.e. the information level, which may for example comprise: serious error information, general error information, warning information, general information, and the like. Debug information display formats may also be partitioned, including, for example: no additional format, output debug content additional time information, output debug content additional code presence information, output debug content additional function name information, output debug content additional place thread name information, and the like.
The information attribute data may include an identifier of a module (i.e., a target module) of the debug information to be printed and an identifier of a print level (i.e., a target information level) of the debug information to be printed, and the device to be debugged determines, according to the information attribute data in the configuration file, that the module of the debug information to be printed obtains the target module, and determines a type of the debug information to be printed in the target module to obtain a target type. The target type includes a target information level. The target information level may be one or more of serious error information, general error information, warning information and general information, and is determined according to information attribute data. Optionally, the information attribute data includes an information level identifier, a display format identifier, a module identifier, and a sub-module identifier.
In order to normalize and modularize the debugging information of the equipment, the program can be packaged through the printf and other standard output functions, and the concepts of the debugging information level, the debugging information display format and the debugging module are added. Alternatively, this can be represented by four fields: iDbgLevel (i.e., information level identification), iDbgFormat (i.e., display format identification), iDbgModule (i.e., module identification), and iDbgMask (i.e., sub-module identification). The iDbgModule and the iDbgMask together represent the concept of the module, and the module is convenient to finely divide and output a plurality of sub-modules. Of course, other fields can be added according to actual situations in the actual application process, fields in the field can be reduced, and the like, which are all within the protection scope of the application.
Correspondingly, the determining the target module of the debug information to be printed and the target type of the debug information to be printed in the target module according to the information attribute data comprises the following steps:
step one, determining a target module of the debugging information to be printed according to the module identification and the sub-module identification.
Each identification field in the information attribute data can be overlapped by an AND operation. For example, the preview module is further divided into two sub-modules, namely a local preview sub-module and a remote preview sub-module, and the two sub-modules are respectively represented by 0x1 and 0x2, when the iDbgMask is set to 0x 3, the 0x1 and the 0x 3 perform the and operation, and the 0x2 and the 0x 3 perform the and operation, and the result is a TRUE value, so that the two sub-modules can output debugging information simultaneously, that is, the local preview sub-module and the remote preview sub-module are both used as target modules.
And step two, determining the target type of the debug information to be printed according to the level identification and the display format identification, wherein the target type comprises a target information level and a target display format.
The device to be debugged determines the display format (i.e. target display format) of the debugging information to be printed according to the display format identification, and determines the printing level (i.e. target information level) of the debugging information to be printed according to the level identification, so as to obtain the target type of the debugging information to be printed. The target type includes a target information level and a target display format, for example, the level of debug information includes: serious error information 0x1, general error information 0x2, warning information 0x4, and general information 0x8; the debug information display format includes: no additional format 0x0, output debug content additional time information 0x1, output debug content additional code line information 0x2, output debug content additional function name information 0x4, output debug content additional place thread name information 0x8, when the information level mark is 0x1 and the display format mark is 0x0, the target type is serious error information and no additional format; when the information level mark is 4 and the display format mark is 2, the target type is warning information and the line information of the additional code of the output debugging content is located.
The equipment to be debugged can acquire a configuration file through a getDbgCtrl command, and all identification fields in information attribute data in the configuration file can be overlapped through AND operation. For example, the level of debug information includes: serious error information 0x1, general error information 0x2, warning information 0x4, and general information 0x8; the debug information display format includes: no additional format 0x0, output debug content additional time information 0x1, output debug content additional code line information 0x2, output debug content additional function name information 0x4, output debug content additional place thread name information 0x8; the modularized classification of the debug information to be printed comprises a storage module 0x1, a network module 0x2 and a preview module 0x4, wherein the storage module is divided into an optical disk storage 0x1 and a hard disk storage 0x2, the network module is divided into a network search 0x1 and a network configuration 0x2, and the preview module is divided into a local preview 0x1, a remote preview 0x2 and a playback preview 0x4.
For example, in order of iDbgLevel, iDbgFormat, iDbgModule, iDbgMask, the information attribute data is: 0x7 x6 x2 x3, the debug information for the printout is: and printing and outputting all serious errors, general errors and warning information of the network searching module and the network configuration module, and attaching function name information and line information of codes.
S104, calling a preset printout function, printing target debugging information of the target type of the target module, and storing the target debugging information into the mobile storage device.
The device to be debugged is pre-stored with a printout function, invokes the printout function to print the debugging information (namely, target debugging information) of the target type of the target module, and stores the target debugging information in the mobile storage device. For example, the information attribute data is: 0x7 x6 x2 x3, the debug information for the printout is: and printing and outputting all serious errors, general errors and warning information of the network searching module and the network configuration module, and attaching function name information and line information of codes. A specific process of printing debug information may be as shown in fig. 2.
Because the default output directory of debug information in the device to be debugged may default to a debug serial port, it is necessary to redirect the output path of the debug information. Of course, when the default output directory of the debug information is a mobile storage device, no redirection may be required. Optionally, the configuration file further includes: redirecting switch information, calling a preset printout function, printing target debugging information of a target type of the target module, and storing the target debugging information into the mobile storage device, wherein the method comprises the following steps:
And step one, when the redirection switch information indicates that redirection is needed, calling a preset redirection function, and redirecting the output position of the preset printout function to be the appointed text file of the mobile storage device.
The device to be debugged can store a redirection function in advance, and when the redirection switch information indicates that redirection is needed, the device to be debugged calls the redirection function to redirect the output position of the preset printout function to be a specified text file of the mobile storage device.
And step two, printing target debugging information of the target type of the target module through the preset printout function, and storing the target debugging information into the appointed text file.
After the redirection is completed, the equipment to be debugged calls a preset printout function, the target debugging information of the target type of the target module is printed, and the printed target debugging information is stored in a designated text file of the mobile storage equipment according to the redirection result. After printing is finished, the data in the mobile storage device is only required to be sent to a technician by means of mail and the like.
Optionally, before calling a preset redirection function according to the redirection information and redirecting the output position of the preset printout function to the specified text file of the mobile storage device, the method further includes:
And acquiring the current time, and establishing a specified text file in the mobile storage device according to the current time, wherein the naming of the specified text file comprises the current time.
Before a preset redirection function is called, the device to be debugged can acquire the current time, and a specified text file is established in the mobile storage device, wherein the name of the specified text file contains the current time.
In the embodiment of the application, the debug information is stored in the mobile storage device through the configuration file in the mobile storage device, a technician is not required to be dispatched to print on site, and the data in the mobile storage device can be remotely sent to the technician after the printing is finished, so that the obtaining efficiency of the debug information is improved. And the configuration file is stored in the mobile storage device and is not an executable program, so that compared with the executable program in the mobile storage device, the efficiency of calling the executable program of the device to be debugged is higher.
In many cases, the debug information relates to secret data in the development and use processes of the device, and in order to ensure the security of the debug information, key data can be added into the configuration file. Optionally, the configuration file further includes key data, and the method further includes:
And detecting whether the key data is correct.
The key data can be in the form of a user name encryption code or a character string with a preset length. The equipment to be debugged acquires the key data in the configuration file and detects whether the key data is correct.
Correspondingly, the step S103 of determining, according to the information attribute data, a target module of the debug information to be printed and a target type of the debug information to be printed in the target module includes:
and when the key data is correct, determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data.
When the key data is correct, judging that the current user has printing permission, and continuously executing the steps of determining the target module of the debugging information to be printed and the target type of the debugging information to be printed in the target module according to the information attribute data. When the key data is erroneous, no subsequent step is performed, and key data error information is displayed to the user.
Optionally, before calling a preset redirection function according to the redirection information and redirecting the output position of the preset printout function to the specified text file of the mobile storage device, the method further includes:
And acquiring the current time, and establishing a specified text file in the mobile storage device according to the current time, wherein the naming of the specified text file comprises the current time.
Optionally, the debug information output method of the embodiment of the present application further includes:
step one, acquiring file configuration information.
The device to be debugged acquires file configuration information input by a user, wherein the file configuration information is used for configuring configuration files in the mobile storage device. The file configuration information may include information level identification, display format identification, module identification, sub-module identification, and the like.
And step two, configuring the configuration file of the mobile storage device according to the file configuration information.
And configuring the configuration file of the mobile storage device according to the file configuration information to be debugged. For example, data such as an information level identifier, a display format identifier, a module identifier, a sub-module identifier, and the like in the configuration file of the mobile storage device is configured according to the file configuration information. In one possible implementation, the configuration of the configuration file in the mobile storage device may be implemented by a setDbgCtrl command, by which: the setDbgCtrl 0x7 x6 0x2 0x3, according to the order of the information level identifier, the display format identifier, the module identifier and the sub-module identifier, the information level identifier of the information attribute data in the configuration file is 0x7, the display format identifier is 0x6, the module identifier is 0x2 and the sub-module identifier is 0x3. It can be understood that the configuration of the configuration file in the mobile storage device through the setDbgCtrl command is only one possible implementation manner in the embodiment of the present application, and the configuration of the configuration file can be completed through other set commands in the actual execution process, or even can be implemented in a form of directly modifying the configuration file or directly modifying a system variable, etc.
Of course, in the embodiment of the present application, the configuration of the configuration file in the mobile storage device is not necessarily completed by the device to be debugged, and the configuration of the configuration file in the mobile storage device may be completed by any device having information writing capability.
Specifically, the mobile storage device in the embodiment of the present application may be a usb disk, and the debug information output method in the embodiment of the present application may also be as shown in fig. 3. The U disk redirection function is to put a configuration file in the U disk, wherein the configuration file comprises a total length field, a version information field, a user name field, a password field, a redirection switch field, information attribute data (iDbgLevel, iDbgFormat, iDbgModule and iDbgMask fields), a check field and the like. The configuration file may be stored in a designated folder of the U-disc packing directory. After the detection device is started, a USB (Universal Serial Bus ) interface is detected, and whether the USB flash disk is detected or not is judged. After the USB flash disk is detected, detecting the configuration file in the USB flash disk, and judging whether the configuration file is stored in the USB flash disk. And when the configuration file exists in the USB flash disk, reading the configuration file to calculate a configuration file check value. And detecting whether the data such as the length of the configuration file, the user name, the password, the check value and the like are correct, and judging whether redirection is started or not when all parameters are correct. When redirection needs to be started, setting debugging printing control data, reading the current time, and establishing a text file according to the current time, wherein the current time is 20181107 17:15:31. According to the current time, a text file 181107_171531.Log is created in the U disk. And calling a redirection function to redirect the serial port output to the text file of the USB flash disk.
The debugging information output method provided by the embodiment of the application can be based on an embedded Linux system, and has stronger applicability. The USB flash disk is inserted into the equipment to be debugged, and then the equipment to be debugged is started, and a daemon is not specially created to detect whether the USB flash disk exists or not at all. The configuration file is copied into the U disk, then the device is inserted, and the device is started. When the device is powered on, the USB flash disk is detected once, judgment is completed, and if the detection is passed, redirection is directly started. The task is cut off. There is no thread running all the time. The configuration file is only put in the USB flash disk, and is not an executable program. The configuration file contains information of several aspects: whether to start the USB flash disk to acquire the information function, the user name and the password, and a print output module which the user wants to acquire.
In the embodiment of the application, the security is considered, the configuration file in the U disk contains the user information (user name and password) of the equipment to be debugged, the function of acquiring the serial port information by the U disk can be started only when the user name and password are correct, and otherwise, the serial port information can not be acquired, so that the security of the system is improved, and some sensitive information in the serial port information is prevented from being leaked. The system has the output information classification function, the more complex the system, the more functional modules, and the printing information can be classified in a modularized manner for convenient debugging. For Linux systems, the system functions that control the printout are fixed, such as printf () functions, perror () functions, etc., and if each module calls these functions, the amount of printed information is enormous. In the embodiment of the application, the functions are packaged, so that the modularization of the printout is realized. According to the module control field in the USB flash disk, the module printing information to be output is acquired, so that the method has more pertinence.
The embodiment of the application also provides a debugging information output device, which is applied to equipment to be debugged, referring to fig. 4, and comprises:
a storage device detection module 401, configured to detect whether a mobile storage device is connected to the device to be debugged after the device to be debugged is started;
a configuration file obtaining module 402, configured to obtain a configuration file in the mobile storage device when the device to be debugged is connected to the mobile storage device, where the configuration file includes information attribute data;
the to-be-printed information determining module 403 is configured to determine, according to the information attribute data, a target module of to-be-printed debug information and a target type of debug information to be printed in the target module;
the debug information printing module 404 is configured to call a preset printout function, print target debug information of a target type of the target module, and store the target debug information in the mobile storage device.
Optionally, the profile obtaining module 402 includes:
the configuration file detection submodule is used for detecting whether a configuration file is stored in the mobile storage device or not when the mobile storage device is connected with the device to be debugged;
And the configuration file reading sub-module is used for acquiring the configuration file in the mobile storage device when the configuration file is detected in the mobile storage device.
Optionally, the configuration file further includes key data, and the debug information output device according to the embodiment of the present application further includes:
the key data detection module is used for detecting whether the key data are correct or not;
the above-mentioned information to be printed determining module 403 is specifically configured to:
and when the key data is correct, determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data.
Optionally, the information attribute data includes an information level identifier, a display format identifier, a module identifier and a sub-module identifier;
the information to be printed determining module 403 includes:
the target module determining submodule is used for determining a target module of the debugging information to be printed according to the module identifier and the submodule identifier;
and the target module determining submodule is used for determining the target type of the debugging information to be printed according to the level identifier and the display format identifier, wherein the target type comprises a target information level and a target display format.
Optionally, the configuration file further includes: redirecting switch information, the debug information printing module 404 includes:
the redirection function calling sub-module is used for calling a preset redirection function when the redirection switch information indicates that redirection is needed, and redirecting the output position of the preset printing output function to be a designated text file of the mobile storage device;
and the printing output function calling sub-module is used for printing target debugging information of the target type of the target module through the preset printing output function and storing the target debugging information into the appointed text file.
Optionally, the debug information output device of the embodiment of the present application further includes:
and the appointed text file establishing module is used for acquiring the current time and establishing an appointed text file in the mobile storage device according to the current time, wherein the naming of the appointed text file comprises the current time.
Optionally, the debug information output device of the embodiment of the present application further includes:
the configuration information acquisition module is used for acquiring file configuration information;
and the configuration file configuration module is used for configuring the configuration file of the mobile storage device according to the file configuration information.
The embodiment of the application also provides electronic equipment, which comprises a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the following steps when executing the program stored in the memory:
after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not;
when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data;
determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data;
calling a preset printout function, printing target debugging information of the target type of the target module, and storing the target debugging information into the mobile storage device.
Optionally, the processor may be configured to implement any one of the debug information output methods described above when executing the program stored in the memory.
Optionally, as shown in fig. 5, the electronic device according to the embodiment of the present application further includes a communication interface 502 and a communication bus 504, where the processor 501, the communication interface 502, and the memory 503 perform communication with each other through the communication bus 504.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the following steps when being executed by a processor:
after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not;
when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data;
determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data;
calling a preset printout function, printing target debugging information of the target type of the target module, and storing the target debugging information into the mobile storage device.
Optionally, when the computer program is executed by the processor, any of the debug information output methods described above may also be implemented.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for embodiments of the apparatus, electronic device and storage medium, the description is relatively simple as it is substantially similar to the method embodiments, where relevant see the section description of the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (8)

1. A debug information output method, characterized by being applied to a device to be debugged, the method comprising:
after the equipment to be debugged is started, detecting whether the equipment to be debugged is connected with a mobile storage device or not;
when the equipment to be debugged is connected with the mobile storage equipment, acquiring a configuration file in the mobile storage equipment, wherein the configuration file comprises information attribute data, and the information attribute data comprises an information level identifier, a display format identifier, a module identifier and a sub-module identifier;
Determining a target module of the debugging information to be printed according to the module identifier and the sub-module identifier; determining a target type of the debug information to be printed according to the level identification and the display format identification, wherein the target type comprises a target information level and a target display format;
calling a packaged preset printout function, printing target debugging information of a target type of the target module, and storing the target debugging information into the mobile storage device;
the target module of the debugging information to be printed is determined according to the module identifier and the sub-module identifier; before determining the target type of the debug information to be printed according to the level identifier and the display format identifier, the method further comprises:
carrying out modularized classification on the debugging information to be printed; dividing the printing level of the debugging information to be printed; dividing the display format of the debugging information to be printed;
the method further comprises the steps of:
acquiring file configuration information, wherein the file configuration information is used for configuring a configuration file in mobile storage equipment, and the file configuration information comprises an information level identifier, a display format identifier, a module identifier and a submodule identifier;
And configuring the configuration file in the mobile storage device according to the file configuration information.
2. The method of claim 1, wherein the configuration file further comprises key data, the method further comprising:
detecting whether the key data is correct;
the target module of the debugging information to be printed is determined according to the module identifier and the sub-module identifier; according to the level identifier and the display format identifier, determining the target type of the debug information to be printed comprises the following steps:
when the key data are correct, determining a target module of the debug information to be printed according to the module identifier and the sub-module identifier; and determining the target type of the debugging information to be printed according to the level identifier and the display format identifier.
3. The method of claim 1, wherein the configuration file further comprises: redirecting switch information, wherein the calling of the packaged preset printout function prints target debugging information of a target type of the target module and stores the target debugging information into the mobile storage device comprises the following steps:
when the redirection switch information represents that redirection is needed, a preset redirection function is called, and the output position of the packaged preset printout function is redirected to a specified text file of the mobile storage device;
And printing target debugging information of the target type of the target module through the packaged preset printing output function, and storing the target debugging information into the appointed text file.
4. A debug information output apparatus, characterized by being applied to a device to be debugged, comprising:
the storage device detection module is used for detecting whether the device to be debugged is connected with a mobile storage device or not after the device to be debugged is started;
a configuration file obtaining module, configured to obtain a configuration file in the mobile storage device when the device to be debugged is connected with the mobile storage device, where the configuration file includes information attribute data;
the information to be printed determining module is used for determining a target module of the debugging information to be printed and a target type of the debugging information to be printed in the target module according to the information attribute data, wherein the target type comprises a target information level;
the debugging information printing module is used for calling the packaged preset printout function, printing target debugging information of the target type of the target module and storing the target debugging information into the mobile storage device;
The information attribute data comprises an information level identifier, a display format identifier, a module identifier and a sub-module identifier, and the information to be printed determining module comprises:
the target module determining submodule is used for determining a target module of the debugging information to be printed according to the module identifier and the submodule identifier;
the target module determining submodule is used for determining a target type of the debug information to be printed according to the level identification and the display format identification, wherein the target type comprises a target information level and a target display format;
the apparatus also includes means for:
carrying out modularized classification on the debugging information to be printed; dividing the printing level of the debugging information to be printed; dividing the display format of the debugging information to be printed;
the apparatus also includes means for:
acquiring file configuration information, wherein the file configuration information is used for configuring a configuration file in mobile storage equipment, and the file configuration information comprises an information level identifier, a display format identifier, a module identifier and a submodule identifier;
and configuring the configuration file in the mobile storage device according to the file configuration information.
5. The apparatus of claim 4, wherein the configuration file further comprises key data, the apparatus further comprising:
the key data detection module is used for detecting whether the key data is correct or not;
the information to be printed determining module is specifically configured to:
when the key data are correct, determining a target module of the debug information to be printed according to the module identifier and the sub-module identifier; and determining the target type of the debugging information to be printed according to the level identifier and the display format identifier.
6. The apparatus of claim 4, wherein the configuration file further comprises: redirecting switch information, the debug information printing module comprising:
a redirection function calling sub-module, configured to call a preset redirection function when the redirection switch information indicates that redirection is required, and redirect the output position of the packaged preset printout function to a specified text file of the mobile storage device;
and the printing output function calling sub-module is used for printing target debugging information of the target type of the target module through the packaged preset printing output function and storing the target debugging information into the appointed text file.
7. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the method steps of any of claims 1-3 when executing a program stored on the memory.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-3.
CN201910191056.2A 2019-03-12 2019-03-12 Debug information output method, device, electronic equipment and storage medium Active CN111694704B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910191056.2A CN111694704B (en) 2019-03-12 2019-03-12 Debug information output method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910191056.2A CN111694704B (en) 2019-03-12 2019-03-12 Debug information output method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111694704A CN111694704A (en) 2020-09-22
CN111694704B true CN111694704B (en) 2023-10-10

Family

ID=72475074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910191056.2A Active CN111694704B (en) 2019-03-12 2019-03-12 Debug information output method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111694704B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112732586B (en) * 2021-01-20 2024-06-07 山东云海国创云计算装备产业创新中心有限公司 Chip debugging method, system, device and computer readable storage medium
CN113051093A (en) * 2021-03-16 2021-06-29 长沙景嘉微电子股份有限公司 OpenGL-driven error grading processing method and device and electronic equipment
CN114153509A (en) * 2021-12-01 2022-03-08 联想(北京)有限公司 System starting method and electronic equipment
CN114996082A (en) * 2022-05-05 2022-09-02 重庆创通联达智能技术有限公司 Method, device, electronic device and storage medium for acquiring information of non-display device

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006133836A (en) * 2004-11-02 2006-05-25 Seiko Epson Corp Microcomputer and method of manufacturing microcomputer
CN101800843A (en) * 2010-04-22 2010-08-11 四川长虹电器股份有限公司 Set top box capturing printing information method
CN102270131A (en) * 2011-06-29 2011-12-07 深圳市博康智能信息技术有限公司 System for unified management of debugging information
CN102521087A (en) * 2011-11-02 2012-06-27 烽火通信科技股份有限公司 System and method for remotely obtaining real-time graded debugging information of kernel module
JP2012141906A (en) * 2011-01-06 2012-07-26 Nec Access Technica Ltd Debug object device, debug information output system, debug information output method and debug information output program
CN104007944A (en) * 2014-06-23 2014-08-27 上海斐讯数据通信技术有限公司 A debug printing method and a debug print system
CN104951395A (en) * 2014-03-27 2015-09-30 浙江大华技术股份有限公司 Debugging information processing method and device for embedded system
CN105204789A (en) * 2015-08-24 2015-12-30 北京金山安全软件有限公司 API (application program interface) debugging log printing method and device
CN105260315A (en) * 2015-11-13 2016-01-20 上海斐讯数据通信技术有限公司 Method for debugging log in embedded system process
CN105868391A (en) * 2012-09-25 2016-08-17 北京奇虎科技有限公司 Method and device for recording log
CN106776308A (en) * 2016-12-06 2017-05-31 福州高图信息技术有限公司 A kind of electronic product malfunction test method and system based on Uboot
CN107547943A (en) * 2016-06-23 2018-01-05 中兴通讯股份有限公司 A kind of journal file is derived automatically from method and set top box
CN107577577A (en) * 2017-09-13 2018-01-12 郑州云海信息技术有限公司 Method, apparatus, system and the computer-readable recording medium of log-rank printing

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8806435B2 (en) * 2004-12-31 2014-08-12 Intel Corporation Remote logging mechanism
JP2006259810A (en) * 2005-03-15 2006-09-28 Matsushita Electric Ind Co Ltd Debug device
US8458667B2 (en) * 2008-01-30 2013-06-04 National Instruments Corporation Debugging a statechart for a real time target
US20130031419A1 (en) * 2011-07-28 2013-01-31 International Business Machines Corporation Collecting Debug Data in a Secure Chip Implementation

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006133836A (en) * 2004-11-02 2006-05-25 Seiko Epson Corp Microcomputer and method of manufacturing microcomputer
CN101800843A (en) * 2010-04-22 2010-08-11 四川长虹电器股份有限公司 Set top box capturing printing information method
JP2012141906A (en) * 2011-01-06 2012-07-26 Nec Access Technica Ltd Debug object device, debug information output system, debug information output method and debug information output program
CN102270131A (en) * 2011-06-29 2011-12-07 深圳市博康智能信息技术有限公司 System for unified management of debugging information
CN102521087A (en) * 2011-11-02 2012-06-27 烽火通信科技股份有限公司 System and method for remotely obtaining real-time graded debugging information of kernel module
CN105868391A (en) * 2012-09-25 2016-08-17 北京奇虎科技有限公司 Method and device for recording log
CN104951395A (en) * 2014-03-27 2015-09-30 浙江大华技术股份有限公司 Debugging information processing method and device for embedded system
CN104007944A (en) * 2014-06-23 2014-08-27 上海斐讯数据通信技术有限公司 A debug printing method and a debug print system
CN105204789A (en) * 2015-08-24 2015-12-30 北京金山安全软件有限公司 API (application program interface) debugging log printing method and device
CN105260315A (en) * 2015-11-13 2016-01-20 上海斐讯数据通信技术有限公司 Method for debugging log in embedded system process
CN107547943A (en) * 2016-06-23 2018-01-05 中兴通讯股份有限公司 A kind of journal file is derived automatically from method and set top box
CN106776308A (en) * 2016-12-06 2017-05-31 福州高图信息技术有限公司 A kind of electronic product malfunction test method and system based on Uboot
CN107577577A (en) * 2017-09-13 2018-01-12 郑州云海信息技术有限公司 Method, apparatus, system and the computer-readable recording medium of log-rank printing

Also Published As

Publication number Publication date
CN111694704A (en) 2020-09-22

Similar Documents

Publication Publication Date Title
CN111694704B (en) Debug information output method, device, electronic equipment and storage medium
CN108427731B (en) Page code processing method and device, terminal equipment and medium
CN110866258B (en) Rapid vulnerability positioning method, electronic device and storage medium
CN113489713B (en) Network attack detection method, device, equipment and storage medium
WO2015131804A1 (en) Call stack relationship acquiring method and apparatus
CN110096314A (en) A kind of interface initialization method, apparatus, equipment and computer readable storage medium
US20170199889A1 (en) Method and device for identifying junk picture files
CN111538659A (en) Interface testing method and system for service scene, electronic device and storage medium
CN112015483B (en) POST request parameter automatic processing method and device and readable storage medium
CN111143831A (en) Installation package privacy permission scanning method and device and computer equipment
CN107085684B (en) Program feature detection method and device
CN105207830A (en) Detection method and apparatus for terminal information, and terminal
CN113553578A (en) Log printing response method and device, electronic equipment and storage medium
CN112784272B (en) Application processing method, device, electronic equipment, system and storage medium
Al-Zarouni Introduction to mobile phone flasher devices and considerations for their use in mobile phone forensics
WO2025123744A1 (en) Log sensitive information detection method and system, electronic device, and storage medium
JP2006236220A (en) Device, method, program and storage medium for forming test data file
CN108520185A (en) Detect method, apparatus, equipment and the computer readable storage medium of webpage tamper
CN118779850A (en) A code obfuscation configuration method, device, equipment and medium
CN102984229B (en) For configuring the method and system of trust machine
CN113722639B (en) Website access verification method, device, electronic equipment and readable storage medium
CN110244986A (en) Browser configuration method and device
CN116522380A (en) Data desensitization method and system based on data center station and electronic equipment
CN108965108A (en) A kind of information push method and relevant device
CN100511178C (en) Detection item location method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant