Skip to content

Commit afec0df

Browse files
committed
Add symex-backtrace
1 parent 56c97f3 commit afec0df

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,3 +856,22 @@ void goto_symex_statet::switch_to_thread(unsigned t)
856856

857857
guard=threads[t].guard;
858858
}
859+
860+
void goto_symex_statet::print_backtrace(std::ostream &out)
861+
{
862+
out << source.pc->function << " " << source.pc->location_number << "\n";
863+
864+
for(
865+
auto stackit = threads[source.thread_nr].call_stack.rbegin(),
866+
stackend = threads[source.thread_nr].call_stack.rend();
867+
stackit != stackend;
868+
++stackit)
869+
{
870+
const auto &frame = *stackit;
871+
if(frame.calling_location.is_set)
872+
{
873+
out << frame.calling_location.pc->function << " "
874+
<< frame.calling_location.pc->location_number << "\n";
875+
}
876+
}
877+
}

src/goto-symex/goto_symex_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ class goto_symex_statet final
340340
void pop_frame() { call_stack().pop_back(); }
341341
const framet &previous_frame() { return *(--(--call_stack().end())); }
342342

343+
void print_backtrace(std::ostream &);
344+
343345
// threads
344346
unsigned atomic_section_id;
345347
typedef std::pair<unsigned, std::list<guardt> > a_s_r_entryt;

0 commit comments

Comments
 (0)