The same pericope is repeated many times throughout the suttas.Vitakkasanthana Sutta wrote: Like a well-dressed young man or woman who feels horrified, humiliated and disgusted because of the carcass of a snake, dog, or human that is hung round his or her neck, should the bhikkhu in whom unskillful thoughts continue to arise in spite of his reflection on the object which is connected with skill, ponder on the disadvantages of unskillful thoughts thus: Truly, these thoughts of mine are unskillful, blameworthy, and productive of misery. Then the evil, unskillful thoughts are eliminated; they disappear. By their elimination, the mind stands firm, settles down, becomes unified and concentrated, just within (his subject of meditation).
Imagine how you would feel if you came to, and found yourself sitting in the street, smearing sh*t on yourself. That is how we should feel upon discovering ourselves participating in unskillful thinking and behaviour. That's how I interpret shame in a Dhammic context.