Since the caterpillar had been immobile for some time (except for the frass excretion), I gave him a little nudge on his butt. This caused him to expose the osmeterium from his head and to bend almost completely backwards in an attempt to whack me with the osmeterium. This tactic is meant to thwart predators. I doubt that this has much impact on birds, but wasps are also predators of the caterpillar and this may be somewhat effective with them.

Osmeterium: When the mature larva is disturbed by, for instance, a bird, it rears up and uses blood pressure to squeeze out a forked, finger-like orange-coloured organ called an osmeterium from just behind its head. Besides the visual impact of the organ, it also has a strong smell, like rotten cheese, which acts as a further discentive to the predator. The smell is evidently caused by accumulation of substances from the oil glands in the leaves of the host plant.