CN101446918B - Method for realizing debugging of single function by user state debugger and system thereof - Google Patents

Method for realizing debugging of single function by user state debugger and system thereof Download PDF

Info

Publication number
CN101446918B
CN101446918B CN2008102183976A CN200810218397A CN101446918B CN 101446918 B CN101446918 B CN 101446918B CN 2008102183976 A CN2008102183976 A CN 2008102183976A CN 200810218397 A CN200810218397 A CN 200810218397A CN 101446918 B CN101446918 B CN 101446918B
Authority
CN
China
Prior art keywords
function
module
thread
waiting task
address
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.)
Expired - Fee Related
Application number
CN2008102183976A
Other languages
Chinese (zh)
Other versions
CN101446918A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN2008102183976A priority Critical patent/CN101446918B/en
Publication of CN101446918A publication Critical patent/CN101446918A/en
Application granted granted Critical
Publication of CN101446918B publication Critical patent/CN101446918B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for realizing debugging of a single function by a user state debugger and a system thereof. The system comprises a symbol table operating module, a register operating module, a memory operating module, an operation control module and an operation environment constructing module. In the method, A. the symbol table operating module analyzes a current debugged program and symbol information of a dynamic library thereof and constructs a hash table; the operation control module selects one from tasks in the debugged program as a task to be processed; B. the operation control module searches for a thread from the hash table to construct a library function and stops running the task to be processed after finding the thread; C. the operation environment constructing module constructs the library function and the function to be debugged according to the thread; the register operating module and the memory operating module are used for modifying values in registers of the task to be processed and in stack to change the action of the task to be processed; the thread is constructed to execute the function to be debugged during the later operation; then, the task to be processed is operated. With the invention, the single function operating function is realized by the construction of threads on various CPUs.

Description

A kind of method and system that realize debugging of single function by user state debugger
Technical field
The present invention relates to the realization technology of debugger, relate in particular to a kind of method and system that realize debugging of single function by user state debugger.
Background technology
Debugger is with a kind of tool software of helping developer's finder fault.Present debugger totally is divided into two classes: kernel level debugger and user mode debugger.The kernel level debugger can be followed the tracks of and the task of commissioning test at kernel state; User mode debugger can only be debugged the task of operating in user's attitude.Debugger provides breakpoint has been set, and check variable, register, demonstration storehouse and ask basic debug function such as transition formula evaluation, and the single step of control program operation skips, and single step enters, and continues functions such as operation.These functions follow the tracks of and find that fault plays an important role for the programmer.
Call the turn at program design language, function can be finished the specified function of function deviser as relatively independent in logic code snippet.The correctness of function performance plays decisive action to the correctness of program global behavior, therefore, how debugs at single function and verifies its correctness, becomes a kind of needs of debugging.
Vxworks (a kind of embedded real-time operating system) with WindRiver company is an example, and the shell debugger that it provides just possesses the function of debugging single function.By fill order in shell, create new task, the function of this task fill order appointment, and can debug it.The shell debugger of Vxworks belongs to the kernel level debugger, and the function that is moved moves at kernel state.The realization of its function depends on the interface function of the creation task that kernel provides, and finishes by the address and the function parameter that import the function that will move into.Hence one can see that, under kernel state, only need call kernel task creation function, and import the entry address that will create function into, the function that can realize debugging single function.
Yet for user mode debugger, the interface that neither one is unified under user's attitude is implemented in other process and creates new thread.Specifically, the program of user's attitude is commonly called a process, and a process can have a plurality of threads, shares the resource of same process between the thread; And the address space between the process is separate, and each process all has the virtual address space of oneself, the content of the virtual address space that process can not other process of direct read; Simultaneously, operating system is not provided at the interface of creating thread operation single function in other process.Therefore, user mode debugger will be implemented in and create thread operation single function in the debugged task as a common process of moving under user's attitude, can't directly utilize the interface of operating system to finish.In present user mode debugger, also do not create the realization of thread operation single function function.
Summary of the invention
Technical matters to be solved by this invention provides a kind of method that realizes debugging of single function by user state debugger, and the system that realizes this method.
For solving the problems of the technologies described above, the present invention is achieved by the following technical solutions:
A kind of method that realizes debugging of single function by user state debugger, described user mode debugger as the current debug function for the treatment of, and are done following the processing with this function after the order of receiving the described single function of debugging:
The symbolic information of A, dynamic base that current debugged program and debugged program are loaded is analyzed, and all symbolic information with symbol key word by name, are set up Hash table; Simultaneously, from the task of described debugged program, select a task as waiting task;
B, the entry address of searching the thread creation built-in function in described Hash table after finding, stop the operation of described waiting task;
C, be foundation with described thread creation built-in function and the described debug function for the treatment of, revise each register of described waiting task and the value in the storehouse, to change the behavior of described waiting task, make described waiting task after create thread when moving and carry out the described debug function for the treatment of, revise the successfully described waiting task of back operation, described is foundation with described thread creation built-in function and the described debug function for the treatment of, revises each register of described waiting task and the value in the storehouse and is:
I) value that the programmable counter of waiting task is set is the entry address of thread creation built-in function;
Ii) according in the application binaries interface of different CPU to the definition difference of function call, structure is treated the function call stack frame of debug function, the parameters for the treatment of debug function is placed into tram in the storehouse, and the return address after the function call is set to an abnormal address; Construction method writes the local variable of described thread internal indicator for distribute the space of the local variable of depositing the thread internal indicator earlier on described storehouse; On storehouse, distribute the space of depositing the parameter for the treatment of debug function again, write the described parameters for the treatment of debug function; Allocation space on described storehouse at last writes the address of the entry address for the treatment of debug function, thread attribute, thread internal indicator local variable successively;
The new stack top of pointed in the SP of waiting task iii) is set.
Wherein, among the described step B, after the operation that stops described waiting task, also comprise: whole registers of current described waiting task and the value in the storehouse are preserved;
Also comprise after the step C: the signal that returns according to described waiting task is confirmed describedly to treat whether the operation of debug function finishes, if finish, then whole registers of described waiting task and the value in the storehouse are reverted to the value of being preserved among the described step B after the operation that stops described waiting task.
Wherein, also comprise among the described step B: if in described Hash table, do not find the entry address of thread creation built-in function, then thread library is loaded in the described debugged program, after loading successfully, the symbolic information of described thread library is added in the described Hash table, from this Hash table, finds out the entry address of described thread creation built-in function again.
Wherein, among the step B, the method that described thread library is loaded in the described debugged program is:
1. in the standard C function library, search the entry address of dynamic base loading function;
2. the value of the programmable counter of described waiting task is set to the entry address of dynamic base loading function;
3. from the SP of described waiting task, read the address of current stack top; With this address is start address, makes up the call frame of described dynamic base loading function on the storehouse of described waiting task, comprises dynamic base path, pattern, dynamic base path address and return address parameter in this call frame; Wherein, described dynamic base path is the path of thread library, and described pattern is the loading mode of described thread library, and described dynamic base path address is the path address of described thread library;
The value that 4. SP of waiting task is set is new stack top address;
5. behind the call stack of having constructed the dynamic base loading function, continue the operation of waiting task, waiting task will begin from the entry address of dynamic base loading function to carry out, and loads thread library.
Wherein, further comprise described step I i):
E2, the address of from the SP of described waiting task, reading current stack top;
E3, be start address, in the storehouse of described waiting task, make up the described function call stack frame for the treatment of debug function with the address of described current stack top.
A kind of system that realizes debugging of single function by user state debugger comprises symbol table operational module, register manipulation module, internal memory operation module, also comprises: operation control module, running environment make up module;
Described symbol table operational module, the symbolic information that is used for dynamic base that current debugged program and debugged program are loaded is analyzed, and all symbolic information with symbol key word by name, are set up Hash table;
Described register manipulation module is used for the value of each register of the task of debugged program is carried out read-write operation;
Described internal memory operation module is used for the operation that the value to the storehouse of the task of debugged program reads and revises;
Described operation control module, be used to receive the order of debugging single function, with described single function as treating debug function, carry out following operation: from the task of current debugged program, choose a task as waiting task, the entry address that call sign table handling module is set up Hash table and therefrom searched the thread creation built-in function, from this Hash table, search described thread creation built-in function then again, after finding, stop the operation of described waiting task; Control running environment structure module is with described thread creation built-in function and treat that debug function serves as according to the behavior that changes described waiting task, make this waiting task after create thread when moving and carry out the described debug function for the treatment of, and make up module in described running environment and revise the operation that starts described waiting task after finishing;
Described running environment makes up module, be used for described thread creation built-in function and treat that debug function is a foundation, the value of revising each register of described waiting task and storehouse by allocating register operational module and internal memory operation module changes the behavior of described waiting task, for the described debug function for the treatment of is created running environment, described is foundation with described thread creation built-in function and the described debug function for the treatment of, revises each register of described waiting task and the value in the storehouse and is:
I) value that the programmable counter of waiting task is set is the entry address of thread creation built-in function;
Ii) according in the application binaries interface of different CPU to the definition difference of function call, structure is treated the function call stack frame of debug function, the parameters for the treatment of debug function is placed into tram in the storehouse, and the return address after the function call is set to an abnormal address; Construction method writes the local variable of described thread internal indicator for distribute the space of the local variable of depositing the thread internal indicator earlier on described storehouse; On storehouse, distribute the space of depositing the parameter for the treatment of debug function again, write the described parameters for the treatment of debug function; Allocation space on described storehouse at last writes the address of the entry address for the treatment of debug function, thread attribute, thread internal indicator local variable successively;
The new stack top of pointed in the SP of waiting task iii) is set.
In the said system, also comprise the dynamic base load-on module, be used for loading the dynamic base of appointment to debugged program;
Described operation control module, also be used for when described Hash table does not find the entry address of thread creation built-in function, in described debugged program, load thread library by calling the dynamic base load-on module, and call sign table handling module is added into the symbolic information of described thread library in the described Hash table, searches the entry address of described thread creation built-in function then from this Hash table again.
In the said system, also comprise signal processing module and running environment recovery module;
Described signal processing module is used for waiting for receiving the signal that described waiting task returns at operational process, judges describedly treat whether the operation of debug function finishes according to the type of signal, if finish, then notifies running environment recovery module;
Described running environment is recovered module, be used for the allocating register operational module, preserve the whole registers and the value of storehouse before being made up the module modification of described waiting task by described running environment, and after receiving the notice of signal processing module, the whole registers of described waiting task and the value of storehouse are reverted to the value of preserving before.
The present invention has following beneficial effect:
Adopt the present invention, can realize on various CPU that the establishment thread moves the function of single function, overcome to lack in the present user mode debugger moving the support that single function is debugged.
Description of drawings
Fig. 1 is a system architecture synoptic diagram of the present invention;
Fig. 2 is the structural representation of register manipulation module;
Fig. 3 is the structural representation of internal memory operation module;
The structural representation of Fig. 4 is-symbol table handling module;
Fig. 5 is the structural representation of signal processing module;
Fig. 6 is the method flow diagram of debugging of single function by user state debugger of the present invention;
Fig. 7 is the method flow diagram of dynamic load library in the debugged program among the present invention;
Fig. 8 is the storehouse schematic layout pattern in the process of dynamic load thread of the present invention storehouse;
Fig. 9 is that the present invention creates the storehouse schematic layout pattern in the thread operation single function process;
Figure 10 is the synoptic diagram of signal Processing circulation process among the present invention.
Embodiment
Core concept of the present invention is: revise debugged program implementation environment by debugger, change the behavior of debugged task, make it create the debug function for the treatment of that thread is carried out user's appointment, treat that the debug function operation is finished after, recover the original execution environment of debugged program again.
The present invention is described in further detail below in conjunction with drawings and the specific embodiments:
See also Fig. 1, the system of realization user mode debugger operation single function of the present invention comprises following eight modules: register manipulation module, internal memory operation module, symbol table operational module, signal processing module, dynamic base load-on module, running environment make up module, running environment is recovered module, operation control module.Register manipulation module wherein, internal memory operation module, symbol table operational module are debugger general utility functions module, other is the module of establishment thread operation single function function involved in the present invention.
The register manipulation module is used for the value of the register of debugged program is carried out read-write operation.As shown in Figure 2, comprise register mappings buffer memory, reading and writing register interface and register manipulation interface.Wherein the register mappings buffer memory is used to preserve the value of all registers of current task, reads in the register mappings buffer memory by the value of read register interface with all registers of current task; By writing register interface, the content of register mappings buffer memory is written in the register of task.The register manipulation interface externally provides the unified interface of read-write register.
The internal memory operation module is used for the operation that the virtual address space to debugged program reads and revises.As shown in Figure 3, by system interface, realize the content of core buffer being write the address of appointment or the content of the address of appointment being read in the core buffer.
The symbol table operational module, as shown in Figure 4, be used to analyze the symbolic information of debugged program and the symbolic information of the dynamic base that debugged program loads, set up hash table (Hash table), the function of searching symbolic address and searching symbolic name by symbolic address by symbolic name is provided.
Signal processing module is used for according to the signal of debugged program to the debugger transmission, asynchronous events such as perception new thread establishment.As shown in Figure 5, debugger is at first registered the signal set that needs monitoring, monitors the asynchronous signal incident then.For the asynchronous signal of receiving, analyze the type of this signal, and handle this signal, perhaps notify the user.
The dynamic base load-on module is used to control the dynamic base that debugged program loads appointment.The treatment scheme of this module as shown in Figure 7.
Running environment makes up module, is used to the environment construction work before the operation single function is carried out operation.
Running environment is recovered module, is used to recover debugged program all states before creating thread operation single function.This module is recovered the content of all registers and storehouse mainly by the allocating register operational module.
Operation control module is used for the overall control of creating thread operation single function flow process and fault processing etc.
Principle of work in the said system is:
Operation control module as treating debug function, carries out following operation with described single function: choose a task as waiting task from the task of current debugged program after the order that receives the debugging single function; The entry address that call sign table handling module is set up Hash table and therefrom searched the thread creation built-in function, if do not find, then call the dynamic base load-on module, in described debugged program, load thread library, and call sign table handling module is added into the symbolic information of described thread library in the described Hash table, searches described thread creation built-in function then from this Hash table again; After finding, stop the operation of waiting task, control running environment structure module is with described thread creation built-in function and treat that debug function serves as according to the behavior that changes waiting task, make this task after create thread when moving and carry out the described debug function for the treatment of, and after modification is finished, start the operation of described waiting task.In operational process, signal processing module is waited for and receive the signal that waiting task returns in operational process, judge according to the type of signal and describedly to treat whether the operation of debug function finishes, if finish, then notify running environment to recover module, each register of waiting task and the value of storehouse are reverted to original state value before.
See also Fig. 6, this figure is depicted as the method for debugging of single function by user state debugger of the present invention, specifically may further comprise the steps:
601, the symbolic information of the dynamic base that debugged program and debugged program are loaded is analyzed, set up Hash table according to analysis result: by reading and analyze the executable file of debugged program, (sign pattern comprises overall situation function to obtain title, virtual address and the type information of debugged procedure sign, global variable, static function, static variable etc.), all symbolic information with symbol key word by name, are set up the hash table; In like manner, for all dynamic base that this debugged program loads, also according to the method described above its symbolic information is joined in the hash table.Simultaneously, among a plurality of tasks of debugged program, select a task as waiting task.
602, the entry address of in the hash table, searching pthread_create function (thread creation built-in function).This address is the symbolic address in the thread library, if do not find in the hash table, then execution in step 603, otherwise execution in step 604.
603, call the dynamic base load-on module, the libpthread.so.0 thread library is loaded in the debugged program; After loading successfully, call sign table handling module is added the symbolic information of libpthread.so.0 thread library in the hash table to once more, finds out the entry address of pthread_create then from this table.
See also Fig. 7, the loading method of above-mentioned thread library is:
701, the entry address of in libc storehouse (standard C function library), searching dl_open function (dynamic base loading function).
702, the value of the pc register (programmable counter) of waiting task is set to the entry address of dl_open.
703, structure dl_open function calls stack frame on the storehouse of waiting task, the layout of the storehouse of neotectonics as shown in Figure 8, this layout is applicable to the x86 architecture, can be with reference to the definition in its ABI interface to other framework CPU.In the stack frame of neotectonics, at first be a buffer zone of depositing the thread library complete trails; Next is parameter m ode, shows the pattern of opening thread library, is set to RTLD_NOW, and expression loads immediately; Be the address in thread library path then, (first parameter of dl_open function is the address in path, storehouse promptly to point to the buffer zone address of depositing the path, storehouse that begins to distribute most, second parameter is mode, in the present embodiment these two all directions of parameter write storehouse in proper order); Be the return address at last, this return address is set to an abnormal address in the present embodiment, is used for the end that the signal processing module discriminant function calls.
704, the new stack top of pointed of the sp register (SP) of waiting task is set.
705, after having constructed dl_open function calls stack, continue the operation of waiting task, waiting task will begin from the entry address of dl_open function to carry out, and loads thread library.
706, read the rreturn value of dl_open function from the eax register, if load successfully, then rreturn value is a handle of thread library; If load failure, then rreturn value is-1.
604, stop the operation of waiting task; And call running environment and recover module, all registers of waiting task and the currency in the storehouse are preserved.
605, call running environment and make up module, make up the running environment for the treatment of debug function:
I) value that the pc register of waiting task is set is the entry address of pthread_create.
Ii) according among the ABI (application binaries interface) of different CPU to the definition difference of function call, structure is treated the function call stack frame of debug function, the parameters for the treatment of debug function is placed into tram in the storehouse, and the return address after the function call is set to an abnormal address; Construction method writes the local variable of described thread internal indicator for distribute the space of the local variable of depositing the thread internal indicator earlier on described storehouse; On storehouse, distribute the space of depositing the parameter for the treatment of debug function again, write the described parameters for the treatment of debug function; Allocation space on described storehouse at last writes the address of the entry address for the treatment of debug function, thread attribute, thread internal indicator local variable successively.The new storehouse layout that makes up as shown in Figure 9.
The new stack top of pointed in the sp register of waiting task iii) is set.
606, operation waiting task.
607, signal processing module is waited for and is received the asynchronous signal that waiting task sends to debugger, and does different processing according to the type of the asynchronous signal that is received, as shown in figure 10.If the signal of receiving the new thread establishment is (under the linux2.6 kernel, can be by the SIGTRAP signal be carried out shifting function, and obtain its reason field and judge), the thread of newly creating is joined management in the debugged task chained list, continue to wait for the signal of waiting task then; If receive abnormal signal, illustrate that then this task call pthread_create function creation thread finishes execution in step 608; If receive other signals, then handle the signal that continues to wait for waiting task behind this signal.
608, call running environment and recover module, all registers preserved before recovering and the value of storehouse, the initial conditions of getting back to waiting task.
Above embodiment is only unrestricted in order to technical scheme of the present invention to be described, only with reference to preferred embodiment the present invention is had been described in detail.Those of ordinary skill in the art should be appreciated that and can make amendment or be equal to replacement technical scheme of the present invention, and do not break away from the spirit and scope of technical solution of the present invention, all should be encompassed in the middle of the claim scope of the present invention.

Claims (8)

1. a method that realizes debugging of single function by user state debugger is characterized in that, described user mode debugger as the current debug function for the treatment of, and is done following the processing with this function after the order of receiving the described single function of debugging:
The symbolic information of A, dynamic base that current debugged program and debugged program are loaded is analyzed, and all symbolic information with symbol key word by name, are set up Hash table; Simultaneously, from the task of described debugged program, select a task as waiting task;
B, the entry address of searching the thread creation built-in function in described Hash table after finding, stop the operation of described waiting task;
C, be foundation with described thread creation built-in function and the described debug function for the treatment of, revise each register of described waiting task and the value in the storehouse, to change the behavior of described waiting task, make described waiting task after create thread when moving and carry out the described debug function for the treatment of, revise the successfully described waiting task of back operation, described is foundation with described thread creation built-in function and the described debug function for the treatment of, revises each register of described waiting task and the value in the storehouse and is:
I) value that the programmable counter of waiting task is set is the entry address of thread creation built-in function;
Ii) according in the application binaries interface of different CPU to the definition difference of function call, structure is treated the function call stack frame of debug function, the parameters for the treatment of debug function is placed into tram in the storehouse, and the return address after the function call is set to an abnormal address; Construction method writes the local variable of described thread internal indicator for distribute the space of the local variable of depositing the thread internal indicator earlier on described storehouse; On storehouse, distribute the space of depositing the parameter for the treatment of debug function again, write the described parameters for the treatment of debug function; Allocation space on described storehouse at last writes the address of the entry address for the treatment of debug function, thread attribute, thread internal indicator local variable successively;
The new stack top of pointed in the SP of waiting task iii) is set.
2. the method for realization debugging of single function by user state debugger as claimed in claim 1, it is characterized in that, among the described step B, after the operation that stops described waiting task, also comprise: whole registers of current described waiting task and the value in the storehouse are preserved;
Also comprise after the step C: the signal that returns according to described waiting task is confirmed describedly to treat whether the operation of debug function finishes, if finish, then whole registers of described waiting task and the value in the storehouse are reverted to the value of being preserved among the described step B after the operation that stops described waiting task.
3. the method for realization debugging of single function by user state debugger as claimed in claim 1 or 2, it is characterized in that, also comprise among the described step B: if in described Hash table, do not find the entry address of thread creation built-in function, then thread library is loaded in the described debugged program, after loading successfully, the symbolic information of described thread library is added in the described Hash table, from this Hash table, finds out the entry address of described thread creation built-in function again.
4. the method for realization debugging of single function by user state debugger as claimed in claim 3 is characterized in that, among the step B, the method that described thread library is loaded in the described debugged program is:
1. in the standard C function library, search the entry address of dynamic base loading function;
2. the value of the programmable counter of described waiting task is set to the entry address of dynamic base loading function;
3. from the SP of described waiting task, read the address of current stack top; With this address is start address, makes up the call frame of described dynamic base loading function on the storehouse of described waiting task, comprises dynamic base path, pattern, dynamic base path address and return address parameter in this call frame; Wherein, described dynamic base path is the path of thread library, and described pattern is the loading mode of described thread library, and described dynamic base path address is the path address of described thread library;
The value that 4. SP of waiting task is set is new stack top address;
5. behind the call stack of having constructed the dynamic base loading function, continue the operation of waiting task, waiting task will begin from the entry address of dynamic base loading function to carry out, and loads thread library.
5. the method for realization debugging of single function by user state debugger as claimed in claim 1 or 2 is characterized in that, described step I i) in further comprise:
E2, the address of from the SP of described waiting task, reading current stack top;
E3, be start address, in the storehouse of described waiting task, make up the described function call stack frame for the treatment of debug function with the address of described current stack top.
6. a system that realizes debugging of single function by user state debugger comprises symbol table operational module, register manipulation module, internal memory operation module, it is characterized in that, also comprises: operation control module, running environment make up module;
Described symbol table operational module, the symbolic information that is used for dynamic base that current debugged program and debugged program are loaded is analyzed, and all symbolic information with symbol key word by name, are set up Hash table;
Described register manipulation module is used for the value of each register of the task of debugged program is carried out read-write operation;
Described internal memory operation module is used for the operation that the value to the storehouse of the task of debugged program reads and revises;
Described operation control module, be used to receive the order of debugging single function, with described single function as treating debug function, carry out following operation: from the task of current debugged program, choose a task as waiting task, the entry address that call sign table handling module is set up Hash table and therefrom searched the thread creation built-in function, from this Hash table, search described thread creation built-in function then again, after finding, stop the operation of described waiting task; Control running environment structure module is with described thread creation built-in function and treat that debug function serves as according to the behavior that changes described waiting task, make this waiting task after create thread when moving and carry out the described debug function for the treatment of, and make up module in described running environment and revise the operation that starts described waiting task after finishing;
Described running environment makes up module, be used for described thread creation built-in function and treat that debug function is a foundation, the value of revising each register of described waiting task and storehouse by allocating register operational module and internal memory operation module changes the behavior of described waiting task, for the described debug function for the treatment of is created running environment, described is foundation with described thread creation built-in function and the described debug function for the treatment of, revises each register of described waiting task and the value in the storehouse and is:
I) value that the programmable counter of waiting task is set is the entry address of thread creation built-in function;
Ii) according in the application binaries interface of different CPU to the definition difference of function call, structure is treated the function call stack frame of debug function, the parameters for the treatment of debug function is placed into tram in the storehouse, and the return address after the function call is set to an abnormal address; Construction method writes the local variable of described thread internal indicator for distribute the space of the local variable of depositing the thread internal indicator earlier on described storehouse; On storehouse, distribute the space of depositing the parameter for the treatment of debug function again, write the described parameters for the treatment of debug function; Allocation space on described storehouse at last writes the address of the entry address for the treatment of debug function, thread attribute, thread internal indicator local variable successively;
The new stack top of pointed in the SP of waiting task iii) is set.
7. the system of realization debugging of single function by user state debugger as claimed in claim 6 is characterized in that, also comprises the dynamic base load-on module, is used for loading to debugged program the dynamic base of appointment;
Described operation control module, also be used for when described Hash table does not find the entry address of thread creation built-in function, in described debugged program, load thread library by calling the dynamic base load-on module, and call sign table handling module is added into the symbolic information of described thread library in the described Hash table, searches the entry address of described thread creation built-in function then from this Hash table again.
8. as the system of claim 6 or 7 described realization debugging of single function by user state debugger, it is characterized in that, also comprise signal processing module and running environment recovery module;
Described signal processing module is used for waiting for receiving the signal that described waiting task returns at operational process, judges describedly treat whether the operation of debug function finishes according to the type of signal, if finish, then notifies running environment recovery module;
Described running environment is recovered module, be used for the allocating register operational module, preserve the whole registers and the value of storehouse before being made up the module modification of described waiting task by described running environment, and after receiving the notice of signal processing module, the whole registers of described waiting task and the value of storehouse are reverted to the value of preserving before.
CN2008102183976A 2008-12-10 2008-12-10 Method for realizing debugging of single function by user state debugger and system thereof Expired - Fee Related CN101446918B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008102183976A CN101446918B (en) 2008-12-10 2008-12-10 Method for realizing debugging of single function by user state debugger and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008102183976A CN101446918B (en) 2008-12-10 2008-12-10 Method for realizing debugging of single function by user state debugger and system thereof

Publications (2)

Publication Number Publication Date
CN101446918A CN101446918A (en) 2009-06-03
CN101446918B true CN101446918B (en) 2011-12-28

Family

ID=40742606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008102183976A Expired - Fee Related CN101446918B (en) 2008-12-10 2008-12-10 Method for realizing debugging of single function by user state debugger and system thereof

Country Status (1)

Country Link
CN (1) CN101446918B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108427640A (en) * 2018-01-25 2018-08-21 南京翼辉信息技术有限公司 A method of debugging driver under User space

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102262587B (en) * 2011-07-22 2014-12-31 中国科学院声学研究所 Breakpoint debugging method and debugger
CN103246591B (en) * 2013-04-26 2016-01-27 华为技术有限公司 The method and apparatus of signal transacting
CN104572046B (en) * 2013-10-16 2019-01-11 腾讯科技(深圳)有限公司 A kind of storehouse restoring method and computer system
CN104461905A (en) * 2014-12-30 2015-03-25 东信和平科技股份有限公司 Method and system for debugging intelligent card virtual machine, API bank and upper layer application at same time
CN104536892B (en) * 2015-01-05 2018-03-27 瑞斯康达科技发展股份有限公司 A kind of software on-line debugging method and system
CN108845841B (en) * 2018-06-15 2021-10-01 广州多益网络股份有限公司 Method and device for changing terminal application behaviors and terminal
WO2020073200A1 (en) * 2018-10-09 2020-04-16 华为技术有限公司 Program debugging method and system
CN111611161B (en) * 2020-05-20 2023-08-08 中电科航空电子有限公司 Implementation method of lightweight debugging tool applied to avionic software
CN111639312B (en) * 2020-06-02 2023-04-14 腾讯科技(成都)有限公司 Anti-debugging method, anti-debugging device, storage medium and electronic device
CN112256570B (en) * 2020-10-19 2023-08-11 网易(杭州)网络有限公司 Remote debugging method, device, equipment and storage medium
CN114840847A (en) * 2021-02-02 2022-08-02 武汉斗鱼鱼乐网络科技有限公司 Method, device, medium and equipment for safely creating thread in target process
CN115221524B (en) * 2022-09-20 2023-01-03 深圳市科力锐科技有限公司 Service data protection method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6026362A (en) * 1995-09-11 2000-02-15 Compaq Computer Corporation Tool and method for diagnosing and correcting errors in a computer program
US6915509B1 (en) * 2000-06-28 2005-07-05 Microsoft Corporation Method and system for debugging a program
CN1779652A (en) * 2004-11-24 2006-05-31 中兴通讯股份有限公司 Method and apparatus for debugging internal core state programm of operation system
CN101281488A (en) * 2007-04-06 2008-10-08 上海宇梦通信科技有限公司 Inner core debug method of Linux operating system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6026362A (en) * 1995-09-11 2000-02-15 Compaq Computer Corporation Tool and method for diagnosing and correcting errors in a computer program
US6915509B1 (en) * 2000-06-28 2005-07-05 Microsoft Corporation Method and system for debugging a program
CN1779652A (en) * 2004-11-24 2006-05-31 中兴通讯股份有限公司 Method and apparatus for debugging internal core state programm of operation system
CN101281488A (en) * 2007-04-06 2008-10-08 上海宇梦通信科技有限公司 Inner core debug method of Linux operating system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JP特开2005-346409A 2005.12.15

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108427640A (en) * 2018-01-25 2018-08-21 南京翼辉信息技术有限公司 A method of debugging driver under User space

Also Published As

Publication number Publication date
CN101446918A (en) 2009-06-03

Similar Documents

Publication Publication Date Title
CN101446918B (en) Method for realizing debugging of single function by user state debugger and system thereof
US8689215B2 (en) Structured exception handling for application-managed thread units
EP2359247B1 (en) Transforming user script code for debugging
US7950001B2 (en) Method and apparatus for instrumentation in a multiprocessing environment
US8856742B2 (en) Distributed debugging
CN101719090A (en) Method for automatically analyzing crash cause of computer software system
CN103729288A (en) Application program debugging method under embedded multi-core environment
CN104461876A (en) Concurrent program reappearance debugging method based on snapshot sequence running
JP2007500401A (en) Software debugging apparatus and method
CN101667154A (en) Apparatus and method for improving emulation speed of high-level languages in on-chip emulation systems
CN100592266C (en) Microprocessor debugging method and microprocessor debugging module
CN101645020A (en) Virtual operating system creation method
CN100349131C (en) Method for positioning malfunction of application program
Sack et al. Accurate and efficient filtering for the intel thread checker race detector
US7793160B1 (en) Systems and methods for tracing errors
CN100388234C (en) Method for monitoring internal memory varible rewrite based on finite-state-machine
US20090222825A1 (en) Data race detection in a concurrent processing environment
CN105308578A (en) Diagnostics of state transitions
CN101237350B (en) Global variant exception alteration and positioning method for multi-task environment single board machine
CN102662845B (en) A kind of method, Apparatus and system realized through property data breakpoint
CN112948136A (en) Method for implementing asynchronous log record of embedded operating system
CN109885489B (en) Data race detection method and device in driver
CN101650688B (en) Method for accessing VM_IO address space and user mode debugger
CN112905474B (en) Hardware-based advanced program dynamic control flow tracking method and device
Dantas et al. Towards aspect-oriented programming for context-aware systems: A comparative study

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20111228

Termination date: 20171210

CF01 Termination of patent right due to non-payment of annual fee