"Search me, O God, and know my heart! Try me and know my thoughts. And see if there be any grievous way in me, and lead me in the way everlasting." This is a dangerous passage. Think about it, we're inviting the God of the universe, creator of EVERYTHING, to search us and know our hearts, to try us and know our thoughts, to see if there is any grievous way within us. This is suicide. Let's put it in simpler terms, 'perfect God, check out my life and point out any imperfections you find.' It's like shooting fish in a barrel.
But thats the point right? The last line says, 'lead me in the way everlasting.' David is inviting God into the depths of his heart, so that he might have everlasting life with God. And the process of getting there is full of God pointing out our imperfections. There is nothing more intimate, personal, and real than a right relationship with God and if we want that then we are going to have to invite God to search and know us, to try us and point out all the grievousness that is within us. We are literally dying to ourselves so we can be alive in God.
May we be bold enough to trust God with our hearts, our inner most thoughts, and in the midst of trials.