Question

How does a undolr_stop() or undolr_discard() failure affect the state of the debugged program?

  • 18 June 2021
  • 1 reply
  • 38 views

Badge

If, while recording through the API, one of the undolr_stop() or undolr_discard() functions fails (e.g. returns -1), what does that imply for the debugged program?

What measures should a programmer take when such failures are met?


1 reply

At present the error codes returned in errno do not offer enough
precision to allow the caller of undolr_stop() and undolr_discard() to
assume the debugged program is in a safe state to continue executing,
or whether any further API calls will have any chosen effect.

There are certain error codes that point to conditions that are likely
to be recoverable e.g.

undolr_stop()

    ENODATA:  this is returned if undolr_start() has not already been
             called. In this situation it may be possible to recover by
             calling the undolr_start() function before retrying,
             although correcting the API usage might make more sense.

undolr_discard()

    EINVAL: if undolr_discard() is called without NULL context then this
            error number will be returned. Calling undolr_discard()
            again with a valid contextmight be expected to work. In this
            situation a likely misuse of the API is what needs
            correcting.


Unfortunately the only safe thing to do when an error is returned is to
assume that the situation is non-recoverable and tidy up accordingly.

             

Reply