How to debug a crashing solve?

51 views
Skip to first unread message

David Banas

unread,
Jan 26, 2024, 2:02:53 PMJan 26
to Ceres Solver
Hi all,

Newbie here needs help on best way to debug a crashing solve.
My code:

                dbg("About to run solver...");
                ceres::Solve(options, &problem, &summary);
                dbg("Solver complete.");

I see the first message, but the program crashes before I see the second.
I'm assuming that I should wrap the call to ceres::Solve() in a try/catch block.
What sort of things should I look at, inside my catch block?

Thanks!
-db

Sameer Agarwal

unread,
Jan 26, 2024, 2:08:27 PMJan 26
to ceres-...@googlegroups.com
try compiling in debug mode.

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/65209e0d-1767-4b0c-af03-d8c8e569326bn%40googlegroups.com.

David Banas

unread,
Jan 27, 2024, 6:09:16 AMJan 27
to Ceres Solver
Would that entail using an extra compiler flag, linker flag, both? Which flag(s)?

Also, this code isn't doing what I'd expect:

                dbg("About to run solver...");
                try {
                    ceres::Solve(options, &problem, &summary);
                } catch (exception& e) {
                    dbg(e.what());
                    throw;
                }
                dbg("Solver complete.");

I've confirmed that I am throwing an exception where I think I am (by putting a dbg(...) statement just before the throw(...) statement).
However, I'm not seeing anything in my debug log from that dbg(e.what());
Does a running solver intercept the normal C++ exception handling mechanism?

Thanks,
-db

Sameer Agarwal

unread,
Jan 27, 2024, 9:53:22 AMJan 27
to ceres-...@googlegroups.com
David, 
The exact flags will depend on your build environment. Do you have a small reproduction that is causing the crash?
Sameer 

David Banas

unread,
Jan 27, 2024, 4:38:21 PMJan 27
to ceres-...@googlegroups.com
Hi Sameer,

Thanks for your reply.
I found my bug and fixed it.

-db


You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/ucrS3hOaRhs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUD9cjPf61q9AsXx0__eEew7ftZWNz8BtrgQGFXpn-bjUQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages