this is a financial decision no one should take lightly.
Your question is very broad.
No one knows your situation.
We can not give legal advice.
If you are asking should I file BK or short sell or foreclose? that's a whole other question.
I would suggest you think about doing a short sale, then if necessary after the property is gone and you still need to go bk then you should consult an attorney then. A bankruptcy does not help you keep your house. It may slow down a foreclosure around 30 - 60 days. Then you have a BK for 10 years on your record.
Generally speaking, I say not. I say don't do it for a first trust deed home loan. It wont help.
You need to consider your options and speak with professionals, a real estate attorney, a CPA, a REALTOR, a BK attorney, and then pick a direction. I would not pick the direction until you talked to all.
Harold Sharpe - Broker
So Cal Homes Realty
California Department of Real Estate Broker License # 01312992