File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -774,3 +774,26 @@ void goto_symex_statet::get_l1_name(exprt &expr) const
774774 Forall_operands (it, expr)
775775 get_l1_name (*it);
776776}
777+
778+ // / Dumps the current state of symex, printing the function name and location
779+ // / number for each stack frame in the currently active thread.
780+ // / This is for use from the debugger or in debug code; please don't delete it
781+ // / just because it isn't called at present.
782+ // / \param out: stream to write to
783+ void goto_symex_statet::print_backtrace (std::ostream &out) const
784+ {
785+ out << source.pc ->function << " " << source.pc ->location_number << " \n " ;
786+
787+ for (auto stackit = threads[source.thread_nr ].call_stack .rbegin (),
788+ stackend = threads[source.thread_nr ].call_stack .rend ();
789+ stackit != stackend;
790+ ++stackit)
791+ {
792+ const auto &frame = *stackit;
793+ if (frame.calling_location .is_set )
794+ {
795+ out << frame.calling_location .pc ->function << " "
796+ << frame.calling_location .pc ->location_number << " \n " ;
797+ }
798+ }
799+ }
Original file line number Diff line number Diff line change @@ -230,6 +230,8 @@ class goto_symex_statet final
230230 void pop_frame () { call_stack ().pop_back (); }
231231 const framet &previous_frame () { return *(--(--call_stack ().end ())); }
232232
233+ void print_backtrace (std::ostream &) const ;
234+
233235 // threads
234236 unsigned atomic_section_id;
235237 typedef std::pair<unsigned , std::list<guardt> > a_s_r_entryt;
You can’t perform that action at this time.
0 commit comments