  This paper presents a rigorous framework for the continuation of solutions to
nonlinear constraints and the simultaneous analysis of the sensitivities of
test functions to constraint violations at each solution point using an
adjoint-based approach. By the linearity of a problem Lagrangian in the
associated Lagrange multipliers, the formalism is shown to be directly amenable
to analysis using the COCO software package, specifically its paradigm for
staged problem construction. The general theory is illustrated in the context
of algebraic equations and boundary-value problems, with emphasis on periodic
orbits in smooth and hybrid dynamical systems, and quasiperiodic invariant tori
of flows. In the latter case, normal hyperbolicity is used to prove the
existence of continuous solutions to the adjoint conditions associated with the
sensitivities of the orbital periods to parameter perturbations and constraint
violations, even though the linearization of the governing boundary-value
problem lacks a bounded inverse, as required by the general theory. An
assumption of transversal stability then implies that these solutions predict
the asymptotic phases of trajectories based at initial conditions perturbed
away from the torus. Example COCO code is used to illustrate the minimal
additional investment in setup costs required to append sensitivity analysis to
regular parameter continuation.
