Movatterモバイル変換


[0]ホーム

URL:


CN111563000A - File generation method, intelligent terminal and storage medium - Google Patents

File generation method, intelligent terminal and storage medium
Download PDF

Info

Publication number
CN111563000A
CN111563000ACN202010347465.XACN202010347465ACN111563000ACN 111563000 ACN111563000 ACN 111563000ACN 202010347465 ACN202010347465 ACN 202010347465ACN 111563000 ACN111563000 ACN 111563000A
Authority
CN
China
Prior art keywords
thread
program
user program
file generation
file
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.)
Granted
Application number
CN202010347465.XA
Other languages
Chinese (zh)
Other versions
CN111563000B (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.)
Shenzhen Zhenyou Software Technology Co ltd
Original Assignee
Shenzhen Genew Technologies 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 Shenzhen Genew Technologies Co LtdfiledCriticalShenzhen Genew Technologies Co Ltd
Priority to CN202010347465.XApriorityCriticalpatent/CN111563000B/en
Publication of CN111563000ApublicationCriticalpatent/CN111563000A/en
Application grantedgrantedCritical
Publication of CN111563000BpublicationCriticalpatent/CN111563000B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention discloses a file generation method, an intelligent terminal and a storage medium, wherein the method comprises the following steps: when a first thread in a plurality of threads in the user program executes an error instruction, the user program triggers a CPU (Central processing Unit) to interrupt so as to execute an interrupt program; the interrupt program searches and records a first thread executing the wrong instruction; the Linux operating system sends an event that the user program executes an error instruction and the ID of the first thread to the user program; and the user program stores the data in the memory address area used by the first thread to a core dump file according to the ID of the first thread. The invention only generates the corresponding core dump file for the thread executing the error instruction, thereby greatly reducing the size of the core dump file and facilitating the storage, the copying and the use of the core dump file.

Description

File generation method, intelligent terminal and storage medium
Technical Field
The invention relates to the technical field of computer application, in particular to a file generation method, an intelligent terminal and a storage medium.
Background
A Linux (operating system kernel) is a widely used operating system, on which a user program (for example, a 5G data forwarding plane is used to forward a user data packet in a 5G network, a program for implementing the data forwarding plane is called a forwarding program, and the forwarding program may be a user program), and when the user program executes an incorrect instruction (including that the executed instruction is correct but an incorrect parameter is input), the Linux operating system is triggered to generate a coredump file (core dump file) that includes information such as dynamic data of all threads of the program at the moment when the user program executes an error, system dynamic memory data, and the like; the method can be used for analyzing and positioning the reasons of errors of the user program, and can be used for positioning corresponding information such as stack call when the program exits abnormally by analyzing the coredump file through a tool so as to find out and solve the problem in time.
It can be known that the coredump file stores all the memory data of the user program during operation, which causes the coredump file to be very large, usually having a size of several gbytes (e.g. 8 gbytes), and is inconvenient to store, copy and use the large file.
Accordingly, the prior art is yet to be improved and developed.
Disclosure of Invention
The invention mainly aims to provide a file generation method, an intelligent terminal and a storage medium, and aims to solve the problem that a coredump file with a large memory is inconvenient to store, copy and use in the prior art.
In order to achieve the above object, the present invention provides a file generating method, including the steps of:
when a first thread in a plurality of threads in the user program executes an error instruction, the user program triggers a CPU (Central processing Unit) to interrupt so as to execute an interrupt program;
the interrupt program searches and records a first thread executing the wrong instruction;
the Linux operating system sends an event that the user program executes an error instruction and the ID of the first thread to the user program;
and the user program stores the data in the memory address area used by the first thread to a core dump file according to the ID of the first thread.
Optionally, in the file generation method, the user program is composed of a plurality of independent threads.
Optionally, in the file generation method, each thread uses an independent memory address area.
Optionally, in the file generating method, the interrupt program is used to control the CPU to stop executing the normal code of the program, and jump to execute the code for processing the current emergency.
Optionally, in the file generating method, the error instruction includes an instruction that an error parameter is input.
Optionally, the file generating method further includes:
when a first thread in a plurality of threads in a user program executes an error instruction, the Linux operating system does not directly trigger generation of a core dump file any more.
In addition, to achieve the above object, the present invention further provides an intelligent terminal, wherein the intelligent terminal includes: a memory, a processor and a file generation program stored on the memory and executable on the processor, the file generation program when executed by the processor implementing the steps of the file generation method as described above.
In order to achieve the above object, the present invention further provides a storage medium storing a file generation program that realizes the steps of the file generation method described above when executed by a processor.
In the invention, when a first thread in a plurality of threads in a user program executes an error instruction, the user program triggers a CPU (Central processing Unit) to interrupt so as to execute an interrupt program; the interrupt program searches and records a first thread executing the wrong instruction; the Linux operating system sends an event that the user program executes an error instruction and the ID of the first thread to the user program; and the user program stores the data in the memory address area used by the first thread to a core dump file according to the ID of the first thread. The invention only generates the corresponding core dump file for the thread executing the error instruction, thereby greatly reducing the size of the core dump file and facilitating the storage, the copying and the use of the core dump file.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of a document generation method of the present invention;
fig. 2 is a schematic operating environment diagram of an intelligent terminal according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, the file generation method according to the preferred embodiment of the present invention includes the following steps:
step S10, when the first thread of the plurality of threads in the user program executes the error instruction, the user program triggers the CPU to interrupt to execute the interrupt program.
Specifically, the user program can run a plurality of threads (a thread is the minimum unit of operation scheduling of an operating system, is contained in a process and is the actual operation unit in the process, one thread refers to a single-sequence control flow in the process, a plurality of threads can be concurrently executed in one process, each thread executes different tasks in parallel, the advantage of multi-thread program design on a multi-core or multi-CPU or a CPU supporting Hyper-threading is obvious, namely the execution throughput rate of the program is improved, a multithreading technology is used on a single-CPU and single-core computer, the part which is in charge of I/O processing and human-computer interaction and is usually blocked in the process can be separated from the part of intensive calculation, a special work thread is written to execute the intensive calculation, and the execution efficiency of the program is improved), and the user program consists of a plurality of independent threads.
The first thread refers to one of the threads (which may be any one of the threads), that is, when a thread of the user program executes an error instruction, the CPU is triggered to interrupt, and an interrupt program is executed (also referred to as an interrupt service program, where a processor processes a "panic" which is understood to be a service that is completed by executing a specific program programmed in advance, the program processing the "panic" is referred to as an interrupt service program, when the CPU is processing internal data, an emergency occurs outside, the CPU is required to suspend the current work to process the emergency, and after the processing is completed, the CPU returns to the original interrupted address to continue the original work, and such a process is referred to as interrupt).
The interrupt program is used for controlling the CPU to stop executing the normal codes of the program, skipping to execute the codes for processing the current emergency condition, namely when some emergency condition occurs (for example, the error instruction is executed), the CPU stops executing the normal codes of the program, and skipping to execute the codes for processing the emergency condition.
Wherein the error instruction comprises an instruction into which an error parameter is input. For example, the memory has 8Gbyte, the address range is 0-8Gbyte, if a certain command reads the data of the memory with the memory address of 9Gbyte, this is an erroneous command, and the blue screen of the windows system is often caused by the erroneous command.
Step S20, the interrupt program searches for the first thread executing the faulty instruction and records the first thread.
Specifically, when the user program triggers the CPU interrupt, and after the interrupt program is executed, the interrupt program searches for a first thread (i.e., a certain thread that executes the wrong instruction) that executes the wrong instruction and records the first thread.
In step S30, the Linux operating system sends the user program an event that the user program executed the error instruction and the ID of the first thread to the user program.
Specifically, the Linux operating system (a multi-user, multi-task and multi-CPU supporting operating system based on POSIX and Unix; Linux is not only stable in system performance but also open source software; the core firewall component of the Linux is efficient in performance and simple in configuration, and the safety of the system is guaranteed; in many enterprise networks, in order to pursue speed and safety, Linux is used as a server by network operation and maintenance personnel, and can be used as a server and a network firewall, and the Linux sends an event that a user program executes an incorrect instruction and the ID of the thread (namely, the ID can identify which thread the user program executes) to the user program, wherein each thread corresponds to a special ID.
In step S40, the user program saves the data in the memory address area used by the first thread to the core dump file according to the ID of the first thread.
Specifically, the user program saves, according to the thread ID (i.e., a thread that executed an erroneous instruction), only data in a memory address area (each thread uses a separate memory address area) used by the thread (i.e., a thread that executed an erroneous instruction) to the core dump file (i.e., the coredump file). Further, when a plurality of threads execute wrong instructions, the steps are executed one by one according to the sequence.
The Linux operating system sends the event that the user program executes the wrong instruction and the thread ID to the user program, and because only the user program knows which memory addresses are used when the thread runs, the user program only saves the data of the memory addresses used by the thread to a coredump file.
For example, the user program creates 10 threads, thread 1, thread 2, thread 3, thread 4, thread 5, thread 6, thread 7, thread 8, thread 9,thread 10. Each thread uses an independent memory address area 1, a memory address area 2, a memory address area 3, a memory address area 4, a memory address area 5, a memory address area 6, a memory address area 7, a memory address area 8, a memory address area 9 and amemory address area 10, and one thread corresponds to one memory address area. When thread 2 executes an error instruction, the Linux operating system sends an event that the user program executes the error instruction and the ID of the thread 2 to the user program, and the user program only saves the data in the memory address area 2 used by the thread 2 to a coredump file (i.e., a core dump file).
The invention generates a simplified coredump file, when a certain thread of a user program executes an error instruction, a Linux operating system does not directly trigger the generation of the coredump file (the Linux operating system cannot distinguish which data are data which cannot be used by the thread and only can store all data of a brain), but finds out the thread ID executing the error instruction, transmits an event executing the error instruction and the thread ID to the user program for processing, and the user program only stores data in a memory address area used by the thread into the coredump file according to the thread ID.
Further, as shown in fig. 2, based on the file generation method, the present invention also provides an intelligent terminal, which includes aprocessor 10, amemory 20 and adisplay 30. Fig. 2 shows only some of the components of the smart terminal, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Thememory 20 may be an internal storage unit of the intelligent terminal in some embodiments, such as a hard disk or a memory of the intelligent terminal. Thememory 20 may also be an external storage device of the Smart terminal in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the Smart terminal. Further, thememory 20 may also include both an internal storage unit and an external storage device of the smart terminal. Thememory 20 is used for storing application software installed in the intelligent terminal and various data, such as program codes of the installed intelligent terminal. Thememory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, thememory 20 stores afile generation program 40, and thefile generation program 40 can be executed by theprocessor 10 to implement the file generation method of the present application.
Theprocessor 10 may be, in some embodiments, a Central Processing Unit (CPU), a microprocessor or other file generation chip, and is used for executing program codes stored in thememory 20 or processing data, such as executing the file generation method.
Thedisplay 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like in some embodiments. Thedisplay 30 is used for displaying information at the intelligent terminal and for displaying a visual user interface. The components 10-30 of the intelligent terminal communicate with each other via a system bus.
In one embodiment, the following steps are implemented when theprocessor 10 executes thefile generation program 40 in the memory 20:
when a first thread in a plurality of threads in the user program executes an error instruction, the user program triggers a CPU (Central processing Unit) to interrupt so as to execute an interrupt program;
the interrupt program searches and records a first thread executing the wrong instruction;
the Linux operating system sends an event that the user program executes an error instruction and the ID of the first thread to the user program;
and the user program stores the data in the memory address area used by the first thread to a core dump file according to the ID of the first thread.
The user program is composed of a plurality of independent threads.
Each thread uses a separate memory address region.
The interrupt program is used for controlling the CPU to stop executing the normal codes of the program and jump to execute the codes for processing the current emergency condition.
The error instruction includes an instruction that an error parameter is input.
The file generation method further comprises:
when a first thread in a plurality of threads in a user program executes an error instruction, the Linux operating system does not directly trigger generation of a core dump file any more.
The present invention also provides a storage medium, wherein the storage medium stores a file generation program, and the file generation program realizes the steps of the file generation method when being executed by a processor.
In summary, the present invention provides a file generating method, an intelligent terminal and a storage medium, where the method includes: when a first thread in a plurality of threads in the user program executes an error instruction, the user program triggers a CPU (Central processing Unit) to interrupt so as to execute an interrupt program; the interrupt program searches and records a first thread executing the wrong instruction; the Linux operating system sends an event that the user program executes an error instruction and the ID of the first thread to the user program; and the user program stores the data in the memory address area used by the first thread to a core dump file according to the ID of the first thread. The invention only generates the corresponding core dump file for the thread executing the error instruction, thereby greatly reducing the size of the core dump file and facilitating the storage, the copying and the use of the core dump file.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.

Claims (8)

CN202010347465.XA2020-04-282020-04-28File generation method, intelligent terminal and storage mediumActiveCN111563000B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010347465.XACN111563000B (en)2020-04-282020-04-28File generation method, intelligent terminal and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010347465.XACN111563000B (en)2020-04-282020-04-28File generation method, intelligent terminal and storage medium

Publications (2)

Publication NumberPublication Date
CN111563000Atrue CN111563000A (en)2020-08-21
CN111563000B CN111563000B (en)2023-08-18

Family

ID=72071832

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010347465.XAActiveCN111563000B (en)2020-04-282020-04-28File generation method, intelligent terminal and storage medium

Country Status (1)

CountryLink
CN (1)CN111563000B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113220495A (en)*2021-05-242021-08-06浙江大华技术股份有限公司Process abnormal event processing method and device, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101989322A (en)*2010-11-192011-03-23北京安天电子设备有限公司Method and system for automatically extracting memory features of malicious code
US20140129880A1 (en)*2012-11-082014-05-08Dell Products L.P.Generation of memory dump of a computer process without terminating the computer process
CN107357731A (en)*2017-07-172017-11-17福建星瑞格软件有限公司Process produces monitoring, analysis and the processing method of core dump problems
CN109445877A (en)*2018-09-192019-03-08珠海金山网络游戏科技有限公司A method of detection game server multithreading uses same virtual machine
CN109582542A (en)*2018-12-042019-04-05中国航空工业集团公司西安航空计算技术研究所A kind of method of core of embedded system dump
CN110109770A (en)*2019-05-062019-08-09Oppo广东移动通信有限公司Adjustment method, device, electronic equipment and medium
CN110147294A (en)*2019-05-232019-08-20Oppo广东移动通信有限公司Acquisition methods, device, terminal and the computer readable storage medium of Debugging message
CN110262918A (en)*2019-06-192019-09-20深圳市网心科技有限公司Process collapses analysis method and device, distributed apparatus and storage medium
CN110727566A (en)*2019-09-052020-01-24北京字节跳动网络技术有限公司Method, device, medium and electronic equipment for acquiring process crash information
CN110928720A (en)*2020-02-102020-03-27北京安博通科技股份有限公司Core dump file generation method and device based on Linux system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101989322A (en)*2010-11-192011-03-23北京安天电子设备有限公司Method and system for automatically extracting memory features of malicious code
US20140129880A1 (en)*2012-11-082014-05-08Dell Products L.P.Generation of memory dump of a computer process without terminating the computer process
CN107357731A (en)*2017-07-172017-11-17福建星瑞格软件有限公司Process produces monitoring, analysis and the processing method of core dump problems
CN109445877A (en)*2018-09-192019-03-08珠海金山网络游戏科技有限公司A method of detection game server multithreading uses same virtual machine
CN109582542A (en)*2018-12-042019-04-05中国航空工业集团公司西安航空计算技术研究所A kind of method of core of embedded system dump
CN110109770A (en)*2019-05-062019-08-09Oppo广东移动通信有限公司Adjustment method, device, electronic equipment and medium
CN110147294A (en)*2019-05-232019-08-20Oppo广东移动通信有限公司Acquisition methods, device, terminal and the computer readable storage medium of Debugging message
CN110262918A (en)*2019-06-192019-09-20深圳市网心科技有限公司Process collapses analysis method and device, distributed apparatus and storage medium
CN110727566A (en)*2019-09-052020-01-24北京字节跳动网络技术有限公司Method, device, medium and electronic equipment for acquiring process crash information
CN110928720A (en)*2020-02-102020-03-27北京安博通科技股份有限公司Core dump file generation method and device based on Linux system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113220495A (en)*2021-05-242021-08-06浙江大华技术股份有限公司Process abnormal event processing method and device, electronic equipment and storage medium
CN113220495B (en)*2021-05-242024-04-16浙江大华技术股份有限公司Method and device for processing process abnormal event, electronic equipment and storage medium

Also Published As

Publication numberPublication date
CN111563000B (en)2023-08-18

Similar Documents

PublicationPublication DateTitle
RU2286595C2 (en)Method for realization of computer multi-task system through virtual organization of thread processing
CA2061298C (en)Method for detecting critical failures during the building of complex computer programs from source code parts
US9104425B2 (en)Apparatus and method for handling exception events
US8136097B2 (en)Thread debugging device, thread debugging method and information storage medium
US6886081B2 (en)Method and tool for determining ownership of a multiple owner lock in multithreading environments
EP0767938B1 (en)Method for enforcing a hierarchical invocation structure in real time asynchronous software applications
US8561070B2 (en)Creating a thread of execution in a computer processor without operating system intervention
CN101504626B (en)Debugging control implementing method and system
US8756583B2 (en)Thread-specific event management in a non-stop debugging environment
JP6401235B2 (en) Operating system support for contracts
US20060200807A1 (en)Breakpoint timers
US7971205B2 (en)Handling of user mode thread using no context switch attribute to designate near interrupt disabled priority status
CN114816662A (en)Container arrangement method and system applied to Kubernetes
US9824229B2 (en)Controller with enhanced reliability
JPH06324885A (en)Method and equipment for processing exception condition
US8694961B2 (en)Thread-agile execution of dynamic programming language programs
US7080374B2 (en)System and method for using native code interpretation to move threads to a safe state in a run-time environment
CN111563000B (en)File generation method, intelligent terminal and storage medium
CN119938246A (en) User-mode interrupt processing method, device, equipment and program product
US8359602B2 (en)Method and system for task switching with inline execution
CN112988365B (en)Thread management method, device, equipment and medium
US7877629B2 (en)Facilitating handling of exceptions in a program implementing a M-on-N threading model
JP2022107229A (en) Information processing equipment, control method and control program
CN119376874B (en)Role-based multi-task software system construction and monitoring method and system
JP2007213396A (en) Debug system, operation system, debugging method, program

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
TA01Transfer of patent application right
TA01Transfer of patent application right

Effective date of registration:20230609

Address after:518057 area a, 5th floor, Caixun technology building, 3176 Keyuan South Road, Gaoxin community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after:Shenzhen Zhenyou Software Technology Co.,Ltd.

Address before:518057 5 / F and 6 / F, Caixun technology building, 3176 Keyuan South Road, high tech community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant before:SHENZHEN GENEW TECHNOLOGY Co.,Ltd.

GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp