CN110007984A - Function calling relationship retrogressive method and system based on Xtensa DSP - Google Patents
Function calling relationship retrogressive method and system based on Xtensa DSP Download PDFInfo
- Publication number
- CN110007984A CN110007984A CN201910260649.XA CN201910260649A CN110007984A CN 110007984 A CN110007984 A CN 110007984A CN 201910260649 A CN201910260649 A CN 201910260649A CN 110007984 A CN110007984 A CN 110007984A
- Authority
- CN
- China
- Prior art keywords
- function
- register
- windowbase
- return addresses
- calling relationship
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
- G06F9/4484—Executing subprograms
- G06F9/4486—Formation of subprogram jump address
Abstract
The present invention discloses a kind of function calling relationship retrogressive method and system based on Xtensa DSP, which comprises in system starting, registration abnormity handles function in exception vector table;When being abnormal in function call process, call the abnormality processing function to obtain Function return addresses from the exception vector table;Judge the legitimacy of the Function return addresses;When judging that the Function return addresses are illegal, terminate function calling relationship backtracking.Present invention registration abnormity in the exception vector table of DSP handles function, the abnormality processing function registered before jumping to when there is exception.Abnormality processing function is responsible for reading current exception information, and recalls to the call relation of function, in this way can quick orientation problem.
Description
Technical field
The present invention relates to information technology field more particularly to a kind of function calling relationship backtracking sides based on Xtensa DSP
Method and system.
Background technique
Function calling relationship backtracking, is to do reverse parsing on the basis of understanding how processor organizes function call.It is existing
Function call recalls mode in some technologies, is mainly based upon the universal cpu of the mainstreams such as X86, ARM, MIPS.These similar skills
Art can not work because the architecture of processor is different in the DSP of Xtensa architecture., function reason is: 1)
The organizational form of call relation is different, and similar technology is all by function SP (Stack Point, stack pointer) and function return value
(RA, Return Address) is saved in the stack space of memory;2), function call is about different with specification;3), instruction is different, often
A system has a set of instruction set of oneself, therefore instructs the mode of parsing also different.
The business model of general dsp chip carrying is fairly simple, is largely to run the less simple calculating of size of code
Or control is also not easy to go wrong if debugged in IDE environment without discovery system exception in actual use.
The understanding that exception call stack back trace technique needs that it is deep to have the architecture of chip, general chip user are more concerned about business
The realization of relevant portion.The abnormal method of positioning conventional on DSP is still by IDE tool and print log come real at present
It is existing.
Summary of the invention
Present invention registration abnormity in the exception vector table of DSP handles function, registers before jumping to when there is exception
Abnormality processing function.Abnormality processing function is responsible for reading current exception information, and recalls to the call relation of function.
It in this way can quick orientation problem.
The embodiment of the present invention provides a kind of function calling relationship retrogressive method based on Xtensa DSP, at least solving
One of above-mentioned technical problem.
In a first aspect, the embodiment of the present invention provides a kind of function calling relationship retrogressive method based on Xtensa DSP, packet
It includes:
S10, in system starting, registration abnormity handles function in exception vector table;
S20, when being abnormal in function call process, the abnormality processing function is called from the exception vector table
To obtain Function return addresses;
S30, the legitimacy for judging the Function return addresses;
S40, when judging that the Function return addresses are illegal, terminate function calling relationship backtracking.
Second aspect, the embodiment of the present invention provide a kind of function calling relationship backtracking system based on Xtensa DSP, packet
It includes:
Accreditation process module, for registration abnormity to handle function in exception vector table in system starting;
Information acquiring program module, for being adjusted from the exception vector table when being abnormal in function call process
With the abnormality processing function to obtain Function return addresses;
Determining program module, for judging the legitimacy of the Function return addresses;
Backtracking terminates program module, for terminating function calling relationship when judging that the Function return addresses are illegal
Backtracking.
The third aspect, the embodiment of the present invention provide a kind of storage medium, are stored with one or more in the storage medium
Including the program executed instruction, it is described execute instruction can by electronic equipment (including but not limited to computer, server, or
Network equipment etc.) it reads and executes, for executing function calling relationship of any of the above-described of the present invention based on Xtensa DSP
Retrogressive method.
Fourth aspect provides a kind of electronic equipment comprising: at least one processor, and with described at least one
Manage the memory of device communication connection, wherein the memory is stored with the instruction that can be executed by least one described processor, institute
It states instruction to be executed by least one described processor, so that at least one described processor is able to carry out any of the above-described of the present invention
Function calling relationship retrogressive method based on Xtensa DSP.
5th aspect, the embodiment of the present invention also provide a kind of computer program product, and the computer program product includes
The computer program of storage on a storage medium, the computer program includes program instruction, when described program instruction is calculated
When machine executes, the computer is made to execute function calling relationship retrogressive method of any of the above-described based on Xtensa DSP.
The beneficial effect of the embodiment of the present invention is: present invention registration abnormity in the exception vector table of DSP handles function,
The abnormality processing function registered before being jumped to when there is exception.Abnormality processing function is responsible for reading current exception information,
And the call relation of function is recalled, it in this way can quick orientation problem.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, required use in being described below to embodiment
Attached drawing be briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, for this field
For those of ordinary skill, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the flow chart of an embodiment of the function calling relationship retrogressive method of the invention based on Xtensa DSP;
Fig. 2 is the process of another embodiment of the function calling relationship retrogressive method of the invention based on Xtensa DSP
Figure;
Fig. 3 is the process of another embodiment of the function calling relationship retrogressive method of the invention based on Xtensa DSP
Figure;
Fig. 4 is the process of another embodiment of the function calling relationship retrogressive method of the invention based on Xtensa DSP
Figure;
Fig. 5 is the register management schematic diagram of mechanism of windows rotation mode employed in the present invention;
Fig. 6 is the schematic diagram of an embodiment of middle function call in the present invention;
Fig. 7 is the principle frame of another embodiment of the function calling relationship backtracking system of the invention based on Xtensa DSP
Figure;
Fig. 8 is the structural schematic diagram of an embodiment of electronic equipment of the invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.It should also be noted that, herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise", include not only those elements, but also wrap
Include other elements that are not explicitly listed, or further include for this process, method, article or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence " including ... ", it is not excluded that including the element
There is also other identical elements in process, method, article or equipment.
The means of usually orientation problem all pass through the IDE tool (Xplorer) that dsp chip producer provides, this work at present
Tool operates on PC, and breakpoint, single step tracking, inquiry register and memory program can be arranged.In addition it is used in code
Printf type information and a kind of means of common orientation problem.
It is desirable that can be when occurring extremely, it is out of joint to obtain which instruction, be type of error what is, is by whom
It calls.Technology above is not able to satisfy.
In the embodiment of the present invention, registration abnormity handles function in the exception vector table of DSP, can jump to when there is exception
The abnormality processing function registered before, abnormality processing function are responsible for reading current exception information, and to the call relation of function
Recalled, it in this way can quick orientation problem.
As shown in Figure 1, the stream of an embodiment of the function calling relationship retrogressive method of the invention based on Xtensa DSP
Cheng Tu, this method comprises:
S10, in system starting, registration abnormity handles function in exception vector table;
S20, when being abnormal in function call process, the abnormality processing function is called from the exception vector table
To obtain Function return addresses;
S30, the legitimacy for judging the Function return addresses;
S40, when judging that the Function return addresses are illegal, terminate function calling relationship backtracking.
Present invention registration abnormity in the exception vector table of DSP handles function, registers before jumping to when there is exception
Abnormality processing function.Abnormality processing function is responsible for reading current exception information, and recalls to the call relation of function,
It in this way can quick orientation problem.Further, since which raises the speed of orientation problem, so product stability is mentioned
It rises, higher user satisfaction, degree of recognition can be obtained.
As shown in Fig. 2, in some embodiments, the legitimacy of the judgement Function return addresses includes:
S31, the code section address range for obtaining corresponding current function;
S32, judge whether the return address belongs to the code section address range;
S33, if it is, determining that the function return value is legal;
S34, if it is not, then determining that the function return value is illegal.
There is a possibility that code segment is surprisingly modified in systems, therefore legitimacy is carried out to the RA value currently obtained
It checks.Code segment limit is obtained, can be obtained by the initial address of the initial address of code segment and read-only data section.It checks
The address RA whether in the affiliated range of code segment in, RA is that the return address one of subfunction is positioned in code segment;Check address
Whether it is aligned, such as 32 processing RA will meet 4 byte-aligneds.If RA value validity checking fails.Then explanation is current posts
Storage, which has been destroyed, skips epicycle backtracking.
As shown in figure 3, in some embodiments, calling the abnormality processing function to obtain from the exception vector table
Function return addresses include:
S21, the register management mechanism using window rotation mode, logic register and physical register are separated;
S22, configuration WINDOWSTART register and WINDOWBASE register, are patrolled with controlling the sliding of window from described
It collects in register and obtains Function return addresses.
Using the DSP of Xtensa framework, in order to reduce, register frequently carries out stacking and Pop operations bring performance is opened
Pin, devises a kind of register management mechanism of windows rotation mode, by logic register (a0-a15) and physical register
(AR0-AR63) it separates, it is independent for function distribution by windows slide handover logic register when function call
Register, reduce pop down and the operation popped, improve performance to a greater extent.In order to cooperate windows to slide, additionally provide
Two specified registers WINDOWSTART and WINDOWBASE control the sliding of windows by the two registers, including
Function call, subfunction return, register covers and restores etc..Windows ABI function call is about as shown in table 1 with specification,
A0 is used to save return address, and a1 is then sp stack pointer, and a2~a7 is then used to transmission function and enters ginseng, parameter be more than 6 when
Time is then needed using storehouse, and a8~a15 is then scratch register, may be used in subfunction.
Callee Register | Register Name | Usage |
0 | a0 | Save the return address of function |
1 | a1 | Current stack plot |
2..7 | a2...a7 | Function enters ginseng |
Table 1
As shown in figure 4, in some embodiments, the function calling relationship retrogressive method of the invention based on Xtensa DSP
Further include:
The WINDOWBASE bit in WINDOWSTART register is set to 0;
When judging that the function return value is legal, checks WINDOWSTART register and WINDOWBASE register is
It is no at the same be 0;
If it is, terminating the function calling relationship backtracking;
If it is not, then translating the code segment of Function return addresses institute membership fuction;
According to the code segment after translation judge the current function whether generation stack underflow;
If it is, being popped to the register of the current function to restore patrolling in the register of father's function
Collect address a0~a3, and the S20 that gos to step.
If it is not, then updating WINDOWBASE register, bit corresponding in WINDOWSTART register is set 0, and jump
Go to step S20.
In some embodiments, the code segment according to after translation judge the current function whether generation storehouse
Underflow includes:
4 bytes of successively decreasing every time since the Function return addresses find call n instruction;Wherein, n can be 4,8,12,
The value of n indicates that father's function occupies the number of register, and in the format of call instruction, bit3~0 is to be identified as to be fixed as 0101,
Bit5~4 represent the value of n: 01 corresponding n=1,10 corresponding n=8,11 corresponding n=1;
It is call instruction by finding the instruction that bit3~0 is 0101 in code segment, then calculates bit5~4 and obtain
N value just calculates the corresponding WINDOWBASE value of father's function after obtaining the value of n:
WINDOWBASENEW=WINDOWBASECURRENT–x/4
Check the WINDOWBASE in WINDOWSTART registerNEWWhether a bit is 0;If it is, determining hair
The raw stack underflow.
Step 1, registration abnormity handles function first when the starting of system, can jump to me when an anomaly occurs
In the abnormality processing vector registered, take over subsequent abnormality processing, the current exception PC of acquisition and exception provided in this system
The status register of reason only just knows that current wrong address is far from being enough, for example current exception PC direction is one
C library function as a memset then it is an address for mistake that problem, which tends to occur at incoming parameter, therefore will also be appreciated that
It is who has invoked this function, it is therefore desirable to the call relation of function all be shown using recursive mode, also just originally
The function calling relationship retrogressive method based on Xtensa DSP of invention.
Step 2 obtains function return value.As shown in figure 5, frequent in order to reduce register using the DSP of Xtensa framework
Carry out stacking and Pop operations bring performance cost, devise a kind of register management mechanism of windows rotation mode,
Logic register (a0~a15) and physical register (AR1~AR31) are separated, pass through windows when function call
Slide handover logic register distributes independent register for each function, the operation for reducing pop down and popping, to a greater extent
Improve performance.In order to cooperate windows to slide, two specified registers WINDOWSTART and WINDOWBASE are additionally provided, are led to
The sliding of the two registers control windows is crossed, including function call, subfunction return, register covers and restores etc..
Windows ABI function call about with specification as shown in table 1, a0 is used to save return address, and a1 is then sp stack pointer, a2~
A7 is then used to transmission function and enters ginseng, and parameter is then needed using storehouse when being more than 6, and a8~a15 then posts for scratch
Storage, may be used in subfunction.
It is obtained as described above when the value of a0 deposit is the return value (Return Address, RA) of current function.Simultaneously
The WINDOWBASE bit in WINDOWSTART is set to 0.
Step 3: judge whether RA value is legal.There is a possibility that code segment is surprisingly modified in systems, therefore right
The RA value currently obtained carries out validity checking.Code segment limit is obtained, the initial address and only reading of code segment can be passed through
It is obtained according to the initial address of section.The address RA is checked whether in the affiliated range of code segment, RA is the return address one of subfunction
It is positioned in code segment;Check whether address is aligned, for example, 32 processing RA will meet 4 byte-aligneds.If RA value is legal
Property inspection failure, then illustrate current register be destroyed skip epicycle backtracking.
Step 4: whether judgement is equal to 0 as register WINDOWSTART, while whether WINDOWBASE is equal to 1, if together
Shi Chengli illustrates otherwise to continue backtracking process without function in the presence of that can jump out circulation in windows register.
Step 5: the code command of translation RA institute membership fuction, 4 bytes of successively decreasing every time since the address RA are found callx and are referred to
It enables, x can be 4,8,12, i.e. call4, call8, call12, and the value of x indicates that father's function occupies the number of register.Obtain x's
The corresponding WINDOWBASE value of father's function can be calculated after value:
WINDOWBASENEW=WINDOWBASECURRENT–x/4。
Step 6: WINDOWBASE in WINDOWSTART is checkedNEWWhether a bit is 0, if posting for 0 father's function
Storage is capped, and original register has been saved in the stack of subfunction, needs to carry out register and pops, and executes step 7.If
Step 2 is jumped to for 1, carries out new round parsing.
Step 7: windows register is in sliding, if the intracorporal register of window is occupied by other functions,
Register in current form can be saved in the stack of subfunction.For example, call relation A- > B- > C- > D-E, when forms slide
E will cover A, as shown in figure 6, register a0-a3 used in A function at this time, it will it is saved in the stack of subfunction B function, from
The range of SP-16 to SP-4.When tracing back to A function, it is found that WINDOWBASE in WINDOWSTARTNEWA bit is 0,
Because the corresponding bit of WINDOWSTART has been zeroed out when recalling E function.
The stack address of current function (subfunction) is saved first simultaneously by WINDOWBASENEWWINDOWBASE is updated to post
Window register is slided into father's function position, is obtained with the access authority of father's function register in this way by storage.Then
The register value saved in subfunction stack is popped, is restored in a0~a3, and WINDOWSTART corresponding bit is set 1, is jumped
To step 1.
As shown in fig. 7, the embodiment of the present invention also provides a kind of function calling relationship backtracking system based on Xtensa DSP
System 700, comprising:
Accreditation process module 710, for registration abnormity to handle function in exception vector table in system starting;
Information acquiring program module 720, for when being abnormal in function call process, from the exception vector table
Call the abnormality processing function to obtain Function return addresses;
Determining program module 730, for judging the legitimacy of the Function return addresses;
Backtracking terminates program module 740, closes for when judging that the Function return addresses are illegal, terminating function call
System's backtracking.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of
Movement merge, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because
According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention
It is necessary.In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
In some embodiments, the embodiment of the present invention provides a kind of non-volatile computer readable storage medium storing program for executing, described to deposit
Being stored in storage media one or more includes the programs executed instruction, it is described execute instruction can by electronic equipment (including but
It is not limited to computer, server or the network equipment etc.) it reads and executes, to be based on for executing any of the above-described of the present invention
The function calling relationship retrogressive method of Xtensa DSP.
In some embodiments, the embodiment of the present invention also provides a kind of computer program product, and the computer program produces
Product include the computer program being stored on non-volatile computer readable storage medium storing program for executing, and the computer program includes that program refers to
It enables, when described program instruction is computer-executed, the computer is made to execute letter of any of the above-described based on Xtensa DSP
Number call relation retrogressive method.
In some embodiments, the embodiment of the present invention also provides a kind of electronic equipment comprising: at least one processor,
And the memory being connect at least one described processor communication, wherein the memory is stored with can be by described at least one
The instruction that a processor executes, described instruction is executed by least one described processor, so that at least one described processor energy
It is enough to execute the function calling relationship retrogressive method based on Xtensa DSP.
In some embodiments, the embodiment of the present invention also provides a kind of storage medium, is stored thereon with computer program,
It is characterized in that, based on the function calling relationship retrogressive method of Xtensa DSP when which is executed by processor.
The function calling relationship backtracking system based on Xtensa DSP of the embodiments of the present invention can be used for executing this hair
The function calling relationship retrogressive method based on Xtensa DSP of bright embodiment, and reach the embodiments of the present invention accordingly
Realize the function calling relationship retrogressive method technical effect achieved based on Xtensa DSP, which is not described herein again.The present invention
Hardware processor (hardware processor) Lai Shixian related function module can be passed through in embodiment.
Below with reference to Fig. 8, it illustrates the computer systems 800 for the electronic equipment for being suitable for being used to realize the embodiment of the present invention
Structural schematic diagram.Electronic equipment shown in Fig. 8 is only an example, function to the embodiment of the present invention and should not use model
Shroud carrys out any restrictions.
As shown in figure 8, computer system 800 includes central processing unit (CPU) 801, it can be read-only according to being stored in
Program in memory (ROM) 802 or be loaded into the program in random access storage device (RAM) 803 from storage section 808 and
Execute various movements appropriate and processing.In RAM 803, also it is stored with system 800 and operates required various programs and data.
CPU 801, ROM 802 and RAM 803 are connected with each other by bus 804.Input/output (I/O) interface 805 is also connected to always
Line 804.
I/O interface 805 is connected to lower component: the importation 806 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 807 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 808 including hard disk etc.;
And the communications portion 809 of the network interface card including LAN card, modem etc..Communications portion 809 via such as because
The network of spy's net executes communication process.Driver 810 is also connected to I/O interface 805 as needed.Detachable media 811, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 810, in order to read from thereon
Computer program be mounted into storage section 808 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention
Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer
Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.?
In such embodiment, which can be downloaded and installed from network by communications portion 809, and/or from can
Medium 811 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 801, system of the invention is executed
The above-mentioned function of middle restriction.
Method provided by the embodiment of the present application can be performed in the said goods, has the corresponding functional module of execution method and has
Beneficial effect.The not technical detail of detailed description in the present embodiment, reference can be made to method provided by the embodiment of the present application.
The electronic equipment of the embodiment of the present application exists in a variety of forms, including but not limited to:
(1) mobile communication equipment: the characteristics of this kind of equipment is that have mobile communication function, and to provide speech, data
Communication is main target.This Terminal Type includes: smart phone (such as iPhone), multimedia handset, functional mobile phone and low
Hold mobile phone etc..
(2) super mobile personal computer equipment: this kind of equipment belongs to the scope of personal computer, there is calculating and processing function
Can, generally also have mobile Internet access characteristic.This Terminal Type includes: PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device: this kind of equipment can show and play multimedia content.Such equipment include: audio,
Video player (such as iPod), handheld device, e-book and intelligent toy and portable car-mounted navigation equipment.
(4) server: providing the equipment of the service of calculating, and the composition of server includes that processor, hard disk, memory, system are total
Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, in processing energy
Power, stability, reliability, safety, scalability, manageability etc. are more demanding.
(5) other electronic devices with data interaction function.
The apparatus embodiments described above are merely exemplary, wherein described, unit can as illustrated by the separation member
It is physically separated with being or may not be, component shown as a unit may or may not be physics list
Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs
In some or all of the modules achieve the purpose of the solution of this embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It is realized by the mode of software plus general hardware platform, naturally it is also possible to pass through hardware.Based on this understanding, above-mentioned technology
Scheme substantially in other words can be embodied in the form of software products the part that the relevant technologies contribute, the computer
Software product may be stored in a computer readable storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions to
So that computer equipment (can be personal computer, server or the network equipment etc.) execute each embodiment or
Method described in certain parts of embodiment.
Finally, it should be noted that above embodiments are only to illustrate the technical solution of the application, rather than its limitations;Although
The application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution spirit and
Range.
Claims (10)
1. a kind of function calling relationship retrogressive method based on Xtensa DSP, comprising:
S10, in system starting, registration abnormity handles function in exception vector table;
S20, when being abnormal in function call process, call the abnormality processing function to obtain from the exception vector table
Obtain Function return addresses;
S30, the legitimacy for judging the Function return addresses;
S40, when judging that the Function return addresses are illegal, terminate function calling relationship backtracking.
2. according to the method described in claim 1, wherein, the legitimacy of the judgement Function return addresses includes:
Obtain the code section address range of corresponding current function;
Judge whether the return address belongs to the code section address range;
If it is, determining that the function return value is legal;
If it is not, then determining that the function return value is illegal.
3. according to the method described in claim 1, wherein, calling the abnormality processing function to obtain from the exception vector table
Obtaining Function return addresses includes:
Using the register management mechanism of window rotation mode, logic register and physical register are separated;
WINDOWSTART register and WINDOWBASE register are configured, to control the sliding of window from the logic register
Middle acquisition Function return addresses.
4. according to the method described in claim 3, wherein, further includes:
The WINDOWBASE bit in WINDOWSTART register is set to 0;
When judging that the function return value is legal, check whether WINDOWSTART register and WINDOWBASE register are same
When be 0;
If it is, terminating the function calling relationship backtracking;
If it is not, then continuing the function calling relationship backtracking.
5. according to the method described in claim 4, wherein, the continuation function calling relationship backtracking includes:
Translate the code segment of Function return addresses institute membership fuction;
According to the code segment after translation judge the current function whether generation stack underflow;
If it is, being popped to the register of the current function to restore in the register of father's function logically
Location a0~a3, and the S20 that gos to step.
6. according to the method described in claim 5, wherein, the code segment according to after translation judges the current function
Stack underflow, which whether occurs, includes:
4 bytes of successively decreasing every time since the Function return addresses find call n instruction;Wherein, n can be 4,8,12, n
Value indicates that father's function occupies the number of register, and in the format of call instruction, bit3~0 is to be identified as to be fixed as 0101,
Bit5~4 represent the value of n: 01 corresponding n=1,10 corresponding n=8,11 corresponding n=1;
It is call instruction by finding the instruction that bit3~0 is 0101 in code segment, then calculates bit5~4 and obtain n value,
The corresponding WINDOWBASE value of father's function is just calculated after obtaining the value of n:
WINDOWBASENEW=WINDOWBASECURRENT–x/4
Check the WINDOWBASE in WINDOWSTART registerNEWWhether a bit is 0;
If it is, determining that the stack underflow occurs.
7. according to the method described in claim 6, wherein, further includes:
WINDOWBASE in inspection WINDOWSTART registerNEWWhen a bit is 1, WINDOWBASE deposit is updated
Bit corresponding in WINDOWSTART register is set 0 by device, and the S20 that gos to step.
8. a kind of function calling relationship backtracking system based on Xtensa DSP, comprising:
Accreditation process module, for registration abnormity to handle function in exception vector table in system starting;
Information acquiring program module, for calling institute from the exception vector table when being abnormal in function call process
Abnormality processing function is stated to obtain Function return addresses;
Determining program module, for judging the legitimacy of the Function return addresses;
Backtracking terminates program module, for when judging that the Function return addresses are illegal, terminating function calling relationship backtracking.
9. a kind of electronic equipment comprising: at least one processor, and deposited with what at least one described processor communication was connect
Reservoir, wherein the memory be stored with can by least one described processor execute instruction, described instruction by it is described at least
One processor executes, so that at least one described processor is able to carry out any one of claim 1-7 the method
Step.
10. a kind of storage medium, is stored thereon with computer program, which is characterized in that the realization when program is executed by processor
The step of any one of claim 1-7 the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910260649.XA CN110007984B (en) | 2019-04-02 | 2019-04-02 | Function call relation backtracking method and system based on Xtensa DSP |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910260649.XA CN110007984B (en) | 2019-04-02 | 2019-04-02 | Function call relation backtracking method and system based on Xtensa DSP |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110007984A true CN110007984A (en) | 2019-07-12 |
CN110007984B CN110007984B (en) | 2022-07-15 |
Family
ID=67169607
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910260649.XA Active CN110007984B (en) | 2019-04-02 | 2019-04-02 | Function call relation backtracking method and system based on Xtensa DSP |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110007984B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114416219A (en) * | 2021-12-31 | 2022-04-29 | 北京五八信息技术有限公司 | System function calling method and device, electronic equipment and readable medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101122881A (en) * | 2007-09-20 | 2008-02-13 | 福建星网锐捷网络有限公司 | CPU abnormal point positioning diagnosis method based MIPS structure |
CN101539883A (en) * | 2009-05-05 | 2009-09-23 | 北京和利时系统工程有限公司 | Error tracking method of embedded system and device thereof |
US20190044971A1 (en) * | 2018-06-29 | 2019-02-07 | Vadim Sukhomlinov | Techniques to provide function-level isolation with capability-based security |
-
2019
- 2019-04-02 CN CN201910260649.XA patent/CN110007984B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101122881A (en) * | 2007-09-20 | 2008-02-13 | 福建星网锐捷网络有限公司 | CPU abnormal point positioning diagnosis method based MIPS structure |
CN101539883A (en) * | 2009-05-05 | 2009-09-23 | 北京和利时系统工程有限公司 | Error tracking method of embedded system and device thereof |
US20190044971A1 (en) * | 2018-06-29 | 2019-02-07 | Vadim Sukhomlinov | Techniques to provide function-level isolation with capability-based security |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114416219A (en) * | 2021-12-31 | 2022-04-29 | 北京五八信息技术有限公司 | System function calling method and device, electronic equipment and readable medium |
CN114416219B (en) * | 2021-12-31 | 2023-05-23 | 北京五八信息技术有限公司 | System function calling method, device, electronic equipment and readable medium |
Also Published As
Publication number | Publication date |
---|---|
CN110007984B (en) | 2022-07-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109325195A (en) | Rendering method and system, computer equipment, the computer storage medium of browser | |
CN107832099A (en) | A kind of client release compatible method, apparatus and storage medium | |
CN106888236A (en) | Conversation managing method and session management device | |
US9152423B2 (en) | Method and apparatus for efficient loop instruction execution using bit vector scanning | |
US7840948B2 (en) | Automation of keyboard accessibility testing | |
US6598181B1 (en) | Method and system for debugging multiple function calls | |
US20080010536A1 (en) | Breakpoints with Separate Conditions | |
US20100146347A1 (en) | System and method for fault mapping of exceptions across programming models | |
CN110457198A (en) | Debugging message output method, device and storage medium | |
KR20180129623A (en) | Apparatus for statically analyzing assembly code including assoxiated multi files | |
CN106997313A (en) | A kind of signal processing method of application program, system and terminal device | |
CN110007984A (en) | Function calling relationship retrogressive method and system based on Xtensa DSP | |
CN111159040A (en) | Test data generation method, device, equipment and storage medium | |
US20070150866A1 (en) | Displaying parameters associated with call statements | |
CN106228065A (en) | The localization method of a kind of buffer-overflow vulnerability and device | |
CN109634838A (en) | Position method, apparatus, storage medium and the electronic equipment of application failure | |
CN113132522A (en) | Test method, device, server and medium | |
CN111385661B (en) | Method, device, terminal and storage medium for voice control of full screen playing | |
CN116755828A (en) | Parameter value configuration method, analysis method, electronic device and storage medium | |
US20030159087A1 (en) | Generating a test suite from an abstract state machine | |
US9348610B2 (en) | Replacement of virtual functions | |
CN109040645B (en) | Audio and video file transcription method and device, storage medium and server | |
US11074069B2 (en) | Replaying interactions with transactional and database environments with re-arrangement | |
CN107678967B (en) | Unit test coverage rate generation method and device, readable storage medium and equipment | |
CN117453495B (en) | Chip supporting online error correction and debugging, design method and related equipment |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 215123 building 14, Tengfei Innovation Park, 388 Xinping street, Suzhou Industrial Park, Suzhou City, Jiangsu Province Applicant after: Sipic Technology Co.,Ltd. Address before: 215123 building 14, Tengfei Innovation Park, 388 Xinping street, Suzhou Industrial Park, Suzhou City, Jiangsu Province Applicant before: AI SPEECH Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |