Skip to content

Commit 562dd88

Browse files
committed
Add symex-backtrace
1 parent 8a75ce4 commit 562dd88

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,3 +774,21 @@ void goto_symex_statet::get_l1_name(exprt &expr) const
774774
Forall_operands(it, expr)
775775
get_l1_name(*it);
776776
}
777+
778+
void goto_symex_statet::print_backtrace(std::ostream &out)
779+
{
780+
out << source.pc->function << " " << source.pc->location_number << "\n";
781+
782+
for(auto stackit = threads[source.thread_nr].call_stack.rbegin(),
783+
stackend = threads[source.thread_nr].call_stack.rend();
784+
stackit != stackend;
785+
++stackit)
786+
{
787+
const auto &frame = *stackit;
788+
if(frame.calling_location.is_set)
789+
{
790+
out << frame.calling_location.pc->function << " "
791+
<< frame.calling_location.pc->location_number << "\n";
792+
}
793+
}
794+
}

src/goto-symex/goto_symex_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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 &);
234+
233235
// threads
234236
unsigned atomic_section_id;
235237
typedef std::pair<unsigned, std::list<guardt> > a_s_r_entryt;

0 commit comments

Comments
 (0)