Code injection for conditional breakpoints

US9785536B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-9785536-B2
Application numberUS-201315036234-A
CountryUS
Kind codeB2
Filing dateNov 29, 2013
Priority dateNov 29, 2013
Publication dateOct 10, 2017
Grant dateOct 10, 2017

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

An apparatus for debugging operational code of a target program comprises a memory storing the operational code and a set of instructions representing a debugger program for debugging the operational code. A microprocessor is configured to execute the operational code and the debugger program. The debugger program can inject a jump to a breakpoint handling routine into the operational code and let a compiler program create code pieces for the breakpoint handling routine.

First claim

Opening claim text (preview).

The invention claimed is: 1. A method of debugging operational code of a target program, where a jump to an breakpoint handling routine is injected into the operational code, the method comprising: receiving a command to set a conditional breakpoint, the command comprising a breakpoint position and a condition; computing an address of the breakpoint and an address of a next valid instruction within the operational code, the next valid instruction being the first next instruction not affected by the injection of the jump to the breakpoint handling routine; saving a part of the operational code starting from the address of the breakpoint until the address of the next valid instruction, to obtain a saved code part; translating the condition into a compiler program language to obtain a translated condition; calling a compiler program with information comprising the address of the breakpoint, the address of the next valid instruction, the saved code part and the translated condition, to let the compiler program create code pieces for a breakpoint handling routine, the code pieces comprising: a context save block comprising instructions to temporarily save context data; a condition evaluation code block comprising instructions to evaluate the condition that the debugger program received; a context restore block comprising instructions to restore the context data; the translated opcode, and a jump to the next valid instruction; the method further comprising: receiving the code pieces and one or more debugger program hooks from the compiler program; computing a routine memory address where the breakpoint handling routine will be inserted; inserting the breakpoint handling routine at the routine memory address, and injecting the jump to the breakpoint handling routine into the operational code at the address of the breakpoint. 2. A method of debugging operational code according to claim 1 , the method further comprising: checking the validity of the condition; stopping the method if the condition is found to be invalid; reporting, for example to a user, that the condition is invalid. 3. A method of debugging operational code according to claim 1 , the method further comprising: receiving an instruction to remove the conditional breakpoint; restoring the saved code part at the address of the breakpoint; marking as free an area of the program memory where the breakpoint handling routine was inserted. 4. A method of debugging operational code according to claim 1 , wherein the debugger program hooks comprise an offset and size of the context restore block within the breakpoint handling routine, the method further comprising: detecting that the conditional breakpoint is hit, and putting the target program in debug mode; restoring the saved code part at the address of the breakpoint; setting a program counter to the start of the context restore block using the offset; performing single instruction steps in debug mode until the program counter gets to an end of the context restore block; setting the program counter to the address of the breakpoint. 5. A method of debugging operational code according to claim 1 , the method further comprising: receiving a request to resume execution of the target program after the conditional breakpoint was hit; performing one or more single instruction steps to exit the memory area where the jump will be reinserted; reinserting the jump to breakpoint handling routine at the address of the breakpoint, and resuming the target program. 6. A method of debugging operational code according to claim 1 , the method further comprising: receiving a request to execute step operation; performing a single step operation; if a next instruction is valid: reinserting the jump to breakpoint handling routine at the address of the breakpoint, and executing the step as requested; if the next instruction is not valid and if user operation requires more steps: return to the action of performing a single step operation. 7. A method of generating code for a breakpoint handling routine, the method comprising: receiving information from a debugger program, the information comprising an address of a breakpoint, an address of a next valid instruction, a saved code part of an operational code and a translated condition; generating code to save context information including register data affected by the breakpoint handling routine to obtain a context save block; generating code to evaluate the translated condition, to obtain a condition evaluation code block; generating code to restore the context information so as to revert any changes done by the breakpoint handling routine, to obtain a context restore block; generating code to execute the saved code part of the operational code; generating code to jump to the address of the next valid instruction in the operational code. 8. A method of generating code according to claim 7 , the method further comprising: computing an offset and a size of the context restore block; computing an offset of a first instruction within the condition evaluation code block that is to be executed if the translated condition is met; sending the offset and the size of the context restore instruction block to the debugger program; sending the offset of the first instruction to the debugger program. 9. An apparatus for debugging operational code of a target program, the apparatus comprising: a memory storing the operational code and a set of instructions representing a debugger program for debugging the operational code; a microprocessor configured to execute the operational code and the debugger program; the debugger program being arranged to inject a jump to a breakpoint handling routine into the operational code, the debugger program being arranged for: receiving a command to set a conditional breakpoint, the command comprising a breakpoint position and a condition; computing an address of the breakpoint and an address of a next valid instruction within the operational code, the next valid instruction being the first next instruction not affected by the injection of the jump to the breakpoint handling routine; saving a part of the operational code starting from the address of the breakpoint until the address of the next valid instruction, to obtain a saved code part; translating the condition into a compiler program language to obtain a translated condition; calling a compiler program with information comprising the address of the breakpoint, the address of the next valid instruction, the saved code part and the translated condition, to let the compiler program create code pieces for a breakpoint handling routine, the code pieces comprising: a context save block comprising instructions to temporarily save context data; a condition evaluation code block comprising instructions to evaluate the condition that the debugger program received; a context restore block comprising instructions to restore the context data; the translated opcode, and a jump to the next valid instruction; the debugger program further being arranged for: receiving the code pieces and one or more debugger program hooks from the compiler program; computing a routine memory address where the breakpoint handling routine will be inserted; inserting the breakpoint handling routine at the routine memory address, and injecting the jump to the breakpoint handling routine into the operational code at the address of the breakpoint. 10. An apparatus for generating code for a breakpoint handling routine, comprising: a memory storing a set of instructions representing a compiler program; a microprocessor configured to execute the compiler progra

Assignees

Inventors

Classifications

  • G06F11/362Primary

    Debugging of software · CPC title

  • Creation or generation of source code · CPC title

  • by instrumenting at runtime · CPC title

  • Compilation · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US9785536B2 cover?
An apparatus for debugging operational code of a target program comprises a memory storing the operational code and a set of instructions representing a debugger program for debugging the operational code. A microprocessor is configured to execute the operational code and the debugger program. The debugger program can inject a jump to a breakpoint handling routine into the operational code and …
Who is the assignee on this patent?
Nistor Mihail-Marian, Miloiu Dragos, Nxp Usa Inc
What technology area does this patent fall under?
Primary CPC classification G06F11/362. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue Oct 10 2017 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 1 related publication on this page (citations in our corpus or others sharing the same primary CPC).