1. A method, comprising: determining that a software debug event is pending, wherein the software debug event is an event that causes invocation of a software debug interrupt handler to handle the software debug event; determining that a hardware debug event is pending at a same time that the software debug event is pending, wherein the hardware debug event is an event that causes a processor to cease fetching and executing instructions and to enter a debug halted state; determining that the pending software debug event initially has priority over the pending hardware debug event; when the software debug event is being handled, fetching a first instruction of the software debug interrupt handler; when the software debug event is being handled, executing the first instruction of the software debug interrupt handler; after said step of fetching the first instruction of the software debug interrupt handler and before said step of executing the first instruction of the software debug interrupt handler, switching priority to the hardware debug event; handling the hardware debug event between the steps of fetching the first instruction and executing the first instruction; and after said step of handling the hardware debug event, resuming execution of the software debug interrupt handler for handling of the software debug event.