A Maskil of David, when he was in the cave, a prayer
“With my voice
I cry to Yahweh!
With my voice
I make supplication to Yahweh!
I pour out my complaint before him.
I tell my trouble before him.
When my spirit is faint,
You know my way!”
Psalm 142 is a maskil or wisdom song of David, when he was in the cave. There is no explicit mention of an incident in the life of David where he was being persecuted in a cave. He may have been hiding out when he was trying to escape from King Saul. There is no doubt that it is a personal lament to Yahweh. David cries with his voice to Yahweh as he makes his supplications or complaints. He was telling Yahweh his troubles because his spirit was weak or faint. Yahweh knew David so that made him hopeful.
Psalm 86 seems like a personal prayer of David. There is no other indication in the title. David wanted Yahweh to listen to him by giving him his ear. He wanted an answer since he was poor and needy. He wanted to preserve his life since he was devoted to Yahweh. He trusted in Yahweh as a servant. All day long he cried to Yahweh, his God. He wanted Yahweh to be gracious to him and gladden his soul. He knew that Yahweh was good and forgiving due to his steadfast love. David wanted Yahweh to hear him in the times of his trouble. He called and expected an answer.