Need to retain the asm_stmts vector so that bpf assembly tokens
are not deallocated on exception throw.
Otherwise, printing semantic errors from bpf assembly causes segfault.
* bpf-translate.cxx (struct bpf_unparser): retain asm_stmts vector.
(bpf_unparser::visit_embeddedcode): reuse retained asm_stmts vector.
// Used to track errors.
value *error_status;
+ std::vector<asm_stmt> asm_stmts;
// Used to switch execution of program to catch blocks.
std::vector<block *> catch_jump;
#ifdef DEBUG_CODEGEN
this_ins.notes.push("asm");
#endif
- std::vector<asm_stmt> statements;
+ // XXX retain asm_stmts to avoid deallocating tok on throw
+ std::vector<asm_stmt> &statements = this->asm_stmts;
+ statements.clear();
asm_stmt stmt;
// PR24528: The /* userspace */ annotation is used to mark