CN114327979A - Method and device for acquiring stack information of thread crash - Google Patents

Method and device for acquiring stack information of thread crash Download PDF

Info

Publication number
CN114327979A
CN114327979A CN202111612874.9A CN202111612874A CN114327979A CN 114327979 A CN114327979 A CN 114327979A CN 202111612874 A CN202111612874 A CN 202111612874A CN 114327979 A CN114327979 A CN 114327979A
Authority
CN
China
Prior art keywords
thread
crash
stack information
microkernel
stack
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.)
Pending
Application number
CN202111612874.9A
Other languages
Chinese (zh)
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.)
Beijing Hollysys Co Ltd
Original Assignee
Beijing Hollysys 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 Beijing Hollysys Co Ltd filed Critical Beijing Hollysys Co Ltd
Priority to CN202111612874.9A priority Critical patent/CN114327979A/en
Publication of CN114327979A publication Critical patent/CN114327979A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application discloses a method and a device for acquiring stack information of thread breakdown, wherein the method comprises the following steps: after the user space receives the thread crash notification, the crash processing thread of the user space reads stack information of the thread crash in the FLASH outside the CPU; and recording the read stack information of the thread crash into a log file of the system, so that a user can obtain the stack information of the thread crash by reading the log file. The method and the device enable a user to acquire stack information of the thread breakdown.

Description

Method and device for acquiring stack information of thread crash
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for obtaining stack information of a thread crash.
Background
The PLC is widely applied to the field of process control and is very important automatic control equipment. And time corporation developed a highly secure microkernel operating system kernel (microkernel for short) based on a domestic MIPS architecture processor, which runs in the kernel space of a CPU. And time corporation developed PLC controller software based on the micro-kernel, which runs in the user space of the CPU.
Depending on the PLC controller software requirements, stack information for a thread crash must be provided when a thread crash occurs to further analyze and locate problems. However, the PLC controller software runs in user mode, uses virtual memory, and cannot access the memory of the microkernel. The microkernel only provides five extremely original functions of thread management, interprocess communication (IPC), virtual memory space, handle space and equipment basic unit (interrupt object) in the kernel space, and can identify the crash stack of the thread but cannot access the memory of the PLC controller software. Due to the two points, when the thread crash occurs, the micro-kernel cannot transmit stack communication with the crashed thread to the PLC controller software through the memory.
Content of application
The application provides a method and a device for acquiring stack information of a thread crash by a user space, which can enable a user to acquire the stack information of the thread crash.
The application provides a method for acquiring stack information of thread crash, which comprises the following steps:
after the user space receives the thread crash notification, the crash processing thread of the user space reads stack information of the thread crash in the external FLASH of the CPU;
and recording the read stack information of the thread crash into a log file of the system, so that a user can obtain the stack information of the thread crash by reading the log file.
In an exemplary embodiment, the stack information of the thread crash is stored in the block storage space where the last first number of bytes of the external FLASH are located.
In an exemplary embodiment, the stack information of the thread crash is written into the external FLASH by the microkernel when the thread crash occurs.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
initializing the external FLASH by the initial thread of the microkernel;
after the microkernel writes the stack information of the thread crash into the external FLASH, the method comprises the following steps:
an interrupt is generated to notify the user space that a thread crash has occurred.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
the microkernel intercepts a second amount of byte data in all stack information of the thread crash according to the initial stack address and sp value of the crash thread;
adding a third number of byte data headers to the second number of byte data to form stack information of the thread crash;
erasing the block storage space where the last first number of bytes of the external FLASH are located;
writing stack information of the thread crash into the erased block memory space;
the first number is equal to a sum of the second number and the third number.
In an exemplary embodiment, the micro-kernel intercepting a second amount of byte data in all information of the thread crash according to a starting stack address and a sp value of the crashed thread comprises:
reading a second amount of byte data starting from the sp when the difference between the starting stack address and the value of the sp is greater than the second amount;
reading an actual number of bytes from the sp when a difference between the starting stack address and the sp is less than or equal to a second number.
In an exemplary embodiment, the first number is 1024; the second number is 1000; the third number is 24.
In an exemplary embodiment, the initializing thread of the microkernel initializes the external FLASH, including:
and calling an initialization function of the external FLASH to realize the initialization of the external FLASH.
In an exemplary embodiment, the external FLASH includes a nor-FLASH.
The device for acquiring the stack information of the thread crash comprises a memory and a processor,
the memory is used for storing a program for acquiring stack information of thread crash;
the processor is configured to read and execute the program for acquiring the stack information of the thread crash, and perform the following operations:
after the user space receives the thread crash notification, the crash processing thread of the user space reads stack information of the thread crash in the external FLASH of the CPU;
and recording the read stack information of the thread crash into a log file of the system, so that a user can obtain the stack information of the thread crash by reading the log file.
In an exemplary embodiment, the stack information of the thread crash is stored in the block storage space where the last first number of bytes of the external FLASH are located.
In an exemplary embodiment, the stack information of the thread crash is written into the external FLASH by the microkernel when the thread crash occurs.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
initializing the external FLASH by the initial thread of the microkernel;
after the microkernel writes the stack information of the thread crash into the external FLASH, the method comprises the following steps:
an interrupt is generated to notify the user space that a thread crash has occurred.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
the microkernel intercepts a second amount of byte data in all stack information of the thread crash according to the initial stack address and sp value of the crash thread;
adding a third number of byte data headers to the second number of byte data to form stack information of the thread crash;
erasing the block storage space where the last first number of bytes of the external FLASH are located;
writing stack information of the thread crash into the erased block memory space;
the first number is equal to a sum of the second number and the third number.
In an exemplary embodiment, the micro-kernel intercepting a second amount of byte data in all information of the thread crash according to a starting stack address and a sp value of the crashed thread comprises:
reading a second amount of byte data starting from the sp when the difference between the starting stack address and the value of the sp is greater than the second amount;
reading an actual number of bytes from the sp when a difference between the starting stack address and the sp is less than or equal to a second number.
In an exemplary embodiment, the first number is 1024; the second number is 1000; the third number is 24.
In an exemplary embodiment, the initializing thread of the microkernel initializes the external FLASH, including:
and calling an initialization function of the external FLASH to realize the initialization of the external FLASH.
In an exemplary embodiment, the external FLASH includes a nor-FLASH.
According to the method, the stack information of the thread crash is written into the nor-flash through the microkernel, so that a user can acquire the stack information of the thread crash.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. Other advantages of the present application may be realized and attained by the instrumentalities and combinations particularly pointed out in the specification and the drawings.
Drawings
The accompanying drawings are included to provide an understanding of the present disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the examples serve to explain the principles of the disclosure and not to limit the disclosure.
FIG. 1 is a flowchart of a method for obtaining stack information of a thread crash according to an embodiment of the present disclosure;
fig. 2 is a block diagram of a PLC controller according to an embodiment of the present disclosure;
FIG. 3 is a general flowchart of a thread crash stack information record according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of an apparatus for acquiring stack information of a thread crash according to an embodiment of the present disclosure.
Detailed Description
Fig. 1 is a flowchart of a method for obtaining a thread crash address according to an embodiment of the present disclosure, and as shown in fig. 1, the method for obtaining stack information of a thread crash according to the embodiment includes steps S11-S12:
s11, when the user space receives the thread crash notification, the crash processing thread of the user space reads the stack information of the thread crash in the external FLASH of the CPU;
and S12, recording the read stack information of the thread crash into a log file of the system, so that a user can obtain the stack information of the thread crash by reading the log file.
In an exemplary embodiment, the stack information of the thread crash is stored in the block storage space where the last first number of bytes of the external FLASH are located.
In an exemplary embodiment, the stack information of the thread crash is written into the external FLASH by the microkernel when the thread crash occurs.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
initializing the external FLASH by the initial thread of the microkernel;
in an exemplary embodiment, after the microkernel writes stack information of the thread crash to the external FLASH, the method includes:
an interrupt is generated to notify the user space that a thread crash has occurred.
In an exemplary embodiment, writing stack information of the thread crash to the external FLASH by the microkernel includes:
the microkernel intercepts a second amount of byte data in all stack information of the thread crash according to the initial stack address and sp value of the crash thread;
adding a third number of byte data headers to the second number of byte data to form stack information of the thread crash;
erasing the block storage space where the last first number of bytes of the external FLASH are located;
writing stack information of the thread crash into the erased block memory space;
the first number is equal to a sum of the second number and the third number.
In an exemplary embodiment, the micro-kernel intercepting a second amount of byte data in all information of the thread crash according to a starting stack address and a sp value of the crashed thread comprises:
reading a second amount of byte data starting from the sp when the difference between the starting stack address and the value of the sp is greater than the second amount;
reading an actual number of bytes from the sp when a difference between the starting stack address and the sp is less than or equal to a second number.
In an exemplary embodiment, the first number is 1024; the second number is 1000; the third number is 24.
In an exemplary embodiment, the initializing thread of the microkernel initializes the external FLASH, including:
and calling an initialization function of the external FLASH to realize the initialization of the external FLASH.
In an exemplary embodiment, the external FLASH of the cpu comprises a nor-FLASH.
In an exemplary embodiment, the log file is saved in a nand-flash external to the cpu.
For a better understanding of the application, the following description is made in detail with an implementation method for transferring stack information of a thread crash from a microkernel to PLC controller software based on a microkernel operating system.
The crash stack recording function designed by the application mainly modifies two parts, namely a microkernel operating system kernel and a crash processing thread. Wherein the micro-kernel operating system kernel corresponds to the component 12 of the structural block diagram of the PLC controller of fig. 2; the crash processing thread corresponds to the crash processing thread of component 20 of the block diagram of the PLC controller structure of fig. 2.
The difficulty of the thread crash stack recording function of the PLC based on the microkernel operating system is that an effective channel for transmitting information from the microkernel to the PLC software is found. The crash stack of the thread is the content stored in the thread stack when the thread crashes, and the user can recall the calling process of the function when the crash occurs by combining the content with the code disassembling information. The crash stack information for a thread is typically large, at least tens of bytes. Since the microkernel operating system provides only five extremely primitive functions, no method and interface functions are provided to pass user information from the microkernel to the user space, resulting in the difficulty of passing crash stack information for threads from the microkernel to the PLC controller software. The method is specifically divided into the following 2 aspects:
first, the microkernel cannot pass the crash address to the PLC controller software via memory. The microkernel runs in a kernel space, the PLC controller software runs in a user space, the microkernel and the PLC controller software are both virtual addresses, the addresses are invisible, and a channel and an interface function of a shared memory of the microkernel and the PLC controller software do not exist. Although the crash stack information of the thread is stored in the microkernel, the microkernel cannot transfer the crash stack information to the PLC controller software by means of the memory, so that the PLC controller software cannot obtain the crash stack information of the thread.
Secondly, the microkernel cannot pass the crash stack information to the PLC controller software by means of the cpu register. The cpu of Mips architecture has 32 registers in total, and the thread crash stack is a data area, and the registers cannot store the data at all. In summary, the microkernel cannot pass this crash stack information to the PLC controller software via the cpu register.
The crash stack information can not be transmitted to the PLC controller software by the aid of the memory through the microkernel, and the crash stack information can not be transmitted to the PLC controller software by the aid of the cpu register through the microkernel. The demonstration process is as follows:
the stack of threads in the microkernel is default to 64KB, a minimum of no less than 4 KB. In most cases, the latest 1024 bytes of the thread stack information are intercepted, and in combination with the code disassembling information, the user can backtrack the calling process of the function when the crash occurs. Because the crash stack information for a thread is large, it is preferably stored in a non-memory swappable medium. A file system is designed in the PLC controller software, and large pieces of information can be stored in nand-flash in a file form. The PLC controller software is also designed with a power-down maintaining function, and a large number of pieces of user data can be stored in the nor-flash in a binary mode when the power is down. If the microkernel can also access the nor-flash or the nand-flash, the function can be realized by recording the thread crash stack information into the nor-flash or the nand-flash when the crash occurs and then reading the thread crash stack information in the crash processing thread. The microkernel can access the serial port to print some debugging information, which indicates that the microkernel can access some peripheral equipment of the cpu; the PLC controller software can also print some debugging information to the serial port, and the function does not depend on the micro-kernel, which shows that the PLC controller software can also access some peripheral equipment of the cpu. Therefore, the microkernel and the PLC controller software can access some peripheral equipment of the cpu, and it is inferred that a nor-flash driver or a nand-flash driver can be added into the microkernel, so that the nor-flash driver or the nand-flash driver can be accessed. In the PLC controller software, a file system is constructed on the nand-flash, and the nand-flash is complex to use; the nor-flash has no file system thereon, only has simple drive, and only writes some data when the system is powered off, and reads some data when the system is powered on. Therefore, the use of the nor-flash in the PLC controller software is much simpler than that of the nand-flash, the influence is smaller when the function is increased, and the selection of the nor-flash is more suitable. In summary, the method combines the characteristics of PLC controller software developed by Heishi company, a nor-flash driver can be constructed in the kernel, and when the thread crash occurs, the kernel stores the information of the thread crash stack into the nor-flash; and reading the crash stack information from the nor-flash when the crash processing thread runs, and then calling a log system to store the crash stack information into a log file located in the nand-flash, thereby realizing the thread crash stack recording function of the PLC based on the microkernel operating system.
The thread crash stack information recording function of the PLC based on the microkernel operating system comprises 2 points of change of the kernel of the microkernel operating system. When the microkernel is initialized, the initialization of the nor-flash is added by referring to the initialization process of the serial port, so that the microkernel can access the nor-flash. And by combining the characteristics of PLC controller software developed by Harry corporation, the nor-flash only uses the front block, and the back block is not used, so that the last 1024 bytes of the nor-flash are selected to store the thread crash information. When the thread is crashed, the microkernel firstly erases a block where the last 1024 bytes of the nor-flash are located, then intercepts the last 1000 bytes of the thread crash stack, adds a 24-byte crash stack information data head, writes the crash stack information data head into the last 1024 bytes of the nor-flash, and continues to operate.
The thread crash stack information recording function of the PLC based on the microkernel operating system is located when the initial thread of the user space is initialized, and the initialization of the nor-flash is executed before, so that the module does not need to be modified.
The thread crash stack information recording function of the PLC based on the microkernel operating system comprises 2 points of change of crash processing threads. When the crash processing thread runs, it first reads the last 1024 bytes of the nor-flash and then calls the log interface to record the 1024 bytes into the log file. The PLC controller software already provides a log reading function, and a user can see the crash stack information by reading the log file.
The general flow of the thread crash stack information recording function and the thread crash stack information recording of the PLC controller based on the microkernel operating system designed in the present application is shown in fig. 3. When the crash happens, the micro kernel writes the crash stack information into the last 1024 bytes of the nor-flash; reading the last 1024 bytes of the nor-flash by the crash processing thread and calling a log module to write the 1024 bytes into a log file; and then the user reads the log file through the network to acquire the information of the crash stack.
According to the method for realizing the thread crash stack information recording function of the PLC based on the microkernel operating system and the realization thereof, a nor-flash drive function is added in the microkernel, and a group of functions are added in the microkernel and PLC software, as follows:
int os_ker_drv_init_norflash(void);
int os_ker_drv_erase_norflash_block(unsigned int offset);
int os_ker_drv_write_to_norflash(char*paddr,unsigned int len);
int os_ker_drv_read_from_norflash(char*paddr,unsigned int len);
void os_ker_init_norflash(void);
void os_ker_write_estack_to_norflash(char*paddr,unsigned int len);
unsigned int os_app_read_estack_from_norflash(char*paddr,unsigned int len);
the os _ ker _ init _ norflash function completes initialization of the nor-flash.
Among the above functions, the driving functions of the nor-flash added in the microkernel include os _ ker _ drv _ init _ norflash, os _ ker _ drv _ erase _ norflash _ block, os _ ker _ drv _ write _ to _ norflash, os _ ker _ drv _ read _ from _ norflash. The functions respectively realize the functions of bottom layer initialization, data reading and data writing of the nor-flash. The part of the code is mainly rewritten by referring to a nor-flash driver in the PLC software. It should be noted here that the microkernel runs in kernel space and uses virtual addresses, and the PLC controller software runs in user space and uses virtual addresses, so there is a separate nor-flash driver in each of the microkernel and the PLC controller software, which is not visible between them. The main difference between these two drivers is different in accessing the virtual address of the nor-flash. The method comprises the steps that an equipment virtual address obtained by mapping of an os _ api _ mem _ map function is used in PLC controller software; the microkernel directly uses the kernel-mode device virtual address. Specifically for mips architectures, the microkernel may obtain the virtual address of the device by the device physical address +0xA0000000, which is a characteristic of mips architectures. In the case of the ARM or X86 architecture, the virtual address of the device must be obtained by other methods, and the specific implementation idea should be to establish a mapping relationship between the physical address and the virtual address of the device in the kernel mode. The application only carries out complete realization on mips architecture at present, and does not carry out specific analysis and realization on ARM or X86 architecture.
The os _ ker _ init _ norflash function implements the initialization function of the nor-flash. This function calls the initialization function os _ ker _ drv _ init _ norflash of the nor-flash to realize the initialization of the nor-flash.
The os _ ker _ write _ estack _ to _ norflash function implements a crash stack information write nor-flash function. The function firstly intercepts the latest 1000 bytes of the crash stack information, and the specific intercepting method is as follows: the starting stack address and sp value (i.e., the stack pointer) of the crashed thread are found, and if the difference between the two values is greater than 1000 bytes, the 1000 bytes are read from sp, otherwise the actual number of bytes are read from sp. A 24-byte data header is added to the crash stack information, the 24-byte data header including a 4-byte valid data length and a 20-byte reserved field. The function then calls the nor-flash erase function os _ ker _ drv _ erase _ norflash _ block to erase the block where the last 1024 bytes of the nor-flash are located. This function then calls the nor-flash write function os _ ker _ drv _ write _ to _ norflash to write the information into the last 1024 bytes in the nor-flash.
The os _ app _ read _ est _ from _ norflash function implements the read crash stack information from nor-flash and log function. The function calls the nor-flash read function to read the last 1024 bytes of the nor-flash (note: the nor-flash read function was previously present and not modified in this application). The function then calls the log module to write the 1024 bytes into the log file.
It should be noted here that the microkernel runs in kernel space and uses virtual addresses, and the PLC controller software runs in user space and uses virtual addresses, so there is a separate nor-flash driver in each of the microkernel and the PLC controller software. For os _ ker _ init _ norflash, os _ ker _ write _ estack _ to _ norflash, and os _ app _ read _ estack _ from _ norflash calls, respectively.
The application has the advantages that: the method and the device have the advantages that the characteristics of the microkernel are tightly surrounded, the nor-flash is suitable to be used as an exchange medium, the thread crash stack information is transmitted to the PLC controller software from the microkernel, and the functional requirements of products are met. The thread crash stack information recording function of the PLC based on the microkernel operating system abandons a transfer path based on a memory and a cpu register, adopts nor-flash as the transfer path, has clear logic, avoids a plurality of limits and difficulties of the microkernel operating system, and avoids large-scale modification of the microkernel. The thread crash stack information recording function of the PLC based on the microkernel operating system is added with a group of function sets, and the function sets are relatively simple to realize.
Fig. 4 is a schematic diagram of an apparatus for acquiring stack information of a thread crash according to an embodiment of the present disclosure, as shown in fig. 4, the apparatus for acquiring stack information of a thread crash according to an embodiment of the present disclosure includes a memory and a processor,
the memory is used for storing a program of stack information for thread crash;
the processor is used for reading and executing the program of the stack information for the thread crash and executing the method of the stack information for the thread crash.
The present application describes embodiments, but the description is illustrative rather than limiting and it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are possible. Any feature or element of any embodiment may be used in combination with or instead of any other feature or element in any other embodiment, unless expressly limited otherwise.
The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique application as defined in the claims. Any feature or element of any embodiment may be combined with features or elements from other applications to form yet another unique application defined by the claims. Thus, it should be understood that any of the features shown and/or discussed in this application may be implemented alone or in any suitable combination. Accordingly, the embodiments are not limited except as by the appended claims and their equivalents. Furthermore, various modifications and changes may be made within the scope of the appended claims.
Further, in describing representative embodiments, the specification may have presented the method and/or process as a particular sequence of steps. However, to the extent that the method or process does not rely on the particular order of steps set forth herein, the method or process should not be limited to the particular sequence of steps described. Other orders of steps are possible as will be understood by those of ordinary skill in the art. Therefore, the particular order of the steps set forth in the specification should not be construed as limitations on the claims. Further, the claims directed to the method and/or process should not be limited to the performance of their steps in the order written, and one skilled in the art can readily appreciate that the sequences may be varied and still remain within the spirit and scope of the embodiments of the present application.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.

Claims (10)

1. A method of obtaining stack information for a thread crash,
after the user space receives the thread crash notification, the crash processing thread of the user space reads stack information of the thread crash in the external FLASH of the CPU;
and recording the read stack information of the thread crash into a log file of the system, so that a user can obtain the stack information of the thread crash by reading the log file.
2. The method of claim 1, comprising:
and the stack information of the thread crash is stored in the block storage space where the last first number of bytes of the external FLASH are located.
3. The method of claim 1, comprising:
and the stack information of the thread crash is written into the external FLASH by the microkernel when the thread crash occurs.
4. The method of claim 3, wherein:
the writing of the stack information of the thread crash into the external FLASH by the microkernel comprises the following steps:
initializing the external FLASH by the initial thread of the microkernel;
after the microkernel writes the stack information of the thread crash into the external FLASH, the method comprises the following steps:
an interrupt is generated to notify the user space that a thread crash has occurred.
5. The method of claim 3, the microkernel writing stack information of the thread crash to the external FLASH, comprising:
the microkernel intercepts a second amount of byte data in all stack information of the thread crash according to the initial stack address and sp value of the crash thread;
adding a third number of byte data headers to the second number of byte data to form stack information of the thread crash;
erasing the block storage space where the last first number of bytes of the external FLASH are located;
writing stack information of the thread crash into the erased block memory space;
the first number is equal to a sum of the second number and the third number.
6. The method of claim 5, the microkernel intercepting a second amount of byte data in all information of a thread crash based on a starting stack address and a value of sp of the crashed thread, comprising:
reading a second amount of byte data starting from the sp when the difference between the starting stack address and the value of the sp is greater than the second amount;
reading an actual number of bytes from the sp when a difference between the starting stack address and the sp is less than or equal to a second number.
7. The method of claim 5, wherein:
the first number is 1024; the second number is 1000; the third number is 24.
8. The method of claim 4, wherein:
the initialization of the external FLASH by the initial thread of the microkernel comprises the following steps:
and calling an initialization function of the external FLASH to realize the initialization of the external FLASH.
9. The method of any one of claims 1-8, wherein:
the external FLASH comprises a nor-FLASH.
10. An apparatus for obtaining stack information of a thread crash, comprising a memory and a processor, wherein:
the memory is used for storing a program for acquiring stack information of thread crash;
the processor, configured to read the program executing the stack information for acquiring a thread crash, and execute the method according to any one of claims 1 to 9.
CN202111612874.9A 2021-12-27 2021-12-27 Method and device for acquiring stack information of thread crash Pending CN114327979A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111612874.9A CN114327979A (en) 2021-12-27 2021-12-27 Method and device for acquiring stack information of thread crash

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111612874.9A CN114327979A (en) 2021-12-27 2021-12-27 Method and device for acquiring stack information of thread crash

Publications (1)

Publication Number Publication Date
CN114327979A true CN114327979A (en) 2022-04-12

Family

ID=81013479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111612874.9A Pending CN114327979A (en) 2021-12-27 2021-12-27 Method and device for acquiring stack information of thread crash

Country Status (1)

Country Link
CN (1) CN114327979A (en)

Similar Documents

Publication Publication Date Title
US20080229046A1 (en) Unified support for solid state storage
US11340808B2 (en) Latency-based storage in a hybrid memory system
TWI696188B (en) Hybrid memory system
US11650942B2 (en) Method and apparatus for data reads in host performance acceleration mode
US7774575B2 (en) Integrated circuit capable of mapping logical block address data across multiple domains
US11556466B2 (en) Logical-to-physical data structures
US11308007B2 (en) Apparatus and method and computer program product for executing host input-output commands
JP2020502606A (en) Store operation queue
US11327892B2 (en) Latency-based storage in a hybrid memory system
US11544186B2 (en) Method and apparatus for data reads in host performance acceleration mode
US11544185B2 (en) Method and apparatus for data reads in host performance acceleration mode
CN114327979A (en) Method and device for acquiring stack information of thread crash
US11720276B2 (en) Memory system and controller for managing write status
US7886310B2 (en) RAID control method and core logic device having RAID control function
US20240061614A1 (en) Error detection and correction in a controller
US20230315622A1 (en) Method and non-transitory computer-readable storage medium and apparatus for data access in response to host discard commands
CN114327980A (en) Method and device for acquiring thread breakdown address
CN117577154A (en) Method and related apparatus for simulating an electrically erasable programmable read-only memory (EEPROM) in a flash memory

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